+2006-08-15 Danny Smith <dannysmith@users.sourceforge.net>
+
+ PR c/28287
+ * c-common.c (handle_weak_attribute): Ignore and warn if
+ not a FUNCTION_ or VAR_DECL.
+
2006-07-15 Mike Stump <mrs@apple.com>
PR c/28280
struct attribute_spec.handler. */
static tree
-handle_weak_attribute (tree *node, tree ARG_UNUSED (name),
+handle_weak_attribute (tree *node, tree name,
tree ARG_UNUSED (args),
int ARG_UNUSED (flags),
bool * ARG_UNUSED (no_add_attrs))
{
- declare_weak (*node);
+ if (TREE_CODE (*node) == FUNCTION_DECL
+ || TREE_CODE (*node) == VAR_DECL)
+ declare_weak (*node);
+ else
+ warning (OPT_Wattributes, "%qE attribute ignored", name);
+
return NULL_TREE;
}
+2006-08-15 Danny Smith <dannysmith@users.sourceforge.net>
+
+ PR c/28287
+ * gcc.dg/attr-invalid.c: Add tests for invalid weak attribute.
+
2006-08-15 Lee Millward <lee.millward@codesourcery.com>
PR c++/28594
auto int lvar ATTR; /* { dg-warning "attribute ignored" "" } */
return 0;
}
+
+
+/* PR 28287 */
+/* These are invalid on all targets. Applying to PARM_ or FIELD_DECL
+ also caused a tree checking ice on targets that support weak, */
+#undef AT
+#define AT weak
+
+typedef int ATSYM(type) ATTR; /* { dg-warning "attribute ignored" "" } */
+
+typedef int (*ATSYM(fntype))(void) ATTR; /* { dg-warning "attribute ignored" "" } */
+
+struct ATSYM(struct) {
+ char dummy ATTR; /* { dg-warning "attribute ignored" "" } */
+};
+
+int ATSYM(fn_knrarg) (arg)
+ int arg ATTR; /* { dg-warning "attribute ignored" "" } */
+{ return 0; }
+
+int ATSYM(fn_isoarg) (int arg ATTR) { return 0; } /* { dg-warning "attribute ignored" "" } */