aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Kay <chris.kay@arm.com>2020-06-04 14:40:29 +0100
committerChris Kay <chris@cjkay.com>2020-06-09 15:26:35 +0100
commitad83ff78962341908674993c92057493f8afd9b0 (patch)
tree03a0e614b69216b43d16b64aa6f2a315d17bd23a
parent2182425300a2ebcbb36b44b4d4a4a2c78cd2d96c (diff)
misc: Switch from ISO C11 to GNU C11
We use a number of compiler extensions already, and the strict rules required for compliance with ISO C11 can be prohitive for embedded development. This commit moves our C variant from ISO C11 to GNU C11, which is compatible with all the toolchains we currently support. Change-Id: I58ce6479c4f8ca9039d957d08aadd3ebff4ac8fc Signed-off-by: Chris Kay <chris.kay@arm.com>
-rw-r--r--debugger/include/checkpoint.h26
-rw-r--r--debugger/include/cli.h10
-rw-r--r--framework/include/fwk_macros.h4
-rw-r--r--tools/build_system/rules.mk6
-rw-r--r--tools/build_system/test.mk2
5 files changed, 23 insertions, 25 deletions
diff --git a/debugger/include/checkpoint.h b/debugger/include/checkpoint.h
index cede47da..865052ba 100644
--- a/debugger/include/checkpoint.h
+++ b/debugger/include/checkpoint.h
@@ -128,12 +128,12 @@ void checkpoint(checkpoint_st *c, char *file, int32_t line, char *tag);
* \retval FWK_E_NOMEM when checkpoints limit is reached.
*
*/
-#define checkpoint_register(c, name) \
- __extension__({ \
- (void)c; \
- (void)name; \
- FWK_SUCCESS; \
- })
+# define checkpoint_register(c, name) \
+ ({ \
+ (void)c; \
+ (void)name; \
+ FWK_SUCCESS; \
+ })
/*!
* \brief Insert a checkpoint
@@ -151,13 +151,13 @@ void checkpoint(checkpoint_st *c, char *file, int32_t line, char *tag);
* \param line Line number of the checkpoint, use __LINE__ macro.
* \param tag Checkpoint tag string.
*/
-#define checkpoint(c, file, line, tag) \
- do { \
- (void)c; \
- (void)file; \
- (void)line; \
- (void)tag; \
- } while (0)
+# define checkpoint(c, file, line, tag) \
+ do { \
+ (void)c; \
+ (void)file; \
+ (void)line; \
+ (void)tag; \
+ } while (0)
#endif
diff --git a/debugger/include/cli.h b/debugger/include/cli.h
index ef34d323..bbe2fdf3 100644
--- a/debugger/include/cli.h
+++ b/debugger/include/cli.h
@@ -294,11 +294,11 @@ int cli_command_register(cli_command_st new_cmd);
* \retval CLI_SUCCESS Operation succeeded.
* \retval CLI_ERR_MEM Not enough memory.
*/
-#define cli_command_register(new_cmd) \
- __extension__({ \
- (void)new_cmd; \
- FWK_SUCCESS; \
- })
+# define cli_command_register(new_cmd) \
+ ({ \
+ (void)new_cmd; \
+ FWK_SUCCESS; \
+ })
#endif
#endif /* _CLI_H_ */
diff --git a/framework/include/fwk_macros.h b/framework/include/fwk_macros.h
index 1a2973ca..01855ac8 100644
--- a/framework/include/fwk_macros.h
+++ b/framework/include/fwk_macros.h
@@ -150,7 +150,7 @@
* \return The smallest value from a and b. If both are equal, b is returned.
*/
#define FWK_MIN(a, b) \
- __extension__({ \
+ ({ \
__auto_type _a = (a); \
__auto_type _b = (b); \
_a < _b ? _a : _b; \
@@ -169,7 +169,7 @@
* \return The largest value from a and b. If both are equal, b is returned.
*/
#define FWK_MAX(a, b) \
- __extension__({ \
+ ({ \
__auto_type _a = (a); \
__auto_type _b = (b); \
_a > _b ? _a : _b; \
diff --git a/tools/build_system/rules.mk b/tools/build_system/rules.mk
index 009baa7c..df6331d5 100644
--- a/tools/build_system/rules.mk
+++ b/tools/build_system/rules.mk
@@ -99,12 +99,10 @@ endif
# set of warnings, and any warnings that do occur are upgraded to errors to
# prevent the firmware from building.
CFLAGS += -Werror
-CFLAGS += -Wno-error=deprecated-declarations
CFLAGS += -Wall
CFLAGS += -Wextra
-CFLAGS += -pedantic
-CFLAGS += -pedantic-errors
+CFLAGS += -Wno-error=deprecated-declarations
CFLAGS += -Wno-unused-parameter
# GCC is not currently consistent in how it applies this warning, but this flag
@@ -128,7 +126,7 @@ LDFLAGS_ARM += -Wl,--remove
CFLAGS_CLANG += -Wno-dollar-in-identifier-extension
CFLAGS += -g
-CFLAGS += -std=c11
+CFLAGS += -std=gnu11
CFLAGS_CLANG += -fshort-enums # Required by RTX
CFLAGS += -fno-exceptions
diff --git a/tools/build_system/test.mk b/tools/build_system/test.mk
index 115afa3e..a8240a30 100644
--- a/tools/build_system/test.mk
+++ b/tools/build_system/test.mk
@@ -24,7 +24,7 @@ CFLAGS += -Wno-missing-field-initializers
CFLAGS += -Wno-error=deprecated-declarations
CFLAGS += -Wno-unused-parameter
CFLAGS += -Wno-strict-aliasing
-CFLAGS += -std=c11
+CFLAGS += -std=gnu11
CFLAGS += $(addprefix -I,$(INCLUDES))
CFLAGS += -DBUILD_MODE_DEBUG