[clang] 32d441b - [PS4/PS5] Specify no <complex.h> or <threads.h>

Paul Robinson via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 23 07:09:41 PST 2023


Author: Paul Robinson
Date: 2023-02-23T07:09:30-08:00
New Revision: 32d441bfb4f302e02736dc922b0388c7594fd90e

URL: https://github.com/llvm/llvm-project/commit/32d441bfb4f302e02736dc922b0388c7594fd90e
DIFF: https://github.com/llvm/llvm-project/commit/32d441bfb4f302e02736dc922b0388c7594fd90e.diff

LOG: [PS4/PS5] Specify no <complex.h> or <threads.h>

We've never provided these headers so set the preprocessor
toggles to reflect that.

Differential Revision: https://reviews.llvm.org/D144586

Added: 
    

Modified: 
    clang/lib/Basic/Targets/OSTargets.h
    clang/test/C/C11/n1460.c

Removed: 
    


################################################################################
diff  --git a/clang/lib/Basic/Targets/OSTargets.h b/clang/lib/Basic/Targets/OSTargets.h
index fd372cb12df2b..0280129b3c950 100644
--- a/clang/lib/Basic/Targets/OSTargets.h
+++ b/clang/lib/Basic/Targets/OSTargets.h
@@ -535,6 +535,8 @@ class LLVM_LIBRARY_VISIBILITY PSOSTargetInfo : public OSTargetInfo<Target> {
     DefineStd(Builder, "unix", Opts);
     Builder.defineMacro("__ELF__");
     Builder.defineMacro("__SCE__");
+    Builder.defineMacro("__STDC_NO_COMPLEX__");
+    Builder.defineMacro("__STDC_NO_THREADS__");
   }
 
 public:

diff  --git a/clang/test/C/C11/n1460.c b/clang/test/C/C11/n1460.c
index c52ea22d99277..388b905a5ed41 100644
--- a/clang/test/C/C11/n1460.c
+++ b/clang/test/C/C11/n1460.c
@@ -7,9 +7,15 @@
 // If we claim to not support the feature then we expect diagnostics when
 // using that feature. Otherwise, we expect no diagnostics.
 #ifdef __STDC_NO_COMPLEX__
-  // We do not have any targets which do not support complex, so we don't
-  // expect to get into this block.
-  #error "it's unexpected that we don't support complex"
+  // PS4/PS5 set this to indicate no <complex.h> but still support the
+  // _Complex syntax.
+  #ifdef __SCE__
+    #define HAS_COMPLEX
+  #else
+    // We do not have any other targets which do not support complex, so we
+    // don't expect to get into this block.
+    #error "it's unexpected that we don't support complex"
+  #endif
   float _Complex fc;
   double _Complex dc;
   long double _Complex ldc;


        


More information about the cfe-commits mailing list