Skip to content

Commit

Permalink
Use -Oz when optimization=s in Clang
Browse files Browse the repository at this point in the history
-Oz is the appropriate flag to use when you want to produce the smallest
possible binary, and is one would expect when setting optimization to s
or using the minsize build type.
  • Loading branch information
Tachi107 authored and dcbaker committed Sep 21, 2021
1 parent ca866bc commit 68eca11
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion mesonbuild/compilers/mixins/clang.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
'1': ['-O1'],
'2': ['-O2'],
'3': ['-O3'],
's': ['-Os'],
's': ['-Oz'],
} # type: T.Dict[str, T.List[str]]

class ClangCompiler(GnuLikeCompiler):
Expand Down
2 changes: 1 addition & 1 deletion mesonbuild/interpreter/interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -2322,7 +2322,7 @@ def _warn_about_builtin_args(self, args: T.List[str]) -> None:
# https://github.com/mesonbuild/meson/issues/3275#issuecomment-641354956
# https://github.com/mesonbuild/meson/issues/3742
warnargs = ('/W1', '/W2', '/W3', '/W4', '/Wall', '-Wall', '-Wextra')
optargs = ('-O0', '-O2', '-O3', '-Os', '/O1', '/O2', '/Os')
optargs = ('-O0', '-O2', '-O3', '-Os', '-Oz', '/O1', '/O2', '/Os')
for arg in args:
if arg in warnargs:
mlog.warning(f'Consider using the built-in warning_level option instead of using "{arg}".',
Expand Down

0 comments on commit 68eca11

Please sign in to comment.