Chandler Carruth | 1aaddf2 | 2011-10-16 07:20:21 +0000 | [diff] [blame] | 1 | // Tests for macro expansion backtraces. The RUN and CHECK lines are grouped |
| 2 | // below the test code to reduce noise when updating them. |
Douglas Gregor | 6c1cb99 | 2010-05-04 17:13:42 +0000 | [diff] [blame] | 3 | |
| 4 | #define M1(A, B) ((A) < (B)) |
| 5 | #define M2(A, B) M1(A, B) |
| 6 | #define M3(A, B) M2(A, B) |
| 7 | #define M4(A, B) M3(A, B) |
| 8 | #define M5(A, B) M4(A, B) |
| 9 | #define M6(A, B) M5(A, B) |
| 10 | #define M7(A, B) M6(A, B) |
| 11 | #define M8(A, B) M7(A, B) |
| 12 | #define M9(A, B) M8(A, B) |
| 13 | #define M10(A, B) M9(A, B) |
| 14 | #define M11(A, B) M10(A, B) |
| 15 | #define M12(A, B) M11(A, B) |
| 16 | |
| 17 | void f(int *ip, float *fp) { |
Chandler Carruth | 1aaddf2 | 2011-10-16 07:20:21 +0000 | [diff] [blame] | 18 | if (M12(ip, fp)) { } |
Chandler Carruth | e0376c0 | 2011-10-16 07:20:23 +0000 | [diff] [blame^] | 19 | // RUN: %clang_cc1 -fsyntax-only -fmacro-backtrace-limit 5 %s 2>&1 \ |
| 20 | // RUN: | FileCheck %s -check-prefix=CHECK-LIMIT |
| 21 | // CHECK-LIMIT: macro-backtrace.c:18:7: warning: comparison of distinct pointer types ('int *' and 'float *') |
| 22 | // CHECK-LIMIT: if (M12(ip, fp)) { } |
| 23 | // CHECK-LIMIT: macro-backtrace.c:15:19: note: expanded from: |
| 24 | // CHECK-LIMIT: #define M12(A, B) M11(A, B) |
| 25 | // CHECK-LIMIT: macro-backtrace.c:14:19: note: expanded from: |
| 26 | // CHECK-LIMIT: #define M11(A, B) M10(A, B) |
| 27 | // CHECK-LIMIT: note: (skipping 7 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) |
| 28 | // CHECK-LIMIT: macro-backtrace.c:6:18: note: expanded from: |
| 29 | // CHECK-LIMIT: #define M3(A, B) M2(A, B) |
| 30 | // CHECK-LIMIT: macro-backtrace.c:5:18: note: expanded from: |
| 31 | // CHECK-LIMIT: #define M2(A, B) M1(A, B) |
| 32 | // CHECK-LIMIT: macro-backtrace.c:4:23: note: expanded from: |
| 33 | // CHECK-LIMIT: #define M1(A, B) ((A) < (B)) |
Douglas Gregor | 6c1cb99 | 2010-05-04 17:13:42 +0000 | [diff] [blame] | 34 | } |