brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · 388b905 Raw
55 lines · c
1// RUN: %clang_cc1 -verify -Wno-vla %s2 3/* WG14 N1460: Yes4 * Subsetting the standard5 */6 7// If we claim to not support the feature then we expect diagnostics when8// using that feature. Otherwise, we expect no diagnostics.9#ifdef __STDC_NO_COMPLEX__10  // PS4/PS5 set this to indicate no <complex.h> but still support the11  // _Complex syntax.12  #ifdef __SCE__13    #define HAS_COMPLEX14  #else15    // We do not have any other targets which do not support complex, so we16    // don't expect to get into this block.17    #error "it's unexpected that we don't support complex"18  #endif19  float _Complex fc;20  double _Complex dc;21  long double _Complex ldc;22#else23  #define HAS_COMPLEX24  float _Complex fc;25  double _Complex dc;26  long double _Complex ldc;27#endif28 29#ifdef __STDC_NO_VLA__30  // We do not have any targets which do not support VLAs, so we don't expect31  // to get into this block.32  #error "it's unexpected that we don't support VLAs"33 34  void func(int n, int m[n]) {35    int array[n];36  }37#else38  #define HAS_VLA39  void func(int n, int m[n]) {40    int array[n];41  }42#endif43 44// NB: it's not possible to test for __STDC_NO_THREADS__ because that is45// specifically about whether <threads.h> exists and is supported, which is46// outside the control of the compiler. It does not cover use of thread_local.47 48#if defined(HAS_COMPLEX) && defined(HAS_VLA)49// If we support all these optional features, we don't expect any other50// diagnostics to have fired.51 52// expected-no-diagnostics53#endif54 55