diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2011-10-26 21:05:10 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2011-10-26 21:05:10 +0000 |
commit | 1586f8a371bc576969febc98a0ac96db2b013517 (patch) | |
tree | 296ec745c94a1e623fc5f0900f73b8e44d597294 /gcc | |
parent | e1e5852c9f5e3c4327b0dbfbd255145a3702ff6b (diff) | |
download | gcc-1586f8a371bc576969febc98a0ac96db2b013517.zip gcc-1586f8a371bc576969febc98a0ac96db2b013517.tar.gz gcc-1586f8a371bc576969febc98a0ac96db2b013517.tar.bz2 |
decl.c (elaborate_expression_1): Add EXPR_PUBLIC_P local variable.
* gcc-interface/decl.c (elaborate_expression_1): Add EXPR_PUBLIC_P local
variable. Always create the elaboration variable, if any, as constant.
From-SVN: r180541
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/ada/gcc-interface/decl.c | 12 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gnat.dg/specs/discr1.ads | 10 | ||||
-rw-r--r-- | gcc/testsuite/gnat.dg/specs/discr1_pkg.ads | 14 |
5 files changed, 40 insertions, 6 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 53ea8c5..7883ad6 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,6 +1,11 @@ 2011-10-26 Eric Botcazou <ebotcazou@adacore.com> + * gcc-interface/decl.c (elaborate_expression_1): Add EXPR_PUBLIC_P local + variable. Always create the elaboration variable, if any, as constant. + +2011-10-26 Eric Botcazou <ebotcazou@adacore.com> + * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Record_Subtype>: Try to make a packable type for fields of union types as well. <is_type>: Use RECORD_OR_UNION_TYPE_P predicate. diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index 9c7c318..4943443 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -6085,7 +6085,8 @@ static tree elaborate_expression_1 (tree gnu_expr, Entity_Id gnat_entity, tree gnu_name, bool definition, bool need_debug) { - const bool expr_global_p = Is_Public (gnat_entity) || global_bindings_p (); + const bool expr_public_p = Is_Public (gnat_entity); + const bool expr_global_p = expr_public_p || global_bindings_p (); bool expr_variable_p, use_variable; /* In most cases, we won't see a naked FIELD_DECL because a discriminant @@ -6153,11 +6154,10 @@ elaborate_expression_1 (tree gnu_expr, Entity_Id gnat_entity, tree gnu_name, if (use_variable || need_debug) { tree gnu_decl - = create_var_decl (create_concat_name (gnat_entity, - IDENTIFIER_POINTER (gnu_name)), - NULL_TREE, TREE_TYPE (gnu_expr), gnu_expr, - !need_debug, Is_Public (gnat_entity), - !definition, expr_global_p, NULL, gnat_entity); + = create_var_decl_1 + (create_concat_name (gnat_entity, IDENTIFIER_POINTER (gnu_name)), + NULL_TREE, TREE_TYPE (gnu_expr), gnu_expr, true, expr_public_p, + !definition, expr_global_p, !need_debug, NULL, gnat_entity); if (use_variable) return gnu_decl; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d8380fb..15d3f23 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2011-10-26 Eric Botcazou <ebotcazou@adacore.com> + * gnat.dg/specs/discr1.ads: New test. + * gnat.dg/specs/discr1_pkg.ads: New helper. + +2011-10-26 Eric Botcazou <ebotcazou@adacore.com> + * gnat.dg/specs/unchecked_union.ads: Rename to... * gnat.dg/specs/unchecked_union1.ads: ...this. * gnat.dg/specs/unchecked_union2.ads: New test. diff --git a/gcc/testsuite/gnat.dg/specs/discr1.ads b/gcc/testsuite/gnat.dg/specs/discr1.ads new file mode 100644 index 0000000..2e02076 --- /dev/null +++ b/gcc/testsuite/gnat.dg/specs/discr1.ads @@ -0,0 +1,10 @@ +-- { dg-do compile } +-- { dg-options "-gnatct" } + +with Discr1_Pkg; use Discr1_Pkg; + +package Discr1 is + + procedure Proc (V : Variable_String_Array); + +end Discr1; diff --git a/gcc/testsuite/gnat.dg/specs/discr1_pkg.ads b/gcc/testsuite/gnat.dg/specs/discr1_pkg.ads new file mode 100644 index 0000000..4bb40ad --- /dev/null +++ b/gcc/testsuite/gnat.dg/specs/discr1_pkg.ads @@ -0,0 +1,14 @@ +package Discr1_Pkg is + + Maximum_Length : Natural := 80 ; + + subtype String_Length is Natural range 0 .. Maximum_Length; + + type Variable_String (Length : String_Length := 0) is + record + S : String (1 .. Length); + end record; + + type Variable_String_Array is array (Natural range <>) of Variable_String; + +end Discr1_Pkg; |