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
Fixes bazelbuild#17794

I was looking at writing a test for this, but not sure how you'd like me to go about that. Hard-code a gcc, e.g. `gcc-11`, or search the `$PATH` for a `gcc-<version>`?

Closes bazelbuild#20350.

PiperOrigin-RevId: 604543138
Change-Id: I71ebbac77e4e32ebc5d99ec4a81415727af12cbc
  • Loading branch information
iancha1992 committed Feb 6, 2024
1 parent 89f23ac commit f52f8c8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions MODULE.bazel.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/test/tools/bzlmod/MODULE.bazel.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion tools/cpp/unix_cc_configure.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,8 @@ 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_stdout = repository_ctx.execute([cc, "--version"]).stdout
return cc_stdout.startswith("gcc ") or cc_stdout.startswith("gcc-")

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

0 comments on commit f52f8c8

Please sign in to comment.