diff options
author | Richard Stallman <rms@gnu.org> | 1992-06-21 21:15:34 +0000 |
---|---|---|
committer | Richard Stallman <rms@gnu.org> | 1992-06-21 21:15:34 +0000 |
commit | e841f997bc052028514a26a49ba8081cc17eb66a (patch) | |
tree | 9b55bd43a47fd83d59c9e9320dc57954562ae1fd /gcc | |
parent | 16ab02ac8a426827dd532fddbc0d64d9c7a17d7d (diff) | |
download | gcc-e841f997bc052028514a26a49ba8081cc17eb66a.zip gcc-e841f997bc052028514a26a49ba8081cc17eb66a.tar.gz gcc-e841f997bc052028514a26a49ba8081cc17eb66a.tar.bz2 |
(duplicate_decls): Never warn if redeclaring a predeclared function.
(duplicate_decls): Never warn if redeclaring
a predeclared function. Use the new declaration's types
but keep any predeclared volatile flag.
From-SVN: r1227
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/c-decl.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 1997080..5c503ac 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -1190,6 +1190,7 @@ duplicate_decls (newdecl, olddecl) else if (TREE_CODE (olddecl) == FUNCTION_DECL && DECL_BUILT_IN (olddecl)) { + /* A function declaration for a built-in function. */ if (!TREE_PUBLIC (newdecl)) { /* If you declare a built-in function name as static, the @@ -1204,20 +1205,23 @@ duplicate_decls (newdecl, olddecl) warning_with_decl (newdecl, "conflicting types for built-in function `%s'"); } else if (TREE_CODE (olddecl) == FUNCTION_DECL - && DECL_BUILT_IN_NONANSI (olddecl)) + && DECL_SOURCE_LINE (olddecl) == 0) { + /* A function declaration for a predeclared function + that isn't actually built in. */ if (!TREE_PUBLIC (newdecl)) { - /* If you declare a built-in function name as static, the - built-in definition is overridden, - but optionally warn this was a bad choice of name. */ - if (warn_shadow) - warning_with_decl (newdecl, "shadowing library function `%s'"); - /* Discard the old built-in function. */ + /* If you declare a it as static, the + default definition is overridden. */ return 0; } else if (!types_match) - warning_with_decl (newdecl, "conflicting types for library function `%s'"); + { + /* If the types don't match, use whatever the program declares, + not the predeclared type. Preserve volatility indication. */ + TREE_THIS_VOLATILE (newdecl) |= TREE_THIS_VOLATILE (olddecl); + return 0; + } } else if (!types_match /* Permit char *foo (int, ...); followed by char *foo (); |