+1004-10-28 Matt Austern <austern@apple.com>
+
+ PR c++/17542
+ * cp-tree.h (class_key_or_enum_as_string): Declare.
+ * error.c (class_key_or_enum): Rename to class_key_or_enum_as_string
+ and remove static qualifier.
+ * decl.c (shadow_tag): Warn about ignored attributes in class/struct/
+ union/enum declaration.
+
2004-10-29 Kazu Hirata <kazu@cs.umass.edu>
* pt.c: Fix a comment typo.
extern const char *context_as_string (tree, int);
extern const char *lang_decl_name (tree, int);
extern const char *language_to_string (enum languages);
+extern const char *class_key_or_enum_as_string (tree);
extern void print_instantiation_context (void);
/* in except.c */
if (!t)
return NULL_TREE;
+ if (declspecs->attributes)
+ {
+ cp_warning_at ("attribute ignored in declaration of %q#T", t);
+ cp_warning_at ("attribute for %q#T must follow the %qs keyword",
+ t,
+ class_key_or_enum_as_string (t));
+
+ }
+
maybe_process_partial_specialization (t);
/* This is where the variables in an anonymous union are
static void dump_global_iord (tree);
static void dump_parameters (tree, int);
static void dump_exception_spec (tree, int);
-static const char *class_key_or_enum (tree);
static void dump_template_argument (tree, int);
static void dump_template_argument_list (tree, int);
static void dump_template_parameter (tree, int);
/* Return the name of the supplied aggregate, or enumeral type. */
-static const char *
-class_key_or_enum (tree t)
+const char *
+class_key_or_enum_as_string (tree t)
{
if (TREE_CODE (t) == ENUMERAL_TYPE)
return "enum";
dump_aggr_type (tree t, int flags)
{
tree name;
- const char *variety = class_key_or_enum (t);
+ const char *variety = class_key_or_enum_as_string (t);
int typdef = 0;
int tmplate = 0;
+2004-10-30 Matt Austern <austern@apple.com>
+
+ PR c++/17542
+ * g++.dg/ext/attrib18.C: New test.
+
2004-10-30 Roger Sayle <roger@eyesopen.com>
PR middle-end/18096
--- /dev/null
+// PR c++/17542
+// Test that we warn when an attribute preceding the class-key is ignored.
+// { dg-do compile }
+
+__attribute__ ((packed)) struct A
+{ // { dg-warning "attribute" }
+ char c;
+ int x;
+ void f();
+};