From: Chris Lattner Date: Wed, 7 Apr 2010 20:49:23 +0000 (+0000) Subject: add a new driver-level -ferror-limit=412 option, which causes clang to stop X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0f0c963f9b7ac6f0176c34d405d48fcb005dfab6;p=clang add a new driver-level -ferror-limit=412 option, which causes clang to stop emitting diagnostics after it has produced that many errors. Give this a default value of 20 which produces plenty of errors for people to fix before recompiling but not so many that their entire console scrolls away when the compiler gets confused. The experience looks like this: $ clang foo.c foo.c:102:3: error: unknown type name 'somethingbad' somethingbad x; ^ fatal error: too many errors emitted, stopping now 36 warnings and 20 errors generated. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100689 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/docs/UsersManual.html b/docs/UsersManual.html index e7ea133ce9..f6651b1678 100644 --- a/docs/UsersManual.html +++ b/docs/UsersManual.html @@ -189,6 +189,10 @@ introduces the language selection and other high level options like -c, -g, etc.

-pedantic-errors: Error on language extensions.

-Wsystem-headers: Enable warnings from system headers.

+

-ferror-limit=123: Stop emitting diagnostics after 123 errors have + been produced. The default is 20, and the error limit can be disabled with + -ferror-limit=0.

+

Formatting of Diagnostics

diff --git a/include/clang/Driver/Options.td b/include/clang/Driver/Options.td index ed68d68dd6..dd4586e619 100644 --- a/include/clang/Driver/Options.td +++ b/include/clang/Driver/Options.td @@ -356,6 +356,7 @@ def fstack_protector : Flag<"-fstack-protector">, Group; def fstrict_aliasing : Flag<"-fstrict-aliasing">, Group; def fsyntax_only : Flag<"-fsyntax-only">, Flags<[DriverOption]>; def ftabstop_EQ : Joined<"-ftabstop=">, Group; +def ferror_limit_EQ : Joined<"-ferror-limit=">, Group; def ftemplate_depth_ : Joined<"-ftemplate-depth-">, Group; def fterminated_vtables : Flag<"-fterminated-vtables">, Group; def fthreadsafe_statics : Flag<"-fthreadsafe-statics">, Group; diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 2a3799152a..cd38c4d9fd 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -1073,6 +1073,12 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, CmdArgs.push_back(A->getValue(Args)); } + CmdArgs.push_back("-ferror-limit"); + if (Arg *A = Args.getLastArg(options::OPT_ferror_limit_EQ)) + CmdArgs.push_back(A->getValue(Args)); + else + CmdArgs.push_back("19"); + // Pass -fmessage-length=. CmdArgs.push_back("-fmessage-length"); if (Arg *A = Args.getLastArg(options::OPT_fmessage_length_EQ)) {