Here is updated diff with all comments addressed. ismail: could you check this one last time on openSUSE before I commit?
2015-07-14 14:33 GMT+03:00 Joerg Sonnenberger <jo...@britannica.bec.de>: > On Mon, Jul 13, 2015 at 11:53:47PM +0300, Yaron Keren wrote: > > Re-reading, the problem is with using #ifdef inside the conditional or > > using the #ifdef at all? > > the problem is adding #else blocks that themselve that with else. > Can you restructure the branches to avoid that? A single trailing > conditional block is fine as is a single leading conditional block. > But having #if #else #endif where both start with a else is bad. > > Joerg > _______________________________________________ > cfe-commits mailing list > cfe-commits@cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits >
Index: tools/clang/lib/Driver/MinGWToolChain.cpp =================================================================== --- tools/clang/lib/Driver/MinGWToolChain.cpp (revision 242033) +++ tools/clang/lib/Driver/MinGWToolChain.cpp (working copy) @@ -24,6 +24,9 @@ : ToolChain(D, Triple, Args) { getProgramPaths().push_back(getDriver().getInstalledDir()); + llvm::SmallString<1024> LibDir; + +#ifdef LLVM_ON_WIN32 if (getDriver().SysRoot.size()) Base = getDriver().SysRoot; else if (llvm::ErrorOr<std::string> GPPName = @@ -33,8 +36,17 @@ else Base = llvm::sys::path::parent_path(getDriver().getInstalledDir()); Base += llvm::sys::path::get_separator(); - llvm::SmallString<1024> LibDir(Base); + LibDir = Base; llvm::sys::path::append(LibDir, "lib", "gcc"); +#else + if (getDriver().SysRoot.size()) + Base = getDriver().SysRoot; + else + Base = "/usr/"; + LibDir = Base; + llvm::sys::path::append(LibDir, "lib64", "gcc"); +#endif + LibDir += llvm::sys::path::get_separator(); // First look for mingw-w64. @@ -58,6 +70,10 @@ getFilePaths().push_back(GccLibDir); getFilePaths().push_back(Base + "lib"); getFilePaths().push_back(Base + Arch + "lib"); +#ifdef LLVM_ON_UNIX + // For openSUSE. + getFilePaths().push_back(Base + Arch + "sys-root/mingw/lib"); +#endif } bool MinGW::IsIntegratedAssemblerDefault() const { return true; } @@ -117,6 +133,11 @@ llvm::sys::path::append(IncludeDir, "include"); addSystemInclude(DriverArgs, CC1Args, IncludeDir.c_str()); IncludeDir += "-fixed"; +#ifdef LLVM_ON_UNIX + // For openSUSE. + addSystemInclude(DriverArgs, CC1Args, + "/usr/x86_64-w64-mingw32/sys-root/mingw/include"); +#endif addSystemInclude(DriverArgs, CC1Args, IncludeDir.c_str()); addSystemInclude(DriverArgs, CC1Args, Base + Arch + "include"); addSystemInclude(DriverArgs, CC1Args, Base + "include"); @@ -129,9 +150,15 @@ return; // C++ includes may be found in several locations depending on distribution. + // Windows + // ------- // mingw-w64 mingw-builds: $sysroot/i686-w64-mingw32/include/c++. // mingw-w64 msys2: $sysroot/include/c++/4.9.2 // mingw.org: GccLibDir/include/c++ + // + // Linux + // ----- + // openSUSE: GccLibDir/include/c++ llvm::SmallVector<llvm::SmallString<1024>, 3> CppIncludeBases; CppIncludeBases.emplace_back(Base); llvm::sys::path::append(CppIncludeBases[0], Arch, "include", "c++");
_______________________________________________ cfe-commits mailing list cfe-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits