diff for clang environment variables/paths

Hello fellow clangers :wink:

I am just sending a quick diff for a couple clang.cpp "FIXME"'s. Not sure if the use of the system()/getenv() calls are appropriate but I just wanted this to work for my setup. Let me know if this is not an acceptable patch.

Not really tested on Mac OS X but the syscalls exist and 'gcc -v' replies with the correct info, I think.

Thanks,
K.Wilson

clang.cpp.diff (4.65 KB)

Using fork, execv("cpp", ["cpp", "-v"]) and reading stderr, you might
be able to have the same functionality without creating a tempfile
with a fixed name and using system().

regards,

Benoit

Hello,

Using fork, execv("cpp", ["cpp", "-v"]) and reading stderr, you might
be able to have the same functionality without creating a tempfile
with a fixed name and using system().

Both approaches are bad, unfortunately: fork is not portable. And code
shouldn't call std::system directly, only via LLVM's libSystem.

Ahh,

Sorry about that one, I didn't really think it was a good general solution. I will check ExecuteAndWait() or similar from the libSystem.

Thanks,
K.Wilson

Hi Kelly,

Sorry for the delay, I'm catching up on old email.

This is a very interesting approach, but it would have some serious startup-time implications :). I think that clang really needs a configure script, which could sniff these values when the compiler is being built, instead of doing it on each run. Alternatively, it could have some configuration file that specifies where to find stuff etc. Are you still interested in working on this?

-Chris