Merge pull request #14738 from benpicco/c11
CODING_CONVENTIONS.md: default to C11
This commit is contained in:
commit
ffdddc802e
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
## General
|
## General
|
||||||
|
|
||||||
* Code shall be [C99](http://www.open-std.org/jtc1/sc22/WG14/www/docs/n1256.pdf)
|
* Code shall be [C11](http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf)
|
||||||
compliant.
|
compliant.
|
||||||
* Avoid dynamic memory allocation (malloc/free, new, etc.)! It will break
|
* Avoid dynamic memory allocation (malloc/free, new, etc.)! It will break
|
||||||
real-time guarantees, increase code complexity, and make it more likely to use
|
real-time guarantees, increase code complexity, and make it more likely to use
|
||||||
|
|||||||
@ -23,7 +23,7 @@ export GPROF ?= gprof
|
|||||||
CFLAGS += -Wall -Wextra -pedantic $(CFLAGS_DBG)
|
CFLAGS += -Wall -Wextra -pedantic $(CFLAGS_DBG)
|
||||||
CFLAGS_DBG ?= -g3
|
CFLAGS_DBG ?= -g3
|
||||||
|
|
||||||
# default std set to gnu99 of not overwritten by user
|
# default std set to gnu11 if not overwritten by user
|
||||||
ifeq (,$(filter -std=%, $(CFLAGS)))
|
ifeq (,$(filter -std=%, $(CFLAGS)))
|
||||||
CFLAGS += -std=gnu11
|
CFLAGS += -std=gnu11
|
||||||
endif
|
endif
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
# Test if the input language was specified externally.
|
# Test if the input language was specified externally.
|
||||||
# Otherwise test if the compiler unterstands the "-std=c99" flag, and use it if so.
|
# Otherwise test if the compiler unterstands the "-std=c11" flag, and use it if so.
|
||||||
ifeq ($(filter -std=%,$(CFLAGS)),)
|
ifeq ($(filter -std=%,$(CFLAGS)),)
|
||||||
ifeq ($(shell $(CC) -std=c99 -E - 2>/dev/null >/dev/null </dev/null ; echo $$?),0)
|
ifeq ($(shell $(CC) -std=c11 -E - 2>/dev/null >/dev/null </dev/null ; echo $$?),0)
|
||||||
CFLAGS += -std=c99
|
CFLAGS += -std=c11
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|||||||
@ -29,7 +29,7 @@ $(PKG_BUILD_DIR)/lib/librelic_s.a: $(PKG_BUILD_DIR)/Makefile
|
|||||||
|
|
||||||
# Pass 'COMP' with a target specific export to not have issues with the shell
|
# Pass 'COMP' with a target specific export to not have issues with the shell
|
||||||
# escaping evaluation.
|
# escaping evaluation.
|
||||||
COMP = $(filter-out -Werror -Werror=old-style-definition -Werror=strict-prototypes -std=gnu99,$(CFLAGS))
|
COMP = $(filter-out -Werror -Werror=old-style-definition -Werror=strict-prototypes -std=gnu11,$(CFLAGS))
|
||||||
$(PKG_BUILD_DIR)/Makefile: export COMP ?=
|
$(PKG_BUILD_DIR)/Makefile: export COMP ?=
|
||||||
$(PKG_BUILD_DIR)/Makefile: $(PKG_PREPARED) $(TOOLCHAIN_FILE) | ..cmake_version_supported
|
$(PKG_BUILD_DIR)/Makefile: $(PKG_PREPARED) $(TOOLCHAIN_FILE) | ..cmake_version_supported
|
||||||
cmake -B$(PKG_BUILD_DIR) -H$(PKG_SOURCE_DIR) \
|
cmake -B$(PKG_BUILD_DIR) -H$(PKG_SOURCE_DIR) \
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user