[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 2/5] configure: Set gnu99 C language standard by default
From: |
Daniel Kiper |
Subject: |
[PATCH v3 2/5] configure: Set gnu99 C language standard by default |
Date: |
Wed, 13 May 2020 14:02:48 +0200 |
Commit d5a32255d (misc: Make grub_strtol() "end" pointers have safer
const qualifiers) introduced "restrict" keyword into some functions
definitions. This keyword was introduced in C99 standard. However, some
compilers by default may use C89 or something different. This behavior
leads to the breakage during builds when c89 or gnu89 is in force. So,
let's set gnu99 C language standard for all compilers by default. This
way a bit random build issue will be fixed and the GRUB source will be
build consistently regardless of type and version of the compiler.
It was decided to use gnu99 C language standard because it fixes the
issue mentioned above and also provides some useful extensions which are
used here and there in the GRUB source. Potentially we can use gnu11
too. However, this may reduce pool of older compilers which can be used
to build the GRUB. So, let's live with gnu99 until we discover that we
strongly require a feature from newer C standard.
The user is still able to override C language standard using relevant
*_CFLAGS variables.
Signed-off-by: Daniel Kiper <address@hidden>
---
v3 - suggestions/fixes:
- add a comment before the change in configure.ac
(suggested by Javier Martinez Canillas and Leif Lindholm),
- improve commit message
(suggested by Javier Martinez Canillas and Leif Lindholm).
v2 - suggestions/fixes:
- unconditionally enforce gnu99 C language standard
(suggested by Leif Lindholm).
---
configure.ac | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/configure.ac b/configure.ac
index b2576b013..3eda9a5a2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -80,6 +80,12 @@ if test "x$TARGET_CFLAGS" = x; then
TARGET_CFLAGS=-Os
fi
+# Enable support for "restrict" keyword and other
+# features from gnu99 C language standard.
+BUILD_CFLAGS="-std=gnu99 $BUILD_CFLAGS"
+HOST_CFLAGS="-std=gnu99 $HOST_CFLAGS"
+TARGET_CFLAGS="-std=gnu99 $TARGET_CFLAGS"
+
# Default HOST_CPPFLAGS
HOST_CPPFLAGS="$HOST_CPPFLAGS -Wall -W"
HOST_CPPFLAGS="$HOST_CPPFLAGS -DGRUB_UTIL=1"
--
2.11.0
- [PATCH v3 0/5] Various build and doc fixes, Daniel Kiper, 2020/05/13
- [PATCH v3 4/5] INSTALL: Update configure example, Daniel Kiper, 2020/05/13
- [PATCH v3 1/5] configure: Drop unneeded TARGET_CFLAGS expansion, Daniel Kiper, 2020/05/13
- [PATCH v3 5/5] autogen: Replace -iname with -ipath in find command, Daniel Kiper, 2020/05/13
- [PATCH v3 2/5] configure: Set gnu99 C language standard by default,
Daniel Kiper <=
- Re: [PATCH v3 2/5] configure: Set gnu99 C language standard by default, Daniel Axtens, 2020/05/14
- Re: [PATCH v3 2/5] configure: Set gnu99 C language standard by default, Daniel Kiper, 2020/05/18
- Re: [PATCH v3 2/5] configure: Set gnu99 C language standard by default, Javier Martinez Canillas, 2020/05/18
- Re: [PATCH v3 2/5] configure: Set gnu99 C language standard by default, Daniel Axtens, 2020/05/18
- Re: [PATCH v3 2/5] configure: Set gnu99 C language standard by default, Javier Martinez Canillas, 2020/05/19
- Re: [PATCH v3 2/5] configure: Set gnu99 C language standard by default, Daniel Axtens, 2020/05/19
- [PATCH] json: Remove invalid typedef redefinition, Patrick Steinhardt, 2020/05/27
- Re: [PATCH] json: Remove invalid typedef redefinition, Daniel Kiper, 2020/05/29
- Re: [PATCH] json: Remove invalid typedef redefinition, Daniel Axtens, 2020/05/29
[PATCH v3 3/5] INSTALL/configure: Update install doc and configure comment, Daniel Kiper, 2020/05/13