MinGW include directories [RFC]

Hi,

The current setup of MinGW include directories in InitHeaderSearch.cpp has several problems:

  • New versions are added manually to the code.
  • All existing versions of MinGW directories are added regardless of what is actually installed (and pruned later), wasted work.
  • Two MinGW.org C includes are missing.
  • If multiple MinGW versions are installed clang will add directories for all of them leading to unpredictable results.

I’d like to suggest that clang will add include directories only for the gcc.exe which is on the system PATH based on the list below for both distributions.
This way:

  • clang will not add include diectories for every possible version, only for this one.
  • clang will correctly hanlde multiple based on the dveloper choice which gcc.exe is on the path
  • We won’t have to manually update new versions in InitHeaderSearch.cpp.

What do you think?

Yaron

mingw.org

That makes total sense, given that (I think) we do roughly the same on Linux.

That makes total sense, given that (I think) we do roughly the same on Linux.

We do a search in the driver and pass the result down. Doing the same for mingw would be nice.

Hi Rafael,

Do you mean Generic_GCC::GCCInstallationDetector ?

Yaron

Yaron,

At first, we may implement the driver instead of twiddling InitHeaderSearch.
By the way, did you consider cross tools on other hosts, like cygwin and linux?

...Takumi

Hi Takumi,

Do you mean to create a new MinGWToolChain in driver?

I am trying to solve the situation on host Windows where the install directory is not standard and different between the distributions and between 32 and 64 bit.
I’d like clang to handle at least MinGW.org and mingw-builds 32,64 bit automatically for any install directory as long as gcc.exe is on the PATH.

This scheme should work running under host CygWin as well just the same.

Under host Linux it’s not MinGW but gcc and clang already knows to find include directory since they are standard.

Yaron

Yaron

Yes.

Cheers,
Rafael