File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change 1+ // RUN: %clang_cc1 -E -x c %s | FileCheck %s --check-prefixes=EXPANDED
2+ // RUN: %clang_cc1 -E -x cpp-output %s | FileCheck %s --check-prefixes=EXPANDED
3+
4+ // EXPANDED: void __attribute__((__attribute__((always_inline)))) foo()
5+
6+ #define always_inline __attribute__((always_inline))
7+ void __attribute__((always_inline )) foo () {
8+ return 4 ;
9+ }
Original file line number Diff line number Diff line change 1+ // RUN: %clang_cc1 -E -x c %s | FileCheck %s
2+ // RUN: %clang_cc1 -x c -fsyntax-only %s -verify
3+ // RUN: %clang_cc1 -x cpp-output -fsyntax-only -verify %s
4+ // expected-no-diagnostics
5+
6+ // The preprocessor does not expand macro-identifiers in #pragma directives.
7+ // When we preprocess & parse the code, clang expands the macros in directives.
8+ // When we parse already preprocessed code, clang still has to expand the
9+ // macros in the directives.
10+ // This means that we're not always able to parse the preprocessor's output
11+ // without preserving the definitions (-dD).
12+
13+ #define FACTOR 4
14+
15+ void foo () {
16+ // CHECK: #pragma unroll FACTOR
17+ #pragma unroll FACTOR
18+ for (;;) {
19+ }
20+ return ;
21+ }
You can’t perform that action at this time.
0 commit comments