On 03/29/2013 04:27 PM, Assaf Gordon wrote: > Hello, > > I'm trying to add "gnulib" to a new project. > My project enables gcc's "-Wswitch-enum -Wswitch-default -Werror" settings.
In general, gnulib does NOT try to cater to all possible gcc warnings. You may want to take the approach that coreutils and several other projects have taken, of using a strong set of warnings for your own code, and a smaller set of warnings on gnulib code, so that use of -Werror doesn't trip over places where gnulib's coding styles aren't as strict as what you want in your own code. > When adding some gnulib modules, compilation fails. > > When adding the "propername" module, I get the following error: > === > unistr/u8-uctomb-aux.c: In function 'u8_uctomb_aux': > unistr/u8-uctomb-aux.c:57:3: error: switch missing default case > [-Werror=switch-default] Not sure if Bruno wants to adjust code to work around this. > === > > When adding the "quote" module, I get the following errors: > === > quotearg.c: In function 'quotearg_buffer_restyled': > quotearg.c:389:11: error: enumeration value 'literal_quoting_style' not > handled in switch [-Werror=switch-enum] > quotearg.c:389:11: error: enumeration value 'shell_quoting_style' not handled > in switch [-Werror=switch-enum] > quotearg.c:389:11: error: enumeration value 'c_maybe_quoting_style' not > handled in switch [-Werror=switch-enum] > quotearg.c:389:11: error: enumeration value 'escape_quoting_style' not > handled in switch [-Werror=switch-enum] > quotearg.c:389:11: error: enumeration value 'locale_quoting_style' not > handled in switch [-Werror=switch-enum] > quotearg.c:389:11: error: enumeration value 'clocale_quoting_style' not > handled in switch [-Werror=switch-enum] > quotearg.c:389:11: error: enumeration value 'custom_quoting_style' not > handled in switch [-Werror=switch-enum] Blah. There's already a default label, precisely because we don't need to do anything for all these other enum values. I'm reluctant to add to the code base just to silence an over-strict compiler warning. Another option is that you can use a local patch, so that when gnulib-tool is run on your project, you patch files locally to meet your coding standards, even though upstream gnulib is reluctant to make those changes. > > Please advise, if this is a configuration error on my part, or a known > problem, or simply gnulib can't be used with GCC's extra warnings. The latter. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature