analyzer: Define INCLUDE_UNIQUE_PTR

Message ID 20210910080152.2933-1-maxim.blinov@embecosm.com
State Superseded
Headers show
Series
  • analyzer: Define INCLUDE_UNIQUE_PTR
Related show

Commit Message

Maxim Blinov Sept. 10, 2021, 8:01 a.m.
Un-break the build for AArch64 Darwin. Build currently fails with an
error very similar to pr82091:

```
In file included from ../../../gcc-master-wip-apple-si/gcc/analyzer/engine.cc:69:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/memory:678:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/stdexcept:239:5: error: no member named 'fancy_abort' in namespace 'std::__1'; did you mean simply 'fancy_abort'?
    _VSTD::abort();
    ^~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__config:852:15: note: expanded from macro '_VSTD'

../../../gcc-master-wip-apple-si/gcc/system.h:777:13: note: 'fancy_abort' declared here
extern void fancy_abort (const char *, int, const char *)
            ^
```

Judging from the following comment in gcc/system.h, we just need to
define INCLUDE_UNIQUE_PTR since commit eafa9d96923 added the inclusion
of <memory>:

```
/* Some of the headers included by <memory> can use "abort" within a
   namespace, e.g. "_VSTD::abort();", which fails after we use the
   preprocessor to redefine "abort" as "fancy_abort" below.
   Given that unique-ptr.h can use "free", we need to do this after "free"
   is declared but before "abort" is overridden.  */

```

gcc/analyzer/ChangeLog:
	* engine.cc: Define INCLUDE_UNIQUE_PTR.
---
 gcc/analyzer/engine.cc | 1 +
 1 file changed, 1 insertion(+)

-- 
2.30.1 (Apple Git-130)

Comments

Antony Polukhin via Gcc-patches Sept. 10, 2021, 2:38 p.m. | #1
On Fri, 2021-09-10 at 09:01 +0100, Maxim Blinov wrote:
> Un-break the build for AArch64 Darwin. Build currently fails with an

> error very similar to pr82091:

> 

> ```

> In file included from ../../../gcc-master-wip-apple-

> si/gcc/analyzer/engine.cc:69:

> In file included from

> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/

> Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/memory:678:

> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/

> Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/stdexcept:239:5: error:

> no member named 'fancy_abort' in namespace 'std::__1'; did you mean

> simply 'fancy_abort'?

>     _VSTD::abort();

>     ^~~~~~~

> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/

> Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/__config:852:15: note:

> expanded from macro '_VSTD'

> 

> ../../../gcc-master-wip-apple-si/gcc/system.h:777:13: note:

> 'fancy_abort' declared here

> extern void fancy_abort (const char *, int, const char *)

>             ^

> ```

> 

> Judging from the following comment in gcc/system.h, we just need to

> define INCLUDE_UNIQUE_PTR since commit eafa9d96923 added the

> inclusion

> of <memory>:

> 

> ```

> /* Some of the headers included by <memory> can use "abort" within a

>    namespace, e.g. "_VSTD::abort();", which fails after we use the

>    preprocessor to redefine "abort" as "fancy_abort" below.

>    Given that unique-ptr.h can use "free", we need to do this after

> "free"

>    is declared but before "abort" is overridden.  */

> 

> ```


Sorry about the breakage.

Does the patch fix the build for you?

If so, looks good for trunk.  Please reference PR bootstrap/102242 in
the ChangeLog entry.

Thanks
Dave


> 

> gcc/analyzer/ChangeLog:

>         * engine.cc: Define INCLUDE_UNIQUE_PTR.

> ---

>  gcc/analyzer/engine.cc | 1 +

>  1 file changed, 1 insertion(+)

> 

> diff --git a/gcc/analyzer/engine.cc b/gcc/analyzer/engine.cc

> index 24f0931197d..f21f8e5b78a 100644

> --- a/gcc/analyzer/engine.cc

> +++ b/gcc/analyzer/engine.cc

> @@ -19,6 +19,7 @@ along with GCC; see the file COPYING3.  If not see

>  <http://www.gnu.org/licenses/>.  */

>  

>  #include "config.h"

> +#define INCLUDE_UNIQUE_PTR

>  #include "system.h"

>  #include "coretypes.h"

>  #include "tree.h"

Patch

diff --git a/gcc/analyzer/engine.cc b/gcc/analyzer/engine.cc
index 24f0931197d..f21f8e5b78a 100644
--- a/gcc/analyzer/engine.cc
+++ b/gcc/analyzer/engine.cc
@@ -19,6 +19,7 @@  along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
 
 #include "config.h"
+#define INCLUDE_UNIQUE_PTR
 #include "system.h"
 #include "coretypes.h"
 #include "tree.h"