};
const CompOpt compopts[] = {
- {"--Werror", TAKES_ARG}, // nvcc
+ {"--Werror", TAKES_ARG | AFFECTS_COMP}, // nvcc
{"--analyze", TOO_HARD}, // Clang
{"--compiler-bindir", AFFECTS_CPP | TAKES_ARG}, // nvcc
+ {"--compiler-options", AFFECTS_CPP | TAKES_ARG}, // nvcc
{"--config", TAKES_ARG}, // Clang
{"--gcc-toolchain=", TAKES_CONCAT_ARG | TAKES_PATH}, // Clang
{"--libdevice-directory", AFFECTS_CPP | TAKES_ARG}, // nvcc
{"-Wno-error", AFFECTS_COMP},
{"-Xassembler", TAKES_ARG | TAKES_CONCAT_ARG | AFFECTS_COMP},
{"-Xclang", TAKES_ARG},
+ {"-Xcompiler", AFFECTS_CPP | TAKES_ARG}, // nvcc
{"-Xlinker", TAKES_ARG | TAKES_CONCAT_ARG | AFFECTS_COMP},
{"-Xpreprocessor", AFFECTS_CPP | TOO_HARD_DIRECT | TAKES_ARG},
{"-Yc", TAKES_ARG | TOO_HARD}, // msvc
CHECK(result.compiler_args.to_string() == "nvcc -g -Wall -DX -c");
}
+TEST_CASE("nvcc_warning_flags_short")
+{
+ // With -Werror. This should conflict with host's -Werror flag.
+ TestContext test_context;
+ Context ctx;
+ ctx.config.set_compiler_type(CompilerType::nvcc);
+ ctx.orig_args =
+ Args::from_string("nvcc -Werror all-warnings -Xcompiler -Werror -c foo.cu");
+ util::write_file("foo.cu", "");
+ const ProcessArgsResult result = process_args(ctx);
+
+ CHECK(!result.error);
+ CHECK(result.preprocessor_args.to_string() == "nvcc -Xcompiler -Werror");
+ CHECK(result.extra_args_to_hash.to_string() == "-Werror all-warnings");
+ CHECK(result.compiler_args.to_string()
+ == "nvcc -Werror all-warnings -Xcompiler -Werror -c");
+}
+
+TEST_CASE("nvcc_warning_flags_long")
+{
+ // With --Werror. This shouldn't conflict with host's -Werror flag.
+ TestContext test_context;
+ Context ctx;
+ ctx.config.set_compiler_type(CompilerType::nvcc);
+ ctx.orig_args = Args::from_string(
+ "nvcc --Werror all-warnings -Xcompiler -Werror -c foo.cu");
+ util::write_file("foo.cu", "");
+ const ProcessArgsResult result = process_args(ctx);
+
+ CHECK(!result.error);
+ CHECK(result.preprocessor_args.to_string() == "nvcc -Xcompiler -Werror");
+ CHECK(result.extra_args_to_hash.to_string() == "--Werror all-warnings");
+ CHECK(result.compiler_args.to_string()
+ == "nvcc --Werror all-warnings -Xcompiler -Werror -c");
+}
+
TEST_CASE("-Xclang")
{
TestContext test_context;