Skip to content

Commit

Permalink
toolchain-funcs.eclass: Assume CPP="$(tc-getCC) -E" when unset, #582822
Browse files Browse the repository at this point in the history
Modify the tc-getCPP and tc-getBUILD_CPP functions to use "$(tc-getCC)
-E" (i.e. the C compiler's preprocessing call) instead of falling back
to 'cpp'. This ensures that in environment with CC (and CXX) overriden
the correct compiler is used rather than the one selected by gcc-config,
which in turn fixes gcc version queries.

The alternative would be to always override CPP along with CC & CXX.
However, that is uncommon and is known to break some packages.

Bug: https://bugs.gentoo.org/show_bug.cgi?id=582822
  • Loading branch information
mgorny committed Jun 26, 2016
1 parent 66d4ffc commit c65f608
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions eclass/toolchain-funcs.eclass
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ tc-getCC() { tc-getPROG CC gcc "$@"; }
# @FUNCTION: tc-getCPP
# @USAGE: [toolchain prefix]
# @RETURN: name of the C preprocessor
tc-getCPP() { tc-getPROG CPP cpp "$@"; }
tc-getCPP() { tc-getPROG CPP "${CC:-gcc} -E" "$@"; }
# @FUNCTION: tc-getCXX
# @USAGE: [toolchain prefix]
# @RETURN: name of the C++ compiler
Expand Down Expand Up @@ -132,7 +132,7 @@ tc-getBUILD_CC() { tc-getBUILD_PROG CC gcc "$@"; }
# @FUNCTION: tc-getBUILD_CPP
# @USAGE: [toolchain prefix]
# @RETURN: name of the C preprocessor for building binaries to run on the build machine
tc-getBUILD_CPP() { tc-getBUILD_PROG CPP cpp "$@"; }
tc-getBUILD_CPP() { tc-getBUILD_PROG CPP "$(tc-getBUILD_CC) -E" "$@"; }
# @FUNCTION: tc-getBUILD_CXX
# @USAGE: [toolchain prefix]
# @RETURN: name of the C++ compiler for building binaries to run on the build machine
Expand Down

0 comments on commit c65f608

Please sign in to comment.