summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2024-12-26 18:37:01 -0700
committerLuke T. Shumaker <lukeshu@lukeshu.com>2024-12-26 20:07:33 -0700
commitc7a0d6de46610ac9ceaea5afe1b7983550fc1be6 (patch)
treec8a2d283f62bba07e8871bcc0dab4174f6fe135e
parente783ff4d07ecb0a7bae90651c17735069a094a82 (diff)
libcr: Tell GCC that coroutine_table[n].name might not be nul-terminated
-rw-r--r--libcr/coroutine.c6
-rw-r--r--libcr/tests/test_matrix/config.h2
2 files changed, 6 insertions, 2 deletions
diff --git a/libcr/coroutine.c b/libcr/coroutine.c
index 05892c3..32253c8 100644
--- a/libcr/coroutine.c
+++ b/libcr/coroutine.c
@@ -46,6 +46,10 @@
#error config.h must define CONFIG_COROUTINE_GDB (bool)
#endif
+/* Enforce that CONFIG_COROUTINE_NUM is greater than 1, to work around
+ * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118212 */
+static_assert(CONFIG_COROUTINE_NUM > 1);
+
/* Implementation *************************************************************/
#if CONFIG_COROUTINE_VALGRIND
@@ -386,7 +390,7 @@ struct coroutine {
#if CONFIG_COROUTINE_VALGRIND
unsigned stack_id;
#endif
- char name[CONFIG_COROUTINE_NAME_LEN];
+ [[gnu::nonstring]] char name[CONFIG_COROUTINE_NAME_LEN];
};
/* constants ******************************************************************/
diff --git a/libcr/tests/test_matrix/config.h b/libcr/tests/test_matrix/config.h
index 9802f08..becfce0 100644
--- a/libcr/tests/test_matrix/config.h
+++ b/libcr/tests/test_matrix/config.h
@@ -9,6 +9,6 @@
#define CONFIG_COROUTINE_DEFAULT_STACK_SIZE (4*1024)
#define CONFIG_COROUTINE_NAME_LEN 16
-#define CONFIG_COROUTINE_NUM 1
+#define CONFIG_COROUTINE_NUM 2
#endif /* _CONFIG_H_ */