Skip to content

Commit

Permalink
make: Check for -Wno-format-truncation in configure.py and record to …
Browse files Browse the repository at this point in the history
…GNUmakefile.

Makes clang shut up and can be used as a template to test whether the compiler supports other warnings.
  • Loading branch information
bradleysepos committed Sep 10, 2019
1 parent bbc27a3 commit 53d6226
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions make/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -1860,6 +1860,17 @@ class Tools:
strerror_r = LDProbe( 'strerror_r', '%s' % Tools.gcc.pathname, '', strerror_r_test )
strerror_r.run()

#########################################
## Compiler option checks
#########################################
gcc_w_extra = []

Wno_format_truncation_command = '%s -O2 -Werror -Wno-format-truncation -S -o /dev/null -xc /dev/null > /dev/null 2>&1' % Tools.gcc.pathname
Wno_format_truncation = ShellProbe('checking for -Wno-format-truncation', '%s' % Wno_format_truncation_command)
Wno_format_truncation.run()
if Wno_format_truncation.fail is False:
gcc_w_extra.append('no-format-truncation')

## cfg hook before doc prep
cfg.doc_ready()

Expand Down Expand Up @@ -2030,6 +2041,7 @@ class Tools:
else:
doc.add( 'GCC.sysroot', '' )
doc.add( 'GCC.minver', '' )
doc.add( 'GCC.W.extra', " ".join(gcc_w_extra) )

if host_tuple.match( 'i?86-*' ):
doc.add( 'LIBHB.GCC.D', 'ARCH_X86_32', append=True )
Expand Down
2 changes: 1 addition & 1 deletion make/include/gcc.defs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ GCC.c_std = 1
GCC.cxx_std = 0
GCC.ML = 1
GCC.H = 0
GCC.W = all no-format-truncation
GCC.W = all $(GCC.W.extra)
GCC.archs =
GCC.sysroot =
GCC.minver =
Expand Down

0 comments on commit 53d6226

Please sign in to comment.