Microsoft Visual C++ (MSVC).
*nvcc*::
NVCC (CUDA) compiler.
+*qcc*::
+ QCC (QNX) compiler.
*other*::
Any compiler other than the known types.
--
- Added support for caching distributed ThinLTO for Clang. +
[small]#_[contributed by GitHub user zcfh]_#
+- Added support for QCC (QNX) compiler.
+
- Added support for caching MSVC `/sourceDependencies` file. +
[small]#_[contributed by Joel Rosdahl]_#
return Statistic::none;
}
- if (config.compiler_type() == CompilerType::gcc) {
+ if (config.is_compiler_group_gcc()) {
if (arg == "-fdiagnostics-color" || arg == "-fdiagnostics-color=always") {
state.color_diagnostics = ColorDiagnostics::always;
state.add_compiler_only_arg_no_hash(args[i]);
if (args_info.actual_language != "assembler") {
diagnostics_color_arg = "-fcolor-diagnostics";
}
- } else if (config.compiler_type() == CompilerType::gcc) {
+ } else if (config.is_compiler_group_gcc()) {
diagnostics_color_arg = "-fdiagnostics-color";
} else {
// Other compilers shouldn't output color, so no need to strip it.
if (config.compiler_type() == CompilerType::clang) {
// Clang does the sane thing: the dependency target is the output file
// so that the dependency file actually makes sense.
- } else if (config.compiler_type() == CompilerType::gcc) {
- // GCC strangely uses the base name of the source file but with a .o
- // extension.
+ } else if (config.is_compiler_group_gcc()) {
+ // GCC (and QCC) strangely uses the base name of the source file but
+ // with a .o extension.
dep_target =
util::with_extension(args_info.orig_input_file.filename(),
get_default_object_file_extension(ctx.config));
// How other compilers behave is currently unknown, so bail out.
LOG(
"-Wp,-M[M]D with -o without -MMD, -MQ or -MT is only supported for"
- " GCC or Clang");
+ " GCC-like or Clang compilers");
return tl::unexpected(Statistic::unsupported_compiler_option);
}
}
return CompilerType::gcc;
} else if (name.find("nvcc") != std::string_view::npos) {
return CompilerType::nvcc;
+ } else if (name == "qcc" || name == "q++") {
+ return CompilerType::qcc;
} else if (name == "icl") {
return CompilerType::icl;
} else if (name == "icx") {
util::UmaskScope umask_scope(ctx.original_umask);
if (ctx.diagnostics_color_failed) {
- DEBUG_ASSERT(ctx.config.compiler_type() == CompilerType::gcc);
+ DEBUG_ASSERT(ctx.config.is_compiler_group_gcc());
args.erase_last("-fdiagnostics-color");
}
std::move(tmp_stdout.fd),
std::move(tmp_stderr.fd));
if (status != 0 && !ctx.diagnostics_color_failed
- && ctx.config.compiler_type() == CompilerType::gcc) {
+ && ctx.config.is_compiler_group_gcc()) {
const auto errors = util::read_file<std::string>(tmp_stderr.path);
if (errors && errors->find("fdiagnostics-color") != std::string::npos) {
// GCC versions older than 4.9 don't understand -fdiagnostics-color, and
- // non-GCC compilers misclassified as CompilerType::gcc might not do it
+ // non-GCC compilers misclassified as GCC-like might not do it
// either. We assume that if the error message contains
// "fdiagnostics-color" then the compilation failed due to
// -fdiagnostics-color being unsupported and we then retry without the
}
// Possibly hash GCC_COLORS (for color diagnostics).
- if (ctx.config.compiler_type() == CompilerType::gcc) {
+ if (ctx.config.is_compiler_group_gcc()) {
const char* gcc_colors = getenv("GCC_COLORS");
if (gcc_colors) {
hash.hash_delimiter("gcccolors");
}
}
+ // Hash QNX-specific environment variables that affect QCC behavior.
+ if (ctx.config.compiler_type() == CompilerType::qcc) {
+ const char* qnx_env_vars[] = {"QNX_HOST", "QNX_TARGET", "QCC_CONF_PATH"};
+ for (const char* name : qnx_env_vars) {
+ const char* value = getenv(name);
+ if (value) {
+ hash.hash_delimiter(name);
+ hash.hash(value);
+ }
+ }
+ }
+
return {};
}
{"-save-temps", TOO_HARD },
{"-save-temps=cwd", TOO_HARD },
{"-save-temps=obj", TOO_HARD },
+ {"-set-default", TOO_HARD }, // qcc
{"-specs", TAKES_ARG },
{"-stdlib=", AFFECTS_CPP | TAKES_CONCAT_ARG },
{"-trigraphs", AFFECTS_CPP },
return CompilerType::msvc;
} else if (value == "nvcc") {
return CompilerType::nvcc;
+ } else if (value == "qcc") {
+ return CompilerType::qcc;
} else if (value == "other") {
return CompilerType::other;
} else {
CASE(icx);
CASE(msvc);
CASE(nvcc);
+ CASE(qcc);
CASE(other);
}
#undef CASE
icx_cl,
msvc,
nvcc,
+ qcc,
other
};
// Return true for Clang, clang-cl and icx (not on Windows).
bool is_compiler_group_clang() const;
+ // Return true for GCC and QCC (QNX compiler, which is GCC-based).
+ bool is_compiler_group_gcc() const;
+
// Return true for MSVC (cl.exe), clang-cl, icl, icx-cl, and icx (on Windows).
bool is_compiler_group_msvc() const;
|| m_compiler_type == CompilerType::clang_cl;
}
+inline bool
+Config::is_compiler_group_gcc() const
+{
+ return m_compiler_type == CompilerType::gcc
+ || m_compiler_type == CompilerType::qcc;
+}
+
inline bool
Config::is_compiler_group_msvc() const
{
CHECK(guess_compiler("/test/prefix/nvcc") == CompilerType::nvcc);
CHECK(guess_compiler("/test/prefix/nvcc-10.1.243") == CompilerType::nvcc);
+ CHECK(guess_compiler("/test/prefix/qcc") == CompilerType::qcc);
+ CHECK(guess_compiler("/test/prefix/q++") == CompilerType::qcc);
+
CHECK(guess_compiler("/test/prefix/x") == CompilerType::other);
CHECK(guess_compiler("/test/prefix/cc") == CompilerType::other);
CHECK(guess_compiler("/test/prefix/c++") == CompilerType::other);