public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: libcpp PATCH to avoid deprecated copy assignment
@ 2018-05-22  1:42 Gerald Pfeifer
  2018-05-22  4:45 ` Jason Merrill
  0 siblings, 1 reply; 6+ messages in thread
From: Gerald Pfeifer @ 2018-05-22  1:42 UTC (permalink / raw)
  To: Jason Merrill, gcc-patches

Hi Jason,

I'm afraid this change

  2018-05-17  Jason Merrill  <jason@redhat.com>

        * line-map.c (linemap_init): Use placement new.
        * system.h: #include <new>.

broke bootstrap on systems using libc++ instead of libstdc++ (such 
as newer versions of FreeBSD, reported on FreeBSD 11 but could also
be noticable on Darwin):

  gmake[3]: Entering directory '/scratch/tmp/gerald/OBJ-0522-0110/build-x86_64-unknown-freebsd11.2/libcpp'
  c++ -std=gnu++98  -I/scratch/tmp/gerald/gcc-HEAD/libcpp -I. 
  -I/scratch/tmp/gerald/gcc-HEAD/libcpp/../include
  -I/scratch/tmp/gerald/gcc-HEAD/libcpp/include  
  -g -O2 -W -Wall -Wno-narrowing -Wwrite-strings -Wmissing-format-attribute 
  -pedantic -Wno-long-long  -fno-exceptions -fno-rtti
  -I/scratch/tmp/gerald/gcc-HEAD/libcpp -I. 
  -I/scratch/tmp/gerald/gcc-HEAD/libcpp/../include 
  -I/scratch/tmp/gerald/gcc-HEAD/libcpp/include   -c -o charset.o 
  -MT charset.o -MMD -MP -MF .deps/charset.Tpo
  /scratch/tmp/gerald/gcc-HEAD/libcpp/charset.c
  In file included from /scratch/tmp/gerald/gcc-HEAD/libcpp/charset.c:21:/scratch/tmp/gerald/gcc-HEAD/libcpp/system.h:435:9: warning: keyword is hidden by macro definition [-Wkeyword-macro]
  #define true 1
          ^
  /scratch/tmp/gerald/gcc-HEAD/libcpp/system.h:436:9: warning: keyword is hidden by macro definition [-Wkeyword-macro]
  #define false 0
          ^
  In file included from /scratch/tmp/gerald/gcc-HEAD/libcpp/charset.c:21:
  In file included from /scratch/tmp/gerald/gcc-HEAD/libcpp/system.h:442:
  In file included from /usr/include/c++/v1/new:91:
  /usr/include/c++/v1/exception:180:5: error: no member named 'fancy_abort' in namespace 'std::__1'; did you mean simply 'fancy_abort'?
      _VSTD::abort();
      ^~~~~~~
  /usr/include/c++/v1/__config:447:15: note: expanded from macro '_VSTD'
  #define _VSTD std::_LIBCPP_NAMESPACE
                ^
  /scratch/tmp/gerald/gcc-HEAD/libcpp/system.h:399:13: note: 'fancy_abort' declared here
      extern void fancy_abort (const char *, int, const char *) ATTRIBUTE_NORETURN;
                  ^


The problem appears to be the added #include <new>; we had a similar
situation last October, cf. the thread starting at

  https://gcc.gnu.org/ml/gcc-patches/2017-10/threads.html#01478

Simply adding #include <memory> before #include <new> does not help
in this case, though; I just tried that.

Gerald

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

* Re: libcpp PATCH to avoid deprecated copy assignment
  2018-05-22  1:42 libcpp PATCH to avoid deprecated copy assignment Gerald Pfeifer
@ 2018-05-22  4:45 ` Jason Merrill
  2018-05-23  6:41   ` Gerald Pfeifer
  0 siblings, 1 reply; 6+ messages in thread
From: Jason Merrill @ 2018-05-22  4:45 UTC (permalink / raw)
  To: Gerald Pfeifer; +Cc: gcc-patches List

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

On Mon, May 21, 2018 at 9:25 PM, Gerald Pfeifer <gerald@pfeifer.com> wrote:
> Hi Jason,
>
> I'm afraid this change
>
>   2018-05-17  Jason Merrill  <jason@redhat.com>
>
>         * line-map.c (linemap_init): Use placement new.
>         * system.h: #include <new>.
>
> broke bootstrap on systems using libc++ instead of libstdc++ (such
> as newer versions of FreeBSD, reported on FreeBSD 11 but could also
> be noticable on Darwin):
>
>   gmake[3]: Entering directory '/scratch/tmp/gerald/OBJ-0522-0110/build-x86_64-unknown-freebsd11.2/libcpp'
>   c++ -std=gnu++98  -I/scratch/tmp/gerald/gcc-HEAD/libcpp -I.
>   -I/scratch/tmp/gerald/gcc-HEAD/libcpp/../include
>   -I/scratch/tmp/gerald/gcc-HEAD/libcpp/include
>   -g -O2 -W -Wall -Wno-narrowing -Wwrite-strings -Wmissing-format-attribute
>   -pedantic -Wno-long-long  -fno-exceptions -fno-rtti
>   -I/scratch/tmp/gerald/gcc-HEAD/libcpp -I.
>   -I/scratch/tmp/gerald/gcc-HEAD/libcpp/../include
>   -I/scratch/tmp/gerald/gcc-HEAD/libcpp/include   -c -o charset.o
>   -MT charset.o -MMD -MP -MF .deps/charset.Tpo
>   /scratch/tmp/gerald/gcc-HEAD/libcpp/charset.c
>   In file included from /scratch/tmp/gerald/gcc-HEAD/libcpp/charset.c:21:/scratch/tmp/gerald/gcc-HEAD/libcpp/system.h:435:9: warning: keyword is hidden by macro definition [-Wkeyword-macro]
>   #define true 1
>           ^
>   /scratch/tmp/gerald/gcc-HEAD/libcpp/system.h:436:9: warning: keyword is hidden by macro definition [-Wkeyword-macro]
>   #define false 0
>           ^
>   In file included from /scratch/tmp/gerald/gcc-HEAD/libcpp/charset.c:21:
>   In file included from /scratch/tmp/gerald/gcc-HEAD/libcpp/system.h:442:
>   In file included from /usr/include/c++/v1/new:91:
>   /usr/include/c++/v1/exception:180:5: error: no member named 'fancy_abort' in namespace 'std::__1'; did you mean simply 'fancy_abort'?
>       _VSTD::abort();
>       ^~~~~~~
>   /usr/include/c++/v1/__config:447:15: note: expanded from macro '_VSTD'
>   #define _VSTD std::_LIBCPP_NAMESPACE
>                 ^
>   /scratch/tmp/gerald/gcc-HEAD/libcpp/system.h:399:13: note: 'fancy_abort' declared here
>       extern void fancy_abort (const char *, int, const char *) ATTRIBUTE_NORETURN;
>                   ^
>
>
> The problem appears to be the added #include <new>; we had a similar
> situation last October, cf. the thread starting at
>
>   https://gcc.gnu.org/ml/gcc-patches/2017-10/threads.html#01478
>
> Simply adding #include <memory> before #include <new> does not help
> in this case, though; I just tried that.

Does moving the #include <new> up higher help?

[-- Attachment #2: libcpp-new.diff --]
[-- Type: text/x-patch, Size: 893 bytes --]

commit 76804c272544cdc90bd2b468f52f414e18f1c6da
Author: Jason Merrill <jason@redhat.com>
Date:   Mon May 21 22:02:11 2018 -0400

            * system.h: #include <new> earlier.

diff --git a/libcpp/system.h b/libcpp/system.h
index 76420e16cfb..3fde817cb83 100644
--- a/libcpp/system.h
+++ b/libcpp/system.h
@@ -37,6 +37,10 @@ along with GCC; see the file COPYING3.  If not see
 
 #include <stdio.h>
 
+#ifdef __cplusplus
+#include <new>
+#endif
+
 /* Define a generic NULL if one hasn't already been defined.  */
 #ifndef NULL
 #define NULL 0
@@ -438,10 +442,6 @@ extern void fancy_abort (const char *, int, const char *) ATTRIBUTE_NORETURN;
 /* Some compilers do not allow the use of unsigned char in bitfields.  */
 #define BOOL_BITFIELD unsigned int
 
-#ifdef __cplusplus
-#include <new>
-#endif
-
 /* Poison identifiers we do not want to use.  */
 #if (GCC_VERSION >= 3000)
 #undef calloc

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

* Re: libcpp PATCH to avoid deprecated copy assignment
  2018-05-22  4:45 ` Jason Merrill
@ 2018-05-23  6:41   ` Gerald Pfeifer
  2018-05-23 17:31     ` Jason Merrill
  0 siblings, 1 reply; 6+ messages in thread
From: Gerald Pfeifer @ 2018-05-23  6:41 UTC (permalink / raw)
  To: Jason Merrill; +Cc: gcc-patches List

On Mon, 21 May 2018, Jason Merrill wrote:
>> broke bootstrap on systems using libc++ instead of libstdc++

>>   In file included from /usr/include/c++/v1/new:91:
>>   /usr/include/c++/v1/exception:180:5: error: no member named 'fancy_abort' in namespace 'std::__1'; did you mean simply 'fancy_abort'?
>>       _VSTD::abort();

>> The problem appears to be the added #include <new>
> Does moving the #include <new> up higher help?

Yes, it does!

(Tested both with a direct bootstrap and by adding this to the 
FreeBSD port of gcc9-devel; both succeeded now.)

Thanks,
Gerald

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

* Re: libcpp PATCH to avoid deprecated copy assignment
  2018-05-23  6:41   ` Gerald Pfeifer
@ 2018-05-23 17:31     ` Jason Merrill
  2018-05-24 13:33       ` Gerald Pfeifer
  0 siblings, 1 reply; 6+ messages in thread
From: Jason Merrill @ 2018-05-23 17:31 UTC (permalink / raw)
  To: Gerald Pfeifer; +Cc: gcc-patches List

On Wed, May 23, 2018 at 1:33 AM, Gerald Pfeifer <gerald@pfeifer.com> wrote:
> On Mon, 21 May 2018, Jason Merrill wrote:
>>> broke bootstrap on systems using libc++ instead of libstdc++
>
>>>   In file included from /usr/include/c++/v1/new:91:
>>>   /usr/include/c++/v1/exception:180:5: error: no member named 'fancy_abort' in namespace 'std::__1'; did you mean simply 'fancy_abort'?
>>>       _VSTD::abort();
>
>>> The problem appears to be the added #include <new>
>> Does moving the #include <new> up higher help?
>
> Yes, it does!
>
> (Tested both with a direct bootstrap and by adding this to the
> FreeBSD port of gcc9-devel; both succeeded now.)

Great, applied.

Jason

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

* Re: libcpp PATCH to avoid deprecated copy assignment
  2018-05-23 17:31     ` Jason Merrill
@ 2018-05-24 13:33       ` Gerald Pfeifer
  0 siblings, 0 replies; 6+ messages in thread
From: Gerald Pfeifer @ 2018-05-24 13:33 UTC (permalink / raw)
  To: Jason Merrill; +Cc: gcc-patches List

On Wed, 23 May 2018, Jason Merrill wrote:
> Great, applied.

Thank you!

Gerald

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

* libcpp PATCH to avoid deprecated copy assignment
@ 2018-05-17 23:46 Jason Merrill
  0 siblings, 0 replies; 6+ messages in thread
From: Jason Merrill @ 2018-05-17 23:46 UTC (permalink / raw)
  To: gcc-patches List

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

Another case of assignment from a value-initialized temporary, which
in this case ought to be placement new.

Tested x86_64-pc-linux-gnu, applying to trunk.

[-- Attachment #2: linemap.diff --]
[-- Type: text/x-patch, Size: 1170 bytes --]

commit ccd4031ebdabf02fe0d54bb43a68c0fa72ec2708
Author: Jason Merrill <jason@redhat.com>
Date:   Thu May 17 17:16:28 2018 -0400

            * line-map.c (linemap_init): Use placement new.
    
            * system.h: #include <new>.

diff --git a/libcpp/line-map.c b/libcpp/line-map.c
index a84084c99f0..b2ebfeb16d4 100644
--- a/libcpp/line-map.c
+++ b/libcpp/line-map.c
@@ -348,7 +348,7 @@ linemap_init (struct line_maps *set,
   /* PR33916, needed to fix PR82939.  */
   memset (set, 0, sizeof (struct line_maps));
 #else
-  *set = line_maps ();
+  new (set) line_maps();
 #endif
   set->highest_location = RESERVED_LOCATION_COUNT - 1;
   set->highest_line = RESERVED_LOCATION_COUNT - 1;
diff --git a/libcpp/system.h b/libcpp/system.h
index 719435df949..76420e16cfb 100644
--- a/libcpp/system.h
+++ b/libcpp/system.h
@@ -438,6 +438,10 @@ extern void fancy_abort (const char *, int, const char *) ATTRIBUTE_NORETURN;
 /* Some compilers do not allow the use of unsigned char in bitfields.  */
 #define BOOL_BITFIELD unsigned int
 
+#ifdef __cplusplus
+#include <new>
+#endif
+
 /* Poison identifiers we do not want to use.  */
 #if (GCC_VERSION >= 3000)
 #undef calloc

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

end of thread, other threads:[~2018-05-24 13:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-22  1:42 libcpp PATCH to avoid deprecated copy assignment Gerald Pfeifer
2018-05-22  4:45 ` Jason Merrill
2018-05-23  6:41   ` Gerald Pfeifer
2018-05-23 17:31     ` Jason Merrill
2018-05-24 13:33       ` Gerald Pfeifer
  -- strict thread matches above, loose matches on Subject: below --
2018-05-17 23:46 Jason Merrill

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).