From: Marek Polacek Date: Wed, 4 Dec 2013 21:15:31 +0000 (+0000) Subject: re PR c/54113 (-Wmissing-prototypes produces false alarms for C99 inline functions) X-Git-Tag: releases/gcc-4.9.0~2284 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=edd280545f0391d97d194d914c4b99ff7cbb17b7;p=thirdparty%2Fgcc.git re PR c/54113 (-Wmissing-prototypes produces false alarms for C99 inline functions) PR c/54113 c/ * c-decl.c (start_function): Don't warn for missing prototype for inline functions. testsuite/ * gcc.dg/pr54113.c: New test. From-SVN: r205680 --- diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index b97e65ec2494..0603852fe866 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,9 @@ +2013-12-04 Marek Polacek + + PR c/54113 + * c-decl.c (start_function): Don't warn for missing prototype for + inline functions. + 2013-12-03 Marek Polacek PR c/59351 diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index 3ebc002560eb..3dbe9cbe5967 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -7974,7 +7974,8 @@ start_function (struct c_declspecs *declspecs, struct c_declarator *declarator, && old_decl != error_mark_node && TREE_PUBLIC (decl1) && !MAIN_NAME_P (DECL_NAME (decl1)) - && C_DECL_ISNT_PROTOTYPE (old_decl)) + && C_DECL_ISNT_PROTOTYPE (old_decl) + && !DECL_DECLARED_INLINE_P (decl1)) warning_at (loc, OPT_Wmissing_prototypes, "no previous prototype for %qD", decl1); /* Optionally warn of any def with no previous prototype diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b2331560b24f..f05612efb724 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-12-04 Marek Polacek + + PR c/54113 + * gcc.dg/pr54113.c: New test. + 2013-12-04 Jakub Jelinek PR c++/59268 diff --git a/gcc/testsuite/gcc.dg/pr54113.c b/gcc/testsuite/gcc.dg/pr54113.c new file mode 100644 index 000000000000..4c68099b3645 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr54113.c @@ -0,0 +1,5 @@ +/* { dg-do compile } */ +/* { dg-options "-Wmissing-prototypes" } */ + +inline int foo (void) { return 42; } /* { dg-bogus "no previous prototype" } */ +extern int foo(void);