Skip to contentSkip to conversation

Implementaiton of cc-option in Config.mk

DISCUSSION Wei Liu 2 participants 5 messages Mar 14, 2018 – Mar 15, 2018

lore
Share & tools
lore

Wei Liu

author
#0 lore raw

Hi all

The implementation of cc-option (grepping the option being tested in output) in Config.mk now makes it not possible to detect if -Og is supported because "-Og" doesn't appear in the output if it is not supported. I suspect there will be other options that cc-option can't work with.

It is implemented like that because we try to detect -Wno-* option. But why is that important? Can't we just ignore -Wno-* if they aren't supported? Does anyone has an idea how to make cc-option work for -Og (and other options)?

Thanks,
Wei.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#1 lore raw
Quoted 10 lines
Quoted 1 line
Quoted 1 line · On 14.03.18 at 18:11, <[email protected]> wrote:

The implementation of cc-option (grepping the option being tested in output) in Config.mk now makes it not possible to detect if -Og is supported because "-Og" doesn't appear in the output if it is not supported. I suspect there will be other options that cc-option can't work with.

It is implemented like that because we try to detect -Wno-* option. But why is that important? Can't we just ignore -Wno-* if they aren't supported?

Well, the explanation for its behavior is given in the comment next to its definition:

# 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

Quoted 2 lines

Does anyone has an idea how to make cc-option work for -Og (and other options)?

How about simply extending it to also use the "test failed" alternative if the compilation produced an error status (which is currently ignored by way of the use of a pipeline)? Untested:

cc-option = $(shell if test -z "`echo 'void*p=1;' | \
              { $(1) $(2) -S -o /dev/null -x c - 2>&1 || echo $(2); } | grep -- $(2) -`"; \
              then echo "$(2)"; else echo "$(3)"; fi ;)

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

author
#2 lore raw
Quoted 7 lines · Jan Beulich
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 14.03.18 at 18:11, <[email protected]> wrote:

The implementation of cc-option (grepping the option being tested in output) in Config.mk now makes it not possible to detect if -Og is supported because "-Og" doesn't appear in the output if it is not supported. I suspect there will be other options that cc-option can't work with.

Quoted 6 lines
Quoted 3 lines

It is implemented like that because we try to detect -Wno-* option. But why is that important? Can't we just ignore -Wno-* if they aren't supported?

Well, the explanation for its behavior is given in the comment next to its definition:

Yeah, I know that. I'm just not sure why nonexistent -Wno-* should be rejected. If there is no corresponding -W* option in the first place, -Wno-* shouldn't cause any difference in the end result.

Quoted 8 lines

# 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

Quoted 2 lines

Does anyone has an idea how to make cc-option work for -Og (and other options)?

Quoted 8 lines

How about simply extending it to also use the "test failed" alternative if the compilation produced an error status (which is currently ignored by way of the use of a pipeline)? Untested:

cc-option = $(shell if test -z "`echo 'void*p=1;' | \
              { $(1) $(2) -S -o /dev/null -x c - 2>&1 || echo $(2); } | grep -- $(2) -`"; \
              then echo "$(2)"; else echo "$(3)"; fi ;)

Yeah, let me try this.

Wei.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#3 lore raw
Quoted 13 lines
Quoted 1 line
Quoted 1 line · On 15.03.18 at 12:22, <[email protected]> wrote:
Quoted 11 lines · Jan Beulich
Quoted 10 lines
Quoted 1 line
Quoted 1 line · On 14.03.18 at 18:11, <[email protected]> wrote:

The implementation of cc-option (grepping the option being tested in output) in Config.mk now makes it not possible to detect if -Og is supported because "-Og" doesn't appear in the output if it is not supported. I suspect there will be other options that cc-option can't work with.

It is implemented like that because we try to detect -Wno-* option. But why is that important? Can't we just ignore -Wno-* if they aren't supported?

Quoted 6 lines
Quoted 2 lines

Well, the explanation for its behavior is given in the comment next to its definition:

Yeah, I know that. I'm just not sure why nonexistent -Wno-* should be rejected. If there is no corresponding -W* option in the first place, -Wno-* shouldn't cause any difference in the end result.

The problem is that at least some compiler versions error on unknown -Wno-* the first time they produce some (other) warning. Hence we can't blindly pass -Wno-*.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

author
#4 lore raw
Quoted 16 lines · Jan Beulich
Quoted 16 lines
Quoted 1 line
Quoted 1 line · On 15.03.18 at 12:22, <[email protected]> wrote:
Quoted 13 lines · Jan Beulich
Quoted 10 lines
Quoted 1 line
Quoted 1 line · On 14.03.18 at 18:11, <[email protected]> wrote:

The implementation of cc-option (grepping the option being tested in output) in Config.mk now makes it not possible to detect if -Og is supported because "-Og" doesn't appear in the output if it is not supported. I suspect there will be other options that cc-option can't work with.

It is implemented like that because we try to detect -Wno-* option. But why is that important? Can't we just ignore -Wno-* if they aren't supported?

Well, the explanation for its behavior is given in the comment next to its definition:

Quoted 8 lines
Quoted 3 lines

Yeah, I know that. I'm just not sure why nonexistent -Wno-* should be rejected. If there is no corresponding -W* option in the first place, -Wno-* shouldn't cause any difference in the end result.

The problem is that at least some compiler versions error on unknown -Wno-* the first time they produce some (other) warning. Hence we can't blindly pass -Wno-*.

Urgh, OK. Thanks for the explanation.

Wei.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel