Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions test/compilable/issue15574.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
#! /usr/bin/env bash


if [[ $OS = *"win"* ]]; then exit 0; fi


if [ $LIBEXT = ".a" ]; then
LIB_PREFIX=lib
else
Expand Down Expand Up @@ -46,9 +44,7 @@ int main() {
}
EOF

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
Copy Markdown
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.

ar rcs ${C_LIB} ${C_FILE}${OBJ}

${DMD} -m${MODEL} -lib -of${D_LIB} ${D_FILE}
Expand Down
6 changes: 6 additions & 0 deletions test/tools/exported_vars.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,9 @@ if [ "$OS" == "win32" ] || [ "$OS" == "win64" ]; then
else
export LIBEXT=.a
fi

# Default to DigitalMars C++ on Win32
if [ "$OS" == "win32" ] && [ -z "${CC+set}" ] ; then
CC="dmc"
fi
export CC="${CC:-c++}" # C++ compiler to use