+2000-06-26 Joseph S. Myers <jsm28@cam.ac.uk>
+
+ * c-decl.c (grokdeclarator): Don't warn about `long long' in C99.
+ Make warnings about implicit int be pedwarns in C99. Don't warn
+ about duplicate type qualifiers in C99.
+ (start_function): Make warning about implict int return type be a
+ pedwarn in C99.
+ * c-lex.c (yylex): Don't warn about `long long' in C99.
+ * c-typeck.c (c_expand_return): In C99, always pedwarn about
+ `return' with no value in function returning non-void.
+
+2000-06-26 Richard Henderson <rth@cygnus.com>
+
+ * c-typeck.c (pedwarn_c99): New.
+ * diagnostic.c (verror, vwarning, vpedwarn): Export.
+ * toplev.h: Prototype them.
+
2000-06-26 J. David Anglin <dave@hiauly1.hia.nrc.ca>
* c-typeck.c (digest_init): Return error_mark_node node when
2000-06-25 Theodore Papadopoulo <Theodore.Papadopoulo@sophia.inria.fr>
- * gengenrtl.c (special_rtx): Fix typo in comment.
+ * gengenrtl.c (special_rtx): Fix typo in comment.
2000-06-26 Michael Hayes <m.hayes@elec.canterbury.ac.nz>
2000-06-25 John David Anglin <dave.anglin@nrc.ca>
- * config/vax/vax.h (TARGET_SWITCHES): Provide descriptions.
+ * config/vax/vax.h (TARGET_SWITCHES): Provide descriptions.
2000-06-25 Herman A.J. ten Brugge <Haj.Ten.Brugge@net.HCC.nl>
error ("`long long long' is too long for GCC");
else
{
- if (pedantic && ! in_system_header && warn_long_long)
+ if (pedantic && !flag_isoc99 && ! in_system_header
+ && warn_long_long)
pedwarn ("ANSI C does not support `long long'");
longlong = 1;
}
if ((warn_implicit_int || warn_return_type) && funcdef_flag)
warn_about_return_type = 1;
else if (warn_implicit_int || flag_isoc99)
- warning ("type defaults to `int' in declaration of `%s'", name);
+ pedwarn_c99 ("type defaults to `int' in declaration of `%s'", name);
}
defaulted_int = 1;
restrictp = !! (specbits & 1 << (int) RID_RESTRICT) + TYPE_RESTRICT (type);
volatilep = !! (specbits & 1 << (int) RID_VOLATILE) + TYPE_VOLATILE (type);
inlinep = !! (specbits & (1 << (int) RID_INLINE));
- if (constp > 1)
+ if (constp > 1 && ! flag_isoc99)
pedwarn ("duplicate `const'");
- if (restrictp > 1)
+ if (restrictp > 1 && ! flag_isoc99)
pedwarn ("duplicate `restrict'");
- if (volatilep > 1)
+ if (volatilep > 1 && ! flag_isoc99)
pedwarn ("duplicate `volatile'");
if (! flag_gen_aux_info && (TYPE_QUALS (type)))
type = TYPE_MAIN_VARIANT (type);
error ("invalid type modifier within pointer declarator");
}
}
- if (constp > 1)
+ if (constp > 1 && ! flag_isoc99)
pedwarn ("duplicate `const'");
- if (volatilep > 1)
+ if (volatilep > 1 && ! flag_isoc99)
pedwarn ("duplicate `volatile'");
- if (restrictp > 1)
+ if (restrictp > 1 && ! flag_isoc99)
pedwarn ("duplicate `restrict'");
type_quals = ((constp ? TYPE_QUAL_CONST : 0)
if (!COMPLETE_OR_VOID_TYPE_P (TREE_TYPE (TREE_TYPE (decl1))))
{
- error ("return-type is an incomplete type");
+ error ("return type is an incomplete type");
/* Make it return void instead. */
TREE_TYPE (decl1)
= build_function_type (void_type_node,
}
if (warn_about_return_type)
- warning ("return-type defaults to `int'");
+ pedwarn_c99 ("return type defaults to `int'");
/* Save the parm names or decls from this function's declarator
where store_parm_decls will find them. */
{
if (spec_long_long)
error ("three `l's in integer constant");
- else if (pedantic && ! in_system_header && warn_long_long)
+ else if (pedantic && ! flag_isoc99
+ && ! in_system_header && warn_long_long)
pedwarn ("ANSI C forbids long long integer constants");
spec_long_long = 1;
}
const char *, int));
extern void c_expand_return PARAMS ((tree));
extern tree c_expand_start_case PARAMS ((tree));
+extern void pedwarn_c99 PARAMS ((const char *, ...))
+ ATTRIBUTE_PRINTF_1;
/* in c-iterate.c */
extern void init_iterators PARAMS ((void));
if (!retval)
{
current_function_returns_null = 1;
- if (warn_return_type && valtype != 0 && TREE_CODE (valtype) != VOID_TYPE)
- warning ("`return' with no value, in function returning non-void");
+ if ((warn_return_type || flag_isoc99)
+ && valtype != 0 && TREE_CODE (valtype) != VOID_TYPE)
+ pedwarn_c99 ("`return' with no value, in function returning non-void");
expand_null_return ();
}
else if (valtype == 0 || TREE_CODE (valtype) == VOID_TYPE)
return exp;
}
+
+/* Issue an ISO C99 pedantic warning MSGID. */
+
+void
+pedwarn_c99 VPARAMS ((const char *msgid, ...))
+{
+#ifndef ANSI_PROTOTYPES
+ const char *msgid;
+#endif
+ va_list ap;
+
+ VA_START (ap, msgid);
+
+#ifndef ANSI_PROTOTYPES
+ msgid = va_arg (ap, const char *);
+#endif
+
+ if (flag_isoc99)
+ vpedwarn (msgid, ap);
+ else
+ vwarning (msgid, ap);
+
+ va_end (ap);
+}
const char *, va_list));
static void v_error_with_decl PARAMS ((tree, const char *, va_list));
static void v_error_for_asm PARAMS ((rtx, const char *, va_list));
-static void verror PARAMS ((const char *, va_list));
static void vfatal PARAMS ((const char *, va_list)) ATTRIBUTE_NORETURN;
static void v_warning_with_file_and_line PARAMS ((const char *, int,
const char *, va_list));
static void v_warning_with_decl PARAMS ((tree, const char *, va_list));
static void v_warning_for_asm PARAMS ((rtx, const char *, va_list));
-static void vwarning PARAMS ((const char *, va_list));
-static void vpedwarn PARAMS ((const char *, va_list));
static void v_pedwarn_with_decl PARAMS ((tree, const char *, va_list));
static void v_pedwarn_with_file_and_line PARAMS ((const char *, int,
const char *, va_list));
/* Report an error at the current line number. */
-static void
+void
verror (msgid, ap)
const char *msgid;
va_list ap;
/* Report a warning at the current line number. */
-static void
+void
vwarning (msgid, ap)
const char *msgid;
va_list ap;
/* These functions issue either warnings or errors depending on
-pedantic-errors. */
-static void
+void
vpedwarn (msgid, ap)
const char *msgid;
va_list ap;
#endif
extern void warning PARAMS ((const char *, ...))
ATTRIBUTE_PRINTF_1;
+extern void vwarning PARAMS ((const char *, va_list));
extern void error PARAMS ((const char *, ...))
ATTRIBUTE_PRINTF_1;
+extern void verror PARAMS ((const char *, va_list));
extern void pedwarn PARAMS ((const char *, ...))
ATTRIBUTE_PRINTF_1;
+extern void vpedwarn PARAMS ((const char *, va_list));
extern void pedwarn_with_file_and_line PARAMS ((const char *, int,
const char *, ...))
ATTRIBUTE_PRINTF_3;