From: Daniel Dunbar Date: Tue, 7 Apr 2009 19:18:24 +0000 (+0000) Subject: Driver: Explicitly warn that -pg isn't supported (even though we X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5c1aaafbd6dd25a99ca1960e1c3c98aeefe9d728;p=clang Driver: Explicitly warn that -pg isn't supported (even though we aren't failing the compilation). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68540 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Basic/DiagnosticDriverKinds.td b/include/clang/Basic/DiagnosticDriverKinds.td index 9246e7ad28..402b9aafdc 100644 --- a/include/clang/Basic/DiagnosticDriverKinds.td +++ b/include/clang/Basic/DiagnosticDriverKinds.td @@ -54,5 +54,7 @@ def warn_drv_not_using_clang_cxx : Warning< "not using the clang compiler for C++ inputs">; def warn_drv_not_using_clang_arch : Warning< "not using the clang compiler for the '%0' architecture">; +def warn_drv_clang_unsupported : Warning< + "the clang compiler does not yet support '%0'">; } diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 62a63cb882..e26bb9e85a 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -37,6 +37,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, const InputInfoList &Inputs, const ArgList &Args, const char *LinkingOutput) const { + const Driver &D = getToolChain().getHost().getDriver(); ArgStringList CmdArgs; assert(Inputs.size() == 1 && "Unable to handle multiple inputs."); @@ -277,11 +278,9 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, Arg *Unsupported; if ((Unsupported = Args.getLastArg(options::OPT_MG)) || - (Unsupported = Args.getLastArg(options::OPT_MQ))) { - const Driver &D = getToolChain().getHost().getDriver(); + (Unsupported = Args.getLastArg(options::OPT_MQ))) D.Diag(clang::diag::err_drv_unsupported_opt) << Unsupported->getOption().getName(); - } } Args.AddAllArgs(CmdArgs, options::OPT_v); @@ -415,6 +414,19 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, Args.MakeArgString(getToolChain().GetProgramPath(C, "clang-cc").c_str()); Dest.addCommand(new Command(Exec, CmdArgs)); + // Explicitly warn that these options are unsupported, even though + // we are allowing compilation to continue. + // FIXME: Use iterator. + for (ArgList::const_iterator + it = Args.begin(), ie = Args.end(); it != ie; ++it) { + const Arg *A = *it; + if (A->getOption().matches(options::OPT_pg)) { + A->claim(); + D.Diag(clang::diag::warn_drv_clang_unsupported) + << A->getAsString(Args); + } + } + // Claim some arguments which clang supports automatically. // -fpch-preprocess is used with gcc to add a special marker in the