+Mon Sep 29 11:05:54 1997 Alexandre Oliva <oliva@dcc.unicamp.br>
+
+ * lang-options.h: new -Wold-style-cast flag.
+ * cp-tree.h (warn_old_style_cast): new variable.
+ * decl2.c (warn_old_style_cast): ditto.
+ (lang_decode_option): support -Wold-style-cast.
+ (reparse_absdcl_as_casts): produce old-style-cast warning.
+
+Mon Sep 29 09:20:53 1997 Benjamin Kosnik <bkoz@rhino.cygnus.com>
+
+ * decl.c (cp_finish_decl): Allow expand_aggr_init to set
+ TREE_USED, reset value based on already_used.
+
+ * init.c (expand_member_init): Revert change.
+
Mon Sep 29 08:57:53 1997 Jason Merrill <jason@yorick.cygnus.com>
* cp-tree.h, decl.c, decl2.c, pt.c:
extern int warn_extern_inline;
+/* Non-zero means warn when an old-style cast is used. */
+
+extern int warn_old_style_cast;
+
/* Nonzero means to treat bitfields as unsigned unless they say `signed'. */
extern int flag_signed_bitfields;
int temporary = allocation_temporary_p ();
char *asmspec = NULL;
int was_readonly = 0;
+ int already_used = 0;
/* If this is 0, then we did not change obstacks. */
if (! decl)
{
/* Compute and store the initial value. */
expand_decl_init (decl);
+ already_used = TREE_USED (decl) || TREE_USED (type);
if (init || TYPE_NEEDS_CONSTRUCTING (type))
{
was initialized was ever used. Don't do this if it has a
destructor, so we don't complain about the 'resource
allocation is initialization' idiom. */
+
if (TYPE_NEEDS_CONSTRUCTING (type)
+ && ! already_used
&& cleanup == NULL_TREE
&& DECL_NAME (decl))
TREE_USED (decl) = 0;
+
+ if (already_used)
+ TREE_USED (decl) = 1;
}
/* Cleanup any temporaries needed for the initial value. */
int warn_sign_promo;
+/* Nonzero means warn when an old-style cast is used. */
+
+int warn_old_style_cast;
+
/* Nonzero means `$' can be in an identifier.
See cccp.c for reasons why this breaks some obscure ANSI C programs. */
warn_ecpp = setting;
else if (!strcmp (p, "sign-promo"))
warn_sign_promo = setting;
+ else if (!strcmp (p, "old-style-cast"))
+ warn_old_style_cast = setting;
else if (!strcmp (p, "comment"))
; /* cpp handles this one. */
else if (!strcmp (p, "comments"))
expr = build_c_cast (type, expr);
}
+ if (warn_old_style_cast)
+ warning ("use of old-style cast");
+
return expr;
}
"-Wno-effc++",
"-Wsign-promo",
"-Wno-sign-promo",
+ "-Wold-style-cast",
+ "-Wno-old-style-cast",