Add -Wno-missing-field-initializers if needed
GCC with -Wmissing-field-initializers warns for a={}, but this is a common construct in Rebirth code to zero-initialize an entire structure. Users might add -Wmissing-field-initializers or a group option which enables -Wmissing-field-initializers, so add code to explicitly disable this warning when the compiler rejects this form of initialization.
This commit is contained in:
parent
ab326e9c8b
commit
95aaf09ae0
10
SConstruct
10
SConstruct
|
@ -277,6 +277,16 @@ int A<int>::a(){return 1;}
|
|||
return
|
||||
self.Compile(context, text='int a();', msg='whether C++ compiler accepts -Wredundant-decls', testflags=f)
|
||||
@_custom_test
|
||||
def check_compiler_missing_field_initializers(self,context):
|
||||
f = {'CXXFLAGS' : [get_Werror_string(context.env['CXXFLAGS']) + 'missing-field-initializers']}
|
||||
text = 'struct A{int a;};'
|
||||
main = 'A a{};(void)a;'
|
||||
if not self.Cxx11Compile(context, text=text, main=main, msg='whether C++ compiler warns for {} initialization', testflags=f, expect_failure=True) or \
|
||||
self.Cxx11Compile(context, text=text, main=main, msg='whether C++ compiler understands -Wno-missing-field-initializers', successflags={'CXXFLAGS' : ['-Wno-missing-field-initializers']}) or \
|
||||
not self.Cxx11Compile(context, text=text, main=main, msg='whether C++ compiler always errors for {} initialization', expect_failure=True):
|
||||
return
|
||||
raise SCons.Errors.StopError("C++ compiler errors on {} initialization, even with -Wno-missing-field-initializers")
|
||||
@_custom_test
|
||||
def check_attribute_error(self,context):
|
||||
"""
|
||||
help:assume compiler supports __attribute__((error))
|
||||
|
|
Loading…
Reference in a new issue