Skip to content

Commit

Permalink
Mark gcc-<version> as gcc instead of compiler in Unix CC toolchain
Browse files Browse the repository at this point in the history
  • Loading branch information
robinlinden committed Nov 28, 2023
1 parent af4d29e commit 243d77f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tools/cpp/unix_cc_configure.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,14 @@ def _is_clang(repository_ctx, cc):
def _is_gcc(repository_ctx, cc):
# GCC's version output uses the basename of argv[0] as the program name:
# https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/gcc.cc;h=158461167951c1b9540322fb19be6a89d6da07fc;hb=HEAD#l8728
return repository_ctx.execute([cc, "--version"]).stdout.startswith("gcc ")
cc_argv0 = repository_ctx.execute([cc, "--version"]).stdout.partition(" ")[0]
if (cc_argv0 == "gcc"):
return True

if (cc_argv0.startswith("gcc-")):
return cc_argv0.removeprefix("gcc-").isdigit()

return False

def _get_compiler_name(repository_ctx, cc):
if _is_clang(repository_ctx, cc):
Expand Down

0 comments on commit 243d77f

Please sign in to comment.