Skip to content

Commit 6da5e6f

Browse files
keesrafaeljw
authored andcommitted
ACPICA: Introduce ACPI_NONSTRING
ACPICA commit 878823ca20f1987cba0c9d4c1056be0d117ea4fe In order to distinguish character arrays from C Strings (i.e. strings with a terminating NUL character), add support for the "nonstring" attribute provided by GCC. (A better name might be "ACPI_NONCSTRING", but that's the attribute name, so stick to the existing naming convention.) GCC 15's -Wunterminated-string-initialization will warn about truncation of the NUL byte for string initializers unless the destination is marked with "nonstring". Prepare for applying this attribute to the project. Link: acpica/acpica@878823ca Signed-off-by: Rafael J. Wysocki <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Kees Cook <[email protected]> [ rjw: Pick up the tag from Kees ] Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent e91e596 commit 6da5e6f

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

include/acpi/actypes.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1327,4 +1327,8 @@ typedef enum {
13271327
#define ACPI_FLEX_ARRAY(TYPE, NAME) TYPE NAME[0]
13281328
#endif
13291329

1330+
#ifndef ACPI_NONSTRING
1331+
#define ACPI_NONSTRING /* No terminating NUL character */
1332+
#endif
1333+
13301334
#endif /* __ACTYPES_H__ */

include/acpi/platform/acgcc.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,12 @@
7272
TYPE NAME[]; \
7373
}
7474

75+
/*
76+
* Explicitly mark strings that lack a terminating NUL character so
77+
* that ACPICA can be built with -Wunterminated-string-initialization.
78+
*/
79+
#if __has_attribute(__nonstring__)
80+
#define ACPI_NONSTRING __attribute__((__nonstring__))
81+
#endif
82+
7583
#endif /* __ACGCC_H__ */

0 commit comments

Comments
 (0)