forked from OSchip/llvm-project
Add -Wno-nested-anon-types to -pedantic builds of LLVM. This Clang warning
catches uses of an extremely minor and widely-available C++ extension (which every C++ compiler I could find supports, but EDG and Clang reject in strict mode). The diagnosed code pattern looks like this: struct X { union { struct { int a; int b; } S; }; }; llvm-svn: 174103
This commit is contained in:
parent
38d3798b94
commit
6c26e74781
|
@ -366,6 +366,8 @@ COVERED_SWITCH_DEFAULT = @COVERED_SWITCH_DEFAULT@
|
|||
NO_UNINITIALIZED = @NO_UNINITIALIZED@
|
||||
# -Wno-maybe-uninitialized
|
||||
NO_MAYBE_UNINITIALIZED = @NO_MAYBE_UNINITIALIZED@
|
||||
# -Wno-nested-anon-types
|
||||
NO_NESTED_ANON_TYPES = @NO_NESTED_ANON_TYPES@
|
||||
|
||||
# Was polly found in tools/polly?
|
||||
LLVM_HAS_POLLY = @LLVM_HAS_POLLY@
|
||||
|
|
|
@ -665,7 +665,7 @@ LD.Flags += $(EXTRA_LD_OPTIONS)
|
|||
endif
|
||||
|
||||
ifndef NO_PEDANTIC
|
||||
CompileCommonOpts += -pedantic -Wno-long-long
|
||||
CompileCommonOpts += -pedantic -Wno-long-long $(NO_NESTED_ANON_TYPES)
|
||||
endif
|
||||
CompileCommonOpts += -Wall -W -Wno-unused-parameter -Wwrite-strings \
|
||||
$(EXTRA_OPTIONS) $(COVERED_SWITCH_DEFAULT) \
|
||||
|
|
|
@ -1264,6 +1264,7 @@ dnl Check optional compiler flags.
|
|||
AC_MSG_CHECKING([optional compiler flags])
|
||||
CXX_FLAG_CHECK(NO_VARIADIC_MACROS, [-Wno-variadic-macros])
|
||||
CXX_FLAG_CHECK(NO_MISSING_FIELD_INITIALIZERS, [-Wno-missing-field-initializers])
|
||||
CXX_FLAG_CHECK(NO_NESTED_ANON_TYPES, [-Wno-nested-anon-types])
|
||||
CXX_FLAG_CHECK(COVERED_SWITCH_DEFAULT, [-Wcovered-switch-default])
|
||||
dnl GCC's potential uninitialized use analysis is weak and presents lots of
|
||||
dnl false positives, so disable it.
|
||||
|
@ -1299,7 +1300,7 @@ else
|
|||
NO_UNINITIALIZED=
|
||||
NO_MAYBE_UNINITIALIZED=
|
||||
fi
|
||||
AC_MSG_RESULT([$NO_VARIADIC_MACROS $NO_MISSING_FIELD_INITIALIZERS $COVERED_SWITCH_DEFAULT $NO_UNINITIALIZED $NO_MAYBE_UNINITIALIZED])
|
||||
AC_MSG_RESULT([$NO_VARIADIC_MACROS $NO_MISSING_FIELD_INITIALIZERS $NO_NESTED_ANON_TYPES $COVERED_SWITCH_DEFAULT $NO_UNINITIALIZED $NO_MAYBE_UNINITIALIZED])
|
||||
|
||||
AC_ARG_WITH([python],
|
||||
[AS_HELP_STRING([--with-python], [path to python])],
|
||||
|
|
|
@ -193,6 +193,10 @@ elseif( LLVM_COMPILER_IS_GCC_COMPATIBLE )
|
|||
|
||||
if (LLVM_ENABLE_PEDANTIC)
|
||||
add_llvm_definitions( -pedantic -Wno-long-long )
|
||||
check_cxx_compiler_flag("-Werror -Wnested-anon-types" CXX_SUPPORTS_NO_NESTED_ANON_TYPES_FLAG)
|
||||
if( CXX_SUPPORTS_NO_NESTED_ANON_TYPES_FLAG )
|
||||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-nested-anon-types" )
|
||||
endif()
|
||||
endif (LLVM_ENABLE_PEDANTIC)
|
||||
check_cxx_compiler_flag("-Werror -Wcovered-switch-default" CXX_SUPPORTS_COVERED_SWITCH_DEFAULT_FLAG)
|
||||
if( CXX_SUPPORTS_COVERED_SWITCH_DEFAULT_FLAG )
|
||||
|
|
|
@ -766,6 +766,7 @@ CONVENIENCE_LTDL_FALSE
|
|||
LIBADD_DL
|
||||
NO_VARIADIC_MACROS
|
||||
NO_MISSING_FIELD_INITIALIZERS
|
||||
NO_NESTED_ANON_TYPES
|
||||
COVERED_SWITCH_DEFAULT
|
||||
NO_MAYBE_UNINITIALIZED
|
||||
NO_UNINITIALIZED
|
||||
|
@ -12260,6 +12261,8 @@ NO_VARIADIC_MACROS=`$CXX -Werror -Wno-variadic-macros -fsyntax-only -xc /dev/nul
|
|||
|
||||
NO_MISSING_FIELD_INITIALIZERS=`$CXX -Werror -Wno-missing-field-initializers -fsyntax-only -xc /dev/null 2>/dev/null && echo -Wno-missing-field-initializers`
|
||||
|
||||
NO_NESTED_ANON_TYPES=`$CXX -Werror -Wno-nested-anon-types -fsyntax-only -xc /dev/null 2>/dev/null && echo -Wno-nested-anon-types`
|
||||
|
||||
COVERED_SWITCH_DEFAULT=`$CXX -Werror -Wcovered-switch-default -fsyntax-only -xc /dev/null 2>/dev/null && echo -Wcovered-switch-default`
|
||||
|
||||
if test "$GXX" = "yes"
|
||||
|
@ -12289,8 +12292,8 @@ else
|
|||
NO_UNINITIALIZED=
|
||||
NO_MAYBE_UNINITIALIZED=
|
||||
fi
|
||||
{ echo "$as_me:$LINENO: result: $NO_VARIADIC_MACROS $NO_MISSING_FIELD_INITIALIZERS $COVERED_SWITCH_DEFAULT $NO_UNINITIALIZED $NO_MAYBE_UNINITIALIZED" >&5
|
||||
echo "${ECHO_T}$NO_VARIADIC_MACROS $NO_MISSING_FIELD_INITIALIZERS $COVERED_SWITCH_DEFAULT $NO_UNINITIALIZED $NO_MAYBE_UNINITIALIZED" >&6; }
|
||||
{ echo "$as_me:$LINENO: result: $NO_VARIADIC_MACROS $NO_MISSING_FIELD_INITIALIZERS $NO_NESTED_ANON_TYPES $COVERED_SWITCH_DEFAULT $NO_UNINITIALIZED $NO_MAYBE_UNINITIALIZED" >&5
|
||||
echo "${ECHO_T}$NO_VARIADIC_MACROS $NO_MISSING_FIELD_INITIALIZERS $NO_NESTED_ANON_TYPES $COVERED_SWITCH_DEFAULT $NO_UNINITIALIZED $NO_MAYBE_UNINITIALIZED" >&6; }
|
||||
|
||||
|
||||
# Check whether --with-python was given.
|
||||
|
@ -22478,6 +22481,7 @@ CONVENIENCE_LTDL_FALSE!$CONVENIENCE_LTDL_FALSE$ac_delim
|
|||
LIBADD_DL!$LIBADD_DL$ac_delim
|
||||
NO_VARIADIC_MACROS!$NO_VARIADIC_MACROS$ac_delim
|
||||
NO_MISSING_FIELD_INITIALIZERS!$NO_MISSING_FIELD_INITIALIZERS$ac_delim
|
||||
NO_NESTED_ANON_TYPES!$NO_NESTED_ANON_TYPES$ac_delim
|
||||
COVERED_SWITCH_DEFAULT!$COVERED_SWITCH_DEFAULT$ac_delim
|
||||
NO_MAYBE_UNINITIALIZED!$NO_MAYBE_UNINITIALIZED$ac_delim
|
||||
NO_UNINITIALIZED!$NO_UNINITIALIZED$ac_delim
|
||||
|
|
Loading…
Reference in New Issue