aboutsummaryrefslogtreecommitdiff
path: root/gcc/d
diff options
context:
space:
mode:
authorIain Buclaw <ibuclaw@gdcproject.org>2022-06-24 15:30:13 +0200
committerIain Buclaw <ibuclaw@gdcproject.org>2022-06-24 20:54:03 +0200
commit5959cf8217e90b1331170fce96d83dd796a2bd8d (patch)
treed6325f42811f2b1bfba3644220a5b93af623e325 /gcc/d
parent91418c42089cd1cbe71edcd6b2f5b26559819372 (diff)
downloadgcc-5959cf8217e90b1331170fce96d83dd796a2bd8d.zip
gcc-5959cf8217e90b1331170fce96d83dd796a2bd8d.tar.gz
gcc-5959cf8217e90b1331170fce96d83dd796a2bd8d.tar.bz2
d: Give consistent error message when attribute argument not a string constant
gcc/d/ChangeLog: * d-attribs.cc (d_handle_section_attribute): Update error message. (d_handle_symver_attribute): Likewise. (d_handle_no_sanitize_attribute): Likewise. (d_handle_visibility_attribute): Likewise. gcc/testsuite/ChangeLog: * gdc.dg/attr_section1.d: Update dg-error. * gdc.dg/attr_visibility1.d: Likewise.
Diffstat (limited to 'gcc/d')
-rw-r--r--gcc/d/d-attribs.cc11
1 files changed, 6 insertions, 5 deletions
diff --git a/gcc/d/d-attribs.cc b/gcc/d/d-attribs.cc
index 23bbe39..1dd806f 100644
--- a/gcc/d/d-attribs.cc
+++ b/gcc/d/d-attribs.cc
@@ -1015,7 +1015,7 @@ d_handle_section_attribute (tree *node, tree name, tree args, int flags,
if (TREE_CODE (TREE_VALUE (args)) != STRING_CST)
{
- error ("section attribute argument not a string constant");
+ error ("%qE attribute argument not a string constant", name);
*no_add_attrs = true;
return NULL_TREE;
}
@@ -1065,7 +1065,8 @@ d_handle_section_attribute (tree *node, tree name, tree args, int flags,
struct attribute_spec.handler. */
static tree
-d_handle_symver_attribute (tree *node, tree, tree args, int, bool *no_add_attrs)
+d_handle_symver_attribute (tree *node, tree name, tree args, int,
+ bool *no_add_attrs)
{
if (TREE_CODE (*node) != FUNCTION_DECL && TREE_CODE (*node) != VAR_DECL)
{
@@ -1088,7 +1089,7 @@ d_handle_symver_attribute (tree *node, tree, tree args, int, bool *no_add_attrs)
tree symver = TREE_VALUE (args);
if (TREE_CODE (symver) != STRING_CST)
{
- error ("%<symver%> attribute argument not a string constant");
+ error ("%qE attribute argument not a string constant", name);
*no_add_attrs = true;
return NULL_TREE;
}
@@ -1391,7 +1392,7 @@ d_handle_no_sanitize_attribute (tree *node, tree name, tree args, int,
tree id = TREE_VALUE (args);
if (TREE_CODE (id) != STRING_CST)
{
- error ("%qE argument not a string", name);
+ error ("%qE attribute argument not a string constant", name);
return NULL_TREE;
}
@@ -1525,7 +1526,7 @@ d_handle_visibility_attribute (tree *node, tree name, tree args,
tree id = TREE_VALUE (args);
if (TREE_CODE (id) != STRING_CST)
{
- error ("visibility argument not a string");
+ error ("%qE attribute argument not a string constant", name);
return NULL_TREE;
}