env MAKEOBJDIRPREFIX=/usr/obj/gcc6 CROSS_TOOLCHAIN=amd64-gcc make buildkernel env MAKEOBJDIRPREFIX=/usr/obj/clang make buildkernel
Details
- Reviewers
markj mjg - Commits
- rS368562: cache_fplookup: quiet gcc -Wreturn-type
Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
Reporting this is a bug in gcc and adding default label defeats the check from clang which makes sure all enums are handled.
iow this would be a regression
Worst the case the following can be added:
diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 7a9fb0aada6..58c82eecb59 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -4603,6 +4603,7 @@ cache_fplookup_impl(struct vnode *dvp, struct cache_fpl *fpl) cache_fpl_cleanup_cnp(cnp); return (error); } + __assert_unreachable(); } /*
which i suspect may be enough to take care of it.
however, you are likely going to get many other warns elsewhere and once more, adding default label defeats the compilation time check in clang that cases are handled so I don't htink it's a good idea.
I can try reporting it as a bug and seeing what they think. For the purposes of moving forward, how about we leave the case labels alone and move the __assert_unreachable to the last line of the function?
Sorry, comments crossed, will do.
however, you are likely going to get many other warns elsewhere and once more, adding default label defeats the compilation time check in clang that cases are handled so I don't htink it's a good idea.
Actually I only encountered one other, D27553, in getting the tree to build with gcc6 and gcc9.
They know for years now, see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87950
I like the current cases as they are, I'm not going to oppose just adding __assert_unreachable by the end of the func.
There is a gcc bug report, filed 2 years ago: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87950