From e5b19bc5944536d51d19082de4f9bbd3fd26b4b8 Mon Sep 17 00:00:00 2001 From: Hiro <31057166+HiroGitea@users.noreply.github.com> Date: Sat, 3 Oct 2026 12:02:08 +0900 Subject: [PATCH] storm: add the const qualifiers SDCC 4.6 asks for Follow-up to #494. Storm control (#455) was merged after it and brings three objects in code space without const: the extern declaration of machine in rtl837x_storm.c and the name tables storm_types and storm_names. SDCC 4.6.0 reports them as warnings 356 and 357, which fail the build with CI=1 (--Werror). SDCC 4.5, which the CI uses, does not report them. The declarations now take the form used in the rest of the tree, as in mime_strings in httpd.c. The images for KP_9000_6XHML_X2 and KP_9000_9XHML_X_V3_1 are byte-identical before and after. --- cmd_parser.c | 2 +- rtl837x_storm.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd_parser.c b/cmd_parser.c index 0a97a288..c493c9e9 100644 --- a/cmd_parser.c +++ b/cmd_parser.c @@ -1574,7 +1574,7 @@ err: cmd_error("bw [in|out|status] [|off|drop|fc]\n"); } -static __code char * __code storm_types[STORM_TYPES] = { "bcast", "mcast", "ucast", "umcast" }; +static __code const char * __code const storm_types[STORM_TYPES] = { "bcast", "mcast", "ucast", "umcast" }; void parse_storm(void) { diff --git a/rtl837x_storm.c b/rtl837x_storm.c index c7e06d71..2308b210 100644 --- a/rtl837x_storm.c +++ b/rtl837x_storm.c @@ -8,7 +8,7 @@ #pragma codeseg BANK3 #pragma constseg BANK3 -extern __code struct machine machine; +extern __code const struct machine machine; extern __xdata uint8_t sfr_data[4]; /* RTL837X_STORM_MIDX words, row type * 2 + half: half 0 holds ports 0-4, half 1 ports 5-9, @@ -20,7 +20,7 @@ static const __code uint8_t storm_midx[8][4] = { { 0x2b, 0x9e, 0x37, 0xdb }, { 0x3f, 0xef, 0x7c, 0xef }, }; -static __code char * __code storm_names[STORM_TYPES] = { " bcast ", " mcast ", " ucast ", " umcast " }; +static __code const char * __code const storm_names[STORM_TYPES] = { " bcast ", " mcast ", " ucast ", " umcast " }; void storm_set(uint8_t port, __xdata uint8_t type, __xdata uint32_t rate, __xdata uint8_t pps) __banked