* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Variable>: Pass the list
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 23 Nov 2009 18:55:50 +0000 (18:55 +0000)
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 23 Nov 2009 18:55:50 +0000 (18:55 +0000)
of attributes when building the corresponding variable of a constant.
* gcc-interface/utils.c (create_var_decl_1): Do not process attributes
for constants.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@154458 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ada/ChangeLog
gcc/ada/gcc-interface/decl.c
gcc/ada/gcc-interface/utils.c
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/specs/weak1.ads [new file with mode: 0644]

index 02c9efe..08b9b7d 100644 (file)
@@ -1,4 +1,11 @@
 2009-11-23  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Variable>: Pass the list
+       of attributes when building the corresponding variable of a constant.
+       * gcc-interface/utils.c (create_var_decl_1): Do not process attributes
+       for constants.
+
+2009-11-23  Eric Botcazou  <ebotcazou@adacore.com>
             Laurent GUERBY  <laurent@guerby.net>
 
        PR ada/42153
index 9e643a3..ceb1f34 100644 (file)
@@ -1366,7 +1366,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
            tree gnu_corr_var
              = create_true_var_decl (gnu_entity_name, gnu_ext_name, gnu_type,
                                      gnu_expr, true, Is_Public (gnat_entity),
-                                     !definition, static_p, NULL,
+                                     !definition, static_p, attr_list,
                                      gnat_entity);
 
            SET_DECL_CONST_CORRESPONDING_VAR (gnu_decl, gnu_corr_var);
index c79dd4e..ae2bf74 100644 (file)
@@ -1404,10 +1404,12 @@ create_var_decl_1 (tree var_name, tree asm_name, tree type, tree var_init,
           != null_pointer_node)
     DECL_IGNORED_P (var_decl) = 1;
 
-  if (asm_name && VAR_OR_FUNCTION_DECL_P (var_decl))
-    SET_DECL_ASSEMBLER_NAME (var_decl, asm_name);
-
-  process_attributes (var_decl, attr_list);
+  if (TREE_CODE (var_decl) == VAR_DECL)
+    {
+      if (asm_name)
+       SET_DECL_ASSEMBLER_NAME (var_decl, asm_name);
+      process_attributes (var_decl, attr_list);
+    }
 
   /* Add this decl to the current binding level.  */
   gnat_pushdecl (var_decl, gnat_node);
index 0a2519c..70ae905 100644 (file)
@@ -1,3 +1,7 @@
+2009-11-23  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * gnat.dg/specs/weak1.ads: New test.
+
 2009-11-23  Steve Ellcey  <sje@cup.hp.com>
 
        * gcc.dg/debug/dwarf2/inline2.c: Modify scan.
diff --git a/gcc/testsuite/gnat.dg/specs/weak1.ads b/gcc/testsuite/gnat.dg/specs/weak1.ads
new file mode 100644 (file)
index 0000000..82cddc0
--- /dev/null
@@ -0,0 +1,7 @@
+package Weak1 is
+
+   Myconst : constant Integer := 1234;
+   pragma Export (C, Myconst, "myconst");
+   pragma Weak_External (Myconst);
+
+end Weak1;