[PATCH] Turn off missing field initializer warnings for gcc
Chandler Carruth
chandlerc at google.com
Thu Jan 31 09:47:00 PST 2013
On Thu, Jan 31, 2013 at 9:46 AM, David Blaikie <dblaikie at gmail.com> wrote:
> +Chandler, CMake owner
>
> Not sure if we need to do the flag support check (ala
> -Wcovered-switch-default) when adding -Wmissing-field-initializers (in
> case we're dealing with non-Clang non-GCC compilers (that are still
> GCC compatible?)?)
>
Yea, i think at least the else branch needs the test. Personally, I would
sink both sides under the test just for clarity.
>
> On Thu, Jan 31, 2013 at 6:51 AM, Edwin Vane <edwin.vane at intel.com> wrote:
> > Hi gribozavr, dblaikie,
> >
> > gcc produces false positives for empty braces so turning the warning
> > off. Instead, turning the warning on for clang so proper warnings aren't
> > missed.
> >
> > http://llvm-reviews.chandlerc.com/D358
> >
> > Files:
> > cmake/modules/HandleLLVMOptions.cmake
> >
> > Index: cmake/modules/HandleLLVMOptions.cmake
> > ===================================================================
> > --- cmake/modules/HandleLLVMOptions.cmake
> > +++ cmake/modules/HandleLLVMOptions.cmake
> > @@ -178,6 +178,14 @@
> > elseif( LLVM_COMPILER_IS_GCC_COMPATIBLE )
> > if (LLVM_ENABLE_WARNINGS)
> > add_llvm_definitions( -Wall -W -Wno-unused-parameter
> -Wwrite-strings )
> > + # Turn off missing field initializer warnings for gcc to avoid
> noise from
> > + # false positives with empty {}. Turn them on otherwise (they're
> off by
> > + # default for clang).
> > + if (CMAKE_COMPILER_IS_GNUCXX)
> > + add_llvm_definitions( -Wno-missing-field-initializers )
> > + else()
> > + add_llvm_definitions( -Wmissing-field-initializers )
> > + endif()
> > if (LLVM_ENABLE_PEDANTIC)
> > add_llvm_definitions( -pedantic -Wno-long-long )
> > endif (LLVM_ENABLE_PEDANTIC)
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130131/c719f77d/attachment.html>
More information about the cfe-commits
mailing list