diff --git a/source/citnames/source/semantic/ToolGcc.cc b/source/citnames/source/semantic/ToolGcc.cc index b90bb02a..42311f40 100644 --- a/source/citnames/source/semantic/ToolGcc.cc +++ b/source/citnames/source/semantic/ToolGcc.cc @@ -251,14 +251,13 @@ namespace cs::semantic { bool ToolGcc::is_compiler_call(const fs::path& program) const { static const auto pattern = std::regex( - // - cc - // - c++ // - cxx // - CC - // - mcc, gcc, m++, g++, gfortran, fortran + // - cc, mcc, gcc, c++, m++, g++, gfortran, fortran // - with prefixes like: arm-none-eabi- // - with postfixes like: -7.0 or 6.4.0 - R"(^(cc|c\+\+|cxx|CC|(([^-]*-)*([mg](cc|\+\+)|[g]?fortran)(-?\d+(\.\d+){0,2})?))$)" + // - (excluding cc1) + R"(^(cxx|CC|(([^-]*-)*(cc(?!1(?![\d\.]))|[mg]cc|[cmg]\+\+|[g]?fortran)(-?\d+(\.\d+){0,2})?))$)" ); std::cmatch m; diff --git a/source/citnames/test/ToolGccTest.cc b/source/citnames/test/ToolGccTest.cc index 4c603e77..28979147 100644 --- a/source/citnames/test/ToolGccTest.cc +++ b/source/citnames/test/ToolGccTest.cc @@ -34,10 +34,13 @@ namespace { EXPECT_TRUE(sut.is_compiler_call("cc")); EXPECT_TRUE(sut.is_compiler_call("/usr/bin/cc")); + EXPECT_TRUE(sut.is_compiler_call("x86_64-pc-linux-gnu-cc")); + EXPECT_FALSE(sut.is_compiler_call("cc1")); EXPECT_TRUE(sut.is_compiler_call("gcc")); EXPECT_TRUE(sut.is_compiler_call("/usr/bin/gcc")); EXPECT_TRUE(sut.is_compiler_call("c++")); EXPECT_TRUE(sut.is_compiler_call("/usr/bin/c++")); + EXPECT_TRUE(sut.is_compiler_call("x86_64-pc-linux-gnu-c++")); EXPECT_TRUE(sut.is_compiler_call("g++")); EXPECT_TRUE(sut.is_compiler_call("/usr/bin/g++")); EXPECT_TRUE(sut.is_compiler_call("arm-none-eabi-g++"));