xref: /aosp_15_r20/external/clang/test/Driver/cuda-unused-arg-warning.cu (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li // Tests that we trigger unused-arg warnings on CUDA flags appropriately.
2*67e74705SXin Li 
3*67e74705SXin Li // REQUIRES: clang-driver
4*67e74705SXin Li // REQUIRES: x86-registered-target
5*67e74705SXin Li // REQUIRES: nvptx-registered-target
6*67e74705SXin Li 
7*67e74705SXin Li // --cuda-host-only and --cuda-compile-host-device should never trigger an
8*67e74705SXin Li // unused arg warning.
9*67e74705SXin Li // RUN: %clang -### -target x86_64-linux-gnu --cuda-host-only -c %s 2>&1 | \
10*67e74705SXin Li // RUN:    FileCheck %s
11*67e74705SXin Li // RUN: %clang -### -target x86_64-linux-gnu --cuda-host-only -x c -c %s 2>&1 | \
12*67e74705SXin Li // RUN:    FileCheck %s
13*67e74705SXin Li // RUN: %clang -### -target x86_64-linux-gnu --cuda-compile-host-device -c %s 2>&1 | \
14*67e74705SXin Li // RUN:    FileCheck %s
15*67e74705SXin Li // RUN: %clang -### -target x86_64-linux-gnu --cuda-compile-host-device -x c -c %s 2>&1 | \
16*67e74705SXin Li // RUN:    FileCheck %s
17*67e74705SXin Li 
18*67e74705SXin Li // --cuda-device-only should warn during non-CUDA compilation.
19*67e74705SXin Li // RUN: %clang -### -target x86_64-linux-gnu --cuda-device-only -x c -c %s 2>&1 | \
20*67e74705SXin Li // RUN:    FileCheck -check-prefix UNUSED-WARNING %s
21*67e74705SXin Li 
22*67e74705SXin Li // --cuda-device-only should not produce warning compiling CUDA files
23*67e74705SXin Li // RUN: %clang -### -target x86_64-linux-gnu --cuda-device-only -c %s 2>&1 | \
24*67e74705SXin Li // RUN:    FileCheck -check-prefix NO-UNUSED-WARNING %s
25*67e74705SXin Li 
26*67e74705SXin Li // CHECK-NOT: warning: argument unused during compilation: '--cuda-host-only'
27*67e74705SXin Li // CHECK-NOT: warning: argument unused during compilation: '--cuda-compile-host-device'
28*67e74705SXin Li // UNUSED-WARNING: warning: argument unused during compilation: '--cuda-device-only'
29*67e74705SXin Li // NO-UNUSED-WARNING-NOT: warning: argument unused during compilation: '--cuda-device-only'
30