On 06 Nov 2013, at 05:30, Bruce Evans <b...@optusnet.com.au> wrote: > On Tue, 5 Nov 2013, Luigi Rizzo wrote: >> On Tue, Nov 05, 2013 at 07:37:35AM +0000, Dimitry Andric wrote: >>> Log: >>> Fix libgcc build with gcc after r257645, by using -Wno-static-in-inline >>> for clang only. > This still just breaks the warning. See my previous reply. (For gcc, > it is unclear if the missing warning is due too fewer warnings by > default or if it is because gcc's default for plain inline is different > from clang's so that the code is correct for gcc.).
First of all, gcc only emits this warning when using -pedantic, see contrib/gcc/c-typeck.c, around line 2123. However, our copy of gcc also ships with a faulty C99 test in contrib/gcclibs/include/ansidecl.h, which has (around line 176): /* inline requires special treatment; it's in C99, and GCC >=2.7 supports it too, but it's not in C89. */ #undef inline #if __STDC_VERSION__ > 199901L /* it's a keyword */ #else # if GCC_VERSION >= 2007 # define inline __inline__ /* __inline__ prevents -pedantic warnings */ # else # define inline /* nothing */ # endif #endif Upstream gcc fixed this here: http://gcc.gnu.org/viewcvs/gcc/trunk/include/ansidecl.h?r1=155654&r2=155653&pathrev=155654 >> I wonder if it is worthwhile adding to the default rules some >> compiler-specific CFLAGS, say CFLAGS_CLANG and CFLAGS_GCC >> >> (there is only a handful of cases now so maybe it is overkill, >> and it harms readability; on the other hand, the Makefiles >> already make a lot of assumptions on variable names) > No, that would further simplify breaking warnings instead of fixing the > bugs exposed by warnings. The code should be portable so that it works > with any compiler. That is just not so easy for contrib'ed code unless > the vendor made it portable. I agree for this particular case, but there are other places in the tree where we must pass either clang-specific or gcc-specific flags. Introducing the variables Luigi suggested makes those Makefiles a little less ugly, at least. > I checked that libgcc is compiled by default with -std=gnu99. This > is just the default from bsd.sys.mk. It is obviously wrong for libgcc, > since the plain inlines in it require gnu89. Yes, I agree. This can be fixed in libgcc's Makefile, but unfortunately clang will still emit the warning. > gnu99 gives consistenly > broken C99 semantic for both gcc and clang. Only clang warned about > this, and the warning has been broken. Indeed, it always emits the warning, even for -std=gnu89, and even when __inline__ is explicitly used. This could probably be considered a bug, but I think upstream has meant this as a general warning towards making code C99-compliant. Is it too hard to make a static variable non-static? :) -Dimitry
signature.asc
Description: Message signed with OpenPGP using GPGMail