From: Guillaume Gomez <[email protected]>

gcc/d/ChangeLog:

        * d-attribs.cc (handle_noreturn_attribute, handle_malloc_attribute)
        (handle_nonnull_attribute, handle_transaction_pure_attribute)
        (handle_omp_declare_simd_attribute, d_handle_noreturn_attribute)
        (d_handle_malloc_attribute, d_handle_nonnull_attribute)
        (d_handle_transaction_pure_attribute)
        (d_handle_omp_declare_simd_attribute): Prepend functions with `d_`
---
Follow-up of #247.

In particular, @dkm suggested here to prepend all Ada attribute handling 
functions to prevent name conflicts and I think it's a very good idea, so I'm 
doing it here as well.

cc @ibuclaw



This is a forge pull request published on the gcc-patches mailing list mailing 
list
as requested by Guillaume Gomez via Sourceware Forge 
<[email protected]>.
Forge discussion: https://forge.sourceware.org/gcc/gcc/pulls/274

Get it locally using:
```
git fetch forge-upstream "+refs/versioned_pull/274/*:refs/versioned_pull/274/*"
git switch -c "pr-274-v1" "refs/versioned_pull/274/1/head"
```
Or, download the patch at: https://forge.sourceware.org/gcc/gcc/pulls/274.diff
Created on: 2026-11-12 15:37:15+00:00
Latest update: 2026-11-12 15:37:48+00:00
Changes: 1 changed files, 17 additions, 15 deletions
Head revision: imperio/gcc ref d-attr-conflict commit 
eb3cbe9b08f92ebca413afe561a46ff4d108b48f 
Base revision: gcc/gcc ref trunk commit 
d20952792b133c691be69a2bfdb71e1956592956 r17-6173-gd20952792b133c
Merge base: d20952792b133c691be69a2bfdb71e1956592956
Requested Reviewers: 

Changed files:
- M: gcc/d/d-attribs.cc

 gcc/d/d-attribs.cc | 32 +++++++++++++++++---------------
 1 file changed, 17 insertions(+), 15 deletions(-)

diff --git a/gcc/d/d-attribs.cc b/gcc/d/d-attribs.cc
index fcba75de065a0..16ab5cd83680d 100644
--- a/gcc/d/d-attribs.cc
+++ b/gcc/d/d-attribs.cc
@@ -47,11 +47,13 @@ along with GCC; see the file COPYING3.  If not see
 
 
 /* Internal attribute handlers for built-in functions.  */
-static tree handle_noreturn_attribute (tree *, tree, tree, int, bool *);
-static tree handle_malloc_attribute (tree *, tree, tree, int, bool *);
-static tree handle_nonnull_attribute (tree *, tree, tree, int, bool *);
-static tree handle_transaction_pure_attribute (tree *, tree, tree, int, bool 
*);
-static tree handle_omp_declare_simd_attribute (tree *, tree, tree, int, bool 
*);
+static tree d_handle_noreturn_attribute (tree *, tree, tree, int, bool *);
+static tree d_handle_malloc_attribute (tree *, tree, tree, int, bool *);
+static tree d_handle_nonnull_attribute (tree *, tree, tree, int, bool *);
+static tree d_handle_transaction_pure_attribute (tree *, tree, tree, int,
+                                                bool *);
+static tree d_handle_omp_declare_simd_attribute (tree *, tree, tree, int,
+                                                bool *);
 
 /* D attribute handlers for user defined attributes.  */
 static tree d_handle_always_inline_attribute (tree *, tree, tree, int, bool *);
@@ -99,23 +101,23 @@ static const struct attribute_spec::exclusions 
attr_target_clones_exclusions[] =
 static const attribute_spec d_langhook_common_attributes[] =
 {
   ATTR_SPEC ("noreturn", 0, 0, true, false, false, false,
-            handle_noreturn_attribute, attr_noreturn_exclusions),
+            d_handle_noreturn_attribute, attr_noreturn_exclusions),
   ATTR_SPEC ("leaf", 0, 0, true, false, false, false,
             handle_leaf_attribute, NULL),
   ATTR_SPEC ("const", 0, 0, true, false, false, false,
             handle_const_attribute, attr_const_pure_exclusions),
   ATTR_SPEC ("malloc", 0, 0, true, false, false, false,
-            handle_malloc_attribute, NULL),
+            d_handle_malloc_attribute, NULL),
   ATTR_SPEC ("returns_twice", 0, 0, true, false, false, false,
             handle_returns_twice_attribute, attr_returns_twice_exclusions),
   ATTR_SPEC ("pure", 0, 0, true, false, false, false,
             handle_pure_attribute, attr_const_pure_exclusions),
   ATTR_SPEC ("nonnull", 0, -1, false, true, true, false,
-            handle_nonnull_attribute, NULL),
+            d_handle_nonnull_attribute, NULL),
   ATTR_SPEC ("nothrow", 0, 0, true, false, false, false,
             handle_nothrow_attribute, NULL),
   ATTR_SPEC ("transaction_pure", 0, 0, false, true, true, false,
-            handle_transaction_pure_attribute, NULL),
+            d_handle_transaction_pure_attribute, NULL),
   ATTR_SPEC ("no vops", 0, 0, true, false, false, false,
             handle_novops_attribute, NULL),
   ATTR_SPEC ("type generic", 0, 0, false, true, true, false,
@@ -123,7 +125,7 @@ static const attribute_spec d_langhook_common_attributes[] =
   ATTR_SPEC ("fn spec", 1, 1, false, true, true, false,
             handle_fnspec_attribute, NULL),
   ATTR_SPEC ("omp declare simd", 0, -1, true,  false, false, false,
-            handle_omp_declare_simd_attribute, NULL),
+            d_handle_omp_declare_simd_attribute, NULL),
 };
 
 const scoped_attribute_specs d_langhook_common_attribute_table =
@@ -388,7 +390,7 @@ apply_user_attributes (Dsymbol *sym, tree node)
    struct attribute_spec.handler.  */
 
 static tree
-handle_noreturn_attribute (tree *node, tree, tree, int, bool *)
+d_handle_noreturn_attribute (tree *node, tree, tree, int, bool *)
 {
   tree type = TREE_TYPE (*node);
 
@@ -410,7 +412,7 @@ handle_noreturn_attribute (tree *node, tree, tree, int, 
bool *)
    struct attribute_spec.handler.  */
 
 tree
-handle_malloc_attribute (tree *node, tree, tree, int, bool *)
+d_handle_malloc_attribute (tree *node, tree, tree, int, bool *)
 {
   gcc_assert (TREE_CODE (*node) == FUNCTION_DECL
              && POINTER_TYPE_P (TREE_TYPE (TREE_TYPE (*node))));
@@ -435,7 +437,7 @@ get_nonnull_operand (tree arg_num_expr, unsigned 
HOST_WIDE_INT *valp)
 /* Handle the "nonnull" attribute.  */
 
 static tree
-handle_nonnull_attribute (tree *node, tree, tree args, int, bool *)
+d_handle_nonnull_attribute (tree *node, tree, tree args, int, bool *)
 {
   tree type = *node;
 
@@ -485,7 +487,7 @@ handle_nonnull_attribute (tree *node, tree, tree args, int, 
bool *)
    struct attribute_spec.handler.  */
 
 static tree
-handle_transaction_pure_attribute (tree *node, tree, tree, int, bool *)
+d_handle_transaction_pure_attribute (tree *node, tree, tree, int, bool *)
 {
   /* Ensure we have a function type.  */
   gcc_assert (TREE_CODE (*node) == FUNCTION_TYPE);
@@ -497,7 +499,7 @@ handle_transaction_pure_attribute (tree *node, tree, tree, 
int, bool *)
    struct attribute_spec.handler.  */
 
 tree
-handle_omp_declare_simd_attribute (tree *node, tree, tree, int, bool *)
+d_handle_omp_declare_simd_attribute (tree *node, tree, tree, int, bool *)
 {
   gcc_assert (TREE_CODE (*node) == FUNCTION_DECL);
   return NULL_TREE;
-- 
2.56.0

Reply via email to