-Wno-deprecated-register with Clang

Geert Janssens janssens-geert at telenet.be
Wed Jul 2 04:50:35 EDT 2014


On Wednesday 02 July 2014 09:58:28 John Ralls wrote:
> On Jul 2, 2014, at 5:14 AM, Mike Alexander <mta at umich.edu> wrote:
> > I just tried to compile GnuCash with clang and it failed because of
> > the change in 4aed8b3 to not set -Wno-deprecated-register with
> > clang.  The version of clang in Mavericks (MacOSX 10.9) certainly
> > recognizes this parameter and won't compile GnuCash without it. 
> > Which version of clang were you using which failed to recognize it?
> >  I'm using "Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM
> > 3.4svn)".
> > 
> > Has anyone built GnuCash successfully with clang?  Even after I
> > fixed that problem, I got lots of link errors that looked like a
> > mismatched C++ library.  I haven't looked into this much yet, but
> > it's probably because Mavericks replaced libstdc++ with libc++. 
> > Since gcc works fine for me, it's not a high priority to fix this.
> Mike,
> 
> Yeah, I build all the time with Clang, otherwise I wouldn't have
> needed to make that change. I'm using Xcode 5.0 because of a problem
> with 5.1,  though I don't remember exactly what. I think it might
> even have been something on another package. I'll have to change that
> to a version-based check, I guess. I think Geert builds with Clang on
> Linux from time to time so that he can run the static analyzer.
> 
> I'm adding -stdlib=libstdc++ to CXXFLAGS for building WebKitGtk
> because the old version I build doesn't like libc++. It's a real PITA
> to get a new version to build on OSX because the WebKitGtk team are
> pretty hostile to the non-X11 backends and enjoy deliberately
> breaking them. That's the only place I use -stdlib, but IIRC you're
> using MacPorts and they might be using it on something that we couple
> with more tightly; libofx comes to mind as one possibility.
> 
> Regards,
> John Ralls
> 
> 

It has been a while since I ran clang so I decided to retry this morning. It doesn't build for me.

With current master (including Mike's fix) the build errors out on gnc-date.cpp:

make[5]: Entering directory `/kobaltnet/janssege/Development/Builds/gnucash-f20-
master/src/libqof/qof'
/bin/sh ../../../libtool  --tag=CXX   --mode=compile clang -DHAVE_CONFIG_H -I. -
I/kobaltnet/janssege/Development/EclipseGnuCash/GnuCash-git/src/libqof/qof -I../../..  -
I/kobaltnet/janssege/Development/EclipseGnuCash/GnuCash-git/lib/libc -
I/kobaltnet/janssege/Development/EclipseGnuCash/GnuCash-git/src -pthread -
I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include  -I/usr/include -DG_LOG_DOMAIN=\"qof\"  -
Werror  -Wall -Wno-unused -g  -std=gnu++11 -g  -MT gnc-date.lo -MD -MP -MF .deps/gnc-
date.Tpo -c -o gnc-date.lo /kobaltnet/janssege/Development/EclipseGnuCash/GnuCash-
git/src/libqof/qof/gnc-date.cpp
libtool: compile:  clang -DHAVE_CONFIG_H -I. -
I/kobaltnet/janssege/Development/EclipseGnuCash/GnuCash-git/src/libqof/qof -I../../.. -
I/kobaltnet/janssege/Development/EclipseGnuCash/GnuCash-git/lib/libc -
I/kobaltnet/janssege/Development/EclipseGnuCash/GnuCash-git/src -pthread -
I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include -DG_LOG_DOMAIN=\"qof\" -Werror 
-Wall -Wno-unused -g -std=gnu++11 -g -MT gnc-date.lo -MD -MP -MF .deps/gnc-date.Tpo -c 
/kobaltnet/janssege/Development/EclipseGnuCash/GnuCash-git/src/libqof/qof/gnc-date.cpp  -
fPIC -DPIC -o .libs/gnc-date.o
In file included from /kobaltnet/janssege/Development/EclipseGnuCash/GnuCash-
git/src/libqof/qof/gnc-date.cpp:34:
In file included from /usr/include/glib-2.0/glib.h:56:
In file included from /usr/include/glib-2.0/glib/giochannel.h:36:
In file included from /usr/include/glib-2.0/glib/gstring.h:37:
/usr/include/glib-2.0/glib/gutils.h:321:3: error: 'register' storage class specifier is deprecated [-
Werror,-Wdeprecated-register]
  register guint n_bits = 0;
  ^~~~~~~~~
1 error generated.
make[5]: *** [gnc-date.lo] Error 1
make[5]: Leaving directory `/kobaltnet/janssege/Development/Builds/gnucash-f20-
master/src/libqof/qof'
make[4]: *** [all-recursive] Error 1
make[4]: Leaving directory `/kobaltnet/janssege/Development/Builds/gnucash-f20-
master/src/libqof/qof'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/kobaltnet/janssege/Development/Builds/gnucash-f20-
master/src/libqof'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/kobaltnet/janssege/Development/Builds/gnucash-f20-master/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/kobaltnet/janssege/Development/Builds/gnucash-f20-master'
make: *** [all] Error 2


If I revert Mike's commit I get a little further, but still it breaks in qof/test:

clang -DHAVE_CONFIG_H -I. -I/kobaltnet/janssege/Development/EclipseGnuCash/GnuCash-
git/src/libqof/qof/test -I../../../..  -I. -I/kobaltnet/janssege/Development/EclipseGnuCash/GnuCash-
git/src/libqof/qof/test -I../../../.. -I/kobaltnet/janssege/Development/EclipseGnuCash/GnuCash-
git/src/libqof/qof -I/kobaltnet/janssege/Development/EclipseGnuCash/GnuCash-git/src/test-core -
DTESTPROG=test_qof -I/kobaltnet/janssege/Development/EclipseGnuCash/GnuCash-git/lib/libc -
pthread -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include   -Werror -Wdeclaration-after-
statement -Wno-pointer-sign  -Wall -Wunused -Wmissing-prototypes -Wmissing-declarations  -
Wno-unused -g  -g  -MT test_qof-test-qofbook.o -MD -MP -MF .deps/test_qof-test-qofbook.Tpo -c -
o test_qof-test-qofbook.o `test -f 'test-qofbook.c' || echo 
'/kobaltnet/janssege/Development/EclipseGnuCash/GnuCash-git/src/libqof/qof/test/'`test-
qofbook.c
/kobaltnet/janssege/Development/EclipseGnuCash/GnuCash-git/src/libqof/qof/test/test-
qofbook.c:264:52: error: expression which evaluates to zero treated as a null pointer constant 
of type 'const char *'
      [-Werror,-Wnon-literal-null-conversion]
    counter = qof_book_get_counter( fixture->book, '\0' );
                                                   ^~~~
/kobaltnet/janssege/Development/EclipseGnuCash/GnuCash-git/src/libqof/qof/test/test-
qofbook.c:301:53: error: expression which evaluates to zero treated as a null pointer constant 
of type 'const char *'
      [-Werror,-Wnon-literal-null-conversion]
    r = qof_book_get_counter_format( fixture->book, '\0' );
                                                    ^~~~
/kobaltnet/janssege/Development/EclipseGnuCash/GnuCash-git/src/libqof/qof/test/test-
qofbook.c:343:63: error: expression which evaluates to zero treated as a null pointer constant 
of type 'const char *'
      [-Werror,-Wnon-literal-null-conversion]
    r = qof_book_increment_and_format_counter( fixture->book, '\0' );
                                                              ^~~~
3 errors generated.
make[5]: *** [test_qof-test-qofbook.o] Error 1
make[5]: Leaving directory `/kobaltnet/janssege/Development/Builds/gnucash-f20-
master/src/libqof/qof/test'
make[4]: *** [all-recursive] Error 1
make[4]: Leaving directory `/kobaltnet/janssege/Development/Builds/gnucash-f20-
master/src/libqof/qof'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/kobaltnet/janssege/Development/Builds/gnucash-f20-
master/src/libqof'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/kobaltnet/janssege/Development/Builds/gnucash-f20-master/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/kobaltnet/janssege/Development/Builds/gnucash-f20-master'
make: *** [all] Error 2


Geert


More information about the gnucash-devel mailing list