Skip to content

Commit

Permalink
bootloader: check if gcc supports -Wno-error=unused-but-set-variable
Browse files Browse the repository at this point in the history
Check if gcc supports `-Wno-error=unused-but-set-variable` before
trying to use it. Fixes bootloader building with old versions of
gcc, such as 4.4.3.
  • Loading branch information
rokm committed Apr 25, 2023
1 parent 9393ae9 commit 78e478a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion bootloader/wscript
Original file line number Diff line number Diff line change
Expand Up @@ -560,11 +560,14 @@ def configure(ctx):
'-Wall',
'-Werror',
'-Wno-error=unused-variable',
'-Wno-error=unused-but-set-variable',
'-Wno-error=unused-function',
]
)

# -Wno-error=unused-but-set-variable is not available on old gcc versions (e.g., 4.4.3)
if ctx.check_cc(cflags='-Wno-error=unused-but-set-variable', execute=False, mandatory=False):
ctx.env.append_value('CFLAGS', ['-Wno-error=unused-but-set-variable'])

# ** Defines, includes **

if not ctx.env.DEST_OS == 'win32':
Expand Down
3 changes: 3 additions & 0 deletions news/7592.bootloader.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Fix bootloader building with old versions of ``gcc`` that do not
support the ``-Wno-error=unused-but-set-variable`` compiler flag
(e.g., ``gcc`` v4.4.3).

0 comments on commit 78e478a

Please sign in to comment.