Skip to contentSkip to conversation

cc-option in Config.mk and -Og

DISCUSSION Wei Liu 2 participants 2 messages May 6, 2016

lore
Share & tools
lore

Wei Liu

author
#0 lore raw

Hi,

I discover an issue with cc-option in Config.mk.

# cc-option: Check if compiler supports first option, else fall back to second. # This is complicated by the fact that unrecognised -Wno-* options:
# (a) are ignored unless the compilation emits a warning; and
# (b) even then produce a warning rather than an error
# To handle this we do a test compile, passing the option-under-test, on a code

# fragment that will always produce a warning (integer assigned to pointer).                                      
# We then grep for the option-under-test in the compiler's output, the presence
# of which would indicate an "unrecognized command-line option" warning/error.

Doug submitted a patch to use -Og if that option is available, which contains such line:

$(call cc-option-add,CFLAGS,CC,-Og)

However the output of -O option is different from what cc-option expects:

$  echo 'void*p=1;' | gcc -Og -S -o /dev/null -x c -
cc1: error: argument to '-O' should be a non-negative integer

So that it always thinks -Og is supported.

Any thought on how to solve this?

Wei.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#1 lore raw

Wei Liu writes ("cc-option in Config.mk and -Og"):

Quoted 4 lines

$(call cc-option-add,CFLAGS,CC,-Og)

However the output of -O option is different from what cc-option expects:

I think cc-option is only suitable for use with warning options. Sorry for leaving this bear trap.

Quoted 1 line

Any thought on how to solve this?

cc-option should be renamed to cc-warning-option.

There should be a new macro cc-option which is suitable for things other than -W[no]-..., and can be simpler.

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel