diff options
author | Joseph Myers <jsm@polyomino.org.uk> | 2004-08-03 23:09:13 +0100 |
---|---|---|
committer | Joseph Myers <jsm28@gcc.gnu.org> | 2004-08-03 23:09:13 +0100 |
commit | 9cbe78fbeb3898ab7f59faba4f027f9fd0a1a4ee (patch) | |
tree | a534cd9d6e051f107ee4ae8faa1e824cf9bddaeb /gcc/c-decl.c | |
parent | 2e847896896e3283a0551eeb46b4d3c3c8211d2a (diff) | |
download | gcc-9cbe78fbeb3898ab7f59faba4f027f9fd0a1a4ee.zip gcc-9cbe78fbeb3898ab7f59faba4f027f9fd0a1a4ee.tar.gz gcc-9cbe78fbeb3898ab7f59faba4f027f9fd0a1a4ee.tar.bz2 |
c-decl.c (implicitly_declare): Diagnose incompatible implicit declarations.
* c-decl.c (implicitly_declare): Diagnose incompatible implicit
declarations.
testsuite:
* gcc.dg/redecl-5.c: New test.
* gcc.dg/format/attr-6.c: Expect warning for implicit declaration
of scanf.
From-SVN: r85509
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r-- | gcc/c-decl.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 27860b4..cbdafbb 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -2082,6 +2082,23 @@ implicitly_declare (tree functionid) implicit_decl_warning (functionid, decl); C_DECL_IMPLICIT (decl) = 1; } + if (DECL_BUILT_IN (decl)) + { + if (!comptypes (default_function_type, TREE_TYPE (decl))) + { + warning ("incompatible implicit declaration of built-in" + " function %qD", decl); + } + } + else + { + if (!comptypes (default_function_type, TREE_TYPE (decl))) + { + error ("incompatible implicit declaration of function %qD", + decl); + locate_old_decl (decl, error); + } + } bind (functionid, decl, current_scope, /*invisible=*/false, /*nested=*/true); return decl; |