[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / Driver / diagnostics.c
blob954a6d9c7be22ac328f9bb25d2f7259806678abe
1 // Parse diagnostic arguments in the driver
3 // Exactly which arguments are warned about and which aren't differ based
4 // on what target is selected. -stdlib= and -fuse-ld= emit diagnostics when
5 // compiling C code, for e.g. *-linux-gnu. Linker inputs, like -lfoo, emit
6 // diagnostics when only compiling for all targets.
8 // This is normally a non-fatal warning:
9 // RUN: %clang --target=x86_64-apple-darwin11 \
10 // RUN: -fsyntax-only -lfoo %s 2>&1 | FileCheck %s
12 // Either with a specific -Werror=unused.. or a blanket -Werror, this
13 // causes the command to fail.
14 // RUN: not %clang --target=x86_64-apple-darwin11 \
15 // RUN: -fsyntax-only -lfoo \
16 // RUN: -Werror=unused-command-line-argument %s 2>&1 | FileCheck %s
18 // RUN: not %clang --target=x86_64-apple-darwin11 \
19 // RUN: -fsyntax-only -lfoo -Werror %s 2>&1 | FileCheck %s
21 // With a specific -Wno-..., no diagnostic should be printed.
22 // RUN: %clang --target=x86_64-apple-darwin11 \
23 // RUN: -fsyntax-only -lfoo -Werror \
24 // RUN: -Wno-unused-command-line-argument %s 2>&1 | count 0
26 // With -Qunused-arguments, no diagnostic should be printed.
27 // RUN: %clang --target=x86_64-apple-darwin11 \
28 // RUN: -fsyntax-only -lfoo -Werror \
29 // RUN: -Qunused-arguments %s 2>&1 | count 0
31 // With the argument enclosed in --{start,end}-no-unused-arguments,
32 // there's no diagnostic.
33 // RUN: %clang --target=x86_64-apple-darwin11 -fsyntax-only \
34 // RUN: --start-no-unused-arguments -lfoo --end-no-unused-arguments \
35 // RUN: -Werror %s 2>&1 | count 0
37 // With --{start,end}-no-unused-argument around a different argument, it
38 // still warns about the unused argument.
39 // RUN: not %clang --target=x86_64-apple-darwin11 \
40 // RUN: --start-no-unused-arguments -fsyntax-only --end-no-unused-arguments \
41 // RUN: -lfoo -Werror %s 2>&1 | FileCheck %s
43 // Test clang-cl warning about unused linker options.
44 // RUN: not %clang_cl -fsyntax-only /WX \
45 // RUN: -LD -- %s 2>&1 | FileCheck %s --check-prefix=CL-WARNING
47 // Test clang-cl ignoring the warning with --start-no-unused-arguments.
48 // RUN: %clang_cl -fsyntax-only /WX \
49 // RUN: --start-no-unused-arguments /LD --end-no-unused-arguments -- %s 2>&1 | count 0
51 // CHECK: -lfoo: 'linker' input unused
53 // CL-WARNING: argument unused during compilation: '-LD'