[PS4/PS5] Specify no <complex.h> or <threads.h>
authorPaul Robinson <paul.robinson@sony.com>
Wed, 22 Feb 2023 19:55:34 +0000 (11:55 -0800)
committerPaul Robinson <paul.robinson@sony.com>
Thu, 23 Feb 2023 15:09:30 +0000 (07:09 -0800)
We've never provided these headers so set the preprocessor
toggles to reflect that.

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

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

index fd372cb12df2b4bc7b50b4a44dd7840b40dd1a94..0280129b3c9501cd0b9741c812707354999e3a19 100644 (file)
@@ -535,6 +535,8 @@ protected:
     DefineStd(Builder, "unix", Opts);
     Builder.defineMacro("__ELF__");
     Builder.defineMacro("__SCE__");
+    Builder.defineMacro("__STDC_NO_COMPLEX__");
+    Builder.defineMacro("__STDC_NO_THREADS__");
   }
 
 public:
index c52ea22d99277adafa79bba2f8fb9b9d7d168f78..388b905a5ed414980e1d5e335640ceb43adb431a 100644 (file)
@@ -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;