linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] kernel: use the gnu89 standard explicitly
@ 2014-10-20  2:40 Sasha Levin
  2014-10-20  9:23 ` Kirill A. Shutemov
  2014-11-14 13:43 ` Andrey Ryabinin
  0 siblings, 2 replies; 4+ messages in thread
From: Sasha Levin @ 2014-10-20  2:40 UTC (permalink / raw)
  To: torvalds, akpm; +Cc: kirill, viro, pinskia, joe, linux-kernel, Sasha Levin

gcc5 changes the default standard to c11, which makes kernel
build unhappy.

Explicitly define the kernel standard to be gnu89 which should
keep everything working exactly like it was before gcc5.

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
---

Changes from v1:
  - I've accidently placed the statement in a CONFIG_READABLE_ASM.
It shouldn't be there.

 Makefile |    1 +
 1 file changed, 1 insertion(+)

diff --git a/Makefile b/Makefile
index dd7e1cb..eb0c026 100644
--- a/Makefile
+++ b/Makefile
@@ -625,6 +625,7 @@ all: vmlinux
 include $(srctree)/arch/$(SRCARCH)/Makefile
 
 KBUILD_CFLAGS	+= $(call cc-option,-fno-delete-null-pointer-checks,)
+KBUILD_CFLAGS	+= $(call cc-option,-std=gnu89,)
 
 ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
 KBUILD_CFLAGS	+= -Os $(call cc-disable-warning,maybe-uninitialized,)
-- 
1.7.10.4


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

* Re: [PATCH v2] kernel: use the gnu89 standard explicitly
  2014-10-20  2:40 [PATCH v2] kernel: use the gnu89 standard explicitly Sasha Levin
@ 2014-10-20  9:23 ` Kirill A. Shutemov
  2014-11-14 13:43 ` Andrey Ryabinin
  1 sibling, 0 replies; 4+ messages in thread
From: Kirill A. Shutemov @ 2014-10-20  9:23 UTC (permalink / raw)
  To: Sasha Levin; +Cc: torvalds, akpm, viro, pinskia, joe, linux-kernel

On Sun, Oct 19, 2014 at 10:40:55PM -0400, Sasha Levin wrote:
> gcc5 changes the default standard to c11, which makes kernel
> build unhappy.
> 
> Explicitly define the kernel standard to be gnu89 which should
> keep everything working exactly like it was before gcc5.
> 
> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
> ---
> 
> Changes from v1:
>   - I've accidently placed the statement in a CONFIG_READABLE_ASM.
> It shouldn't be there.
> 
>  Makefile |    1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/Makefile b/Makefile
> index dd7e1cb..eb0c026 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -625,6 +625,7 @@ all: vmlinux
>  include $(srctree)/arch/$(SRCARCH)/Makefile
>  
>  KBUILD_CFLAGS	+= $(call cc-option,-fno-delete-null-pointer-checks,)
> +KBUILD_CFLAGS	+= $(call cc-option,-std=gnu89,)

I'm pretty sure all gcc versions you can build kernel with supports
-std=gnu89. cc-option is redunrant.

We also need to adjust HOSTCFLAGS otherwise allmodconfig fails for me.

Singed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com.

diff --git a/Makefile b/Makefile
index 05d67af376c5..27570984f28e 100644
--- a/Makefile
+++ b/Makefile
@@ -297,7 +297,7 @@ CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
 
 HOSTCC       = gcc
 HOSTCXX      = g++
-HOSTCFLAGS   = -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer
+HOSTCFLAGS   = -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 -fomit-frame-pointer -std=gnu89
 HOSTCXXFLAGS = -O2
 
 ifeq ($(shell $(HOSTCC) -v 2>&1 | grep -c "clang version"), 1)
@@ -401,7 +401,8 @@ KBUILD_CPPFLAGS := -D__KERNEL__
 KBUILD_CFLAGS   := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
                   -fno-strict-aliasing -fno-common \
                   -Werror-implicit-function-declaration \
-                  -Wno-format-security
+                  -Wno-format-security \
+                  -std=gnu89
 
 KBUILD_AFLAGS_KERNEL :=
 KBUILD_CFLAGS_KERNEL :=
-- 
 Kirill A. Shutemov

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

* Re: [PATCH v2] kernel: use the gnu89 standard explicitly
  2014-10-20  2:40 [PATCH v2] kernel: use the gnu89 standard explicitly Sasha Levin
  2014-10-20  9:23 ` Kirill A. Shutemov
@ 2014-11-14 13:43 ` Andrey Ryabinin
  2014-11-15  3:04   ` Sasha Levin
  1 sibling, 1 reply; 4+ messages in thread
From: Andrey Ryabinin @ 2014-11-14 13:43 UTC (permalink / raw)
  To: Sasha Levin
  Cc: torvalds, Andrew Morton, kirill, Alexander Viro, pinskia, joe, LKML

2014-10-20 5:40 GMT+03:00 Sasha Levin <sasha.levin@oracle.com>:
> gcc5 changes the default standard to c11, which makes kernel
> build unhappy.
>
> Explicitly define the kernel standard to be gnu89 which should
> keep everything working exactly like it was before gcc5.
>

Ping.

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

* Re: [PATCH v2] kernel: use the gnu89 standard explicitly
  2014-11-14 13:43 ` Andrey Ryabinin
@ 2014-11-15  3:04   ` Sasha Levin
  0 siblings, 0 replies; 4+ messages in thread
From: Sasha Levin @ 2014-11-15  3:04 UTC (permalink / raw)
  To: Andrey Ryabinin
  Cc: torvalds, Andrew Morton, kirill, Alexander Viro, pinskia, joe, LKML

On 11/14/2014 08:43 AM, Andrey Ryabinin wrote:
> 2014-10-20 5:40 GMT+03:00 Sasha Levin <sasha.levin@oracle.com>:
>> gcc5 changes the default standard to c11, which makes kernel
>> build unhappy.
>>
>> Explicitly define the kernel standard to be gnu89 which should
>> keep everything working exactly like it was before gcc5.
>>
> 
> Ping.
> 

fwiw, I'm happy with using Kirill's patch from this thread, it
even has his SoB! :)

Thanks,
Sasha

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

end of thread, other threads:[~2014-11-15  3:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-20  2:40 [PATCH v2] kernel: use the gnu89 standard explicitly Sasha Levin
2014-10-20  9:23 ` Kirill A. Shutemov
2014-11-14 13:43 ` Andrey Ryabinin
2014-11-15  3:04   ` Sasha Levin

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).