Skip to contentSkip to conversation

Makefile: Temporarily suppress -Werror=unused-result

PATCH In review Cheng-Yang Chou 2 participants 4 messages Jun 18, 2025 – Jul 1, 2025 Kbuild

lore
Share & tools
lore
#0 lore raw

cover Makefile: Temporarily suppress -Werror=unused-result

This patch adds -Wno-error=unused-result to the Makefile to allow rt-tests to build on glibc >= 2.41, where functions like write(), system(), and ftruncate() are annotated with warn_unused_result. The build currently fails due to these ignored return values being treated as fatal errors under -Werror.

This change serves as a temporary workaround. A follow-up patch will address proper error checking at each affected call site.

Thanks.

-chengyang

---

Cheng-Yang Chou (1):
Makefile: Use -Wno-error=unused-result

 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Signature · 1 line
2.48.1
#1 lore raw

PATCH 1/1 Makefile: Use -Wno-error=unused-result

Since compile warnings are treated as errors, use -Wno-error=unused-result to avoid build failures caused by ignored return values from functions like write(), system(), and ftruncate(). This allows the build to succeed until proper error handling can be added where appropriate.

---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
index 6215541..e3d02cd 100644
@@ -33,7 +33,7 @@ prefix  ?= /usr/local
 bindir  ?= $(prefix)/bin
 mandir	?= $(prefix)/share/man
 
-CFLAGS ?= -Wall -Werror -Wno-nonnull -Wextra -Wno-sign-compare -Wno-unused-parameter -Wno-error=format-truncation=
+CFLAGS ?= -Wall -Werror -Wno-nonnull -Wextra -Wno-sign-compare -Wno-unused-parameter -Wno-error=format-truncation= -Wno-error=unused-result
 CPPFLAGS += -D_GNU_SOURCE -Isrc/include
 LDFLAGS ?=
 
Signature · 1 line
2.48.1
#2 lore raw

Re: [PATCH 1/1] Makefile: Use -Wno-error=unused-result

Quoted 28 lines · Cheng-Yang Chou

Since compile warnings are treated as errors, use -Wno-error=unused-result to avoid build failures caused by ignored return values from functions like write(), system(), and ftruncate(). This allows the build to succeed until proper error handling can be added where appropriate.

---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
index 6215541..e3d02cd 100644
@@ -33,7 +33,7 @@ prefix  ?= /usr/local
 bindir  ?= $(prefix)/bin
 mandir	?= $(prefix)/share/man
 
-CFLAGS ?= -Wall -Werror -Wno-nonnull -Wextra -Wno-sign-compare -Wno-unused-parameter -Wno-error=format-truncation=
+CFLAGS ?= -Wall -Werror -Wno-nonnull -Wextra -Wno-sign-compare -Wno-unused-parameter -Wno-error=format-truncation= -Wno-error=unused-result
 CPPFLAGS += -D_GNU_SOURCE -Isrc/include
 LDFLAGS ?=
 
Signature · 1 line
2.48.1
#3 lore raw
In reply to Cheng-Yang Chou
Quoted 5 lines · Cheng-Yang Chou

Cheng-Yang Chou (1):
Makefile: Use -Wno-error=unused-result

 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Hi Clark and John,

Gentle ping.
Please let me know if any changes are needed.

Thanks.

-chengyang