Fixup after
9d2f97981755 <sys/cdefs.h>: Decay expression passed to fallback version of __generic()
Details
- Reviewers
jhb kib jrtc27 imp - Commits
- rG3cfcbbfaf83a: cdefs.h __generic: avoid gcc -Wunused-value
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
CROSS_TOOLCHAIN=amd64-gcc13 make buildworld produces about 120 warnings like this one:
gcc13/usr/src/freebsd/amd64.amd64/bin/ln/ln.o.meta:/usr/src/freebsd/bin/ln/ln.c:248:26: warning: left-hand operand of comma expression has no effect [-Wunused-value]
Ok. So non c11 env? Would has_extension be a better test so _Generic is used more often?
But either way, what's there is a good fix snd questions like above are for znother day
I see. Yeah, it looks like we are compiling userspace (or ln.c anyway...) with -std=gnu99 (probably from share/mk/bsd.sys.mk?). IIRC they are mostly using __generic indirectly through include/libgen.h (dirname/basename compat stuff).
Would has_extension be a better test so _Generic is used more often?
Unsure. Is there a different extension to look for than what's there on line 242? But after some quick experiments, it seems __has_extension(c_generic_selections) is false for gcc13 with any -std and is also false for clang with -std=gnu99, so I'm not actually sure where it's useful.
Oh, didn't hit submit before, though this doesn't affect the commit
Ah, I need to switch to c11 as the default for everything... Oh, wait, no, that might be a too large a bite to take.
Would has_extension be a better test so _Generic is used more often?
Unsure. Is there a different extension to look for than what's there on line 242? But after some quick experiments, it seems __has_extension(c_generic_selections) is false for gcc13 with any -std and is also false for clang with -std=gnu99, so I'm not actually sure where it's useful.
Ah, so there's not an easy way to do what I'd hoped.... This is the next best thing and I approve. Thanks for fixing it.