54 lines · c
1// Parse diagnostic arguments in the driver2 3// Exactly which arguments are warned about and which aren't differ based4// on what target is selected. -stdlib= and -fuse-ld= emit diagnostics when5// compiling C code, for e.g. *-linux-gnu. Linker inputs, like -lfoo, emit6// diagnostics when only compiling for all targets.7 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 %s11 12// Either with a specific -Werror=unused.. or a blanket -Werror, this13// 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 %s17 18// RUN: not %clang --target=x86_64-apple-darwin11 \19// RUN: -fsyntax-only -lfoo -Werror %s 2>&1 | FileCheck %s20 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 025 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 030 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 036 37// With --{start,end}-no-unused-argument around a different argument, it38// 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 %s42 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-WARNING46 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 050 51// CHECK: -lfoo: 'linker' input unused52 53// CL-WARNING: argument unused during compilation: '-LD'54