summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaciej Żenczykowski <maze@google.com>2024-04-09 23:11:54 -0700
committerMaciej Żenczykowski <maze@google.com>2024-04-09 23:22:44 -0700
commitc720b5a5457b43ab50e636fb9bdfefff3e296689 (patch)
tree69dfb2886c3eda3ec5c1cb5053d3d1f7feb2b8e9
parent56847bdb42061136c15465adbfa4539665a00dcf (diff)
downloadapf-c720b5a5457b43ab50e636fb9bdfefff3e296689.tar.gz
v5: get us closer to ANSI C
This fixes: apf_interpreter.c:42:15: error: comma at end of enumerator list [-Werror=pedantic] 42 | match = True, apf_interpreter.c:1058:27: error: ISO C forbids empty initializer braces before C2X [-Werror=pedantic] 1058 | apf_context apf_ctx = {}; Test: TreeHugger, manually via 'devtools/mk' Signed-off-by: Maciej Żenczykowski <maze@google.com> Change-Id: I43d9ad78010e1864b8d7cd27eb45de6404905e66
-rw-r--r--apf_defs.h2
-rwxr-xr-xdevtools/mk2
-rw-r--r--v5/apf_interpreter.c4
-rw-r--r--v5/apf_interpreter_source.c2
4 files changed, 6 insertions, 4 deletions
diff --git a/apf_defs.h b/apf_defs.h
index e8426e6..e619dce 100644
--- a/apf_defs.h
+++ b/apf_defs.h
@@ -10,7 +10,7 @@ typedef enum {
error_program = -2,
error_packet = -1,
nomatch = false,
- match = true,
+ match = true
} match_result_type;
#define ETH_P_IP 0x0800
diff --git a/devtools/mk b/devtools/mk
index 619aa18..408cc0f 100755
--- a/devtools/mk
+++ b/devtools/mk
@@ -9,6 +9,7 @@ cd "${0%/*}"
declare -ar FLAGS=(
'-std=c89'
+ '-pedantic'
'-Wall'
'-Werror'
'-Werror=implicit-fallthrough'
@@ -19,6 +20,7 @@ declare -ar FLAGS=(
'-Wuninitialized'
'-Os'
'-fomit-frame-pointer'
+ '-Wno-declaration-after-statement'
)
arm-linux-gnueabi-gcc "${FLAGS[@]}" apf_interpreter.c -c -o apf_interpreter.arm.o
diff --git a/v5/apf_interpreter.c b/v5/apf_interpreter.c
index e6be8e0..06af66d 100644
--- a/v5/apf_interpreter.c
+++ b/v5/apf_interpreter.c
@@ -39,7 +39,7 @@ typedef enum {
error_program = -2,
error_packet = -1,
nomatch = False,
- match = True,
+ match = True
} match_result_type;
#define ETH_P_IP 0x0800
@@ -1055,7 +1055,7 @@ int apf_run(void* ctx, u32* const program, const u32 program_len,
/* This cannot wrap due to previous check. */
if (program_len + 20 > ram_len) return PASS_PACKET;
- apf_context apf_ctx = {};
+ apf_context apf_ctx = { 0 };
apf_ctx.caller_ctx = ctx;
apf_ctx.program = (u8*)program;
apf_ctx.program_len = program_len;
diff --git a/v5/apf_interpreter_source.c b/v5/apf_interpreter_source.c
index 4515310..9740a18 100644
--- a/v5/apf_interpreter_source.c
+++ b/v5/apf_interpreter_source.c
@@ -525,7 +525,7 @@ int apf_run(void* ctx, u32* const program, const u32 program_len,
// This cannot wrap due to previous check.
if (program_len + 20 > ram_len) return PASS_PACKET;
- apf_context apf_ctx = {};
+ apf_context apf_ctx = { 0 };
apf_ctx.caller_ctx = ctx;
apf_ctx.program = (u8*)program;
apf_ctx.program_len = program_len;