On 11/15/19 10:05 AM, Jan Hubicka wrote:
I am by no means expert in the area so feedback is welcome.  I would
like to get the patch to trunk early next week if it works well.

Thank you Honza for the patch. The idea looks nice to me and I have just
few comments:

1) we should also support foo@@@VER_1 format:
https://sourceware.org/binutils/docs/as/Symver.html#Symver

2) I quoted some error format messages

Martin
diff --git a/gcc/c-family/c-attribs.c b/gcc/c-family/c-attribs.c
index 8dcd38631d2..1723111bec0 100644
--- a/gcc/c-family/c-attribs.c
+++ b/gcc/c-family/c-attribs.c
@@ -2338,12 +2338,11 @@ handle_symver_attribute (tree *node, tree ARG_UNUSED (name), tree args,
 {
   tree symver;
   const char *symver_str;
-  unsigned n;
 
   if (TREE_CODE (*node) != FUNCTION_DECL && TREE_CODE (*node) != VAR_DECL)
     {
       warning (OPT_Wattributes,
-	       "symver attribute is only applicable on functions and variables");
+	       "%<symver%> attribute is only applicable on functions and variables");
       *no_add_attrs = true;
       return NULL_TREE;
     }
@@ -2351,7 +2350,7 @@ handle_symver_attribute (tree *node, tree ARG_UNUSED (name), tree args,
   if (!decl_in_symtab_p (*node))
     {
       warning (OPT_Wattributes,
-	       "symver attribute is only applicable to symbols");
+	       "%<symver%> attribute is only applicable to symbols");
       *no_add_attrs = true;
       return NULL_TREE;
     }
@@ -2361,7 +2360,7 @@ handle_symver_attribute (tree *node, tree ARG_UNUSED (name), tree args,
       symver = TREE_VALUE (args);
       if (TREE_CODE (symver) != STRING_CST)
 	{
-	  error ("symver attribute argument not a string constant");
+	  error ("%<symver%> attribute argument not a string constant");
 	  *no_add_attrs = true;
 	  return NULL_TREE;
 	}
@@ -2369,13 +2368,14 @@ handle_symver_attribute (tree *node, tree ARG_UNUSED (name), tree args,
       symver_str = TREE_STRING_POINTER (symver);
 
       int ats = 0;
-      for (n = 0; n < TREE_STRING_LENGTH (symver); n++)
+      for (int n = 0; n < TREE_STRING_LENGTH (symver); n++)
 	if (symver_str[n] == '@')
 	  ats++;
 
-      if (ats != 1 && ats != 2)
+      if (ats < 1 || ats > 3)
 	{
-	  error ("symver attribute argument must have format %<name@nodename%>");
+	  error ("%<symver%> attribute argument %qs must contain one, "
+		 "two or three %<@%>", symver_str);
 	  *no_add_attrs = true;
 	  return NULL_TREE;
 	}
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index b45a864f3ed..c7caff5023a 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -776,7 +776,7 @@ process_symver_attribute (symtab_node *n)
       return;
     }
 
-  /* Create new symbol table entry represneting the version.  */
+  /* Create new symbol table entry representing the version.  */
   tree new_decl = copy_node (n->decl);
 
   DECL_INITIAL (new_decl) = NULL_TREE;

Reply via email to