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