31 lines · c
1/* RUN: %clang_cc1 -std=c89 -verify -Wreserved-macro-identifier %s2 RUN: %clang_cc1 -std=c99 -verify -Wreserved-macro-identifier %s3 RUN: %clang_cc1 -std=c11 -verify -Wreserved-macro-identifier %s4 RUN: %clang_cc1 -std=c17 -verify -Wreserved-macro-identifier %s5 RUN: %clang_cc1 -std=c2x -verify -Wreserved-macro-identifier %s6 */7 8/* WG14 DR491: partial9 * Concern with Keywords that Match Reserved Identifiers10 *11 * Claiming this as partial because we do not reject code using a reserved12 * identifier, but our reserved identifier code incorrectly identifies some13 * keywords as reserved identifiers for macro names, but not others.14 */15 16#define const const17#define int int18#define restrict restrict19 20/* FIXME: none of these should diagnose the macro name as a reserved21 * identifier per C2x 6.4.2p7 (similar wording existed in earlier standard22 * versions).23 */24#define _Static_assert _Static_assert /* expected-warning {{macro name is a reserved identifier}} */25#define _Alignof(x) _Alignof(x) /* expected-warning {{macro name is a reserved identifier}} */26#define _Bool _Bool /* expected-warning {{macro name is a reserved identifier}} */27#define __has_c_attribute __has_c_attribute /* expected-warning {{macro name is a reserved identifier}}28 expected-warning {{redefining builtin macro}}29 */30#define __restrict__ __restrict__ /* expected-warning {{macro name is a reserved identifier}} */31