cc-option-yn necessary? (vs cc-option)

2 views
Skip to first unread message

Nick Desaulniers

unread,
Aug 10, 2021, 1:58:16 PM8/10/21
to Masahiro Yamada, Linux Kbuild mailing list, clang-built-linux, Linus Torvalds, Arnd Bergmann
Masahiro,
I was looking through the uses of cc-option, cc-option-yn, and
cc-disable-warning to see what we're missing support for in Clang.

I have a short list of places where cc-option can be removed at
https://github.com/ClangBuiltLinux/linux/issues/1436#issuecomment-895557491
because all supported versions of supported toolchains support these
flags. These should remove a few unnecessary compiler invocations.

There are also a few cc-option tests that are very compiler specific,
so those might be convertible to just check CC_IS_* rather than
cc-option (I'll have to verify).

Another thing I noticed is that it seems that most uses of
cc-option-yn are replaceable with simply cc-option when they use
cc-option-yn but check that the result is equal to y. I think even the
cases that check against n could be converted to:

Examples:
arch/x86/Makefile
From:
ifeq ($(call cc-option-yn, -mfentry), n)
To:
ifeq ($(call cc-option,-mfentry),)
(Though technically, all supported versions of gcc and clang support
-mfentry, so this block should just be deleted)

arch/powerpc/Makefile
From:
ifeq ($(call cc-option-yn,-mcmodel=medium),y)
To:
ifneq ($(call cc-option,-mcmodel=medium),)

Then perhaps we could consolidate cc-option-yn into cc-option? What
are your thoughts? Should I start sending you patches for all of the
above?
--
Thanks,
~Nick Desaulniers

Masahiro Yamada

unread,
Aug 10, 2021, 8:05:52 PM8/10/21
to Nick Desaulniers, Linux Kbuild mailing list, clang-built-linux, Linus Torvalds, Arnd Bergmann
Yes, I think it is a nice clean-up.

Patches are welcome.

--
Best Regards
Masahiro Yamada

Nick Desaulniers

unread,
Aug 16, 2021, 8:24:48 PM8/16/21
to Masahiro Yamada, Linux Kbuild mailing list, clang-built-linux, Linus Torvalds, Arnd Bergmann
Reply all
Reply to author
Forward
0 new messages