diff options
author | Tristan Gingold <tgingold@free.fr> | 2016-02-21 07:56:25 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2016-03-08 06:25:52 +0100 |
commit | 77f983ae738583dfce7c3c3aaab5efde16519af0 (patch) | |
tree | d7f17de16b115bfc3ff52ad0f6b04e840800dae8 /src/ortho/gcc | |
parent | a7bb5f6944b410d2b02b1ae5aa9fdc10c68d7519 (diff) | |
download | ghdl-77f983ae738583dfce7c3c3aaab5efde16519af0.tar.gz ghdl-77f983ae738583dfce7c3c3aaab5efde16519af0.tar.bz2 ghdl-77f983ae738583dfce7c3c3aaab5efde16519af0.zip |
ortho: add new_default_value to initialize a variable.
Diffstat (limited to 'src/ortho/gcc')
-rw-r--r-- | src/ortho/gcc/ortho-lang.c | 7 | ||||
-rw-r--r-- | src/ortho/gcc/ortho_gcc.ads | 5 | ||||
-rw-r--r-- | src/ortho/gcc/ortho_gcc.private.ads | 1 |
3 files changed, 12 insertions, 1 deletions
diff --git a/src/ortho/gcc/ortho-lang.c b/src/ortho/gcc/ortho-lang.c index b4fdbe388..fc86d799f 100644 --- a/src/ortho/gcc/ortho-lang.c +++ b/src/ortho/gcc/ortho-lang.c @@ -1376,7 +1376,6 @@ finish_array_aggr (struct o_array_aggr_list *list, tree *res) *res = build_constructor (list->atype, list->elts); } - tree new_union_aggr (tree atype, tree field, tree value) { @@ -1388,6 +1387,12 @@ new_union_aggr (tree atype, tree field, tree value) } tree +new_default_value (tree atype) +{ + return build_constructor (atype, NULL); +} + +tree new_indexed_element (tree arr, tree index) { ortho_mark_addressable (arr); diff --git a/src/ortho/gcc/ortho_gcc.ads b/src/ortho/gcc/ortho_gcc.ads index ab7e0e3d0..7332ceb21 100644 --- a/src/ortho/gcc/ortho_gcc.ads +++ b/src/ortho/gcc/ortho_gcc.ads @@ -138,6 +138,10 @@ package Ortho_Gcc is -- Create a null access literal. function New_Null_Access (Ltype : O_Tnode) return O_Cnode; + -- Create a literal with default (null) values. Can only be used to + -- define the initial value of a static decalaration. + function New_Default_Value (Ltype : O_Tnode) return O_Cnode; + -- Build a record/array aggregate. -- The aggregate is constant, and therefore can be only used to initialize -- constant declaration. @@ -634,6 +638,7 @@ private pragma Import (C, New_Array_Aggr_El); pragma Import (C, Finish_Array_Aggr); pragma Import (C, New_Union_Aggr); + pragma Import (C, New_Default_Value); pragma Import (C, New_Indexed_Element); pragma Import (C, New_Slice); diff --git a/src/ortho/gcc/ortho_gcc.private.ads b/src/ortho/gcc/ortho_gcc.private.ads index 615c8aa13..fcbc59129 100644 --- a/src/ortho/gcc/ortho_gcc.private.ads +++ b/src/ortho/gcc/ortho_gcc.private.ads @@ -202,6 +202,7 @@ private pragma Import (C, New_Array_Aggr_El); pragma Import (C, Finish_Array_Aggr); pragma Import (C, New_Union_Aggr); + pragma Import (C, New_Default_Value); pragma Import (C, New_Indexed_Element); pragma Import (C, New_Slice); |