Date: Sat, 29 Nov 2025 12:43:13 -0800 From: Mark Millard <marklmi@yahoo.com> To: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= <des@freebsd.org>, eduardo@freebsd.org, dev-commits-src-main <dev-commits-src-main@freebsd.org> Subject: Re: git: 19728f31ae42 - main - sys/_types.h: Unbreak gcc build Message-ID: <4CFFB275-2FB8-4096-AB17-C0CC8EE453AE@yahoo.com> References: <4CFFB275-2FB8-4096-AB17-C0CC8EE453AE.ref@yahoo.com>
index | next in thread | previous in thread | raw e-mail
Dag-Erling_Smørgrav <des_at_FreeBSD.org> wrote on
Date: Sat, 29 Nov 2025 10:38:50 UTC :
> Nuno Teixeira <eduardo@freebsd.org> writes:
> > I'm at main-n282229-687ab0dc54a9: Fri Nov 28 and gcc build still fails:
> >
> > /usr/include/sys/_types.h:164:46: error: missing binary operator before token "("
> > 164 | #if !defined(__has_feature) || !__has_feature(capabilities)
> > | ^
> > gmake[3]: *** [Makefile:501: _trampoline.o] Error 1
>
> I know, and I don't understand why...
>
> what's really weird is this:
>
> $ x86_64-unknown-freebsd14.3-gcc13 -E sys/sys/_types.h >/dev/null
> sys/sys/_types.h:164:46: error: missing binary operator before token "("
> 164 | #if !defined(__has_feature) || !__has_feature(capabilities)
> | ^
>
> as expected, but
>
> $ x86_64-unknown-freebsd14.3-gcc13 -E sys/sys/_types.h | less +Gq
>
> no error!
>
> anyway, see https://reviews.freebsd.org/D53986
Interesting oddity. Getting rid of the more complicated
original context:
int main(void)
{
#if !defined(dog) || !dog(cat)
return 1;
#else
return 0;
#endif
}
# gcc15 gcc_undefined_macro_use_oddity.c
gcc_undefined_macro_use_oddity.c: In function 'main':
gcc_undefined_macro_use_oddity.c:3:26: error: missing binary operator before token '('
3 | #if !defined(dog) || !dog(cat)
| ^
Something treated by gcc as a syntax/parsing requirement before
expression evaluation, as far as I can tell.
That does fit with when gcc added __has_feature as far as the gcc14
builds not failing but gcc 13 and 12 failing goes:
https://gcc.gnu.org/gcc-14/changes.html reports:
QUOTE
C family
The Clang language extensions __has_feature and __has_extension have been implemented in GCC. These are available from C, C++, and Objective-C(++). This is primarily intended to aid the portability of code written against Clang. . . .
END QUOTE
As for the other oddity . . .
I get (looking back in the scroll history afterwards):
# gcc15 gcc_undefined_macro_use_oddity.c | less +Gq
gcc_undefined_macro_use_oddity.c: In function 'main':
gcc_undefined_macro_use_oddity.c:3:26: error: missing binary operator before token '('
3 | #if !defined(dog) || !dog(cat)
| ^
~
~
~
. . .
~
~
~
#
(The error message lines were off screen before the scroll back.)
For the variation below I get:
# gcc15 gcc_undefined_macro_use_oddity.c 2>&1 | less +Gq
~
~
~
. . .
~
~
~
gcc_undefined_macro_use_oddity.c: In function 'main':
gcc_undefined_macro_use_oddity.c:3:26: error: missing binary operator before token '('
3 | #if !defined(dog) || !dog(cat)
| ^
#
(No scroll back needed to see the message lines.)
===
Mark Millard
marklmi at yahoo.com
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4CFFB275-2FB8-4096-AB17-C0CC8EE453AE>
