* [PATCH] btrfs: Use immediate assignment when referencing cc-option
@ 2021-03-16 22:46 Victor Erminpour
2021-03-17 2:24 ` Anand Jain
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Victor Erminpour @ 2021-03-16 22:46 UTC (permalink / raw)
To: clm; +Cc: josef, dsterba, linux-btrfs, linux-kernel, victor.erminpour
Calling cc-option will use KBUILD_CFLAGS, which when lazy setting
subdir-ccflags-y produces the following build error:
scripts/Makefile.lib:10: *** Recursive variable `KBUILD_CFLAGS' \
references itself (eventually). Stop.
Use := assignment to subdir-ccflags-y when referencing cc-option.
This causes make to also evaluate += immediately, cc-option
calls are done right away and we don't end up with KBUILD_CFLAGS
referencing itself.
Signed-off-by: Victor Erminpour <victor.erminpour@oracle.com>
---
fs/btrfs/Makefile | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/fs/btrfs/Makefile b/fs/btrfs/Makefile
index b634c42115ea..3dba1336fa95 100644
--- a/fs/btrfs/Makefile
+++ b/fs/btrfs/Makefile
@@ -7,10 +7,10 @@ subdir-ccflags-y += -Wmissing-format-attribute
subdir-ccflags-y += -Wmissing-prototypes
subdir-ccflags-y += -Wold-style-definition
subdir-ccflags-y += -Wmissing-include-dirs
-subdir-ccflags-y += $(call cc-option, -Wunused-but-set-variable)
-subdir-ccflags-y += $(call cc-option, -Wunused-const-variable)
-subdir-ccflags-y += $(call cc-option, -Wpacked-not-aligned)
-subdir-ccflags-y += $(call cc-option, -Wstringop-truncation)
+subdir-ccflags-y := $(call cc-option, -Wunused-but-set-variable)
+subdir-ccflags-y := $(call cc-option, -Wunused-const-variable)
+subdir-ccflags-y := $(call cc-option, -Wpacked-not-aligned)
+subdir-ccflags-y := $(call cc-option, -Wstringop-truncation)
# The following turn off the warnings enabled by -Wextra
subdir-ccflags-y += -Wno-missing-field-initializers
subdir-ccflags-y += -Wno-sign-compare
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] btrfs: Use immediate assignment when referencing cc-option
2021-03-16 22:46 [PATCH] btrfs: Use immediate assignment when referencing cc-option Victor Erminpour
@ 2021-03-17 2:24 ` Anand Jain
2021-03-17 6:39 ` Nikolay Borisov
2021-03-17 8:39 ` David Sterba
2 siblings, 0 replies; 4+ messages in thread
From: Anand Jain @ 2021-03-17 2:24 UTC (permalink / raw)
To: Victor Erminpour, clm; +Cc: josef, dsterba, linux-btrfs, linux-kernel
On 17/03/2021 06:46, Victor Erminpour wrote:
> Calling cc-option will use KBUILD_CFLAGS, which when lazy setting
> subdir-ccflags-y produces the following build error:
>
> scripts/Makefile.lib:10: *** Recursive variable `KBUILD_CFLAGS' \
> references itself (eventually). Stop.
>
> Use := assignment to subdir-ccflags-y when referencing cc-option.
> This causes make to also evaluate += immediately, cc-option
> calls are done right away and we don't end up with KBUILD_CFLAGS
> referencing itself.
>
Thanks for the patch.
Reviewed-by: Anand Jain <anand.jain@oracle.com>
> Signed-off-by: Victor Erminpour <victor.erminpour@oracle.com>
> ---
> fs/btrfs/Makefile | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/fs/btrfs/Makefile b/fs/btrfs/Makefile
> index b634c42115ea..3dba1336fa95 100644
> --- a/fs/btrfs/Makefile
> +++ b/fs/btrfs/Makefile
> @@ -7,10 +7,10 @@ subdir-ccflags-y += -Wmissing-format-attribute
> subdir-ccflags-y += -Wmissing-prototypes
> subdir-ccflags-y += -Wold-style-definition
> subdir-ccflags-y += -Wmissing-include-dirs
> -subdir-ccflags-y += $(call cc-option, -Wunused-but-set-variable)
> -subdir-ccflags-y += $(call cc-option, -Wunused-const-variable)
> -subdir-ccflags-y += $(call cc-option, -Wpacked-not-aligned)
> -subdir-ccflags-y += $(call cc-option, -Wstringop-truncation)
> +subdir-ccflags-y := $(call cc-option, -Wunused-but-set-variable)
> +subdir-ccflags-y := $(call cc-option, -Wunused-const-variable)
> +subdir-ccflags-y := $(call cc-option, -Wpacked-not-aligned)
> +subdir-ccflags-y := $(call cc-option, -Wstringop-truncation)
> # The following turn off the warnings enabled by -Wextra
> subdir-ccflags-y += -Wno-missing-field-initializers
> subdir-ccflags-y += -Wno-sign-compare
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] btrfs: Use immediate assignment when referencing cc-option
2021-03-16 22:46 [PATCH] btrfs: Use immediate assignment when referencing cc-option Victor Erminpour
2021-03-17 2:24 ` Anand Jain
@ 2021-03-17 6:39 ` Nikolay Borisov
2021-03-17 8:39 ` David Sterba
2 siblings, 0 replies; 4+ messages in thread
From: Nikolay Borisov @ 2021-03-17 6:39 UTC (permalink / raw)
To: Victor Erminpour, clm; +Cc: josef, dsterba, linux-btrfs, linux-kernel
On 17.03.21 г. 0:46 ч., Victor Erminpour wrote:
> Calling cc-option will use KBUILD_CFLAGS, which when lazy setting
> subdir-ccflags-y produces the following build error:
>
> scripts/Makefile.lib:10: *** Recursive variable `KBUILD_CFLAGS' \
> references itself (eventually). Stop.
>
> Use := assignment to subdir-ccflags-y when referencing cc-option.
> This causes make to also evaluate += immediately, cc-option
> calls are done right away and we don't end up with KBUILD_CFLAGS
> referencing itself.
>
> Signed-off-by: Victor Erminpour <victor.erminpour@oracle.com>
> ---
> fs/btrfs/Makefile | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/fs/btrfs/Makefile b/fs/btrfs/Makefile
> index b634c42115ea..3dba1336fa95 100644
> --- a/fs/btrfs/Makefile
> +++ b/fs/btrfs/Makefile
> @@ -7,10 +7,10 @@ subdir-ccflags-y += -Wmissing-format-attribute
> subdir-ccflags-y += -Wmissing-prototypes
> subdir-ccflags-y += -Wold-style-definition
> subdir-ccflags-y += -Wmissing-include-dirs
> -subdir-ccflags-y += $(call cc-option, -Wunused-but-set-variable)
> -subdir-ccflags-y += $(call cc-option, -Wunused-const-variable)
> -subdir-ccflags-y += $(call cc-option, -Wpacked-not-aligned)
> -subdir-ccflags-y += $(call cc-option, -Wstringop-truncation)
> +subdir-ccflags-y := $(call cc-option, -Wunused-but-set-variable)
> +subdir-ccflags-y := $(call cc-option, -Wunused-const-variable)
> +subdir-ccflags-y := $(call cc-option, -Wpacked-not-aligned)
> +subdir-ccflags-y := $(call cc-option, -Wstringop-truncation)
> # The following turn off the warnings enabled by -Wextra
> subdir-ccflags-y += -Wno-missing-field-initializers
> subdir-ccflags-y += -Wno-sign-compare
>
Why does this patch change only some assignments and others are left as
they were?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] btrfs: Use immediate assignment when referencing cc-option
2021-03-16 22:46 [PATCH] btrfs: Use immediate assignment when referencing cc-option Victor Erminpour
2021-03-17 2:24 ` Anand Jain
2021-03-17 6:39 ` Nikolay Borisov
@ 2021-03-17 8:39 ` David Sterba
2 siblings, 0 replies; 4+ messages in thread
From: David Sterba @ 2021-03-17 8:39 UTC (permalink / raw)
To: Victor Erminpour; +Cc: clm, josef, dsterba, linux-btrfs, linux-kernel
On Tue, Mar 16, 2021 at 03:46:10PM -0700, Victor Erminpour wrote:
> Calling cc-option will use KBUILD_CFLAGS, which when lazy setting
> subdir-ccflags-y produces the following build error:
>
> scripts/Makefile.lib:10: *** Recursive variable `KBUILD_CFLAGS' \
> references itself (eventually). Stop.
>
> Use := assignment to subdir-ccflags-y when referencing cc-option.
> This causes make to also evaluate += immediately, cc-option
> calls are done right away and we don't end up with KBUILD_CFLAGS
> referencing itself.
>
> Signed-off-by: Victor Erminpour <victor.erminpour@oracle.com>
> ---
> fs/btrfs/Makefile | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/fs/btrfs/Makefile b/fs/btrfs/Makefile
> index b634c42115ea..3dba1336fa95 100644
> --- a/fs/btrfs/Makefile
> +++ b/fs/btrfs/Makefile
> @@ -7,10 +7,10 @@ subdir-ccflags-y += -Wmissing-format-attribute
> subdir-ccflags-y += -Wmissing-prototypes
> subdir-ccflags-y += -Wold-style-definition
> subdir-ccflags-y += -Wmissing-include-dirs
> -subdir-ccflags-y += $(call cc-option, -Wunused-but-set-variable)
> -subdir-ccflags-y += $(call cc-option, -Wunused-const-variable)
> -subdir-ccflags-y += $(call cc-option, -Wpacked-not-aligned)
> -subdir-ccflags-y += $(call cc-option, -Wstringop-truncation)
> +subdir-ccflags-y := $(call cc-option, -Wunused-but-set-variable)
> +subdir-ccflags-y := $(call cc-option, -Wunused-const-variable)
> +subdir-ccflags-y := $(call cc-option, -Wpacked-not-aligned)
> +subdir-ccflags-y := $(call cc-option, -Wstringop-truncation)
But this overwrites all the previously accumulated values from += so
effectively there's only the last one, no? That's not what we want.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-03-17 8:42 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-16 22:46 [PATCH] btrfs: Use immediate assignment when referencing cc-option Victor Erminpour
2021-03-17 2:24 ` Anand Jain
2021-03-17 6:39 ` Nikolay Borisov
2021-03-17 8:39 ` David Sterba
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).