diff options
author | Niklas Hallqvist <niklas@gnu.org> | 1993-01-30 06:06:09 +0000 |
---|---|---|
committer | Niklas Hallqvist <niklas@gnu.org> | 1993-01-30 06:06:09 +0000 |
commit | 0b73773ce6d43ab6557a9ae8b85913a78f98099b (patch) | |
tree | 633b7489f2b595bb8db561715f9ed783bcb63c14 /gcc | |
parent | 42f769c15a1ffce2b7069bbaa8278f9227ac0cce (diff) | |
download | gcc-0b73773ce6d43ab6557a9ae8b85913a78f98099b.zip gcc-0b73773ce6d43ab6557a9ae8b85913a78f98099b.tar.gz gcc-0b73773ce6d43ab6557a9ae8b85913a78f98099b.tar.bz2 |
c-common.c (c_build_type_variant): Moved here from c-decl.c.
* c-common.c (c_build_type_variant): Moved here from c-decl.c.
Redirected the TYPE_MAIN_VARIANT to the "real" main variant.
Build the possibly new array type on the permanent obstack if it
the original type was permanent.
(permanent_obstack): Added extern declaration.
From-SVN: r3388
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/c-common.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c index 3c51f0b..74168cb 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -24,6 +24,8 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "flags.h" #include <stdio.h> +extern struct obstack permanent_obstack; + /* Make bindings for __FUNCTION__ and __PRETTY_FUNCTION__. */ void @@ -1023,3 +1025,28 @@ get_directive_line (finput) char_escaped = (c == '\\' && ! char_escaped); } } + +/* Make a variant type in the proper way for C/C++, propagating qualifiers + down to the element type of an array. */ + +tree +c_build_type_variant (type, constp, volatilep) + tree type; + int constp, volatilep; +{ + if (TREE_CODE (type) == ARRAY_TYPE) + { + tree real_main_variant = TYPE_MAIN_VARIANT (type); + int permanent = TREE_PERMANENT (type); + + if (permanent) + push_obstacks (&permanent_obstack, &permanent_obstack); + type = build_array_type (c_build_type_variant (TREE_TYPE (type), + constp, volatilep), + TYPE_DOMAIN (type)); + TYPE_MAIN_VARIANT (type) = real_main_variant; + if (permanent) + pop_obstacks (); + } + return build_type_variant (type, constp, volatilep); +} |