From 343fdf03d406d874d1a6fe90d94a16949a2d9f4b Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Mon, 10 Nov 1997 23:10:30 -0500 Subject: [PATCH] decl.c (grokdeclarator): Tweak conditions for pedwarn in previous change. * decl.c (grokdeclarator): Tweak conditions for pedwarn in previous change. Mon Nov 10 20:08:29 1997 Bruno Haible * pt.c (coerce_template_parms): Tweak error message. * decl.c (grokdeclarator): If -Wreturn-type, warn everytime a return type defaults to `int', even if there are storage-class specifiers. From-SVN: r16425 --- gcc/cp/ChangeLog | 13 +++++++++++++ gcc/cp/decl.c | 13 +++++++++---- gcc/cp/pt.c | 2 +- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index b96f7b27434..bd15ca1d3b6 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -4,6 +4,19 @@ Sun Nov 9 01:29:55 1997 Jim Wilson (wilson@cygnus.com) * init.c (build_vec_delete_1): Delete build_block and add_block_current_level calls. +Mon Nov 10 20:08:38 1997 Jason Merrill + + * decl.c (grokdeclarator): Tweak conditions for pedwarn in + previous change. + +Mon Nov 10 20:08:29 1997 Bruno Haible + + * pt.c (coerce_template_parms): Tweak error message. + + * decl.c (grokdeclarator): If -Wreturn-type, warn everytime a + return type defaults to `int', even if there are storage-class + specifiers. + Mon Nov 10 03:04:20 1997 Jason Merrill Complete nested exception support. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 667f1859b38..486897f0a95 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -8104,10 +8104,15 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist) } else if (RIDBIT_SETP (RID_TYPEDEF, specbits)) pedwarn ("ANSI C++ forbids typedef which does not specify a type"); - else if (declspecs == NULL_TREE - && (innermost_code != CALL_EXPR || pedantic)) - cp_pedwarn ("ANSI C++ forbids declaration `%D' with no type or storage class", - dname); + else if (innermost_code != CALL_EXPR || pedantic + || (warn_return_type && return_type == return_normal)) + { + if (innermost_code == CALL_EXPR) + cp_pedwarn ("return-type of `%D' defaults to `int'", dname); + else + cp_pedwarn ("ANSI C++ forbids declaration `%D' with no type", + dname); + } type = integer_type_node; } } diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 1d16bb2de0e..dff871d4288 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -1085,7 +1085,7 @@ coerce_template_parms (parms, arglist, in_decl) } else if (!TREE_CONSTANT (val)) { - cp_error ("non-const `%E' cannot be used as template argument", + cp_error ("non-constant `%E' cannot be used as template argument", arg); val = error_mark_node; } -- 2.30.2