brintos

brintos / llvm-project-archived public Read only

0
0
Text · 858 B · 31c0922 Raw
32 lines · c
1// RUN: %clang_cc1 -verify -std=c99 %s2// RUN: %clang_cc1 -E -std=c99 %s | FileCheck %s3// expected-no-diagnostics4 5/* WG14 N570: Yes6 * Empty macro arguments7 *8 * NB: the original paper is not available online anywhere, so the test9 * coverage is coming from what could be gleaned from the C99 rationale10 * document. In C89, it was UB to pass no arguments to a function-like macro,11 * and that's now supported in C99.12 */13 14#define TEN 1015#define U u16#define I // expands into no preprocessing tokens17#define L L18#define glue(a, b) a ## b19#define xglue(a, b) glue(a, b)20 21const unsigned u = xglue(TEN, U);22const int i = xglue(TEN, I);23const long l = xglue(TEN, L);24 25// CHECK: const unsigned u = 10u;26// CHECK-NEXT: const int i = 10;27// CHECK-NEXT: const long l = 10L;28 29_Static_assert(u == 10U, "");30_Static_assert(i == 10, "");31_Static_assert(l == 10L, "");32