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
This commit is contained in:
parent
42f769c15a
commit
0b73773ce6
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user