From f51b758db4706bd8c24e1d82cfa8d9bf4bfa427d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20P=C3=B6chtrager?= Date: Sat, 27 Feb 2016 09:40:10 +0100 Subject: [PATCH] Clang 3.8 adjustments ... and while I am already there also update the copyright years --- build_compiler_rt.sh | 5 +++-- wrapper/main.cpp | 16 +++++++++++++++- wrapper/programs/dsymutil.cpp | 2 +- wrapper/programs/osxcross-cmp.cpp | 2 +- wrapper/programs/osxcross-conf.cpp | 2 +- wrapper/programs/osxcross-env.cpp | 2 +- wrapper/programs/osxcross-man.cpp | 2 +- wrapper/programs/osxcross-version.cpp | 2 +- wrapper/programs/pkg-config.cpp | 2 +- wrapper/programs/sw_vers.cpp | 2 +- wrapper/programs/xcrun.cpp | 2 +- wrapper/progs.h | 2 +- wrapper/target.cpp | 23 +++++++++++++++++++++-- wrapper/target.h | 4 +++- wrapper/tools.cpp | 2 +- wrapper/tools.h | 2 +- 16 files changed, 54 insertions(+), 18 deletions(-) diff --git a/build_compiler_rt.sh b/build_compiler_rt.sh index 64ee683..69dd970 100755 --- a/build_compiler_rt.sh +++ b/build_compiler_rt.sh @@ -56,8 +56,9 @@ case $CLANG_VERSION in 3.5*) BRANCH=release_35 ;; 3.6*) BRANCH=release_36 ;; 3.7*) BRANCH=release_37 ;; - 3.8*) BRANCH=master ;; - * ) echo "Unsupported Clang version, must be >= 3.2 and <= 3.8" 1>&2; exit 1; + 3.8*) BRANCH=release_38 ;; + 3.9*) BRANCH=master ;; + * ) echo "Unsupported Clang version, must be >= 3.2 and <= 3.9" 1>&2; exit 1; esac pushd $OSXCROSS_BUILD_DIR &>/dev/null diff --git a/wrapper/main.cpp b/wrapper/main.cpp index 3a9cdec..0d17c31 100644 --- a/wrapper/main.cpp +++ b/wrapper/main.cpp @@ -1,6 +1,6 @@ /*********************************************************************** * OSXCross Compiler Wrapper * - * Copyright (C) 2014, 2015 by Thomas Poechtrager * + * Copyright (C) 2014-2016 by Thomas Poechtrager * * t.poechtrager@gmail.com * * * * This program is free software; you can redistribute it and/or * @@ -183,6 +183,16 @@ bool runprog(Target &target, const char *, const char *progname, char **cargs) { (*prog)(args.size() - 1, args.data(), target); } +bool colordiagnostics(Target &target, const char *opt, const char *, char **) { + target.colordiagnostics = !strcmp(opt, "-fcolor-diagnostics"); + return true; +} + +bool liblto(Target &target, const char *opt, const char *, char **) { + target.wliblto = !strcmp(opt, "-Wliblto"); + return true; +} + bool checkincludepath(Target &, const char *opt, const char *path, char **) { #ifndef __APPLE__ constexpr const char *DangerousIncludePaths[] = { "/usr/include", @@ -247,6 +257,10 @@ constexpr struct Opt { {"-x", language, true, true}, {"-foc-use-gcc-libstdc++", usegcclibstdcxx}, {"-foc-run-prog", runprog, true, false, "="}, // for internal use only + {"-fcolor-diagnostics", colordiagnostics, false, true}, + {"-fno-color-diagnostics", colordiagnostics, false, true}, + {"-Wliblto", liblto, false, true}, + {"-Wno-liblto", liblto, false, true}, {"-isystem", checkincludepath, true, true}, {"-icxx-isystem", checkincludepath, true, true}, {"-cxx-isystem", checkincludepath, true, true}, diff --git a/wrapper/programs/dsymutil.cpp b/wrapper/programs/dsymutil.cpp index 44f34f6..47e5a04 100644 --- a/wrapper/programs/dsymutil.cpp +++ b/wrapper/programs/dsymutil.cpp @@ -1,6 +1,6 @@ /*********************************************************************** * OSXCross Compiler Wrapper * - * Copyright (C) 2014, 2015 by Thomas Poechtrager * + * Copyright (C) 2014-2016 by Thomas Poechtrager * * t.poechtrager@gmail.com * * * * This program is free software; you can redistribute it and/or * diff --git a/wrapper/programs/osxcross-cmp.cpp b/wrapper/programs/osxcross-cmp.cpp index b54eff7..0d63938 100644 --- a/wrapper/programs/osxcross-cmp.cpp +++ b/wrapper/programs/osxcross-cmp.cpp @@ -1,6 +1,6 @@ /*********************************************************************** * OSXCross Compiler Wrapper * - * Copyright (C) 2014, 2015 by Thomas Poechtrager * + * Copyright (C) 2014-2016 by Thomas Poechtrager * * t.poechtrager@gmail.com * * * * This program is free software; you can redistribute it and/or * diff --git a/wrapper/programs/osxcross-conf.cpp b/wrapper/programs/osxcross-conf.cpp index bb2af31..d499224 100644 --- a/wrapper/programs/osxcross-conf.cpp +++ b/wrapper/programs/osxcross-conf.cpp @@ -1,6 +1,6 @@ /*********************************************************************** * OSXCross Compiler Wrapper * - * Copyright (C) 2014, 2015 by Thomas Poechtrager * + * Copyright (C) 2014-2016 by Thomas Poechtrager * * t.poechtrager@gmail.com * * * * This program is free software; you can redistribute it and/or * diff --git a/wrapper/programs/osxcross-env.cpp b/wrapper/programs/osxcross-env.cpp index 9474b26..e0c1806 100644 --- a/wrapper/programs/osxcross-env.cpp +++ b/wrapper/programs/osxcross-env.cpp @@ -1,6 +1,6 @@ /*********************************************************************** * OSXCross Compiler Wrapper * - * Copyright (C) 2014, 2015 by Thomas Poechtrager * + * Copyright (C) 2014-2016 by Thomas Poechtrager * * t.poechtrager@gmail.com * * * * This program is free software; you can redistribute it and/or * diff --git a/wrapper/programs/osxcross-man.cpp b/wrapper/programs/osxcross-man.cpp index a2e4c3b..d6bd28b 100644 --- a/wrapper/programs/osxcross-man.cpp +++ b/wrapper/programs/osxcross-man.cpp @@ -1,6 +1,6 @@ /*********************************************************************** * OSXCross Compiler Wrapper * - * Copyright (C) 2014, 2015 by Thomas Poechtrager * + * Copyright (C) 2014-2016 by Thomas Poechtrager * * t.poechtrager@gmail.com * * * * This program is free software; you can redistribute it and/or * diff --git a/wrapper/programs/osxcross-version.cpp b/wrapper/programs/osxcross-version.cpp index 56c864f..c97b18f 100644 --- a/wrapper/programs/osxcross-version.cpp +++ b/wrapper/programs/osxcross-version.cpp @@ -1,6 +1,6 @@ /*********************************************************************** * OSXCross Compiler Wrapper * - * Copyright (C) 2014, 2015 by Thomas Poechtrager * + * Copyright (C) 2014-2016 by Thomas Poechtrager * * t.poechtrager@gmail.com * * * * This program is free software; you can redistribute it and/or * diff --git a/wrapper/programs/pkg-config.cpp b/wrapper/programs/pkg-config.cpp index 71cd84f..0bdb522 100644 --- a/wrapper/programs/pkg-config.cpp +++ b/wrapper/programs/pkg-config.cpp @@ -1,6 +1,6 @@ /*********************************************************************** * OSXCross Compiler Wrapper * - * Copyright (C) 2014, 2015 by Thomas Poechtrager * + * Copyright (C) 2014-2016 by Thomas Poechtrager * * t.poechtrager@gmail.com * * * * This program is free software; you can redistribute it and/or * diff --git a/wrapper/programs/sw_vers.cpp b/wrapper/programs/sw_vers.cpp index 169170b..bad99a9 100644 --- a/wrapper/programs/sw_vers.cpp +++ b/wrapper/programs/sw_vers.cpp @@ -1,6 +1,6 @@ /*********************************************************************** * OSXCross Compiler Wrapper * - * Copyright (C) 2014, 2015 by Thomas Poechtrager * + * Copyright (C) 2014-2016 by Thomas Poechtrager * * t.poechtrager@gmail.com * * * * This program is free software; you can redistribute it and/or * diff --git a/wrapper/programs/xcrun.cpp b/wrapper/programs/xcrun.cpp index c0770f9..879625f 100644 --- a/wrapper/programs/xcrun.cpp +++ b/wrapper/programs/xcrun.cpp @@ -1,6 +1,6 @@ /*********************************************************************** * OSXCross Compiler Wrapper * - * Copyright (C) 2014, 2015 by Thomas Poechtrager * + * Copyright (C) 2014-2016 by Thomas Poechtrager * * t.poechtrager@gmail.com * * * * This program is free software; you can redistribute it and/or * diff --git a/wrapper/progs.h b/wrapper/progs.h index 0c6d80a..ce612ba 100644 --- a/wrapper/progs.h +++ b/wrapper/progs.h @@ -1,6 +1,6 @@ /*********************************************************************** * OSXCross Compiler Wrapper * - * Copyright (C) 2014, 2015 by Thomas Poechtrager * + * Copyright (C) 2014-2016 by Thomas Poechtrager * * t.poechtrager@gmail.com * * * * This program is free software; you can redistribute it and/or * diff --git a/wrapper/target.cpp b/wrapper/target.cpp index ec4c5f8..e07872e 100644 --- a/wrapper/target.cpp +++ b/wrapper/target.cpp @@ -1,6 +1,6 @@ /*********************************************************************** * OSXCross Compiler Wrapper * - * Copyright (C) 2014, 2015 by Thomas Poechtrager * + * Copyright (C) 2014-2016 by Thomas Poechtrager * * t.poechtrager@gmail.com * * * * This program is free software; you can redistribute it and/or * @@ -43,7 +43,8 @@ namespace target { Target::Target() : vendor(getDefaultVendor()), SDK(getenv("OSXCROSS_SDKROOT")), arch(Arch::x86_64), target(getDefaultTarget()), stdlib(StdLib::unset), - usegcclibs(), compiler(getDefaultCompilerIdentifier()), + usegcclibs(), colordiagnostics(-1), wliblto(-1), + compiler(getDefaultCompilerIdentifier()), compilername(getDefaultCompilerName()), language() { if (!getExecutablePath(execpath, sizeof(execpath))) abort(); @@ -785,6 +786,24 @@ bool Target::setup() { } } + if (clangversion >= ClangVersion(3, 8)) { + // + // Silence: + // warning: libLTO.dylib relative to clang installed dir not found; + // using 'ld' default search path instead + // + // '-flto' will of course work nevertheless, it's just a buggy + // cross-compilation warning. + // + if (wliblto == -1) + fargs.push_back("-Wno-liblto"); + // + // Get back color diagnostics. + // + if (colordiagnostics == -1) + fargs.push_back("-fcolor-diagnostics"); + } + return true; } } // namespace target diff --git a/wrapper/target.h b/wrapper/target.h index cbe799e..f4ed7c1 100644 --- a/wrapper/target.h +++ b/wrapper/target.h @@ -1,6 +1,6 @@ /*********************************************************************** * OSXCross Compiler Wrapper * - * Copyright (C) 2014, 2015 by Thomas Poechtrager * + * Copyright (C) 2014-2016 by Thomas Poechtrager * * t.poechtrager@gmail.com * * * * This program is free software; you can redistribute it and/or * @@ -138,6 +138,8 @@ struct Target { ClangVersion clangversion; GCCVersion gccversion; bool usegcclibs; + int colordiagnostics; + int wliblto; Compiler compiler; std::string compilerpath; // /usr/bin/clang | [...]/target/bin/*-gcc std::string compilername; // clang | gcc diff --git a/wrapper/tools.cpp b/wrapper/tools.cpp index f7b8b04..54fb5ae 100644 --- a/wrapper/tools.cpp +++ b/wrapper/tools.cpp @@ -1,6 +1,6 @@ /*********************************************************************** * OSXCross Compiler Wrapper * - * Copyright (C) 2014, 2015 by Thomas Poechtrager * + * Copyright (C) 2014-2016 by Thomas Poechtrager * * t.poechtrager@gmail.com * * * * This program is free software; you can redistribute it and/or * diff --git a/wrapper/tools.h b/wrapper/tools.h index 2056a32..3beba3e 100644 --- a/wrapper/tools.h +++ b/wrapper/tools.h @@ -1,6 +1,6 @@ /*********************************************************************** * OSXCross Compiler Wrapper * - * Copyright (C) 2014, 2015 by Thomas Poechtrager * + * Copyright (C) 2014-2016 by Thomas Poechtrager * * t.poechtrager@gmail.com * * * * This program is free software; you can redistribute it and/or *