Added C standard gnu23 to the makefile (#288)
* Added C standard gnu23 to the makefile * Added gnu23 standard to all test modue makefiles * Added installation of latest gcc version to tests workflow * Fixed typo in previous commit * Made GCC 14 installation conditional and moved from the workflow to the script * Extracted GCC version check to external script for CI and created tests README * Added #!/bin/bash * Make check_gcc_version.sh executable
This commit is contained in:
@@ -8,9 +8,14 @@ jobs:
|
||||
run-unit-tests:
|
||||
name: Run Unit Tests
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: Check and install GCC version
|
||||
run: ./ci_scripts/check_gcc_version.sh
|
||||
|
||||
- name: Run Unit Tests
|
||||
run: cd tests && ./run_tests.sh
|
||||
|
||||
@@ -42,7 +42,7 @@ GIT_DIRTY := $(shell git diff-index --quiet HEAD -- || echo "-dirty")
|
||||
GIT_HASH := $(shell git rev-parse --short HEAD || echo "undef")
|
||||
GIT_C_FLAGS := -DGIT_HASH=\"$(GIT_HASH)\" -DGIT_DIRTY=\"$(GIT_DIRTY)\"
|
||||
|
||||
CFLAGS := -g -O3 -Wall -Werror \
|
||||
CFLAGS := -g -O3 -Wall -Werror -std=gnu23 \
|
||||
-mcpu=arm7tdmi -mtune=arm7tdmi \
|
||||
-ffast-math -fomit-frame-pointer -funroll-loops \
|
||||
$(ARCH)
|
||||
|
||||
Executable
+17
@@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Check GCC version and install GCC 14 if needed
|
||||
check_gcc_version() {
|
||||
if command -v gcc &> /dev/null; then
|
||||
gcc_version=$(gcc -dumpversion | cut -d. -f1)
|
||||
if [ "$gcc_version" -lt 14 ]; then
|
||||
echo "GCC version $gcc_version detected. Installing GCC 14..."
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y gcc-14
|
||||
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 100
|
||||
echo "GCC 14 installed and set as default."
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
check_gcc_version
|
||||
@@ -0,0 +1,5 @@
|
||||
These are tests that run on the repository's CI or can be run locally
|
||||
to make sure none of the base modules are broken.
|
||||
|
||||
The project uses the gnu23 C standard which is stably supported from GCC 14 and onwards
|
||||
so this project should be compiled with GCC 14 or later.
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
CC := gcc
|
||||
CFLAGS := -I../../include -I. \
|
||||
-g -O3 -Wall -Werror
|
||||
-g -O3 -std=gnu23 -Wall -Werror
|
||||
SRC := bitset_test.c \
|
||||
../../source/bitset.c
|
||||
OUT := build/bitset_test
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
|
||||
CC := gcc
|
||||
CFLAGS := -I../../include -I. \
|
||||
-g -O3 -Wall -Werror -DPOOLS_TEST_ENV=yes
|
||||
-g -O3 -std=gnu23 -Wall -Werror -DPOOLS_TEST_ENV=yes
|
||||
|
||||
SRC := list_test.c \
|
||||
../../source/list.c \
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
|
||||
CC := gcc
|
||||
CFLAGS := -I../../include -I. \
|
||||
-g -O3 -Wall -Werror -DPOOLS_TEST_ENV=yes
|
||||
-g -O3 -std=gnu23 -Wall -Werror -DPOOLS_TEST_ENV=yes
|
||||
|
||||
SRC := pool_test.c ../../source/pool.c ../../source/bitset.c
|
||||
OUT := build/pool_test
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
|
||||
CC := gcc
|
||||
CFLAGS := -I../../include -I. \
|
||||
-g -O3 -Wall -Werror -Wno-format
|
||||
-g -O3 -std=gnu23 -Wall -Werror -Wno-format
|
||||
|
||||
SRC := util_test.c ../../source/util.c
|
||||
OUT := build/util_test
|
||||
|
||||
Reference in New Issue
Block a user