Skip to content

Export CC to the test shell environment#8343

Merged
RazvanN7 merged 1 commit intodlang:masterfrom
wilzbach:sh-cc
Jun 11, 2018
Merged

Export CC to the test shell environment#8343
RazvanN7 merged 1 commit intodlang:masterfrom
wilzbach:sh-cc

Conversation

@wilzbach
Copy link
Contributor

@wilzbach wilzbach commented Jun 8, 2018

Useful for e.g. #8342

This performs what d_do_test already does today:

dmd/test/tools/d_do_test.d

Lines 588 to 596 in cce909b

if (envData.ccompiler.empty)
{
switch (envData.os)
{
case "win32": envData.ccompiler = "dmc"; break;
case "win64": envData.ccompiler = `\"Program Files (x86)"\"Microsoft Visual Studio 10.0"\VC\bin\amd64\cl.exe`; break;
default: envData.ccompiler = "c++"; break;
}
}

(though the win64 case isn't really used anymore)

@dlang-bot
Copy link
Contributor

Thanks for your pull request, @wilzbach!

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub fetch digger
dub run digger -- build "master + dmd#8343"

@wilzbach wilzbach force-pushed the sh-cc branch 2 times, most recently from 35d302b to 9767ecd Compare June 8, 2018 11:03
@wilzbach wilzbach changed the title Export CC to the test shell environment [tests] Clear up C/C++ compiler confusion - CC is the C compiler and CPP should be the C++ compiler Jun 8, 2018
@wilzbach wilzbach force-pushed the sh-cc branch 2 times, most recently from 343f9bc to cf360c7 Compare June 8, 2018 11:08
if [ -z ${CC+x} ]; then CC=cc; fi

$CC -m${MODEL} -c -o ${C_FILE}${OBJ} $C_FILE
cc -m${MODEL} -c -o ${C_FILE}${OBJ} $C_FILE
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we managed to reach the state where CC refers to the C++ compiler:

dmd/test/tools/d_do_test.d

Lines 588 to 596 in cce909b

if (envData.ccompiler.empty)
{
switch (envData.os)
{
case "win32": envData.ccompiler = "dmc"; break;
case "win64": envData.ccompiler = `\"Program Files (x86)"\"Microsoft Visual Studio 10.0"\VC\bin\amd64\cl.exe`; break;
default: envData.ccompiler = "c++"; break;
}
}

CC: C++ compiler to use, ex: dmc, g++

But in this case CC is used as people normally use it: the C compiler.

In this case it makes a difference whether a C or C++ compiler is used.
I would suggest we introduce a new environment variable (e.g. CPP) and let CC point to the system's C compiler.
FWIW in the build make scripts the C++ compiler is at least called HOST_CXX.

@wilzbach wilzbach changed the title [tests] Clear up C/C++ compiler confusion - CC is the C compiler and CPP should be the C++ compiler Export CC to the test shell environment Jun 8, 2018
@wilzbach wilzbach added the Merge:72h no objection -> merge The PR will be merged if there are no objections raised. label Jun 10, 2018
@RazvanN7 RazvanN7 merged commit f94c02a into dlang:master Jun 11, 2018
@wilzbach wilzbach deleted the sh-cc branch July 1, 2018 23:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Merge:72h no objection -> merge The PR will be merged if there are no objections raised.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants