@@ -127,6 +127,17 @@ def check_sysmacro_h(context):
127127 return rc
128128
129129
130+ def check_stdnoreturn_h (context ):
131+ rc = 1
132+ if rc and tests .CheckHeader (context , 'stdnoreturn.h' ):
133+ rc = 0
134+
135+ conf .env ['HAVE_STDNORETURN_H' ] = rc
136+ context .did_show_result = True
137+ context .Result (rc )
138+ return rc
139+
140+
130141def check_libelf (context ):
131142 rc = 1
132143
@@ -618,7 +629,8 @@ conf = Configure(env, custom_tests={
618629 'check_mm_crc32_u64' : check_mm_crc32_u64 ,
619630 'check_cpu_extensions' : check_cpu_extensions ,
620631 'check_builtin_cpu_supports' : check_builtin_cpu_supports ,
621- 'check_sysmacro_h' : check_sysmacro_h
632+ 'check_sysmacro_h' : check_sysmacro_h ,
633+ 'check_stdnoreturn_h' : check_stdnoreturn_h
622634})
623635
624636#######################################################################
@@ -706,20 +718,33 @@ conf.check_mm_crc32_u64()
706718if any (cc in os .path .basename (conf .env ['CC' ]) for cc in ('clang' , 'include-what-you-use' )):
707719 conf .env .Append (CCFLAGS = ['-fcolor-diagnostics' ]) # Colored warnings
708720 conf .env .Append (CCFLAGS = ['-Qunused-arguments' ]) # Hide wrong messages
709- conf .env .Append (CCFLAGS = ['-Wno-bad-function-cast' ])
721+ conf .env .Append (CCFLAGS = [
722+ '-Wmost' ,
723+ '-Wunreachable-code-aggressive' ,
724+ '-Wno-bad-function-cast' ,
725+ ])
710726else :
711727 gcc_version = conf .check_gcc_version ()
728+ if gcc_version :
729+ conf .env .Append (CCFLAGS = [
730+ '-Wduplicated-cond' ,
731+ '-Wduplicated-branches' ,
732+ '-Wlogical-op' ,
733+ ])
712734 if gcc_version >= 8 :
713735 conf .env .Append (CCFLAGS = ['-Wno-cast-function-type' ])
714736
715737# Optional flags:
716738conf .env .Append (CCFLAGS = [
717- '-Wall' , '-W' , '- Wextra' ,
739+ '-Wall' , '-Wextra' ,
718740 '-Winit-self' ,
719- '-Wstrict-aliasing' ,
720741 '-Wmissing-include-dirs' ,
721742 '-Wuninitialized' ,
722743 '-Wstrict-prototypes' ,
744+ '-Wnull-dereference' ,
745+ '-Wformat-security' ,
746+ '-Wformat-y2k' ,
747+ '-Wmissing-noreturn' ,
723748 '-Wno-implicit-fallthrough' ,
724749])
725750
@@ -745,6 +770,7 @@ conf.check_btrfs_h()
745770conf .check_linux_fs_h ()
746771conf .check_uname ()
747772conf .check_sysmacro_h ()
773+ conf .check_stdnoreturn_h ()
748774conf .check_cpu_extensions ()
749775
750776if conf .env ['HAVE_LIBELF' ]:
@@ -763,7 +789,7 @@ if conf.env['HAVE_SSE2']:
763789 conf .env .Append (CCFLAGS = ['-msse2' ])
764790
765791# NB: After checks so they don't fail
766- conf .env .Append (CCFLAGS = ['-Werror=undef ' ])
792+ conf .env .Append (CCFLAGS = ['-Werror' ])
767793
768794
769795if ARGUMENTS .get ('GDB' ) == '1' :
0 commit comments