All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] [v4] Kbuild: std=gnu11 changes
@ 2022-03-08 21:56 Arnd Bergmann
  2022-03-08 21:56 ` [PATCH 1/4] [v4] Kbuild: add -Wno-shift-negative-value where -Wextra is used Arnd Bergmann
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: Arnd Bergmann @ 2022-03-08 21:56 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: alexs, arnd, arnd, dsterba, elver, jani.nikula, linux-doc,
	linux-kbuild, linux-kernel, llvm, mark.rutland, ndesaulniers,
	ojeda, torvalds

From: Arnd Bergmann <arnd@arndb.de>

I've incorporated the feedback from Masahiro Yamada in this
version, splitting out one more patch, rebasing on top of 
the kbuild tree, and changing the order of the patches.

Please apply to the kbuild tree.

       Arnd

Cc: linux-kbuild@vger.kernel.org
Cc: llvm@lists.linux.dev

Arnd Bergmann (3):
  [v4] Kbuild: add -Wno-shift-negative-value where -Wextra is used
  [v4] Kbuild: move to -std=gnu11
  Kbuild: use -std=gnu11 for KBUILD_USERCFLAGS

Mark Rutland (1):
  [v4] Kbuild: use -Wdeclaration-after-statement

 Documentation/process/programming-language.rst             | 6 +++---
 .../translations/it_IT/process/programming-language.rst    | 4 ++--
 .../translations/zh_CN/process/programming-language.rst    | 3 +--
 .../translations/zh_TW/process/programming-language.rst    | 3 +--
 Makefile                                                   | 7 ++++---
 arch/arm64/kernel/vdso32/Makefile                          | 3 ++-
 drivers/gpu/drm/i915/Makefile                              | 1 +
 drivers/staging/greybus/tools/Makefile                     | 3 ++-
 fs/btrfs/Makefile                                          | 1 +
 scripts/Makefile.extrawarn                                 | 1 +
 scripts/mod/modpost.c                                      | 4 +++-
 11 files changed, 21 insertions(+), 15 deletions(-)

-- 
2.29.2


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 1/4] [v4] Kbuild: add -Wno-shift-negative-value where -Wextra is used
  2022-03-08 21:56 [PATCH 0/4] [v4] Kbuild: std=gnu11 changes Arnd Bergmann
@ 2022-03-08 21:56 ` Arnd Bergmann
  2022-03-09  8:19   ` Jani Nikula
  2022-03-09 16:47   ` David Sterba
  2022-03-08 21:56 ` [PATCH 2/4] [v4] Kbuild: use -Wdeclaration-after-statement Arnd Bergmann
                   ` (3 subsequent siblings)
  4 siblings, 2 replies; 12+ messages in thread
From: Arnd Bergmann @ 2022-03-08 21:56 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: alexs, arnd, arnd, dsterba, elver, jani.nikula, linux-doc,
	linux-kbuild, linux-kernel, llvm, mark.rutland, ndesaulniers,
	ojeda, torvalds

From: Arnd Bergmann <arnd@arndb.de>

As a preparation for moving to -std=gnu11, turn off the
-Wshift-negative-value option. This warning is enabled by gcc when
building with -Wextra for c99 or higher, but not for c89. Since
the kernel already relies on well-defined overflow behavior,
the warning is not helpful and can simply be disabled in
all locations that use -Wextra.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
[v4]
  split into a separate patch
---
 drivers/gpu/drm/i915/Makefile          | 1 +
 drivers/staging/greybus/tools/Makefile | 3 ++-
 fs/btrfs/Makefile                      | 1 +
 scripts/Makefile.extrawarn             | 1 +
 4 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
index 1b62b9f65196..1618a6e0af4e 100644
--- a/drivers/gpu/drm/i915/Makefile
+++ b/drivers/gpu/drm/i915/Makefile
@@ -17,6 +17,7 @@ subdir-ccflags-y += -Wno-unused-parameter
 subdir-ccflags-y += -Wno-type-limits
 subdir-ccflags-y += -Wno-missing-field-initializers
 subdir-ccflags-y += -Wno-sign-compare
+subdir-ccflags-y += -Wno-shift-negative-value
 subdir-ccflags-y += $(call cc-disable-warning, unused-but-set-variable)
 subdir-ccflags-y += $(call cc-disable-warning, frame-address)
 subdir-ccflags-$(CONFIG_DRM_I915_WERROR) += -Werror
diff --git a/drivers/staging/greybus/tools/Makefile b/drivers/staging/greybus/tools/Makefile
index ad0ae8053b79..a3bbd73171f2 100644
--- a/drivers/staging/greybus/tools/Makefile
+++ b/drivers/staging/greybus/tools/Makefile
@@ -12,7 +12,8 @@ CFLAGS	+= -std=gnu99 -Wall -Wextra -g \
 	    -Wredundant-decls \
 	    -Wcast-align \
 	    -Wsign-compare \
-	    -Wno-missing-field-initializers
+	    -Wno-missing-field-initializers \
+	    -Wno-shift-negative-value
 
 CC	:= $(CROSS_COMPILE)gcc
 
diff --git a/fs/btrfs/Makefile b/fs/btrfs/Makefile
index 4188ba3fd8c3..99f9995670ea 100644
--- a/fs/btrfs/Makefile
+++ b/fs/btrfs/Makefile
@@ -17,6 +17,7 @@ subdir-ccflags-y += $(condflags)
 subdir-ccflags-y += -Wno-missing-field-initializers
 subdir-ccflags-y += -Wno-sign-compare
 subdir-ccflags-y += -Wno-type-limits
+subdir-ccflags-y += -Wno-shift-negative-value
 
 obj-$(CONFIG_BTRFS_FS) := btrfs.o
 
diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
index 8be892887d71..650d0b8ceec3 100644
--- a/scripts/Makefile.extrawarn
+++ b/scripts/Makefile.extrawarn
@@ -36,6 +36,7 @@ KBUILD_CFLAGS += $(call cc-option, -Wstringop-truncation)
 KBUILD_CFLAGS += -Wno-missing-field-initializers
 KBUILD_CFLAGS += -Wno-sign-compare
 KBUILD_CFLAGS += -Wno-type-limits
+KBUILD_CFLAGS += -Wno-shift-negative-value
 
 KBUILD_CPPFLAGS += -DKBUILD_EXTRA_WARN1
 
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 2/4] [v4] Kbuild: use -Wdeclaration-after-statement
  2022-03-08 21:56 [PATCH 0/4] [v4] Kbuild: std=gnu11 changes Arnd Bergmann
  2022-03-08 21:56 ` [PATCH 1/4] [v4] Kbuild: add -Wno-shift-negative-value where -Wextra is used Arnd Bergmann
@ 2022-03-08 21:56 ` Arnd Bergmann
  2022-03-08 21:56 ` [PATCH 3/4] [v4] Kbuild: move to -std=gnu11 Arnd Bergmann
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 12+ messages in thread
From: Arnd Bergmann @ 2022-03-08 21:56 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: alexs, arnd, arnd, dsterba, elver, jani.nikula, linux-doc,
	linux-kbuild, linux-kernel, llvm, mark.rutland, ndesaulniers,
	ojeda, torvalds

From: Mark Rutland <mark.rutland@arm.com>

The kernel is moving from using `-std=gnu89` to `-std=gnu11`, permitting
the use of additional C11 features such as for-loop initial declarations.

One contentious aspect of C99 is that it permits mixed declarations and
code, and for now at least, it seems preferable to enforce that
declarations must come first.

These warnings were already enabled in the kernel itself, but not
for KBUILD_USERCFLAGS or the compat VDSO on arch/arm64, which uses
a separate set of CFLAGS.

This patch fixes an existing violation in modpost.c, which is not
reported because of the missing flag in KBUILD_USERCFLAGS:

| scripts/mod/modpost.c: In function ‘match’:
| scripts/mod/modpost.c:837:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
|   837 |   const char *endp = p + strlen(p) - 1;
|       |   ^~~~~

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
[arnd: don't add a duplicate flag to the default set, update changelog]
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
[v4]
  move ahead of actual std=gnu11 change
---
 Makefile                          | 3 ++-
 arch/arm64/kernel/vdso32/Makefile | 1 +
 scripts/mod/modpost.c             | 4 +++-
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index a82095c69fdd..c791bfd5a471 100644
--- a/Makefile
+++ b/Makefile
@@ -432,7 +432,8 @@ HOSTCXX	= g++
 endif
 
 KBUILD_USERHOSTCFLAGS := -Wall -Wmissing-prototypes -Wstrict-prototypes \
-			 -O2 -fomit-frame-pointer -std=gnu89
+			 -O2 -fomit-frame-pointer -std=gnu89 \
+			 -Wdeclaration-after-statement
 KBUILD_USERCFLAGS  := $(KBUILD_USERHOSTCFLAGS) $(USERCFLAGS)
 KBUILD_USERLDFLAGS := $(USERLDFLAGS)
 
diff --git a/arch/arm64/kernel/vdso32/Makefile b/arch/arm64/kernel/vdso32/Makefile
index 6c01b63ff56d..f46457f1f4f0 100644
--- a/arch/arm64/kernel/vdso32/Makefile
+++ b/arch/arm64/kernel/vdso32/Makefile
@@ -68,6 +68,7 @@ VDSO_CFLAGS += -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
                -fno-strict-aliasing -fno-common \
                -Werror-implicit-function-declaration \
                -Wno-format-security \
+               -Wdeclaration-after-statement \
                -std=gnu89
 VDSO_CFLAGS  += -O2
 # Some useful compiler-dependent flags from top-level Makefile
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 6bfa33217914..fe693304b120 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -833,8 +833,10 @@ static int match(const char *sym, const char * const pat[])
 {
 	const char *p;
 	while (*pat) {
+		const char *endp;
+
 		p = *pat++;
-		const char *endp = p + strlen(p) - 1;
+		endp = p + strlen(p) - 1;
 
 		/* "*foo*" */
 		if (*p == '*' && *endp == '*') {
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 3/4] [v4] Kbuild: move to -std=gnu11
  2022-03-08 21:56 [PATCH 0/4] [v4] Kbuild: std=gnu11 changes Arnd Bergmann
  2022-03-08 21:56 ` [PATCH 1/4] [v4] Kbuild: add -Wno-shift-negative-value where -Wextra is used Arnd Bergmann
  2022-03-08 21:56 ` [PATCH 2/4] [v4] Kbuild: use -Wdeclaration-after-statement Arnd Bergmann
@ 2022-03-08 21:56 ` Arnd Bergmann
  2022-03-08 21:56 ` [PATCH 4/4] Kbuild: use -std=gnu11 for KBUILD_USERCFLAGS Arnd Bergmann
  2022-03-09  0:09 ` [PATCH 0/4] [v4] Kbuild: std=gnu11 changes Linus Torvalds
  4 siblings, 0 replies; 12+ messages in thread
From: Arnd Bergmann @ 2022-03-08 21:56 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: alexs, arnd, arnd, dsterba, elver, jani.nikula, linux-doc,
	linux-kbuild, linux-kernel, llvm, mark.rutland, ndesaulniers,
	ojeda, torvalds, Sedat Dilek

From: Arnd Bergmann <arnd@arndb.de>

During a patch discussion, Linus brought up the option of changing
the C standard version from gnu89 to gnu99, which allows using variable
declaration inside of a for() loop. While the C99, C11 and later standards
introduce many other features, most of these are already available in
gnu89 as GNU extensions as well.

An earlier attempt to do this when gcc-5 started defaulting to
-std=gnu11 failed because at the time that caused warnings about
designated initializers with older compilers. Now that gcc-5.1 is
the minimum compiler version used for building kernels, that is no
longer a concern. Similarly, the behavior of 'inline' functions changes
between gnu89 using gnu_inline behavior and gnu11 using standard c99+
behavior, but this was taken care of by defining 'inline' to include
__attribute__((gnu_inline)) in order to allow building with clang a
while ago.

Nathan Chancellor reported a new -Wdeclaration-after-statement
warning that appears in a system header on arm, this still needs a
workaround.

The differences between gnu99, gnu11, gnu1x and gnu17 are fairly
minimal and mainly impact warnings at the -Wpedantic level that the
kernel never enables. Between these, gnu11 is the newest version
that is supported by all supported compiler versions, though it is
only the default on gcc-5, while all other supported versions of
gcc or clang default to gnu1x/gnu17.

Link: https://lore.kernel.org/lkml/CAHk-=wiyCH7xeHcmiFJ-YgXUy2Jaj7pnkdKpcovt8fYbVFW3TA@mail.gmail.com/
Link: https://github.com/ClangBuiltLinux/linux/issues/1603
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Acked-by: Marco Elver <elver@google.com>
Acked-by: Jani Nikula <jani.nikula@intel.com>
Acked-by: David Sterba <dsterba@suse.com>
Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
Reviewed-by: Alex Shi <alexs@kernel.org>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Miguel Ojeda <ojeda@kernel.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
[v4]
 - split -Wno-shift-negative-value into a separate patch

[v3]
 - split out USERCFLAGS to a separate patch
 - add -Wdeclaration-after-statement patch from Mark Rutland
 - leave out C17 reference
 - more rewording the descrption

[v2]
 - added -std=gnu11 back, rather than just relying on the default
 - minor changes to changelog text
---
 Documentation/process/programming-language.rst              | 6 +++---
 .../translations/it_IT/process/programming-language.rst     | 4 ++--
 .../translations/zh_CN/process/programming-language.rst     | 3 +--
 .../translations/zh_TW/process/programming-language.rst     | 3 +--
 Makefile                                                    | 4 ++--
 arch/arm64/kernel/vdso32/Makefile                           | 2 +-
 6 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/Documentation/process/programming-language.rst b/Documentation/process/programming-language.rst
index ec474a70a02f..5fc9160ca1fa 100644
--- a/Documentation/process/programming-language.rst
+++ b/Documentation/process/programming-language.rst
@@ -5,9 +5,9 @@ Programming Language
 
 The kernel is written in the C programming language [c-language]_.
 More precisely, the kernel is typically compiled with ``gcc`` [gcc]_
-under ``-std=gnu89`` [gcc-c-dialect-options]_: the GNU dialect of ISO C90
-(including some C99 features). ``clang`` [clang]_ is also supported, see
-docs on :ref:`Building Linux with Clang/LLVM <kbuild_llvm>`.
+under ``-std=gnu11`` [gcc-c-dialect-options]_: the GNU dialect of ISO C11.
+``clang`` [clang]_ is also supported, see docs on
+:ref:`Building Linux with Clang/LLVM <kbuild_llvm>`.
 
 This dialect contains many extensions to the language [gnu-extensions]_,
 and many of them are used within the kernel as a matter of course.
diff --git a/Documentation/translations/it_IT/process/programming-language.rst b/Documentation/translations/it_IT/process/programming-language.rst
index 41db2598ce11..c1a9b481a6f9 100644
--- a/Documentation/translations/it_IT/process/programming-language.rst
+++ b/Documentation/translations/it_IT/process/programming-language.rst
@@ -10,8 +10,8 @@ Linguaggio di programmazione
 
 Il kernel è scritto nel linguaggio di programmazione C [it-c-language]_.
 Più precisamente, il kernel viene compilato con ``gcc`` [it-gcc]_ usando
-l'opzione ``-std=gnu89`` [it-gcc-c-dialect-options]_: il dialetto GNU
-dello standard ISO C90 (con l'aggiunta di alcune funzionalità da C99).
+l'opzione ``-std=gnu11`` [it-gcc-c-dialect-options]_: il dialetto GNU
+dello standard ISO C11.
 Linux supporta anche ``clang`` [it-clang]_, leggete la documentazione
 :ref:`Building Linux with Clang/LLVM <kbuild_llvm>`.
 
diff --git a/Documentation/translations/zh_CN/process/programming-language.rst b/Documentation/translations/zh_CN/process/programming-language.rst
index 2a47a1d2ec20..fabdc338dbfb 100644
--- a/Documentation/translations/zh_CN/process/programming-language.rst
+++ b/Documentation/translations/zh_CN/process/programming-language.rst
@@ -9,8 +9,7 @@
 ============
 
 内核是用C语言 :ref:`c-language <cn_c-language>` 编写的。更准确地说,内核通常是用 :ref:`gcc <cn_gcc>`
-在 ``-std=gnu89`` :ref:`gcc-c-dialect-options <cn_gcc-c-dialect-options>` 下编译的:ISO C90的 GNU 方言(
-包括一些C99特性)
+在 ``-std=gnu11`` :ref:`gcc-c-dialect-options <cn_gcc-c-dialect-options>` 下编译的:ISO C11的 GNU 方言
 
 这种方言包含对语言 :ref:`gnu-extensions <cn_gnu-extensions>` 的许多扩展,当然,它们许多都在内核中使用。
 
diff --git a/Documentation/translations/zh_TW/process/programming-language.rst b/Documentation/translations/zh_TW/process/programming-language.rst
index 54e3699eadf8..144bdaf81a41 100644
--- a/Documentation/translations/zh_TW/process/programming-language.rst
+++ b/Documentation/translations/zh_TW/process/programming-language.rst
@@ -12,8 +12,7 @@
 ============
 
 內核是用C語言 :ref:`c-language <tw_c-language>` 編寫的。更準確地說,內核通常是用 :ref:`gcc <tw_gcc>`
-在 ``-std=gnu89`` :ref:`gcc-c-dialect-options <tw_gcc-c-dialect-options>` 下編譯的:ISO C90的 GNU 方言(
-包括一些C99特性)
+在 ``-std=gnu11`` :ref:`gcc-c-dialect-options <tw_gcc-c-dialect-options>` 下編譯的:ISO C11的 GNU 方言
 
 這種方言包含對語言 :ref:`gnu-extensions <tw_gnu-extensions>` 的許多擴展,當然,它們許多都在內核中使用。
 
diff --git a/Makefile b/Makefile
index c791bfd5a471..1ba8dc523952 100644
--- a/Makefile
+++ b/Makefile
@@ -517,7 +517,7 @@ KBUILD_CFLAGS   := -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs \
 		   -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE \
 		   -Werror=implicit-function-declaration -Werror=implicit-int \
 		   -Werror=return-type -Wno-format-security \
-		   -std=gnu89
+		   -std=gnu11
 KBUILD_CPPFLAGS := -D__KERNEL__
 KBUILD_AFLAGS_KERNEL :=
 KBUILD_CFLAGS_KERNEL :=
@@ -785,7 +785,7 @@ KBUILD_CFLAGS += $(KBUILD_CFLAGS-y) $(CONFIG_CC_IMPLICIT_FALLTHROUGH)
 
 ifdef CONFIG_CC_IS_CLANG
 KBUILD_CPPFLAGS += -Qunused-arguments
-# The kernel builds with '-std=gnu89' so use of GNU extensions is acceptable.
+# The kernel builds with '-std=gnu11' so use of GNU extensions is acceptable.
 KBUILD_CFLAGS += -Wno-gnu
 # CLANG uses a _MergedGlobals as optimization, but this breaks modpost, as the
 # source of a reference will be _MergedGlobals and not on of the whitelisted names.
diff --git a/arch/arm64/kernel/vdso32/Makefile b/arch/arm64/kernel/vdso32/Makefile
index f46457f1f4f0..ed181bedbffc 100644
--- a/arch/arm64/kernel/vdso32/Makefile
+++ b/arch/arm64/kernel/vdso32/Makefile
@@ -69,7 +69,7 @@ VDSO_CFLAGS += -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
                -Werror-implicit-function-declaration \
                -Wno-format-security \
                -Wdeclaration-after-statement \
-               -std=gnu89
+               -std=gnu11
 VDSO_CFLAGS  += -O2
 # Some useful compiler-dependent flags from top-level Makefile
 VDSO_CFLAGS += $(call cc32-option,-Wdeclaration-after-statement,)
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 4/4] Kbuild: use -std=gnu11 for KBUILD_USERCFLAGS
  2022-03-08 21:56 [PATCH 0/4] [v4] Kbuild: std=gnu11 changes Arnd Bergmann
                   ` (2 preceding siblings ...)
  2022-03-08 21:56 ` [PATCH 3/4] [v4] Kbuild: move to -std=gnu11 Arnd Bergmann
@ 2022-03-08 21:56 ` Arnd Bergmann
  2022-03-09  0:09 ` [PATCH 0/4] [v4] Kbuild: std=gnu11 changes Linus Torvalds
  4 siblings, 0 replies; 12+ messages in thread
From: Arnd Bergmann @ 2022-03-08 21:56 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: alexs, arnd, arnd, dsterba, elver, jani.nikula, linux-doc,
	linux-kbuild, linux-kernel, llvm, mark.rutland, ndesaulniers,
	ojeda, torvalds

From: Arnd Bergmann <arnd@arndb.de>

As we change the C language standard for the kernel from gnu89 to
gnu11, it makes sense to also update the version for user space
compilation.

Some users have older native compilers than what they use for
kernel builds, so I considered using gnu99 as the default version
for wider compatibility with gcc-4.6 and earlier.

However, testing with older compilers showed that we already require
HOSTCC version 5.1 as well because a lot of host tools include
linux/compiler.h that uses __has_attribute():

  CC      tools/objtool/exec-cmd.o
In file included from tools/include/linux/compiler_types.h:36:0,
                 from tools/include/linux/compiler.h:5,
                 from exec-cmd.c:2:
tools/include/linux/compiler-gcc.h:19:5: error: "__has_attribute" is not defined [-Werror=undef]

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 1ba8dc523952..e0b11ddd0760 100644
--- a/Makefile
+++ b/Makefile
@@ -432,7 +432,7 @@ HOSTCXX	= g++
 endif
 
 KBUILD_USERHOSTCFLAGS := -Wall -Wmissing-prototypes -Wstrict-prototypes \
-			 -O2 -fomit-frame-pointer -std=gnu89 \
+			 -O2 -fomit-frame-pointer -std=gnu11 \
 			 -Wdeclaration-after-statement
 KBUILD_USERCFLAGS  := $(KBUILD_USERHOSTCFLAGS) $(USERCFLAGS)
 KBUILD_USERLDFLAGS := $(USERLDFLAGS)
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH 0/4] [v4] Kbuild: std=gnu11 changes
  2022-03-08 21:56 [PATCH 0/4] [v4] Kbuild: std=gnu11 changes Arnd Bergmann
                   ` (3 preceding siblings ...)
  2022-03-08 21:56 ` [PATCH 4/4] Kbuild: use -std=gnu11 for KBUILD_USERCFLAGS Arnd Bergmann
@ 2022-03-09  0:09 ` Linus Torvalds
  2022-03-09  2:16   ` Masahiro Yamada
  4 siblings, 1 reply; 12+ messages in thread
From: Linus Torvalds @ 2022-03-09  0:09 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Masahiro Yamada, Alex Shi, Arnd Bergmann, David Sterba,
	Marco Elver, Jani Nikula, open list:DOCUMENTATION,
	Linux Kbuild mailing list, Linux Kernel Mailing List, llvm,
	Mark Rutland, Nick Desaulniers, Miguel Ojeda

On Tue, Mar 8, 2022 at 1:56 PM Arnd Bergmann <arnd@kernel.org> wrote:
>
> From: Arnd Bergmann <arnd@arndb.de>
>
> I've incorporated the feedback from Masahiro Yamada in this
> version, splitting out one more patch, rebasing on top of
> the kbuild tree, and changing the order of the patches.
>
> Please apply to the kbuild tree.

I'd actually like to see this as a separate branch, so that I can
merge it early - or other peoples git branches end up depending on it.

Yeah, it shouldn't change anything on its own, but since it allows for
new syntax, we might have other things depending on it (I'm obviously
thinking of the list_for_each_entry() series that keeps getting
posted).

                      Linus

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 0/4] [v4] Kbuild: std=gnu11 changes
  2022-03-09  0:09 ` [PATCH 0/4] [v4] Kbuild: std=gnu11 changes Linus Torvalds
@ 2022-03-09  2:16   ` Masahiro Yamada
  2022-03-09  9:18     ` Masahiro Yamada
  0 siblings, 1 reply; 12+ messages in thread
From: Masahiro Yamada @ 2022-03-09  2:16 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Arnd Bergmann, Alex Shi, Arnd Bergmann, David Sterba,
	Marco Elver, Jani Nikula, open list:DOCUMENTATION,
	Linux Kbuild mailing list, Linux Kernel Mailing List, llvm,
	Mark Rutland, Nick Desaulniers, Miguel Ojeda

On Wed, Mar 9, 2022 at 9:09 AM Linus Torvalds
<torvalds@linux-foundation.org> wrote:
>
> On Tue, Mar 8, 2022 at 1:56 PM Arnd Bergmann <arnd@kernel.org> wrote:
> >
> > From: Arnd Bergmann <arnd@arndb.de>
> >
> > I've incorporated the feedback from Masahiro Yamada in this
> > version, splitting out one more patch, rebasing on top of
> > the kbuild tree, and changing the order of the patches.
> >
> > Please apply to the kbuild tree.
>
> I'd actually like to see this as a separate branch, so that I can
> merge it early - or other peoples git branches end up depending on it.


OK, I can apply this to a separate branch, kbuild-gnu11.
(and I will queue this up shortly because it is already -rc7)

Then, I will send two pull reqs in the next MW,
but please note they will conflict with each other,
between this gnu11 patch set and the following
one in my usual kbuild branch:

https://patchwork.kernel.org/project/linux-kbuild/patch/20220201213542.2808035-1-quic_eberman@quicinc.com/


I hope this is not a complex conflict, but please let me know
if you have any requests to me.





> Yeah, it shouldn't change anything on its own, but since it allows for
> new syntax, we might have other things depending on it (I'm obviously
> thinking of the list_for_each_entry() series that keeps getting
> posted).
>
>                       Linus



-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/4] [v4] Kbuild: add -Wno-shift-negative-value where -Wextra is used
  2022-03-08 21:56 ` [PATCH 1/4] [v4] Kbuild: add -Wno-shift-negative-value where -Wextra is used Arnd Bergmann
@ 2022-03-09  8:19   ` Jani Nikula
  2022-03-09 16:47   ` David Sterba
  1 sibling, 0 replies; 12+ messages in thread
From: Jani Nikula @ 2022-03-09  8:19 UTC (permalink / raw)
  To: Arnd Bergmann, Masahiro Yamada
  Cc: alexs, arnd, arnd, dsterba, elver, linux-doc, linux-kbuild,
	linux-kernel, llvm, mark.rutland, ndesaulniers, ojeda, torvalds

On Tue, 08 Mar 2022, Arnd Bergmann <arnd@kernel.org> wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> As a preparation for moving to -std=gnu11, turn off the
> -Wshift-negative-value option. This warning is enabled by gcc when
> building with -Wextra for c99 or higher, but not for c89. Since
> the kernel already relies on well-defined overflow behavior,
> the warning is not helpful and can simply be disabled in
> all locations that use -Wextra.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Acked-by: Jani Nikula <jani.nikula@intel.com>

> ---
> [v4]
>   split into a separate patch
> ---
>  drivers/gpu/drm/i915/Makefile          | 1 +
>  drivers/staging/greybus/tools/Makefile | 3 ++-
>  fs/btrfs/Makefile                      | 1 +
>  scripts/Makefile.extrawarn             | 1 +
>  4 files changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
> index 1b62b9f65196..1618a6e0af4e 100644
> --- a/drivers/gpu/drm/i915/Makefile
> +++ b/drivers/gpu/drm/i915/Makefile
> @@ -17,6 +17,7 @@ subdir-ccflags-y += -Wno-unused-parameter
>  subdir-ccflags-y += -Wno-type-limits
>  subdir-ccflags-y += -Wno-missing-field-initializers
>  subdir-ccflags-y += -Wno-sign-compare
> +subdir-ccflags-y += -Wno-shift-negative-value
>  subdir-ccflags-y += $(call cc-disable-warning, unused-but-set-variable)
>  subdir-ccflags-y += $(call cc-disable-warning, frame-address)
>  subdir-ccflags-$(CONFIG_DRM_I915_WERROR) += -Werror
> diff --git a/drivers/staging/greybus/tools/Makefile b/drivers/staging/greybus/tools/Makefile
> index ad0ae8053b79..a3bbd73171f2 100644
> --- a/drivers/staging/greybus/tools/Makefile
> +++ b/drivers/staging/greybus/tools/Makefile
> @@ -12,7 +12,8 @@ CFLAGS	+= -std=gnu99 -Wall -Wextra -g \
>  	    -Wredundant-decls \
>  	    -Wcast-align \
>  	    -Wsign-compare \
> -	    -Wno-missing-field-initializers
> +	    -Wno-missing-field-initializers \
> +	    -Wno-shift-negative-value
>  
>  CC	:= $(CROSS_COMPILE)gcc
>  
> diff --git a/fs/btrfs/Makefile b/fs/btrfs/Makefile
> index 4188ba3fd8c3..99f9995670ea 100644
> --- a/fs/btrfs/Makefile
> +++ b/fs/btrfs/Makefile
> @@ -17,6 +17,7 @@ subdir-ccflags-y += $(condflags)
>  subdir-ccflags-y += -Wno-missing-field-initializers
>  subdir-ccflags-y += -Wno-sign-compare
>  subdir-ccflags-y += -Wno-type-limits
> +subdir-ccflags-y += -Wno-shift-negative-value
>  
>  obj-$(CONFIG_BTRFS_FS) := btrfs.o
>  
> diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
> index 8be892887d71..650d0b8ceec3 100644
> --- a/scripts/Makefile.extrawarn
> +++ b/scripts/Makefile.extrawarn
> @@ -36,6 +36,7 @@ KBUILD_CFLAGS += $(call cc-option, -Wstringop-truncation)
>  KBUILD_CFLAGS += -Wno-missing-field-initializers
>  KBUILD_CFLAGS += -Wno-sign-compare
>  KBUILD_CFLAGS += -Wno-type-limits
> +KBUILD_CFLAGS += -Wno-shift-negative-value
>  
>  KBUILD_CPPFLAGS += -DKBUILD_EXTRA_WARN1

-- 
Jani Nikula, Intel Open Source Graphics Center

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 0/4] [v4] Kbuild: std=gnu11 changes
  2022-03-09  2:16   ` Masahiro Yamada
@ 2022-03-09  9:18     ` Masahiro Yamada
  2022-03-10  0:06       ` Nathan Chancellor
  0 siblings, 1 reply; 12+ messages in thread
From: Masahiro Yamada @ 2022-03-09  9:18 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Arnd Bergmann, Alex Shi, Arnd Bergmann, David Sterba,
	Marco Elver, Jani Nikula, open list:DOCUMENTATION,
	Linux Kbuild mailing list, Linux Kernel Mailing List, llvm,
	Mark Rutland, Nick Desaulniers, Miguel Ojeda

On Wed, Mar 9, 2022 at 11:16 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> On Wed, Mar 9, 2022 at 9:09 AM Linus Torvalds
> <torvalds@linux-foundation.org> wrote:
> >
> > On Tue, Mar 8, 2022 at 1:56 PM Arnd Bergmann <arnd@kernel.org> wrote:
> > >
> > > From: Arnd Bergmann <arnd@arndb.de>
> > >
> > > I've incorporated the feedback from Masahiro Yamada in this
> > > version, splitting out one more patch, rebasing on top of
> > > the kbuild tree, and changing the order of the patches.
> > >
> > > Please apply to the kbuild tree.
> >
> > I'd actually like to see this as a separate branch, so that I can
> > merge it early - or other peoples git branches end up depending on it.
>
>
> OK, I can apply this to a separate branch, kbuild-gnu11.
> (and I will queue this up shortly because it is already -rc7)
>
> Then, I will send two pull reqs in the next MW,
> but please note they will conflict with each other,
> between this gnu11 patch set and the following
> one in my usual kbuild branch:
>
> https://patchwork.kernel.org/project/linux-kbuild/patch/20220201213542.2808035-1-quic_eberman@quicinc.com/
>
>
> I hope this is not a complex conflict, but please let me know
> if you have any requests to me.
>
>
>
>
>


All, applied to linux-kbuild/kbuild-gnu11.

If somebody wants to give Reviewed-by, Acked-by, Tested-by, please.

I will append them later.








-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/4] [v4] Kbuild: add -Wno-shift-negative-value where -Wextra is used
  2022-03-08 21:56 ` [PATCH 1/4] [v4] Kbuild: add -Wno-shift-negative-value where -Wextra is used Arnd Bergmann
  2022-03-09  8:19   ` Jani Nikula
@ 2022-03-09 16:47   ` David Sterba
  1 sibling, 0 replies; 12+ messages in thread
From: David Sterba @ 2022-03-09 16:47 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Masahiro Yamada, alexs, arnd, dsterba, elver, jani.nikula,
	linux-doc, linux-kbuild, linux-kernel, llvm, mark.rutland,
	ndesaulniers, ojeda, torvalds

On Tue, Mar 08, 2022 at 10:56:12PM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> As a preparation for moving to -std=gnu11, turn off the
> -Wshift-negative-value option. This warning is enabled by gcc when
> building with -Wextra for c99 or higher, but not for c89. Since
> the kernel already relies on well-defined overflow behavior,
> the warning is not helpful and can simply be disabled in
> all locations that use -Wextra.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> [v4]
>   split into a separate patch
> ---
>  drivers/gpu/drm/i915/Makefile          | 1 +
>  drivers/staging/greybus/tools/Makefile | 3 ++-

For

>  fs/btrfs/Makefile                      | 1 +

Acked-by: David Sterba <dsterba@suse.com>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 0/4] [v4] Kbuild: std=gnu11 changes
  2022-03-09  9:18     ` Masahiro Yamada
@ 2022-03-10  0:06       ` Nathan Chancellor
  2022-03-11  1:00         ` Sedat Dilek
  0 siblings, 1 reply; 12+ messages in thread
From: Nathan Chancellor @ 2022-03-10  0:06 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: Linus Torvalds, Arnd Bergmann, Alex Shi, Arnd Bergmann,
	David Sterba, Marco Elver, Jani Nikula, open list:DOCUMENTATION,
	Linux Kbuild mailing list, Linux Kernel Mailing List, llvm,
	Mark Rutland, Nick Desaulniers, Miguel Ojeda

On Wed, Mar 09, 2022 at 06:18:18PM +0900, Masahiro Yamada wrote:
> On Wed, Mar 9, 2022 at 11:16 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
> >
> > On Wed, Mar 9, 2022 at 9:09 AM Linus Torvalds
> > <torvalds@linux-foundation.org> wrote:
> > >
> > > On Tue, Mar 8, 2022 at 1:56 PM Arnd Bergmann <arnd@kernel.org> wrote:
> > > >
> > > > From: Arnd Bergmann <arnd@arndb.de>
> > > >
> > > > I've incorporated the feedback from Masahiro Yamada in this
> > > > version, splitting out one more patch, rebasing on top of
> > > > the kbuild tree, and changing the order of the patches.
> > > >
> > > > Please apply to the kbuild tree.
> > >
> > > I'd actually like to see this as a separate branch, so that I can
> > > merge it early - or other peoples git branches end up depending on it.
> >
> >
> > OK, I can apply this to a separate branch, kbuild-gnu11.
> > (and I will queue this up shortly because it is already -rc7)
> >
> > Then, I will send two pull reqs in the next MW,
> > but please note they will conflict with each other,
> > between this gnu11 patch set and the following
> > one in my usual kbuild branch:
> >
> > https://patchwork.kernel.org/project/linux-kbuild/patch/20220201213542.2808035-1-quic_eberman@quicinc.com/
> >
> >
> > I hope this is not a complex conflict, but please let me know
> > if you have any requests to me.
> >
> >
> >
> >
> >
> 
> 
> All, applied to linux-kbuild/kbuild-gnu11.
> 
> If somebody wants to give Reviewed-by, Acked-by, Tested-by, please.
> 
> I will append them later.

For the series:

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

Cheers,
Nathan

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 0/4] [v4] Kbuild: std=gnu11 changes
  2022-03-10  0:06       ` Nathan Chancellor
@ 2022-03-11  1:00         ` Sedat Dilek
  0 siblings, 0 replies; 12+ messages in thread
From: Sedat Dilek @ 2022-03-11  1:00 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Masahiro Yamada, Linus Torvalds, Arnd Bergmann, Alex Shi,
	Arnd Bergmann, David Sterba, Marco Elver, Jani Nikula,
	open list:DOCUMENTATION, Linux Kbuild mailing list,
	Linux Kernel Mailing List, llvm, Mark Rutland, Nick Desaulniers,
	Miguel Ojeda

On Thu, Mar 10, 2022 at 5:01 AM Nathan Chancellor <nathan@kernel.org> wrote:
>
> On Wed, Mar 09, 2022 at 06:18:18PM +0900, Masahiro Yamada wrote:
> > On Wed, Mar 9, 2022 at 11:16 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
> > >
> > > On Wed, Mar 9, 2022 at 9:09 AM Linus Torvalds
> > > <torvalds@linux-foundation.org> wrote:
> > > >
> > > > On Tue, Mar 8, 2022 at 1:56 PM Arnd Bergmann <arnd@kernel.org> wrote:
> > > > >
> > > > > From: Arnd Bergmann <arnd@arndb.de>
> > > > >
> > > > > I've incorporated the feedback from Masahiro Yamada in this
> > > > > version, splitting out one more patch, rebasing on top of
> > > > > the kbuild tree, and changing the order of the patches.
> > > > >
> > > > > Please apply to the kbuild tree.
> > > >
> > > > I'd actually like to see this as a separate branch, so that I can
> > > > merge it early - or other peoples git branches end up depending on it.
> > >
> > >
> > > OK, I can apply this to a separate branch, kbuild-gnu11.
> > > (and I will queue this up shortly because it is already -rc7)
> > >
> > > Then, I will send two pull reqs in the next MW,
> > > but please note they will conflict with each other,
> > > between this gnu11 patch set and the following
> > > one in my usual kbuild branch:
> > >
> > > https://patchwork.kernel.org/project/linux-kbuild/patch/20220201213542.2808035-1-quic_eberman@quicinc.com/
> > >
> > >
> > > I hope this is not a complex conflict, but please let me know
> > > if you have any requests to me.
> > >
> > >
> > >
> > >
> > >
> >
> >
> > All, applied to linux-kbuild/kbuild-gnu11.
> >
> > If somebody wants to give Reviewed-by, Acked-by, Tested-by, please.
> >
> > I will append them later.
>
> For the series:
>
> Reviewed-by: Nathan Chancellor <nathan@kernel.org>
>

For the series:

Tested-by: Sedat Dilek <sedat.dilek@gmail.com> # LLVM/Clang v13.0.0 (x86-64)

- Sedat -

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2022-03-11  1:01 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-08 21:56 [PATCH 0/4] [v4] Kbuild: std=gnu11 changes Arnd Bergmann
2022-03-08 21:56 ` [PATCH 1/4] [v4] Kbuild: add -Wno-shift-negative-value where -Wextra is used Arnd Bergmann
2022-03-09  8:19   ` Jani Nikula
2022-03-09 16:47   ` David Sterba
2022-03-08 21:56 ` [PATCH 2/4] [v4] Kbuild: use -Wdeclaration-after-statement Arnd Bergmann
2022-03-08 21:56 ` [PATCH 3/4] [v4] Kbuild: move to -std=gnu11 Arnd Bergmann
2022-03-08 21:56 ` [PATCH 4/4] Kbuild: use -std=gnu11 for KBUILD_USERCFLAGS Arnd Bergmann
2022-03-09  0:09 ` [PATCH 0/4] [v4] Kbuild: std=gnu11 changes Linus Torvalds
2022-03-09  2:16   ` Masahiro Yamada
2022-03-09  9:18     ` Masahiro Yamada
2022-03-10  0:06       ` Nathan Chancellor
2022-03-11  1:00         ` Sedat Dilek

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.