<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sat, Mar 29, 2014 at 6:16 AM, Tim Northover <span dir="ltr"><<a href="mailto:tnorthover@apple.com" target="_blank">tnorthover@apple.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: tnorthover<br>
Date: Sat Mar 29 08:16:12 2014<br>
New Revision: 205095<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=205095&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=205095&view=rev</a><br>
Log:<br>
Driver: implement addClangWarningOptions<br>
<br>
This function allows certain platforms to enable or disable diagnostics<br>
by default.<br></blockquote><div><br></div><div>Have you considered putting this information into the .td files for the diagnostics? It doesn't seem worth doing so while we've only got a handful of these, but if we're going to get many more, it seems like something to consider.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Modified:<br>
cfe/trunk/include/clang/Driver/ToolChain.h<br>
cfe/trunk/lib/Driver/ToolChain.cpp<br>
cfe/trunk/lib/Driver/ToolChains.cpp<br>
cfe/trunk/lib/Driver/ToolChains.h<br>
cfe/trunk/lib/Driver/Tools.cpp<br>
<br>
Modified: cfe/trunk/include/clang/Driver/ToolChain.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/ToolChain.h?rev=205095&r1=205094&r2=205095&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/ToolChain.h?rev=205095&r1=205094&r2=205095&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/include/clang/Driver/ToolChain.h (original)<br>
+++ cfe/trunk/include/clang/Driver/ToolChain.h Sat Mar 29 08:16:12 2014<br>
@@ -283,6 +283,9 @@ public:<br>
virtual void addClangTargetOptions(const llvm::opt::ArgList &DriverArgs,<br>
llvm::opt::ArgStringList &CC1Args) const;<br>
<br>
+ /// \brief Add warning options that need to be passed to cc1 for this target.<br>
+ virtual void addClangWarningOptions(llvm::opt::ArgStringList &CC1Args) const;<br>
+<br>
// GetRuntimeLibType - Determine the runtime library type to use with the<br>
// given compilation arguments.<br>
virtual RuntimeLibType<br>
<br>
Modified: cfe/trunk/lib/Driver/ToolChain.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChain.cpp?rev=205095&r1=205094&r2=205095&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChain.cpp?rev=205095&r1=205094&r2=205095&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/Driver/ToolChain.cpp (original)<br>
+++ cfe/trunk/lib/Driver/ToolChain.cpp Sat Mar 29 08:16:12 2014<br>
@@ -250,6 +250,8 @@ void ToolChain::addClangTargetOptions(co<br>
ArgStringList &CC1Args) const {<br>
}<br>
<br>
+void ToolChain::addClangWarningOptions(ArgStringList &CC1Args) const {}<br>
+<br>
ToolChain::RuntimeLibType ToolChain::GetRuntimeLibType(<br>
const ArgList &Args) const<br>
{<br>
<br>
Modified: cfe/trunk/lib/Driver/ToolChains.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=205095&r1=205094&r2=205095&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=205095&r1=205094&r2=205095&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)<br>
+++ cfe/trunk/lib/Driver/ToolChains.cpp Sat Mar 29 08:16:12 2014<br>
@@ -242,6 +242,20 @@ DarwinClang::DarwinClang(const Driver &D<br>
getProgramPaths().push_back(getDriver().Dir);<br>
}<br>
<br>
+void DarwinClang::addClangWarningOptions(ArgStringList &CC1Args) const {<br>
+ // For iOS, 64-bit, promote certain warnings to errors.<br>
+ if (!isTargetMacOS() && getTriple().isArch64Bit()) {<br>
+ // Always enable -Wdeprecated-objc-isa-usage and promote it<br>
+ // to an error.<br>
+ CC1Args.push_back("-Wdeprecated-objc-isa-usage");<br>
+ CC1Args.push_back("-Werror=deprecated-objc-isa-usage");<br>
+<br>
+ // Also error about implicit function declarations, as that<br>
+ // can impact calling conventions.<br>
+ CC1Args.push_back("-Werror=implicit-function-declaration");<br>
+ }<br>
+}<br>
+<br>
/// \brief Determine whether Objective-C automated reference counting is<br>
/// enabled.<br>
static bool isObjCAutoRefCount(const ArgList &Args) {<br>
<br>
Modified: cfe/trunk/lib/Driver/ToolChains.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.h?rev=205095&r1=205094&r2=205095&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.h?rev=205095&r1=205094&r2=205095&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/Driver/ToolChains.h (original)<br>
+++ cfe/trunk/lib/Driver/ToolChains.h Sat Mar 29 08:16:12 2014<br>
@@ -488,6 +488,8 @@ public:<br>
AddCCKextLibArgs(const llvm::opt::ArgList &Args,<br>
llvm::opt::ArgStringList &CmdArgs) const override;<br>
<br>
+ virtual void addClangWarningOptions(llvm::opt::ArgStringList &CC1Args) const;<br>
+<br>
void<br>
AddLinkARCArgs(const llvm::opt::ArgList &Args,<br>
llvm::opt::ArgStringList &CmdArgs) const override;<br>
<br>
Modified: cfe/trunk/lib/Driver/Tools.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=205095&r1=205094&r2=205095&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=205095&r1=205094&r2=205095&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/Driver/Tools.cpp (original)<br>
+++ cfe/trunk/lib/Driver/Tools.cpp Sat Mar 29 08:16:12 2014<br>
@@ -2116,6 +2116,11 @@ void Clang::ConstructJob(Compilation &C,<br>
std::string TripleStr = getToolChain().ComputeEffectiveClangTriple(Args);<br>
CmdArgs.push_back(Args.MakeArgString(TripleStr));<br>
<br>
+ // Push all default warning arguments that are specific to<br>
+ // the given target. These come before user provided warning options<br>
+ // are provided.<br>
+ getToolChain().addClangWarningOptions(CmdArgs);<br>
+<br>
// Select the appropriate action.<br>
RewriteKind rewriteKind = RK_None;<br>
<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div></div>