public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
* [committed] libstdc++: More workarounds in 17_intro/names.cc test [PR 97088]
@ 2021-06-25 19:51 Jonathan Wakely
  2021-06-28 11:55 ` Christophe LYON
  0 siblings, 1 reply; 5+ messages in thread
From: Jonathan Wakely @ 2021-06-25 19:51 UTC (permalink / raw)
  To: libstdc++, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 311 bytes --]

Conditionally #undef some more names that are used in system headers.

libstdc++-v3/ChangeLog:

	PR libstdc++/97088
	* testsuite/17_intro/names.cc: Undef more names for newlib and
	also for arm-none-linux-gnueabi.
	* testsuite/experimental/names.cc: Disable PCH.

Tested powerpc64le-linux. Committed to trunk.


[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 1948 bytes --]

commit e83a5a6b6893e910dc0b6b1cd034e1a258406c93
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Fri Jun 25 18:31:22 2021

    libstdc++: More workarounds in 17_intro/names.cc test [PR 97088]
    
    Conditionally #undef some more names that are used in system headers.
    
    libstdc++-v3/ChangeLog:
    
            PR libstdc++/97088
            * testsuite/17_intro/names.cc: Undef more names for newlib and
            also for arm-none-linux-gnueabi.
            * testsuite/experimental/names.cc: Disable PCH.

diff --git a/libstdc++-v3/testsuite/17_intro/names.cc b/libstdc++-v3/testsuite/17_intro/names.cc
index 534dab70ff5..805c1002c3f 100644
--- a/libstdc++-v3/testsuite/17_intro/names.cc
+++ b/libstdc++-v3/testsuite/17_intro/names.cc
@@ -208,6 +208,11 @@
 #undef r
 #endif
 
+#if defined (__linux__) && defined (__arm__)
+// <sys/ucontext.h> defines fpregset_t::fpregs::j
+#undef j
+#endif
+
 #if defined (__linux__) && defined (__powerpc__)
 // <asm/types.h> defines __vector128::u
 #undef u
@@ -220,6 +225,15 @@
 #if ! __has_include(<newlib.h>)
 // newlib's <sys/cdefs.h> defines __lockable as a macro, so we can't use it.
 # define __lockable		cannot be used as an identifier
+// newlib's <time.h> defines __tzrule_type with these members.
+#undef d
+#undef m
+#undef n
+#undef s
+// newlib's <math.h> uses this for parameters
+#undef x
+// newlib's <inttypes.h> uses this for parameters
+#undef j
 #endif
 
 #ifdef __sun__
diff --git a/libstdc++-v3/testsuite/experimental/names.cc b/libstdc++-v3/testsuite/experimental/names.cc
index 34ec3ba5968..d695a258f2c 100644
--- a/libstdc++-v3/testsuite/experimental/names.cc
+++ b/libstdc++-v3/testsuite/experimental/names.cc
@@ -16,6 +16,7 @@
 // <http://www.gnu.org/licenses/>.
 
 // { dg-do compile { target c++11 } }
+// { dg-add-options no_pch }
 
 // Define macros for some common variables names that we must not use for
 // naming variables, parameters etc. in the library.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [committed] libstdc++: More workarounds in 17_intro/names.cc test [PR 97088]
  2021-06-25 19:51 [committed] libstdc++: More workarounds in 17_intro/names.cc test [PR 97088] Jonathan Wakely
@ 2021-06-28 11:55 ` Christophe LYON
  2021-06-28 14:20   ` Jonathan Wakely
  0 siblings, 1 reply; 5+ messages in thread
From: Christophe LYON @ 2021-06-28 11:55 UTC (permalink / raw)
  To: Jonathan Wakely, libstdc++, gcc-patches


On 25/06/2021 21:51, Jonathan Wakely via Libstdc++ wrote:
> Conditionally #undef some more names that are used in system headers.
>
> libstdc++-v3/ChangeLog:
>
> 	PR libstdc++/97088
> 	* testsuite/17_intro/names.cc: Undef more names for newlib and
> 	also for arm-none-linux-gnueabi.
> 	* testsuite/experimental/names.cc: Disable PCH.
>
> Tested powerpc64le-linux. Committed to trunk.

Hi Jonathan,

After disabling PCH, we now have the following failures on arm-eabi, 
using newlib-3.3:

FAIL: experimental/names.cc (test for excess errors)
Excess errors:
/aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/arm-none-eabi/include/math.h:194: 
error: expected ')' before ';' token
/aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/arm-none-eabi/include/math.h:195: 
error: expected ')' before ';' token
/aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/arm-none-eabi/include/math.h:196: 
error: expected ')' before ';' token
/aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/arm-none-eabi/include/math.h:197: 
error: expected ')' before ';' token
/aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/arm-none-eabi/include/math.h:198: 
error: expected ')' before ';' token
/aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/arm-none-eabi/include/math.h:199: 
error: expected ')' before ';' token
/aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/arm-none-eabi/include/math.h:200: 
error: expected ')' before ';' token
/aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/arm-none-eabi/include/math.h:201: 
error: expected ')' before ';' token
/aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/arm-none-eabi/include/time.h:110: 
error: expected unqualified-id before ';' token
/aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/arm-none-eabi/include/time.h:110: 
error: expected ')' before ';' token
/aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/arm-none-eabi/include/inttypes.h:323: 
error: expected ')' before ';' token

All this is a bit of a mess :-)

Christophe



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [committed] libstdc++: More workarounds in 17_intro/names.cc test [PR 97088]
  2021-06-28 11:55 ` Christophe LYON
@ 2021-06-28 14:20   ` Jonathan Wakely
  2021-06-28 15:26     ` Jonathan Wakely
  0 siblings, 1 reply; 5+ messages in thread
From: Jonathan Wakely @ 2021-06-28 14:20 UTC (permalink / raw)
  To: Christophe LYON; +Cc: libstdc++, gcc Patches

[-- Attachment #1: Type: text/plain, Size: 2205 bytes --]

On Mon, 28 Jun 2021 at 12:56, Christophe LYON wrote:
>
>
> On 25/06/2021 21:51, Jonathan Wakely via Libstdc++ wrote:
> > Conditionally #undef some more names that are used in system headers.
> >
> > libstdc++-v3/ChangeLog:
> >
> >       PR libstdc++/97088
> >       * testsuite/17_intro/names.cc: Undef more names for newlib and
> >       also for arm-none-linux-gnueabi.
> >       * testsuite/experimental/names.cc: Disable PCH.
> >
> > Tested powerpc64le-linux. Committed to trunk.
>
> Hi Jonathan,
>
> After disabling PCH, we now have the following failures on arm-eabi,
> using newlib-3.3:
>
> FAIL: experimental/names.cc (test for excess errors)
> Excess errors:
> /aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/arm-none-eabi/include/math.h:194:
> error: expected ')' before ';' token
> /aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/arm-none-eabi/include/math.h:195:
> error: expected ')' before ';' token
> /aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/arm-none-eabi/include/math.h:196:
> error: expected ')' before ';' token
> /aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/arm-none-eabi/include/math.h:197:
> error: expected ')' before ';' token
> /aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/arm-none-eabi/include/math.h:198:
> error: expected ')' before ';' token
> /aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/arm-none-eabi/include/math.h:199:
> error: expected ')' before ';' token
> /aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/arm-none-eabi/include/math.h:200:
> error: expected ')' before ';' token
> /aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/arm-none-eabi/include/math.h:201:
> error: expected ')' before ';' token
> /aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/arm-none-eabi/include/time.h:110:
> error: expected unqualified-id before ';' token
> /aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/arm-none-eabi/include/time.h:110:
> error: expected ')' before ';' token
> /aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/arm-none-eabi/include/inttypes.h:323:
> error: expected ')' before ';' token
>
> All this is a bit of a mess :-)

Ugh, that's because I made a mess of the #if logic. My last change was
supposed to avoid exactly those errors, but I messed up.

I'm testing the attached patch (but not on arm or newlib), which should fix it.

[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 1655 bytes --]

commit 75f948f089ceb8888fd00913635264e20610d0f2
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Mon Jun 28 15:13:34 2021

    libstdc++: Fix backwards logic in 17_intro/names.cc test [PR 97088]
    
    I meant to undef the names that clash with newlib headers for newlib,
    but I only undef'd them for non-newlib targets. This means they still
    cause errors for newlib, and aren't tested for other targets.
    
    This fixes the test to check those names for non-newlib targets, and to
    undef them to avoid errors for newlib.
    
    libstdc++-v3/ChangeLog:
    
            PR libstdc++/97088
            * testsuite/17_intro/names.cc: Fix #if condition for names used
            by newlib headers.

diff --git a/libstdc++-v3/testsuite/17_intro/names.cc b/libstdc++-v3/testsuite/17_intro/names.cc
index 805c1002c3f..aca7a8e5812 100644
--- a/libstdc++-v3/testsuite/17_intro/names.cc
+++ b/libstdc++-v3/testsuite/17_intro/names.cc
@@ -123,6 +123,10 @@
 #define ptr (
 #endif
 
+// This clashes with newlib so don't use it.
+# define __lockable		cannot be used as an identifier
+
+
 // Common template parameter names
 #define OutputIterator		OutputIterator is not a reserved name
 #define InputIterator		InputIterator is not a reserved name
@@ -222,9 +226,9 @@
 #undef y
 #endif
 
-#if ! __has_include(<newlib.h>)
-// newlib's <sys/cdefs.h> defines __lockable as a macro, so we can't use it.
-# define __lockable		cannot be used as an identifier
+#if __has_include(<newlib.h>)
+// newlib's <sys/cdefs.h> defines __lockable as a macro.
+#undef __lockable
 // newlib's <time.h> defines __tzrule_type with these members.
 #undef d
 #undef m

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [committed] libstdc++: More workarounds in 17_intro/names.cc test [PR 97088]
  2021-06-28 14:20   ` Jonathan Wakely
@ 2021-06-28 15:26     ` Jonathan Wakely
  2021-06-28 15:43       ` Christophe LYON
  0 siblings, 1 reply; 5+ messages in thread
From: Jonathan Wakely @ 2021-06-28 15:26 UTC (permalink / raw)
  To: Christophe LYON; +Cc: libstdc++, gcc Patches

On Mon, 28 Jun 2021 at 15:20, Jonathan Wakely wrote:
>
> On Mon, 28 Jun 2021 at 12:56, Christophe LYON wrote:
> >
> >
> > On 25/06/2021 21:51, Jonathan Wakely via Libstdc++ wrote:
> > > Conditionally #undef some more names that are used in system headers.
> > >
> > > libstdc++-v3/ChangeLog:
> > >
> > >       PR libstdc++/97088
> > >       * testsuite/17_intro/names.cc: Undef more names for newlib and
> > >       also for arm-none-linux-gnueabi.
> > >       * testsuite/experimental/names.cc: Disable PCH.
> > >
> > > Tested powerpc64le-linux. Committed to trunk.
> >
> > Hi Jonathan,
> >
> > After disabling PCH, we now have the following failures on arm-eabi,
> > using newlib-3.3:
> >
> > FAIL: experimental/names.cc (test for excess errors)
> > Excess errors:
> > /aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/arm-none-eabi/include/math.h:194:
> > error: expected ')' before ';' token
> > /aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/arm-none-eabi/include/math.h:195:
> > error: expected ')' before ';' token
> > /aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/arm-none-eabi/include/math.h:196:
> > error: expected ')' before ';' token
> > /aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/arm-none-eabi/include/math.h:197:
> > error: expected ')' before ';' token
> > /aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/arm-none-eabi/include/math.h:198:
> > error: expected ')' before ';' token
> > /aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/arm-none-eabi/include/math.h:199:
> > error: expected ')' before ';' token
> > /aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/arm-none-eabi/include/math.h:200:
> > error: expected ')' before ';' token
> > /aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/arm-none-eabi/include/math.h:201:
> > error: expected ')' before ';' token
> > /aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/arm-none-eabi/include/time.h:110:
> > error: expected unqualified-id before ';' token
> > /aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/arm-none-eabi/include/time.h:110:
> > error: expected ')' before ';' token
> > /aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/arm-none-eabi/include/inttypes.h:323:
> > error: expected ')' before ';' token
> >
> > All this is a bit of a mess :-)
>
> Ugh, that's because I made a mess of the #if logic. My last change was
> supposed to avoid exactly those errors, but I messed up.
>
> I'm testing the attached patch (but not on arm or newlib), which should fix it.

That's pushed to trunk now (r12-1845).


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [committed] libstdc++: More workarounds in 17_intro/names.cc test [PR 97088]
  2021-06-28 15:26     ` Jonathan Wakely
@ 2021-06-28 15:43       ` Christophe LYON
  0 siblings, 0 replies; 5+ messages in thread
From: Christophe LYON @ 2021-06-28 15:43 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: libstdc++, gcc Patches


On 28/06/2021 17:26, Jonathan Wakely wrote:
> On Mon, 28 Jun 2021 at 15:20, Jonathan Wakely wrote:
>> On Mon, 28 Jun 2021 at 12:56, Christophe LYON wrote:
>>>
>>> On 25/06/2021 21:51, Jonathan Wakely via Libstdc++ wrote:
>>>> Conditionally #undef some more names that are used in system headers.
>>>>
>>>> libstdc++-v3/ChangeLog:
>>>>
>>>>        PR libstdc++/97088
>>>>        * testsuite/17_intro/names.cc: Undef more names for newlib and
>>>>        also for arm-none-linux-gnueabi.
>>>>        * testsuite/experimental/names.cc: Disable PCH.
>>>>
>>>> Tested powerpc64le-linux. Committed to trunk.
>>> Hi Jonathan,
>>>
>>> After disabling PCH, we now have the following failures on arm-eabi,
>>> using newlib-3.3:
>>>
>>> FAIL: experimental/names.cc (test for excess errors)
>>> Excess errors:
>>> /aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/arm-none-eabi/include/math.h:194:
>>> error: expected ')' before ';' token
>>> /aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/arm-none-eabi/include/math.h:195:
>>> error: expected ')' before ';' token
>>> /aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/arm-none-eabi/include/math.h:196:
>>> error: expected ')' before ';' token
>>> /aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/arm-none-eabi/include/math.h:197:
>>> error: expected ')' before ';' token
>>> /aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/arm-none-eabi/include/math.h:198:
>>> error: expected ')' before ';' token
>>> /aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/arm-none-eabi/include/math.h:199:
>>> error: expected ')' before ';' token
>>> /aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/arm-none-eabi/include/math.h:200:
>>> error: expected ')' before ';' token
>>> /aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/arm-none-eabi/include/math.h:201:
>>> error: expected ')' before ';' token
>>> /aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/arm-none-eabi/include/time.h:110:
>>> error: expected unqualified-id before ';' token
>>> /aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/arm-none-eabi/include/time.h:110:
>>> error: expected ')' before ';' token
>>> /aci-gcc-fsf/builds/gcc-fsf-gccsrc/tools/arm-none-eabi/include/inttypes.h:323:
>>> error: expected ')' before ';' token
>>>
>>> All this is a bit of a mess :-)
>> Ugh, that's because I made a mess of the #if logic. My last change was
>> supposed to avoid exactly those errors, but I messed up.
>>
>> I'm testing the attached patch (but not on arm or newlib), which should fix it.
> That's pushed to trunk now (r12-1845).

Thanks, I'll let you know if there are any problems.


Christophe



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-06-28 15:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-25 19:51 [committed] libstdc++: More workarounds in 17_intro/names.cc test [PR 97088] Jonathan Wakely
2021-06-28 11:55 ` Christophe LYON
2021-06-28 14:20   ` Jonathan Wakely
2021-06-28 15:26     ` Jonathan Wakely
2021-06-28 15:43       ` Christophe LYON

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).