===================================================================
@@ -7489,12 +7489,15 @@ handle_tm_wrap_attribute (tree *node, tr
warning (OPT_Wattributes, "%qE attribute ignored", name);
else
{
- tree wrap_id = TREE_VALUE (args);
- if (TREE_CODE (wrap_id) != IDENTIFIER_NODE)
+ tree wrap_decl = TREE_VALUE (args);
+ if (TREE_CODE (wrap_decl) != IDENTIFIER_NODE
+ && TREE_CODE (wrap_decl) != VAR_DECL
+ && TREE_CODE (wrap_decl) != FUNCTION_DECL)
error ("%qE argument not an identifier", name);
else
{
- tree wrap_decl = lookup_name (wrap_id);
+ if (TREE_CODE (wrap_decl) == IDENTIFIER_NODE)
+ wrap_decl = lookup_name (wrap_decl);
if (wrap_decl && TREE_CODE (wrap_decl) == FUNCTION_DECL)
{
if (lang_hooks.types_compatible_p (TREE_TYPE (decl),
@@ -7504,7 +7507,7 @@ handle_tm_wrap_attribute (tree *node, tr
error ("%qD is not compatible with %qD", wrap_decl, decl);
}
else
- error ("%qE is not a function", wrap_id);
+ error ("transaction_wrap argument is not a function");
}
}
===================================================================
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm" } */
+
+#define W(X) __attribute__((transaction_wrap(X)))
+void f1(void);
+void f2(int);
+int i3;
+int f7(void);
+
+void g1(void) W(f1);
+void g2(void) W(f2); /* { dg-error "is not compatible" } */
+void g3(void) W(i3); /* { dg-error "is not a function" } */
+void g4(void) W(f4); /* { dg-error "is not a function" } */
+void g5(void) W(1); /* { dg-error "not an identifier" } */
+void g6(void) W("f1"); /* { dg-error "not an identifier" } */
+void g7(void) W(f7); /* { dg-error "is not compatible" } */
===================================================================
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-options "-fgnu-tm" } */
+
+#define W(X) __attribute__((transaction_wrap(X)))
+void f1(void);
+void f2(int);
+int i3;
+int f7(void);
+
+void g1(void) W(f1);
+void g2(void) W(f2); /* { dg-error "is not compatible" } */
+void g3(void) W(i3); /* { dg-error "is not a function" } */
+void g4(void) W(f4); /* { dg-error "not declared in this scope\|not an identifier" } */
+void g5(void) W(1); /* { dg-error "not an identifier" } */
+void g6(void) W("f1"); /* { dg-error "not an identifier" } */
+void g7(void) W(f7); /* { dg-error "is not compatible" } */
===================================================================
@@ -1,16 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "-fgnu-tm" } */
-
-#define W(X) __attribute__((transaction_wrap(X)))
-void f1(void);
-void f2(int);
-int i3;
-int f7(void);
-
-void g1(void) W(f1);
-void g2(void) W(f2); /* { dg-error "is not compatible" } */
-void g3(void) W(i3); /* { dg-error "is not a function" } */
-void g4(void) W(f4); /* { dg-error "is not a function" } */
-void g5(void) W(1); /* { dg-error "not an identifier" } */
-void g6(void) W("f1"); /* { dg-error "not an identifier" } */
-void g7(void) W(f7); /* { dg-error "is not compatible" } */