Files
TheRock/compiler/amd-llvm/clang/test/Misc/macro-backtrace.c
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

58 lines
2.9 KiB
C

// Tests for macro expansion backtraces. The RUN and CHECK lines are grouped
// below the test code to reduce noise when updating them.
#define M1(A, B) ((A) < (B))
#define M2(A, B) M1(A, B)
#define M3(A, B) M2(A, B)
#define M4(A, B) M3(A, B)
#define M5(A, B) M4(A, B)
#define M6(A, B) M5(A, B)
#define M7(A, B) M6(A, B)
#define M8(A, B) M7(A, B)
#define M9(A, B) M8(A, B)
#define M10(A, B) M9(A, B)
#define M11(A, B) M10(A, B)
#define M12(A, B) M11(A, B)
void f(int *ip, float *fp) {
if (M12(ip, fp)) { }
// RUN: %clang_cc1 -fsyntax-only -fmacro-backtrace-limit=5 %s 2>&1 \
// RUN: | FileCheck %s -check-prefix=CHECK-LIMIT
// CHECK-LIMIT: macro-backtrace.c:18:7: warning: comparison of distinct pointer types ('int *' and 'float *')
// CHECK-LIMIT: if (M12(ip, fp)) { }
// CHECK-LIMIT: macro-backtrace.c:15:19: note: expanded from macro 'M12'
// CHECK-LIMIT: #define M12(A, B) M11(A, B)
// CHECK-LIMIT: macro-backtrace.c:14:19: note: expanded from macro 'M11'
// CHECK-LIMIT: #define M11(A, B) M10(A, B)
// CHECK-LIMIT: note: (skipping 7 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
// CHECK-LIMIT: macro-backtrace.c:6:18: note: expanded from macro 'M3'
// CHECK-LIMIT: #define M3(A, B) M2(A, B)
// CHECK-LIMIT: macro-backtrace.c:5:18: note: expanded from macro 'M2'
// CHECK-LIMIT: #define M2(A, B) M1(A, B)
// CHECK-LIMIT: macro-backtrace.c:4:23: note: expanded from macro 'M1'
// CHECK-LIMIT: #define M1(A, B) ((A) < (B))
// RUN: %clang_cc1 -fsyntax-only -fno-caret-diagnostics %s 2>&1 \
// RUN: | FileCheck %s -check-prefix=CHECK-NO-CARETS
// CHECK-NO-CARETS: macro-backtrace.c:18:7: warning: comparison of distinct pointer types ('int *' and 'float *')
// CHECK-NO-CARETS-NEXT: macro-backtrace.c:15:19: note: expanded from macro 'M12'
// CHECK-NO-CARETS-NEXT: macro-backtrace.c:14:19: note: expanded from macro 'M11'
// CHECK-NO-CARETS-NEXT: macro-backtrace.c:13:19: note: expanded from macro 'M10'
// CHECK-NO-CARETS-NEXT: note: (skipping 6 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
// CHECK-NO-CARETS-NEXT: macro-backtrace.c:6:18: note: expanded from macro 'M3'
// CHECK-NO-CARETS-NEXT: macro-backtrace.c:5:18: note: expanded from macro 'M2'
// CHECK-NO-CARETS-NEXT: macro-backtrace.c:4:23: note: expanded from macro 'M1'
// Check that the expansion notes respect the same formatting options as
// other diagnostics.
// RUN: %clang_cc1 -fsyntax-only -fdiagnostics-format vi %s 2>&1 \
// RUN: | FileCheck %s -check-prefix=CHECK-NOTE-FORMAT
// CHECK-NOTE-FORMAT: macro-backtrace.c +18:7: warning:
// CHECK-NOTE-FORMAT: macro-backtrace.c +15:19: note:
// CHECK-NOTE-FORMAT: macro-backtrace.c +14:19: note:
// CHECK-NOTE-FORMAT: note:
// CHECK-NOTE-FORMAT: macro-backtrace.c +6:18: note:
// CHECK-NOTE-FORMAT: macro-backtrace.c +5:18: note:
// CHECK-NOTE-FORMAT: macro-backtrace.c +4:23: note:
}