Skip to content

Commit e0bc5c2

Browse files
authored
clang > 20.1.4 compat: unterminated strings (#584)
clang introduced a new warning (following gcc) for string initialization to char arrays that do not fit the null terminal. Introduced here: llvm/llvm-project#137829 Included in LLVM version [LLVM 20.1.4](https://github.com/llvm/llvm-project/releases/tag/llvmorg-20.1.4)+ More detail: -Wunterminated-string-initialization warns for c string literals that are written to a buffer too small to include a null terminator. This warning is also included in -Wextra which is enabled for wasi-libc and fails compilation due to -Werror. Possible fixes: 1. deactivate the warning 2. add `__attribute__ ((nonstring))` to the three occurrences where this is a problem. Chosen solution: 1. Since the attribute is not available on older clang versions, it would trigger another warning there. (included a small formatting change in the commit - pls ignore)
1 parent 6b2d6bd commit e0bc5c2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,8 @@ CFLAGS += -Wall -Wextra -Werror \
422422
-Wno-missing-braces \
423423
-Wno-ignored-pragmas \
424424
-Wno-unused-but-set-variable \
425-
-Wno-unknown-warning-option
425+
-Wno-unknown-warning-option \
426+
-Wno-unterminated-string-initialization
426427

427428
# Configure support for threads.
428429
ifeq ($(THREAD_MODEL), single)
@@ -738,7 +739,7 @@ $(INCLUDE_DIRS): $(ALL_POSSIBLE_HEADERS)
738739
touch $@
739740

740741
STARTUP_FILES := $(OBJDIR)/copy-startup-files.stamp
741-
$(STARTUP_FILES): $(INCLUDE_DIRS) $(LIBC_BOTTOM_HALF_CRT_OBJS)
742+
$(STARTUP_FILES): $(INCLUDE_DIRS) $(LIBC_BOTTOM_HALF_CRT_OBJS)
742743
#
743744
# Install the startup files (crt1.o, etc.).
744745
#

0 commit comments

Comments
 (0)