Don't try to find a program via environment variable if that is empty (CC)

Whereas most OSs seem to remove the environment variable if it's cleared,
OSX seems to keep it, explicitly cleared so to speak.

I strongly suspect a cleared CC env variable to be the reason for the
triggering assertion when trying to build dmd-testsuite's d_do_test tool
in our OSX CI builds.
This commit is contained in:
Martin 2015-10-18 20:10:24 +02:00
parent 8211be11de
commit 43ff4373d6

View file

@ -44,7 +44,7 @@ static std::string getProgram(const char* name, const cl::opt<std::string>* opt,
if (opt && opt->getNumOccurrences() > 0 && opt->length() > 0 && (prog = opt->c_str()))
path = findProgramByName(prog);
if (path.empty() && envVar && (prog = getenv(envVar)))
if (path.empty() && envVar && (prog = getenv(envVar)) && prog[0] != '\0')
path = findProgramByName(prog);
if (path.empty())