[cfe-commits] r137506 - in /cfe/trunk: include/clang/Basic/DiagnosticGroups.td include/clang/Basic/DiagnosticSemaKinds.td test/Misc/warning-flags.c

Ted Kremenek kremenek at apple.com
Thu Aug 18 14:26:51 PDT 2011


My mistake.  I've fixed that in r137983.

On Aug 18, 2011, at 2:04 PM, Chad Rosier wrote:

> Hi Ted,
> This is causing a fatal assertion in clang.
> 
> mcrosier$ touch t.c
> mcrosier$ ./build/Debug+Asserts/bin/clang -Wmain t.c
> Assertion failed: ((Diags->isBuiltinWarningOrExtension(Diag) || (Map == diag::MAP_FATAL || Map == diag::MAP_ERROR)) && "Cannot map errors into warnings!"), function setDiagnosticMapping, file /Users/mcrosier/llvm-clean/llvm/tools/clang/lib/Basic/Diagnostic.cpp, line 167.
> 
> Did you mean to include errors in the warning group?
> 
> Chad
> 
> On Aug 12, 2011, at 1:46 PM, Ted Kremenek wrote:
> 
>> Author: kremenek
>> Date: Fri Aug 12 15:46:49 2011
>> New Revision: 137506
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=137506&view=rev
>> Log:
>> Place warnings related to incorrect "main()" declaration under "-Wmain".
>> 
>> Modified:
>>   cfe/trunk/include/clang/Basic/DiagnosticGroups.td
>>   cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
>>   cfe/trunk/test/Misc/warning-flags.c
>> 
>> Modified: cfe/trunk/include/clang/Basic/DiagnosticGroups.td
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticGroups.td?rev=137506&r1=137505&r2=137506&view=diff
>> ==============================================================================
>> --- cfe/trunk/include/clang/Basic/DiagnosticGroups.td (original)
>> +++ cfe/trunk/include/clang/Basic/DiagnosticGroups.td Fri Aug 12 15:46:49 2011
>> @@ -73,7 +73,7 @@
>> def : DiagGroup<"invalid-pch">;
>> def LiteralRange : DiagGroup<"literal-range">;
>> def LocalTypeTemplateArgs : DiagGroup<"local-type-template-args">;
>> -def : DiagGroup<"main">;
>> +def Main : DiagGroup<"main">;
>> def MissingBraces : DiagGroup<"missing-braces">;
>> def MissingDeclarations: DiagGroup<"missing-declarations">;
>> def : DiagGroup<"missing-format-attribute">;
>> 
>> Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=137506&r1=137505&r2=137506&view=diff
>> ==============================================================================
>> --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
>> +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Fri Aug 12 15:46:49 2011
>> @@ -282,17 +282,24 @@
>> /// main()
>> // static/inline main() are not errors in C, just in C++.
>> def warn_unusual_main_decl : Warning<"'main' should not be declared "
>> -    "%select{static|inline|static or inline}0">;
>> +    "%select{static|inline|static or inline}0">,
>> +    InGroup<Main>;
>> def err_unusual_main_decl : Error<"'main' is not allowed to be declared "
>> -    "%select{static|inline|static or inline}0">;
>> -def err_main_template_decl : Error<"'main' cannot be a template">;
>> -def err_main_returns_nonint : Error<"'main' must return 'int'">;
>> +    "%select{static|inline|static or inline}0">,
>> +    InGroup<Main>;
>> +def err_main_template_decl : Error<"'main' cannot be a template">,
>> +    InGroup<Main>;
>> +def err_main_returns_nonint : Error<"'main' must return 'int'">,
>> +    InGroup<Main>;
>> def err_main_surplus_args : Error<"too many parameters (%0) for 'main': "
>> -    "must be 0, 2, or 3">;
>> -def warn_main_one_arg : Warning<"only one parameter on 'main' declaration">;
>> +    "must be 0, 2, or 3">,
>> +    InGroup<Main>;
>> +def warn_main_one_arg : Warning<"only one parameter on 'main' declaration">,
>> +    InGroup<Main>;
>> def err_main_arg_wrong : Error<"%select{first|second|third|fourth}0 "
>>    "parameter of 'main' (%select{argument count|argument array|environment|"
>> -    "platform-specific data}0) must be of type %1">;
>> +    "platform-specific data}0) must be of type %1">,
>> +    InGroup<Main>;
>> 
>> /// parser diagnostics
>> def ext_typedef_without_a_name : ExtWarn<"typedef requires a name">,
>> 
>> Modified: cfe/trunk/test/Misc/warning-flags.c
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Misc/warning-flags.c?rev=137506&r1=137505&r2=137506&view=diff
>> ==============================================================================
>> --- cfe/trunk/test/Misc/warning-flags.c (original)
>> +++ cfe/trunk/test/Misc/warning-flags.c Fri Aug 12 15:46:49 2011
>> @@ -17,7 +17,7 @@
>> 
>> The list of warnings below should NEVER grow.  It should gradually shrink to 0.
>> 
>> -CHECK: Warnings without flags (316):
>> +CHECK: Warnings without flags (314):
>> CHECK-NEXT:   auto_storage_class
>> CHECK-NEXT:   backslash_newline_space
>> CHECK-NEXT:   charize_microsoft_ext
>> @@ -222,7 +222,6 @@
>> CHECK-NEXT:   warn_invalid_asm_cast_lvalue
>> CHECK-NEXT:   warn_ivar_use_hidden
>> CHECK-NEXT:   warn_label_attribute_not_unused
>> -CHECK-NEXT:   warn_main_one_arg
>> CHECK-NEXT:   warn_many_braces_around_scalar_init
>> CHECK-NEXT:   warn_maynot_respond
>> CHECK-NEXT:   warn_member_extra_qualification
>> @@ -330,7 +329,6 @@
>> CHECK-NEXT:   warn_unkwown_analyzer_checker
>> CHECK-NEXT:   warn_unterminated_char
>> CHECK-NEXT:   warn_unterminated_string
>> -CHECK-NEXT:   warn_unusual_main_decl
>> CHECK-NEXT:   warn_use_out_of_scope_declaration
>> CHECK-NEXT:   warn_weak_identifier_undeclared
>> CHECK-NEXT:   warn_weak_import
>> 
>> 
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
> 




More information about the cfe-commits mailing list