dcb: fix test compilation

GCC 14 with LTO generates the following warning:

  src/core/tests/test-dcb.c: In function 'test_dcb_cleanup':
  src/core/tests/test-dcb.c:283:5: error: array subscript _3 is outside array bounds of 'const char *[0:]' [-Werror=array-bounds=]
    283 |     g_assert_cmpstr(expected.cmds[expected.num], ==, NULL);
        |     ^
  src/core/tests/test-dcb.c:14:17: note: while referencing 'cmds'
     14 |     const char *cmds[];
        |                 ^
  src/core/tests/test-dcb.c:261:24: note: defined here 'expected'
    261 |     static DcbExpected expected = {
        |                        ^

Define the commands as a fixed array instead of flexible array member.
This commit is contained in:
Beniamino Galvani
2024-04-04 09:09:48 +02:00
parent d369f55192
commit 9ff7ff28fc

View File

@@ -11,7 +11,7 @@
typedef struct {
guint num;
const char *cmds[];
const char *cmds[16];
} DcbExpected;
static gboolean