Skip to contentSkip to conversation

xen: append -Wno-unused-function to C99 header check

PATCH In review Wei Liu 3 participants 4 messages Apr 6, 2017

lore
Share & tools
lore

Wei Liu

author
#0 lore raw

PATCH 1/1 xen: append -Wno-unused-function to C99 header check

The check builds header file as if it is a C file. Clang doesn't like the idea of having dead code in C file. The check as-is fails on Clang with unused function warnings.

We know for sure we don't care about those unused function warnings. Just ignore them.

---
Cc: Andrew Cooper <[email protected]>
Cc: George Dunlap <[email protected]>
Cc: Ian Jackson <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Konrad Rzeszutek Wilk <[email protected]>
Cc: Stefano Stabellini <[email protected]>
Cc: Tim Deegan <[email protected]>
Cc: Wei Liu <[email protected]>

---
 xen/include/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/include/Makefile +1 -1
index 65a732a707..b0bacc99b5 100644
@@ -111,7 +111,7 @@ headers.chk: $(PUBLIC_ANSI_HEADERS) Makefile
 headers99.chk: $(PUBLIC_C99_HEADERS) Makefile
 	rm -f [email protected]
 	$(foreach i, $(filter %.h,$^),                                        \
-	    $(CC) -x c -std=c99 -Wall -Werror                                 \
+	    $(CC) -x c -std=c99 -Wall -Werror -Wno-unused-function            \
 	    -include stdint.h $(foreach j, $($(i)-prereq), -include $(j).h)   \
 	    -S -o /dev/null $(i)                                              \
 	    || exit $$?; echo $(i) >> [email protected];)
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#1 lore raw

xen/include/Makefile headers.chk: $(PUBLIC_ANSI_HEADERS) Makefile · line 117

Quoted 12 lines
Quoted 1 line
Quoted 1 line · On 06.04.17 at 14:54, <[email protected]> wrote:
xen/include/Makefile +1 -1
@@ -111,7 +111,7 @@ headers.chk: $(PUBLIC_ANSI_HEADERS) Makefile
 headers99.chk: $(PUBLIC_C99_HEADERS) Makefile
 	rm -f [email protected]
 	$(foreach i, $(filter %.h,$^),                                        \
-	    $(CC) -x c -std=c99 -Wall -Werror                                 \
+	    $(CC) -x c -std=c99 -Wall -Werror -Wno-unused-function            \
 	    -include stdint.h $(foreach j, $($(i)-prereq), -include $(j).h)   \
 	    -S -o /dev/null $(i)                                              \
 	    || exit $$?; echo $(i) >> [email protected];)

I think it would be better to make this match the C++ check, where a source file is being generated on the fly (and quite possibly for a similar reason).

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#2 lore raw
Quoted 16 lines · Jan Beulich

xen/include/Makefile headers.chk: $(PUBLIC_ANSI_HEADERS) Makefile · line 117

Quoted 12 lines
Quoted 1 line
Quoted 1 line · On 06.04.17 at 14:54, <[email protected]> wrote:
xen/include/Makefile +1 -1
@@ -111,7 +111,7 @@ headers.chk: $(PUBLIC_ANSI_HEADERS) Makefile
 headers99.chk: $(PUBLIC_C99_HEADERS) Makefile
 	rm -f [email protected]
 	$(foreach i, $(filter %.h,$^),                                        \
-	    $(CC) -x c -std=c99 -Wall -Werror                                 \
+	    $(CC) -x c -std=c99 -Wall -Werror -Wno-unused-function            \
 	    -include stdint.h $(foreach j, $($(i)-prereq), -include $(j).h)   \
 	    -S -o /dev/null $(i)                                              \
 	    || exit $$?; echo $(i) >> [email protected];)

I think it would be better to make this match the C++ check, where a source file is being generated on the fly (and quite possibly for a similar reason).

I don't have an opinion on what is the best way to fix this. However, I'll say that it is expected to have unused functions in header files (it would be a problem if there weren't), so -Wno-unused-function looks fine to me.

Wei, given that the problem was introduced by my patch, let me know if you need any help fixing this.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

author
#3 lore raw
Quoted 18 lines · Stefano Stabellini
Quoted 16 lines · Jan Beulich

xen/include/Makefile headers.chk: $(PUBLIC_ANSI_HEADERS) Makefile · line 117

Quoted 12 lines
Quoted 1 line
Quoted 1 line · On 06.04.17 at 14:54, <[email protected]> wrote:
xen/include/Makefile +1 -1
@@ -111,7 +111,7 @@ headers.chk: $(PUBLIC_ANSI_HEADERS) Makefile
 headers99.chk: $(PUBLIC_C99_HEADERS) Makefile
 	rm -f [email protected]
 	$(foreach i, $(filter %.h,$^),                                        \
-	    $(CC) -x c -std=c99 -Wall -Werror                                 \
+	    $(CC) -x c -std=c99 -Wall -Werror -Wno-unused-function            \
 	    -include stdint.h $(foreach j, $($(i)-prereq), -include $(j).h)   \
 	    -S -o /dev/null $(i)                                              \
 	    || exit $$?; echo $(i) >> [email protected];)

I think it would be better to make this match the C++ check, where a source file is being generated on the fly (and quite possibly for a similar reason).

Quoted 8 lines

I don't have an opinion on what is the best way to fix this. However, I'll say that it is expected to have unused functions in header files (it would be a problem if there weren't), so -Wno-unused-function looks fine to me.

Wei, given that the problem was introduced by my patch, let me know if you need any help fixing this.

No need. I have another patch queued up for posting -- waiting for report from travis.

Wei.

Quoted 4 lines

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel