1 /* RUN: %clang_cc1 -std=c89 -fsyntax-only -verify -DC89 -Wno-c11-extensions %s 2 RUN: %clang_cc1 -std=c99 -fsyntax-only -verify -DC99 -Wno-c11-extensions %s 3 RUN: %clang_cc1 -std=c11 -fsyntax-only -verify -DC11 %s 4 RUN: %clang_cc1 -std=c17 -fsyntax-only -verify -DC17 %s 5 RUN: %clang_cc1 -std=c2x -fsyntax-only -verify -DC2X %s 6 */ 7 8 /* expected-no-diagnostics */ 9 10 /* WG14 DR411: yes 11 * Predefined macro values 12 * 13 * Note: the DR is about the C11 macro value, but we'll test all the standard 14 * version macro values just to be sure. We do not need to test 15 * __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 #endif 21 #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 #else 30 #error "unknown language standard version" 31 #endif 32 33