llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Rainer Orth (rorth)

<details>
<summary>Changes</summary>

Since commit 613a077b05b8352a48695be295037306f5fca151, `flang` doesn't build 
any longer on Solaris/amd64:
```
flang/lib/Evaluate/intrinsics-library.cpp:225:26:
error: address of overloaded function 'acos' does not match required type 
'__float128 (__float128)'
  225 |       FolderFactory&lt;F, F{std::acos}&gt;::Create("acos"),
      |                          ^~~~~~~~~
```
That patch led to the version of `quadmath.h` deep inside `/usr/gcc/&lt;N&gt;` 
to be found, thus `HAS_QUADMATHLIB` is defined.  However, the `struct 
HostRuntimeLibrary&lt;__float128, LibraryVersion::Libm&gt;` template is guarded 
by `_POSIX_C_SOURCE &gt;= 200112L || _XOPEN_SOURCE &gt;= 600`, while `clang` 
only predefines `_XOPEN_SOURCE=500`.

This code dates back to commit 0c1941cb055fcf008e17faa6605969673211bea3 back in 
2012.  Currently, this is long obsolete and `gcc` prefefines 
`_XOPEN_SOURCE=600` instead since GCC 4.6 back in 2011.

This patch follows that.

Tested on `amd64-pc-solaris2.11` and `sparcv9-sun-solaris2.11`.

---
Full diff: https://github.com/llvm/llvm-project/pull/137141.diff


1 Files Affected:

- (modified) clang/lib/Basic/Targets/OSTargets.h (+1-8) 


``````````diff
diff --git a/clang/lib/Basic/Targets/OSTargets.h 
b/clang/lib/Basic/Targets/OSTargets.h
index a88c851797aab..d148b38d03c7c 100644
--- a/clang/lib/Basic/Targets/OSTargets.h
+++ b/clang/lib/Basic/Targets/OSTargets.h
@@ -618,14 +618,7 @@ class LLVM_LIBRARY_VISIBILITY SolarisTargetInfo : public 
OSTargetInfo<Target> {
     DefineStd(Builder, "unix", Opts);
     Builder.defineMacro("__svr4__");
     Builder.defineMacro("__SVR4");
-    // Solaris headers require _XOPEN_SOURCE to be set to 600 for C99 and
-    // newer, but to 500 for everything else.  feature_test.h has a check to
-    // ensure that you are not using C99 with an old version of X/Open or C89
-    // with a new version.
-    if (Opts.C99)
-      Builder.defineMacro("_XOPEN_SOURCE", "600");
-    else
-      Builder.defineMacro("_XOPEN_SOURCE", "500");
+    Builder.defineMacro("_XOPEN_SOURCE", "600");
     if (Opts.CPlusPlus) {
       Builder.defineMacro("__C99FEATURES__");
       Builder.defineMacro("_FILE_OFFSET_BITS", "64");

``````````

</details>


https://github.com/llvm/llvm-project/pull/137141
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to