libstdc++: Fix 17_intro/names.cc on Solaris
Commit Message
17_intro/names.cc and experimental/names.cc currently FAIL on Solaris
FAIL: 17_intro/names.cc (test for excess errors)
FAIL: experimental/names.cc (test for excess errors)
Excess errors:
/usr/include/sys/timespec_util.h:22: error: expected ')' before ';' token
/usr/include/stdlib.h:157: error: expected unqualified-id before '[' token
/usr/include/stdlib.h:157: error: expected ')' before '[' token
<sys/timespec_util.h> has
extern int timespeccompare(const struct timespec *l, const struct timespec *r);
while <stdlib.h> has
typedef struct drand48_data {
unsigned int _initialised;
unsigned short int x[3];
unsigned short int a[3];
unsigned int c;
unsigned short lastx[3];
} drand48_data;
both of which are broken by defining r resp. x to ( in the testcase.
Fixed by undoing the defines. Tested on i386-pc-solaris2.11,
sparc-sun-solaris2.11, and x86_64-pc-linux-gnu.
Ok for master?
Rainer
Comments
On Mon, 25 Oct 2021 at 12:55, Rainer Orth <ro@cebitec.uni-bielefeld.de> wrote:
>
> 17_intro/names.cc and experimental/names.cc currently FAIL on Solaris
>
> FAIL: 17_intro/names.cc (test for excess errors)
> FAIL: experimental/names.cc (test for excess errors)
>
> Excess errors:
> /usr/include/sys/timespec_util.h:22: error: expected ')' before ';' token
> /usr/include/stdlib.h:157: error: expected unqualified-id before '[' token
> /usr/include/stdlib.h:157: error: expected ')' before '[' token
>
> <sys/timespec_util.h> has
>
> extern int timespeccompare(const struct timespec *l, const struct timespec *r);
>
> while <stdlib.h> has
>
> typedef struct drand48_data {
> unsigned int _initialised;
> unsigned short int x[3];
> unsigned short int a[3];
> unsigned int c;
> unsigned short lastx[3];
> } drand48_data;
>
> both of which are broken by defining r resp. x to ( in the testcase.
>
> Fixed by undoing the defines. Tested on i386-pc-solaris2.11,
> sparc-sun-solaris2.11, and x86_64-pc-linux-gnu.
>
> Ok for master?
OK, thanks
# HG changeset patch
# Parent 46e494d20576c10260ec41a54607f36eb946dc2e
libstdc++: Fix 17_intro/names.cc on Solaris
@@ -251,6 +251,10 @@
#undef p
// See https://gcc.gnu.org/ml/libstdc++/2019-05/msg00175.html
#undef ptr
+// <sys/timespec_util.h> uses this as parameter
+#undef r
+// <stdlib.h> uses this as member of drand48_data
+#undef x
#endif
#ifdef __VXWORKS__