Bug 181710 - 9.2-RELENG kernel build with clang fails in vfs
Summary: 9.2-RELENG kernel build with clang fails in vfs
Status: Closed Overcome By Events
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 9.1-RELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-08-31 16:30 UTC by Moritz Wilhelmy
Modified: 2020-09-19 17:53 UTC (History)
1 user (show)

See Also:


Attachments
file.diff (1.22 KB, patch)
2013-08-31 16:30 UTC, Moritz Wilhelmy
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Moritz Wilhelmy 2013-08-31 16:30:00 UTC
	Latest 'make buildkernel' of a recently updated svn checkout
(r255094) of the 9.2-RELENG branch fails with clang due to ignored
return value of some VFS_* macros as follows:

clang -c -O2 -pipe -fno-strict-aliasing  -std=c99 -g -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes  -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual  -Wundef -Wno-pointer-sign -fformat-extensions  -Wmissing-include-dirs -fdiagnostics-show-option  -Wno-error-tautological-compare -Wno-error-empty-body  -Wno-error-parentheses-equality -nostdinc  -I. -I/usr/src/sys -I/usr/src/sys/contrib/altq -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h  -fno-omit-frame-pointer -mno-aes -mno-avx -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float  -fno-asynchronous-unwind-tables -ffreestanding -fstack-protector -Werror  /usr/src/sys/kern/vfs_mountroot.c
/usr/src/sys/kern/vfs_mountroot.c:270:2: error: expression result unused [-Werror,-Wunused-value]
        VFS_ROOT(mporoot, LK_EXCLUSIVE, &vporoot);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/src/sys/sys/mount.h:727:2: note: expanded from macro 'VFS_ROOT'
        _rc; })
        ^~~
1 error generated.
*** [vfs_mountroot.o] Error code 1

Stop in /pool/obj/usr/src/sys/GENERIC.
*** [buildkernel] Error code 1

Stop in /usr/src.
*** [buildkernel] Error code 1

Stop in /usr/src.

Fix: Cast to (void) to explicitely ignore the return value?
The patch below at least fixes my kernel build with clang, but maybe
they should be cast to (void) in the macro definition instead, if the
macro return value is never supposed to be used.
How-To-Repeat: Run "make buildkernel" using clang
Comment 1 moritz 2013-09-01 14:55:52 UTC
Here's another:

clang -c -O2 -pipe -fno-strict-aliasing  -std=c99 -g -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes  -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual  -Wundef -Wno-pointer-sign -fformat-extensions  -Wmissing-include-dirs -fdiagnostics-show-option  -Wno-error-tautological-compare -Wno-error-empty-body  -Wno-error-parentheses-equality -nostdinc  -I. -I/usr/src/sys -I/usr/src/sys/contrib/altq -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h  -fno-omit-frame-pointer -mno-aes  -mno-avx -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float  -fno-asynchronous-unwind-tables -ffreestanding -fstack-protector -Werror  /usr/src/sys/nfsserver/nfs_serv.c
/usr/src/sys/nfsserver/nfs_serv.c:3695:2: error: expression result unused [-Werror,-Wunused-value]
        VFS_STATFS(vp->v_mount, &sb);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/src/sys/sys/mount.h:743:2: note: expanded from macro 'VFS_STATFS'
        _rc; })
        ^~~
1 error generated.
*** [nfs_serv.o] Error code 1

Stop in /pool/obj/usr/src/sys/JAILHOST.
*** [buildkernel] Error code 1

Stop in /usr/src.
*** [buildkernel] Error code 1

Stop in /usr/src.


I'm sure there's more. I think it might be good to fix these before 9.2?
Comment 2 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 07:58:56 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped