r246857 - Put ext_implicit_lib_function_decl in ImplicitFunctionDeclare.

Ed Schouten via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 4 09:07:39 PDT 2015


Author: ed
Date: Fri Sep  4 11:07:39 2015
New Revision: 246857

URL: http://llvm.org/viewvc/llvm-project?rev=246857&view=rev
Log:
Put ext_implicit_lib_function_decl in ImplicitFunctionDeclare.

If we build with -Werror=implicit-function-declaration, only implicit
function declarations of non-library functions throw compiler errors.
For library functions, we only produce a warning. There is no way to
promote both of these cases to an error without promoting other
warnings.

It makes little sense to introduce an additional compiler flag just to
control this specific warning. In my opinion it should just be part of
the same group.

Modified:
    cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
    cfe/trunk/test/Driver/implicit-function-as-error.c
    cfe/trunk/test/Misc/warning-flags.c

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=246857&r1=246856&r2=246857&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Fri Sep  4 11:07:39 2015
@@ -416,7 +416,8 @@ def note_unreachable_silence : Note<
 
 /// Built-in functions.
 def ext_implicit_lib_function_decl : ExtWarn<
-  "implicitly declaring library function '%0' with type %1">;
+  "implicitly declaring library function '%0' with type %1">,
+  InGroup<ImplicitFunctionDeclare>;
 def note_include_header_or_declare : Note<
   "include the header <%0> or explicitly provide a declaration for '%1'">;
 def note_previous_builtin_declaration : Note<"%0 is a builtin with type %1">;

Modified: cfe/trunk/test/Driver/implicit-function-as-error.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/implicit-function-as-error.c?rev=246857&r1=246856&r2=246857&view=diff
==============================================================================
--- cfe/trunk/test/Driver/implicit-function-as-error.c (original)
+++ cfe/trunk/test/Driver/implicit-function-as-error.c Fri Sep  4 11:07:39 2015
@@ -5,5 +5,6 @@
 // to an error.
 
 void radar_10894044() {
+  printf("Hi\n"); // expected-error {{implicitly declaring library function 'printf' with type 'int (const char *, ...)'}} expected-note {{include the header <stdio.h> or explicitly provide a declaration for 'printf'}}
   radar_10894044_not_declared(); // expected-error {{implicit declaration of function 'radar_10894044_not_declared' is invalid in C99}}
 }

Modified: cfe/trunk/test/Misc/warning-flags.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Misc/warning-flags.c?rev=246857&r1=246856&r2=246857&view=diff
==============================================================================
--- cfe/trunk/test/Misc/warning-flags.c (original)
+++ cfe/trunk/test/Misc/warning-flags.c Fri Sep  4 11:07:39 2015
@@ -18,12 +18,11 @@ This test serves two purposes:
 
 The list of warnings below should NEVER grow.  It should gradually shrink to 0.
 
-CHECK: Warnings without flags (93):
+CHECK: Warnings without flags (92):
 CHECK-NEXT:   ext_excess_initializers
 CHECK-NEXT:   ext_excess_initializers_in_char_array_initializer
 CHECK-NEXT:   ext_expected_semi_decl_list
 CHECK-NEXT:   ext_explicit_specialization_storage_class
-CHECK-NEXT:   ext_implicit_lib_function_decl
 CHECK-NEXT:   ext_initializer_string_for_char_array_too_long
 CHECK-NEXT:   ext_missing_declspec
 CHECK-NEXT:   ext_missing_whitespace_after_macro_name




More information about the cfe-commits mailing list