Do not skip a flag without -O, if the flag is checked explicitly
This commit is contained in:
parent
1ad7f0cc25
commit
5ffff08833
2 changed files with 9 additions and 2 deletions
|
|
@ -16,6 +16,10 @@ import sysconfig
|
|||
|
||||
# We will check all flags if none were requested
|
||||
KEYS_TO_CHECK = sys.argv[2:] or list(sysconfig.get_config_vars().keys())
|
||||
# For backwards compatibility, if no flags were provided, we assume flags without -O are to be skipped
|
||||
# But when we provide explicit list of flags, we assert they get the options,
|
||||
# so we can assert things like "CFLAGS has -O3" vs. "CFLAGS has no -O at all"
|
||||
NO_FLAG_FAILS = bool(sys.argv[2:])
|
||||
|
||||
# The flags that currently don't have the -Og flag on the debug build
|
||||
# and we consider it OK, because we don't know any better :)
|
||||
|
|
@ -35,8 +39,8 @@ for key in KEYS_TO_CHECK:
|
|||
flags = sysconfig.get_config_vars()[key]
|
||||
if isinstance(flags, str):
|
||||
oflags = [f for f in flags.split(' ') if f.startswith('-O')]
|
||||
if oflags and oflags[-1] != sys.argv[1]:
|
||||
print('Problem in {} -O flags: {}'.format(key, ' '.join(oflags)))
|
||||
if (oflags and oflags[-1] != sys.argv[1]) or (not oflags and NO_FLAG_FAILS):
|
||||
print('Problem in {} -O flags: {}'.format(key, ' '.join(oflags) or '<empty>'))
|
||||
ret = 1
|
||||
elif oflags:
|
||||
print('{} are OK'.format(key))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue