diff mbox series

[4/7] arc: replace cc-option-yn uses with cc-option

Message ID 20210817002109.2736222-5-ndesaulniers@google.com (mailing list archive)
State New, archived
Headers show
Series kbuild: remove cc-option-yn | expand

Commit Message

Nick Desaulniers Aug. 17, 2021, 12:21 a.m. UTC
cc-option-yn can be replaced with cc-option. ie.
Checking for support:
ifeq ($(call cc-option-yn,$(FLAG)),y)
becomes:
ifneq ($(call cc-option,$(FLAG)),)

Checking for lack of support:
ifeq ($(call cc-option-yn,$(FLAG)),n)
becomes:
ifeq ($(call cc-option,$(FLAG)),)

This allows us to pursue removing cc-option-yn.

Cc: Vineet Gupta <vgupta@kernel.org>
Cc: linux-snps-arc@lists.infradead.org
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
---
 arch/arc/Makefile | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Nathan Chancellor Aug. 17, 2021, 2:05 a.m. UTC | #1
On 8/16/2021 5:21 PM, 'Nick Desaulniers' via Clang Built Linux wrote:
> cc-option-yn can be replaced with cc-option. ie.
> Checking for support:
> ifeq ($(call cc-option-yn,$(FLAG)),y)
> becomes:
> ifneq ($(call cc-option,$(FLAG)),)
> 
> Checking for lack of support:
> ifeq ($(call cc-option-yn,$(FLAG)),n)
> becomes:
> ifeq ($(call cc-option,$(FLAG)),)
> 
> This allows us to pursue removing cc-option-yn.
> 
> Cc: Vineet Gupta <vgupta@kernel.org>
> Cc: linux-snps-arc@lists.infradead.org
> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
> ---
>   arch/arc/Makefile | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/arch/arc/Makefile b/arch/arc/Makefile
> index c0d87ac2e221..8782a03f24a8 100644
> --- a/arch/arc/Makefile
> +++ b/arch/arc/Makefile
> @@ -18,8 +18,7 @@ ifeq ($(CONFIG_ARC_TUNE_MCPU),"")
>   cflags-y				+= $(tune-mcpu-def-y)
>   else
>   tune-mcpu				:= $(shell echo $(CONFIG_ARC_TUNE_MCPU))
> -tune-mcpu-ok 				:= $(call cc-option-yn, $(tune-mcpu))
> -ifeq ($(tune-mcpu-ok),y)
> +ifneq ($(call cc-option,$(tune-mcpu)),)
>   cflags-y				+= $(tune-mcpu)

Any reason not to just turn this into

cflags-y += $(call cc-option,$(tune-mcpu))

?

If $(tune-mcpu) is empty or invalid, nothing will be added to cflags-y.

>   else
>   # The flag provided by 'CONFIG_ARC_TUNE_MCPU' option isn't known by this compiler
>
Nick Desaulniers Aug. 17, 2021, 6:07 p.m. UTC | #2
On Mon, Aug 16, 2021 at 7:05 PM Nathan Chancellor <nathan@kernel.org> wrote:
>
> On 8/16/2021 5:21 PM, 'Nick Desaulniers' via Clang Built Linux wrote:
> > cc-option-yn can be replaced with cc-option. ie.
> > Checking for support:
> > ifeq ($(call cc-option-yn,$(FLAG)),y)
> > becomes:
> > ifneq ($(call cc-option,$(FLAG)),)
> >
> > Checking for lack of support:
> > ifeq ($(call cc-option-yn,$(FLAG)),n)
> > becomes:
> > ifeq ($(call cc-option,$(FLAG)),)
> >
> > This allows us to pursue removing cc-option-yn.
> >
> > Cc: Vineet Gupta <vgupta@kernel.org>
> > Cc: linux-snps-arc@lists.infradead.org
> > Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
> > ---
> >   arch/arc/Makefile | 3 +--
> >   1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/arch/arc/Makefile b/arch/arc/Makefile
> > index c0d87ac2e221..8782a03f24a8 100644
> > --- a/arch/arc/Makefile
> > +++ b/arch/arc/Makefile
> > @@ -18,8 +18,7 @@ ifeq ($(CONFIG_ARC_TUNE_MCPU),"")
> >   cflags-y                            += $(tune-mcpu-def-y)
> >   else
> >   tune-mcpu                           := $(shell echo $(CONFIG_ARC_TUNE_MCPU))
> > -tune-mcpu-ok                                 := $(call cc-option-yn, $(tune-mcpu))
> > -ifeq ($(tune-mcpu-ok),y)
> > +ifneq ($(call cc-option,$(tune-mcpu)),)
> >   cflags-y                            += $(tune-mcpu)
>
> Any reason not to just turn this into
>
> cflags-y += $(call cc-option,$(tune-mcpu))
>
> ?

Yes, you'll need to pull up the source; the diff doesn't provide
enough context. tune-mcpu is used in the body of the else branch
hinted at by the diff. PTAL

>
> If $(tune-mcpu) is empty or invalid, nothing will be added to cflags-y.
>
> >   else
> >   # The flag provided by 'CONFIG_ARC_TUNE_MCPU' option isn't known by this compiler
> >
Nathan Chancellor Aug. 18, 2021, 1:40 a.m. UTC | #3
On 8/17/2021 11:07 AM, 'Nick Desaulniers' via Clang Built Linux wrote:
> On Mon, Aug 16, 2021 at 7:05 PM Nathan Chancellor <nathan@kernel.org> wrote:
>>
>> On 8/16/2021 5:21 PM, 'Nick Desaulniers' via Clang Built Linux wrote:
>>> cc-option-yn can be replaced with cc-option. ie.
>>> Checking for support:
>>> ifeq ($(call cc-option-yn,$(FLAG)),y)
>>> becomes:
>>> ifneq ($(call cc-option,$(FLAG)),)
>>>
>>> Checking for lack of support:
>>> ifeq ($(call cc-option-yn,$(FLAG)),n)
>>> becomes:
>>> ifeq ($(call cc-option,$(FLAG)),)
>>>
>>> This allows us to pursue removing cc-option-yn.
>>>
>>> Cc: Vineet Gupta <vgupta@kernel.org>
>>> Cc: linux-snps-arc@lists.infradead.org
>>> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
>>> ---
>>>    arch/arc/Makefile | 3 +--
>>>    1 file changed, 1 insertion(+), 2 deletions(-)
>>>
>>> diff --git a/arch/arc/Makefile b/arch/arc/Makefile
>>> index c0d87ac2e221..8782a03f24a8 100644
>>> --- a/arch/arc/Makefile
>>> +++ b/arch/arc/Makefile
>>> @@ -18,8 +18,7 @@ ifeq ($(CONFIG_ARC_TUNE_MCPU),"")
>>>    cflags-y                            += $(tune-mcpu-def-y)
>>>    else
>>>    tune-mcpu                           := $(shell echo $(CONFIG_ARC_TUNE_MCPU))
>>> -tune-mcpu-ok                                 := $(call cc-option-yn, $(tune-mcpu))
>>> -ifeq ($(tune-mcpu-ok),y)
>>> +ifneq ($(call cc-option,$(tune-mcpu)),)
>>>    cflags-y                            += $(tune-mcpu)
>>
>> Any reason not to just turn this into
>>
>> cflags-y += $(call cc-option,$(tune-mcpu))
>>
>> ?
> 
> Yes, you'll need to pull up the source; the diff doesn't provide
> enough context. tune-mcpu is used in the body of the else branch
> hinted at by the diff. PTAL

Ah, fair enough. The warning is a little unconventional but oh well :)

Reviewed-by: Nathan Chancellor <nathan@kernel.org>

>>
>> If $(tune-mcpu) is empty or invalid, nothing will be added to cflags-y.
>>
>>>    else
>>>    # The flag provided by 'CONFIG_ARC_TUNE_MCPU' option isn't known by this compiler
>>>
> 
> 
>
Masahiro Yamada Aug. 25, 2021, 4:38 a.m. UTC | #4
On Wed, Aug 18, 2021 at 10:40 AM Nathan Chancellor <nathan@kernel.org> wrote:
>
>
>
> On 8/17/2021 11:07 AM, 'Nick Desaulniers' via Clang Built Linux wrote:
> > On Mon, Aug 16, 2021 at 7:05 PM Nathan Chancellor <nathan@kernel.org> wrote:
> >>
> >> On 8/16/2021 5:21 PM, 'Nick Desaulniers' via Clang Built Linux wrote:
> >>> cc-option-yn can be replaced with cc-option. ie.
> >>> Checking for support:
> >>> ifeq ($(call cc-option-yn,$(FLAG)),y)
> >>> becomes:
> >>> ifneq ($(call cc-option,$(FLAG)),)
> >>>
> >>> Checking for lack of support:
> >>> ifeq ($(call cc-option-yn,$(FLAG)),n)
> >>> becomes:
> >>> ifeq ($(call cc-option,$(FLAG)),)
> >>>
> >>> This allows us to pursue removing cc-option-yn.
> >>>
> >>> Cc: Vineet Gupta <vgupta@kernel.org>
> >>> Cc: linux-snps-arc@lists.infradead.org
> >>> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
> >>> ---
> >>>    arch/arc/Makefile | 3 +--
> >>>    1 file changed, 1 insertion(+), 2 deletions(-)
> >>>
> >>> diff --git a/arch/arc/Makefile b/arch/arc/Makefile
> >>> index c0d87ac2e221..8782a03f24a8 100644
> >>> --- a/arch/arc/Makefile
> >>> +++ b/arch/arc/Makefile
> >>> @@ -18,8 +18,7 @@ ifeq ($(CONFIG_ARC_TUNE_MCPU),"")
> >>>    cflags-y                            += $(tune-mcpu-def-y)
> >>>    else
> >>>    tune-mcpu                           := $(shell echo $(CONFIG_ARC_TUNE_MCPU))
> >>> -tune-mcpu-ok                                 := $(call cc-option-yn, $(tune-mcpu))
> >>> -ifeq ($(tune-mcpu-ok),y)
> >>> +ifneq ($(call cc-option,$(tune-mcpu)),)
> >>>    cflags-y                            += $(tune-mcpu)
> >>
> >> Any reason not to just turn this into
> >>
> >> cflags-y += $(call cc-option,$(tune-mcpu))
> >>
> >> ?
> >
> > Yes, you'll need to pull up the source; the diff doesn't provide
> > enough context. tune-mcpu is used in the body of the else branch
> > hinted at by the diff. PTAL
>
> Ah, fair enough. The warning is a little unconventional but oh well :)
>
> Reviewed-by: Nathan Chancellor <nathan@kernel.org>
>
> >>
> >> If $(tune-mcpu) is empty or invalid, nothing will be added to cflags-y.
> >>
> >>>    else
> >>>    # The flag provided by 'CONFIG_ARC_TUNE_MCPU' option isn't known by this compiler
> >>>
> >
> >
> >

Applied to linux-kbuild.
diff mbox series

Patch

diff --git a/arch/arc/Makefile b/arch/arc/Makefile
index c0d87ac2e221..8782a03f24a8 100644
--- a/arch/arc/Makefile
+++ b/arch/arc/Makefile
@@ -18,8 +18,7 @@  ifeq ($(CONFIG_ARC_TUNE_MCPU),"")
 cflags-y				+= $(tune-mcpu-def-y)
 else
 tune-mcpu				:= $(shell echo $(CONFIG_ARC_TUNE_MCPU))
-tune-mcpu-ok 				:= $(call cc-option-yn, $(tune-mcpu))
-ifeq ($(tune-mcpu-ok),y)
+ifneq ($(call cc-option,$(tune-mcpu)),)
 cflags-y				+= $(tune-mcpu)
 else
 # The flag provided by 'CONFIG_ARC_TUNE_MCPU' option isn't known by this compiler