33 lines · c
1/* RUN: %clang_cc1 -std=c89 -fsyntax-only -verify -DC89 -Wno-c11-extensions %s2 RUN: %clang_cc1 -std=c99 -fsyntax-only -verify -DC99 -Wno-c11-extensions %s3 RUN: %clang_cc1 -std=c11 -fsyntax-only -verify -DC11 %s4 RUN: %clang_cc1 -std=c17 -fsyntax-only -verify -DC17 %s5 RUN: %clang_cc1 -std=c2x -fsyntax-only -verify -DC2X %s6 */7 8/* expected-no-diagnostics */9 10/* WG14 DR411: yes11 * Predefined macro values12 *13 * Note: the DR is about the C11 macro value, but we'll test all the standard14 * version macro values just to be sure. We do not need to test15 * __STDC_LIB_EXT1__ values because that requires an Annex K-compatible header.16 */17#if defined(C89)18#ifdef __STDC_VERSION__19#error "C89 didn't have this macro!"20#endif21#elif defined(C99)22_Static_assert(__STDC_VERSION__ == 199901L, "");23#elif defined(C11)24_Static_assert(__STDC_VERSION__ == 201112L, "");25#elif defined(C17)26_Static_assert(__STDC_VERSION__ == 201710L, "");27#elif defined(C2X)28_Static_assert(__STDC_VERSION__ == 202311L, "");29#else30#error "unknown language standard version"31#endif32 33