[PATCH] D18360: Add AIX Target/ToolChain to Clang Driver

Andrew Paprocki via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 18 13:36:51 PDT 2016


apaprocki added inline comments.

================
Comment at: lib/Basic/Targets.cpp:718
@@ +717,3 @@
+    Builder.defineMacro("_LONG_LONG");
+    Builder.defineMacro("_ALL_SOURCE");
+    Builder.defineMacro("_REENTRANT");
----------------
majnemer wrote:
> apaprocki wrote:
> > majnemer wrote:
> > > Are we really supposed to define this macro?  Does GCC define this?  I cannot find where it does so in the source.
> > I defined both `_ALL_SOURCE` and `_REENTRANT` because the `SolarisTargetInfo` defines them (`__EXTENSIONS__` is the Solaris equivalent of `_ALL_SOURCE`). If that is an oversight in the Solaris work, I'll remove `_ALL_SOURCE` here. GCC does not define it by default.
> After a closer examination of the gcc sources, it looks like `ALL_SOURCE` is defined if gcc is being used for C++ code (via `CPLUSPLUS_CPP_SPEC`).
> 
> I don't see where `_REENTRANT` is defined for AIX though...
On AIX, when `gcc` is passed `-pthread`, it defines `_THREAD_SAFE`. I think this should be changed to

```
    if (Opts.POSIXThreads)
      Builder.defineMacro("_THREAD_SAFE");
```

On Solaris, `gcc` defines `_REENTRANT` when `-pthread` is passed. I think it is a separate bug (and I can file a separate revision) to put the Solaris use of it also on an `Opts.POSIXThreads` check.


https://reviews.llvm.org/D18360





More information about the cfe-commits mailing list