Closed matthiasclasen closed 3 years ago
/usr/lib/gcc/i686-redhat-linux/10/include/stddef.h:424: syntax error, unexpected identifier in ' float128 max_align_f128 attribute((aligned(alignof(float128))));' at '__float128'
This comes from a system header; I guess g-ir-scanner is choking on some compiler attribute, or maybe at the __float128
type?
Yes, it is choking on __float128. But why only on i686 ?
Ah, stddef.h has:
/* _Float128 is defined as a basic type, so max_align_t must be
sufficiently aligned for it. This code must work in C++, so we
use __float128 here; that is only available on some
architectures, but only on i386 is extra alignment needed for
__float128. */
#ifdef __i386__
__float128 __max_align_f128 __attribute__((__aligned__(__alignof(__float128))));
#endif
The whole thing is inside an
#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) \
|| (defined(__cplusplus) && __cplusplus >= 201103L)
#endif /* C11 */
Are we using C11 ?
No, but then again this is g-ir-scanner: it needs to do two passes, one without macro expansion and one with macro expansion.
giscanner/scannerlexer.l has:
"float" { return BASIC_TYPE; }
"_Float16" { return BASIC_TYPE; }
"_Float32" { return BASIC_TYPE; }
"_Float64" { return BASIC_TYPE; }
"_Float128" { return BASIC_TYPE; }
"_Float32x" { return BASIC_TYPE; }
"_Float64x" { return BASIC_TYPE; }
"_Float128x" { return BASIC_TYPE; }
but nothing for __float128
Maybe this would do ?
diff --git a/giscanner/scannerlexer.l b/giscanner/scannerlexer.l
index cfec4d58..8b3ecfe2 100644
--- a/giscanner/scannerlexer.l
+++ b/giscanner/scannerlexer.l
@@ -217,6 +217,8 @@ stringtext ([^\\\"])|(\\.)
"enum" { return ENUM; }
"extern" { return EXTERN; }
"float" { return BASIC_TYPE; }
+"__float80" { return BASIC_TYPE; }
+"__float128" { return BASIC_TYPE; }
"_Float16" { return BASIC_TYPE; }
"_Float32" { return BASIC_TYPE; }
"_Float64" { return BASIC_TYPE; }
Possibly. It would be great if the C library didn't add random types, of course. But at this point, you should open an issue on GitLab. :wink:
Going there
We're seeing this on i686 in the RHEL buildsystem: