Commit 89aec4b1 by Nathanael Nerode

mangle.c: Convert to ISO C.

	2003-06-16  Jens-Michael Hoffmann  <jensmh@gmx.de>
	* mangle.c: Convert to ISO C.

From-SVN: r68050
parent 0a84d874
2003-06-16 Nathanael Nerode <neroden@gcc.gnu.org>
2003-06-16 Jens-Michael Hoffmann <jensmh@gmx.de>
* mangle.c: Convert to ISO C.
2003-06-16 Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 2003-06-16 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* cp/decl.c, cp/pt.c, cp/search.c, cp/tree.c: Don't use the PTR * cp/decl.c, cp/pt.c, cp/search.c, cp/tree.c: Don't use the PTR
......
...@@ -148,71 +148,74 @@ integer_type_codes[itk_none] = ...@@ -148,71 +148,74 @@ integer_type_codes[itk_none] =
'y' /* itk_unsigned_long_long */ 'y' /* itk_unsigned_long_long */
}; };
static int decl_is_template_id PARAMS ((tree, tree*)); static int decl_is_template_id (const tree, tree* const);
/* Functions for handling substitutions. */ /* Functions for handling substitutions. */
static inline tree canonicalize_for_substitution PARAMS ((tree)); static inline tree canonicalize_for_substitution (tree);
static void add_substitution PARAMS ((tree)); static void add_substitution (tree);
static inline int is_std_substitution PARAMS ((tree, substitution_identifier_index_t)); static inline int is_std_substitution (const tree,
static inline int is_std_substitution_char PARAMS ((tree, substitution_identifier_index_t)); const substitution_identifier_index_t);
static int find_substitution PARAMS ((tree)); static inline int is_std_substitution_char (const tree,
static void mangle_call_offset PARAMS ((tree, tree)); const substitution_identifier_index_t);
static int find_substitution (tree);
static void mangle_call_offset (const tree, const tree);
/* Functions for emitting mangled representations of things. */ /* Functions for emitting mangled representations of things. */
static void write_mangled_name PARAMS ((tree)); static void write_mangled_name (const tree);
static void write_encoding PARAMS ((tree)); static void write_encoding (const tree);
static void write_name PARAMS ((tree, int)); static void write_name (tree, const int);
static void write_unscoped_name PARAMS ((tree)); static void write_unscoped_name (const tree);
static void write_unscoped_template_name PARAMS ((tree)); static void write_unscoped_template_name (const tree);
static void write_nested_name PARAMS ((tree)); static void write_nested_name (const tree);
static void write_prefix PARAMS ((tree)); static void write_prefix (const tree);
static void write_template_prefix PARAMS ((tree)); static void write_template_prefix (const tree);
static void write_unqualified_name PARAMS ((tree)); static void write_unqualified_name (const tree);
static void write_conversion_operator_name (tree); static void write_conversion_operator_name (const tree);
static void write_source_name PARAMS ((tree)); static void write_source_name (tree);
static int hwint_to_ascii PARAMS ((unsigned HOST_WIDE_INT, unsigned int, char *, unsigned)); static int hwint_to_ascii (unsigned HOST_WIDE_INT, const unsigned int, char *,
static void write_number PARAMS ((unsigned HOST_WIDE_INT, int, const unsigned int);
unsigned int)); static void write_number (unsigned HOST_WIDE_INT, const int,
static void write_integer_cst PARAMS ((tree)); const unsigned int);
static void write_real_cst PARAMS ((tree)); static void write_integer_cst (const tree);
static void write_identifier PARAMS ((const char *)); static void write_real_cst (const tree);
static void write_special_name_constructor PARAMS ((tree)); static void write_identifier (const char *);
static void write_special_name_destructor PARAMS ((tree)); static void write_special_name_constructor (const tree);
static void write_type PARAMS ((tree)); static void write_special_name_destructor (const tree);
static int write_CV_qualifiers_for_type PARAMS ((tree)); static void write_type (tree);
static void write_builtin_type PARAMS ((tree)); static int write_CV_qualifiers_for_type (const tree);
static void write_function_type PARAMS ((tree)); static void write_builtin_type (tree);
static void write_bare_function_type PARAMS ((tree, int, tree)); static void write_function_type (const tree);
static void write_method_parms PARAMS ((tree, int, tree)); static void write_bare_function_type (const tree, const int, const tree);
static void write_class_enum_type PARAMS ((tree)); static void write_method_parms (tree, const int, const tree);
static void write_template_args PARAMS ((tree)); static void write_class_enum_type (const tree);
static void write_expression PARAMS ((tree)); static void write_template_args (tree);
static void write_template_arg_literal PARAMS ((tree)); static void write_expression (tree);
static void write_template_arg PARAMS ((tree)); static void write_template_arg_literal (const tree);
static void write_template_template_arg PARAMS ((tree)); static void write_template_arg (tree);
static void write_array_type PARAMS ((tree)); static void write_template_template_arg (const tree);
static void write_pointer_to_member_type PARAMS ((tree)); static void write_array_type (const tree);
static void write_template_param PARAMS ((tree)); static void write_pointer_to_member_type (const tree);
static void write_template_template_param PARAMS ((tree)); static void write_template_param (const tree);
static void write_substitution PARAMS ((int)); static void write_template_template_param (const tree);
static int discriminator_for_local_entity PARAMS ((tree)); static void write_substitution (const int);
static int discriminator_for_string_literal PARAMS ((tree, tree)); static int discriminator_for_local_entity (tree);
static void write_discriminator PARAMS ((int)); static int discriminator_for_string_literal (tree, tree);
static void write_local_name PARAMS ((tree, tree, tree)); static void write_discriminator (const int);
static void dump_substitution_candidates PARAMS ((void)); static void write_local_name (const tree, const tree, const tree);
static const char *mangle_decl_string PARAMS ((tree)); static void dump_substitution_candidates (void);
static const char *mangle_decl_string (const tree);
/* Control functions. */ /* Control functions. */
static inline void start_mangling (tree); static inline void start_mangling (const tree);
static inline const char *finish_mangling (bool); static inline const char *finish_mangling (const bool);
static tree mangle_special_for_type PARAMS ((tree, const char *)); static tree mangle_special_for_type (const tree, const char *);
/* Foreign language functions. */ /* Foreign language functions. */
static void write_java_integer_type_codes PARAMS ((tree)); static void write_java_integer_type_codes (const tree);
/* Append a single character to the end of the mangled /* Append a single character to the end of the mangled
representation. */ representation. */
...@@ -249,15 +252,13 @@ static void write_java_integer_type_codes PARAMS ((tree)); ...@@ -249,15 +252,13 @@ static void write_java_integer_type_codes PARAMS ((tree));
Otherwise return zero. */ Otherwise return zero. */
static int static int
decl_is_template_id (decl, template_info) decl_is_template_id (const tree decl, tree* const template_info)
tree decl;
tree* template_info;
{ {
if (TREE_CODE (decl) == TYPE_DECL) if (TREE_CODE (decl) == TYPE_DECL)
{ {
/* TYPE_DECLs are handled specially. Look at its type to decide /* TYPE_DECLs are handled specially. Look at its type to decide
if this is a template instantiation. */ if this is a template instantiation. */
tree type = TREE_TYPE (decl); const tree type = TREE_TYPE (decl);
if (CLASS_TYPE_P (type) && CLASSTYPE_TEMPLATE_ID_P (type)) if (CLASS_TYPE_P (type) && CLASSTYPE_TEMPLATE_ID_P (type))
{ {
...@@ -328,8 +329,7 @@ dump_substitution_candidates () ...@@ -328,8 +329,7 @@ dump_substitution_candidates ()
and substitution candidates and finding matches. */ and substitution candidates and finding matches. */
static inline tree static inline tree
canonicalize_for_substitution (node) canonicalize_for_substitution (tree node)
tree node;
{ {
/* For a TYPE_DECL, use the type instead. */ /* For a TYPE_DECL, use the type instead. */
if (TREE_CODE (node) == TYPE_DECL) if (TREE_CODE (node) == TYPE_DECL)
...@@ -344,8 +344,7 @@ canonicalize_for_substitution (node) ...@@ -344,8 +344,7 @@ canonicalize_for_substitution (node)
the list of candidates. */ the list of candidates. */
static void static void
add_substitution (node) add_substitution (tree node)
tree node;
{ {
tree c; tree c;
...@@ -366,7 +365,7 @@ add_substitution (node) ...@@ -366,7 +365,7 @@ add_substitution (node)
int i; int i;
for (i = VARRAY_ACTIVE_SIZE (G.substitutions); --i >= 0; ) for (i = VARRAY_ACTIVE_SIZE (G.substitutions); --i >= 0; )
{ {
tree candidate = VARRAY_TREE (G.substitutions, i); const tree candidate = VARRAY_TREE (G.substitutions, i);
if ((DECL_P (node) if ((DECL_P (node)
&& node == candidate) && node == candidate)
|| (TYPE_P (node) || (TYPE_P (node)
...@@ -389,9 +388,8 @@ add_substitution (node) ...@@ -389,9 +388,8 @@ add_substitution (node)
name of substitution_index[INDEX] in the ::std namespace. */ name of substitution_index[INDEX] in the ::std namespace. */
static inline int static inline int
is_std_substitution (node, index) is_std_substitution (const tree node,
tree node; const substitution_identifier_index_t index)
substitution_identifier_index_t index;
{ {
tree type = NULL; tree type = NULL;
tree decl = NULL; tree decl = NULL;
...@@ -423,9 +421,8 @@ is_std_substitution (node, index) ...@@ -423,9 +421,8 @@ is_std_substitution (node, index)
substitution_index[INDEX]. */ substitution_index[INDEX]. */
static inline int static inline int
is_std_substitution_char (node, index) is_std_substitution_char (const tree node,
tree node; const substitution_identifier_index_t index)
substitution_identifier_index_t index;
{ {
tree args; tree args;
/* Check NODE's name is ::std::identifier. */ /* Check NODE's name is ::std::identifier. */
...@@ -480,11 +477,10 @@ is_std_substitution_char (node, index) ...@@ -480,11 +477,10 @@ is_std_substitution_char (node, index)
return nonzero. If none is found, just return zero. */ return nonzero. If none is found, just return zero. */
static int static int
find_substitution (node) find_substitution (tree node)
tree node;
{ {
int i; int i;
int size = VARRAY_ACTIVE_SIZE (G.substitutions); const int size = VARRAY_ACTIVE_SIZE (G.substitutions);
tree decl; tree decl;
tree type; tree type;
...@@ -613,8 +609,7 @@ find_substitution (node) ...@@ -613,8 +609,7 @@ find_substitution (node)
/* <mangled-name> ::= _Z <encoding> */ /* <mangled-name> ::= _Z <encoding> */
static inline void static inline void
write_mangled_name (decl) write_mangled_name (const tree decl)
tree decl;
{ {
MANGLE_TRACE_TREE ("mangled-name", decl); MANGLE_TRACE_TREE ("mangled-name", decl);
...@@ -639,8 +634,7 @@ write_mangled_name (decl) ...@@ -639,8 +634,7 @@ write_mangled_name (decl)
::= <data name> */ ::= <data name> */
static void static void
write_encoding (decl) write_encoding (const tree decl)
tree decl;
{ {
MANGLE_TRACE_TREE ("encoding", decl); MANGLE_TRACE_TREE ("encoding", decl);
...@@ -686,9 +680,7 @@ write_encoding (decl) ...@@ -686,9 +680,7 @@ write_encoding (decl)
production, to avoid an infinite recursion. */ production, to avoid an infinite recursion. */
static void static void
write_name (decl, ignore_local_scope) write_name (tree decl, const int ignore_local_scope)
tree decl;
int ignore_local_scope;
{ {
tree context; tree context;
...@@ -770,8 +762,7 @@ write_name (decl, ignore_local_scope) ...@@ -770,8 +762,7 @@ write_name (decl, ignore_local_scope)
::= St <unqualified-name> # ::std:: */ ::= St <unqualified-name> # ::std:: */
static void static void
write_unscoped_name (decl) write_unscoped_name (const tree decl)
tree decl;
{ {
tree context = CP_DECL_CONTEXT (decl); tree context = CP_DECL_CONTEXT (decl);
...@@ -797,8 +788,7 @@ write_unscoped_name (decl) ...@@ -797,8 +788,7 @@ write_unscoped_name (decl)
::= <substitution> */ ::= <substitution> */
static void static void
write_unscoped_template_name (decl) write_unscoped_template_name (const tree decl)
tree decl;
{ {
MANGLE_TRACE_TREE ("unscoped-template-name", decl); MANGLE_TRACE_TREE ("unscoped-template-name", decl);
...@@ -816,8 +806,7 @@ write_unscoped_template_name (decl) ...@@ -816,8 +806,7 @@ write_unscoped_template_name (decl)
<CV-qualifiers> ::= [r] [V] [K] */ <CV-qualifiers> ::= [r] [V] [K] */
static void static void
write_nested_name (decl) write_nested_name (const tree decl)
tree decl;
{ {
tree template_info; tree template_info;
...@@ -858,8 +847,7 @@ write_nested_name (decl) ...@@ -858,8 +847,7 @@ write_nested_name (decl)
::= <substitution> */ ::= <substitution> */
static void static void
write_prefix (node) write_prefix (const tree node)
tree node;
{ {
tree decl; tree decl;
/* Non-NULL if NODE represents a template-id. */ /* Non-NULL if NODE represents a template-id. */
...@@ -924,8 +912,7 @@ write_prefix (node) ...@@ -924,8 +912,7 @@ write_prefix (node)
::= <substitution> */ ::= <substitution> */
static void static void
write_template_prefix (node) write_template_prefix (const tree node)
tree node;
{ {
tree decl = DECL_P (node) ? node : TYPE_NAME (node); tree decl = DECL_P (node) ? node : TYPE_NAME (node);
tree type = DECL_P (node) ? TREE_TYPE (node) : node; tree type = DECL_P (node) ? TREE_TYPE (node) : node;
...@@ -1000,8 +987,7 @@ write_template_prefix (node) ...@@ -1000,8 +987,7 @@ write_template_prefix (node)
::= <source-name> */ ::= <source-name> */
static void static void
write_unqualified_name (decl) write_unqualified_name (const tree decl)
tree decl;
{ {
MANGLE_TRACE_TREE ("unqualified-name", decl); MANGLE_TRACE_TREE ("unqualified-name", decl);
...@@ -1040,7 +1026,7 @@ write_unqualified_name (decl) ...@@ -1040,7 +1026,7 @@ write_unqualified_name (decl)
/* Write the unqualified-name for a conversion operator to TYPE. */ /* Write the unqualified-name for a conversion operator to TYPE. */
static void static void
write_conversion_operator_name (tree type) write_conversion_operator_name (const tree type)
{ {
write_string ("cv"); write_string ("cv");
write_type (type); write_type (type);
...@@ -1051,8 +1037,7 @@ write_conversion_operator_name (tree type) ...@@ -1051,8 +1037,7 @@ write_conversion_operator_name (tree type)
<source-name> ::= </length/ number> <identifier> */ <source-name> ::= </length/ number> <identifier> */
static void static void
write_source_name (identifier) write_source_name (tree identifier)
tree identifier;
{ {
MANGLE_TRACE_TREE ("source-name", identifier); MANGLE_TRACE_TREE ("source-name", identifier);
...@@ -1072,11 +1057,8 @@ write_source_name (identifier) ...@@ -1072,11 +1057,8 @@ write_source_name (identifier)
BUFFER points). */ BUFFER points). */
static int static int
hwint_to_ascii (number, base, buffer, min_digits) hwint_to_ascii (unsigned HOST_WIDE_INT number, const unsigned int base,
unsigned HOST_WIDE_INT number; char *buffer, const unsigned int min_digits)
unsigned int base;
char *buffer;
unsigned min_digits;
{ {
static const char base_digits[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; static const char base_digits[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
unsigned digits = 0; unsigned digits = 0;
...@@ -1102,10 +1084,8 @@ hwint_to_ascii (number, base, buffer, min_digits) ...@@ -1102,10 +1084,8 @@ hwint_to_ascii (number, base, buffer, min_digits)
<number> ::= [n] </decimal integer/> */ <number> ::= [n] </decimal integer/> */
static void static void
write_number (number, unsigned_p, base) write_number (unsigned HOST_WIDE_INT number, const int unsigned_p,
unsigned HOST_WIDE_INT number; const unsigned int base)
int unsigned_p;
unsigned int base;
{ {
char buffer[sizeof (HOST_WIDE_INT) * 8]; char buffer[sizeof (HOST_WIDE_INT) * 8];
unsigned count = 0; unsigned count = 0;
...@@ -1124,8 +1104,7 @@ write_number (number, unsigned_p, base) ...@@ -1124,8 +1104,7 @@ write_number (number, unsigned_p, base)
bigger than that, which we must deal with. */ bigger than that, which we must deal with. */
static inline void static inline void
write_integer_cst (cst) write_integer_cst (const tree cst)
tree cst;
{ {
int sign = tree_int_cst_sgn (cst); int sign = tree_int_cst_sgn (cst);
...@@ -1215,8 +1194,7 @@ write_integer_cst (cst) ...@@ -1215,8 +1194,7 @@ write_integer_cst (cst)
Caller is responsible for the Lx and the E. */ Caller is responsible for the Lx and the E. */
static void static void
write_real_cst (value) write_real_cst (const tree value)
tree value;
{ {
if (abi_version_at_least (2)) if (abi_version_at_least (2))
{ {
...@@ -1265,8 +1243,7 @@ write_real_cst (value) ...@@ -1265,8 +1243,7 @@ write_real_cst (value)
<identifier> ::= </unqualified source code identifier> */ <identifier> ::= </unqualified source code identifier> */
static void static void
write_identifier (identifier) write_identifier (const char *identifier)
const char *identifier;
{ {
MANGLE_TRACE ("identifier", identifier); MANGLE_TRACE ("identifier", identifier);
write_string (identifier); write_string (identifier);
...@@ -1286,8 +1263,7 @@ write_identifier (identifier) ...@@ -1286,8 +1263,7 @@ write_identifier (identifier)
append *INTERNAL* to that, to make sure we never emit it. */ append *INTERNAL* to that, to make sure we never emit it. */
static void static void
write_special_name_constructor (ctor) write_special_name_constructor (const tree ctor)
tree ctor;
{ {
if (DECL_COMPLETE_CONSTRUCTOR_P (ctor) if (DECL_COMPLETE_CONSTRUCTOR_P (ctor)
/* Even though we don't ever emit a definition of the /* Even though we don't ever emit a definition of the
...@@ -1313,8 +1289,7 @@ write_special_name_constructor (ctor) ...@@ -1313,8 +1289,7 @@ write_special_name_constructor (ctor)
append *INTERNAL* to that, to make sure we never emit it. */ append *INTERNAL* to that, to make sure we never emit it. */
static void static void
write_special_name_destructor (dtor) write_special_name_destructor (const tree dtor)
tree dtor;
{ {
if (DECL_DELETING_DESTRUCTOR_P (dtor)) if (DECL_DELETING_DESTRUCTOR_P (dtor))
write_string ("D0"); write_string ("D0");
...@@ -1335,14 +1310,12 @@ write_special_name_destructor (dtor) ...@@ -1335,14 +1310,12 @@ write_special_name_destructor (dtor)
entities with the same name in the same FUNCTION. */ entities with the same name in the same FUNCTION. */
static int static int
discriminator_for_local_entity (entity) discriminator_for_local_entity (tree entity)
tree entity;
{ {
tree *type; tree *type;
int discriminator;
/* Assume this is the only local entity with this name. */ /* Assume this is the only local entity with this name. */
discriminator = 0; int discriminator = 0;
if (DECL_DISCRIMINATOR_P (entity) && DECL_LANG_SPECIFIC (entity)) if (DECL_DISCRIMINATOR_P (entity) && DECL_LANG_SPECIFIC (entity))
discriminator = DECL_DISCRIMINATOR (entity); discriminator = DECL_DISCRIMINATOR (entity);
...@@ -1379,8 +1352,7 @@ discriminator_for_string_literal (function, string) ...@@ -1379,8 +1352,7 @@ discriminator_for_string_literal (function, string)
n - 2, if this is the nth occurrence, in lexical order. */ n - 2, if this is the nth occurrence, in lexical order. */
static void static void
write_discriminator (discriminator) write_discriminator (const int discriminator)
int discriminator;
{ {
/* If discriminator is zero, don't write anything. Otherwise... */ /* If discriminator is zero, don't write anything. Otherwise... */
if (discriminator > 0) if (discriminator > 0)
...@@ -1400,10 +1372,8 @@ write_discriminator (discriminator) ...@@ -1400,10 +1372,8 @@ write_discriminator (discriminator)
:= Z <function encoding> E s [<discriminator>] */ := Z <function encoding> E s [<discriminator>] */
static void static void
write_local_name (function, local_entity, entity) write_local_name (const tree function, const tree local_entity,
tree function; const tree entity)
tree local_entity;
tree entity;
{ {
MANGLE_TRACE_TREE ("local-name", entity); MANGLE_TRACE_TREE ("local-name", entity);
...@@ -1445,8 +1415,7 @@ write_local_name (function, local_entity, entity) ...@@ -1445,8 +1415,7 @@ write_local_name (function, local_entity, entity)
TYPE is a type node. */ TYPE is a type node. */
static void static void
write_type (type) write_type (tree type)
tree type;
{ {
/* This gets set to nonzero if TYPE turns out to be a (possibly /* This gets set to nonzero if TYPE turns out to be a (possibly
CV-qualified) builtin type. */ CV-qualified) builtin type. */
...@@ -1574,8 +1543,7 @@ write_type (type) ...@@ -1574,8 +1543,7 @@ write_type (type)
<CV-qualifiers> ::= [r] [V] [K] */ <CV-qualifiers> ::= [r] [V] [K] */
static int static int
write_CV_qualifiers_for_type (type) write_CV_qualifiers_for_type (const tree type)
tree type;
{ {
int num_qualifiers = 0; int num_qualifiers = 0;
...@@ -1633,8 +1601,7 @@ write_CV_qualifiers_for_type (type) ...@@ -1633,8 +1601,7 @@ write_CV_qualifiers_for_type (type)
::= u <source-name> # vendor extended type */ ::= u <source-name> # vendor extended type */
static void static void
write_builtin_type (type) write_builtin_type (tree type)
tree type;
{ {
switch (TREE_CODE (type)) switch (TREE_CODE (type))
{ {
...@@ -1717,8 +1684,7 @@ write_builtin_type (type) ...@@ -1717,8 +1684,7 @@ write_builtin_type (type)
<function-type> ::= F [Y] <bare-function-type> E */ <function-type> ::= F [Y] <bare-function-type> E */
static void static void
write_function_type (type) write_function_type (const tree type)
tree type;
{ {
MANGLE_TRACE_TREE ("function-type", type); MANGLE_TRACE_TREE ("function-type", type);
...@@ -1759,10 +1725,8 @@ write_function_type (type) ...@@ -1759,10 +1725,8 @@ write_function_type (type)
<bare-function-type> ::= </signature/ type>+ */ <bare-function-type> ::= </signature/ type>+ */
static void static void
write_bare_function_type (type, include_return_type_p, decl) write_bare_function_type (const tree type, const int include_return_type_p,
tree type; const tree decl)
int include_return_type_p;
tree decl;
{ {
MANGLE_TRACE_TREE ("bare-function-type", type); MANGLE_TRACE_TREE ("bare-function-type", type);
...@@ -1783,10 +1747,7 @@ write_bare_function_type (type, include_return_type_p, decl) ...@@ -1783,10 +1747,7 @@ write_bare_function_type (type, include_return_type_p, decl)
parameters are being emitted. */ parameters are being emitted. */
static void static void
write_method_parms (parm_types, method_p, decl) write_method_parms (tree parm_types, const int method_p, const tree decl)
tree decl;
tree parm_types;
int method_p;
{ {
tree first_parm_type; tree first_parm_type;
tree parm_decl = decl ? DECL_ARGUMENTS (decl) : NULL_TREE; tree parm_decl = decl ? DECL_ARGUMENTS (decl) : NULL_TREE;
...@@ -1844,8 +1805,7 @@ write_method_parms (parm_types, method_p, decl) ...@@ -1844,8 +1805,7 @@ write_method_parms (parm_types, method_p, decl)
/* <class-enum-type> ::= <name> */ /* <class-enum-type> ::= <name> */
static void static void
write_class_enum_type (type) write_class_enum_type (const tree type)
tree type;
{ {
write_name (TYPE_NAME (type), /*ignore_local_scope=*/0); write_name (TYPE_NAME (type), /*ignore_local_scope=*/0);
} }
...@@ -1856,8 +1816,7 @@ write_class_enum_type (type) ...@@ -1856,8 +1816,7 @@ write_class_enum_type (type)
<template-args> ::= I <template-arg>+ E */ <template-args> ::= I <template-arg>+ E */
static void static void
write_template_args (args) write_template_args (tree args)
tree args;
{ {
MANGLE_TRACE_TREE ("template-args", args); MANGLE_TRACE_TREE ("template-args", args);
...@@ -1904,8 +1863,7 @@ write_template_args (args) ...@@ -1904,8 +1863,7 @@ write_template_args (args)
::= sr <type> <unqualified-name> <template-args> */ ::= sr <type> <unqualified-name> <template-args> */
static void static void
write_expression (expr) write_expression (tree expr)
tree expr;
{ {
enum tree_code code; enum tree_code code;
...@@ -2095,8 +2053,7 @@ write_expression (expr) ...@@ -2095,8 +2053,7 @@ write_expression (expr)
encoded as 0, true as 1." */ encoded as 0, true as 1." */
static void static void
write_template_arg_literal (value) write_template_arg_literal (const tree value)
tree value;
{ {
tree type = TREE_TYPE (value); tree type = TREE_TYPE (value);
write_char ('L'); write_char ('L');
...@@ -2134,8 +2091,7 @@ write_template_arg_literal (value) ...@@ -2134,8 +2091,7 @@ write_template_arg_literal (value)
::= X <expression> E # expression */ ::= X <expression> E # expression */
static void static void
write_template_arg (node) write_template_arg (tree node)
tree node;
{ {
enum tree_code code = TREE_CODE (node); enum tree_code code = TREE_CODE (node);
...@@ -2187,7 +2143,7 @@ write_template_arg (node) ...@@ -2187,7 +2143,7 @@ write_template_arg (node)
::= <substitution> */ ::= <substitution> */
void void
write_template_template_arg (tree decl) write_template_template_arg (const tree decl)
{ {
MANGLE_TRACE_TREE ("template-template-arg", decl); MANGLE_TRACE_TREE ("template-template-arg", decl);
...@@ -2208,8 +2164,7 @@ write_template_template_arg (tree decl) ...@@ -2208,8 +2164,7 @@ write_template_template_arg (tree decl)
the '_' separator) is omitted." */ the '_' separator) is omitted." */
static void static void
write_array_type (type) write_array_type (const tree type)
tree type;
{ {
write_char ('A'); write_char ('A');
if (TYPE_DOMAIN (type)) if (TYPE_DOMAIN (type))
...@@ -2241,8 +2196,7 @@ write_array_type (type) ...@@ -2241,8 +2196,7 @@ write_array_type (type)
<pointer-to-member-type> ::= M </class/ type> </member/ type> */ <pointer-to-member-type> ::= M </class/ type> </member/ type> */
static void static void
write_pointer_to_member_type (type) write_pointer_to_member_type (const tree type)
tree type;
{ {
write_char ('M'); write_char ('M');
write_type (TYPE_PTRMEM_CLASS_TYPE (type)); write_type (TYPE_PTRMEM_CLASS_TYPE (type));
...@@ -2263,8 +2217,7 @@ write_pointer_to_member_type (type) ...@@ -2263,8 +2217,7 @@ write_pointer_to_member_type (type)
This is used by mangle_conv_op_name_for_type. */ This is used by mangle_conv_op_name_for_type. */
static void static void
write_template_param (parm) write_template_param (const tree parm)
tree parm;
{ {
int parm_index; int parm_index;
int parm_level; int parm_level;
...@@ -2313,8 +2266,7 @@ write_template_param (parm) ...@@ -2313,8 +2266,7 @@ write_template_param (parm)
::= <substitution> */ ::= <substitution> */
static void static void
write_template_template_param (parm) write_template_template_param (const tree parm)
tree parm;
{ {
tree template = NULL_TREE; tree template = NULL_TREE;
...@@ -2342,8 +2294,7 @@ write_template_template_param (parm) ...@@ -2342,8 +2294,7 @@ write_template_template_param (parm)
::= S_ */ ::= S_ */
static void static void
write_substitution (seq_id) write_substitution (const int seq_id)
int seq_id;
{ {
MANGLE_TRACE ("substitution", ""); MANGLE_TRACE ("substitution", "");
...@@ -2356,7 +2307,7 @@ write_substitution (seq_id) ...@@ -2356,7 +2307,7 @@ write_substitution (seq_id)
/* Start mangling ENTITY. */ /* Start mangling ENTITY. */
static inline void static inline void
start_mangling (tree entity) start_mangling (const tree entity)
{ {
G.entity = entity; G.entity = entity;
G.need_abi_warning = false; G.need_abi_warning = false;
...@@ -2369,7 +2320,7 @@ start_mangling (tree entity) ...@@ -2369,7 +2320,7 @@ start_mangling (tree entity)
future version of the ABI, issue a warning. */ future version of the ABI, issue a warning. */
static inline const char * static inline const char *
finish_mangling (bool warn) finish_mangling (const bool warn)
{ {
if (warn_abi && warn && G.need_abi_warning) if (warn_abi && warn && G.need_abi_warning)
warning ("the mangled name of `%D' will change in a future " warning ("the mangled name of `%D' will change in a future "
...@@ -2405,8 +2356,7 @@ init_mangle () ...@@ -2405,8 +2356,7 @@ init_mangle ()
/* Generate the mangled name of DECL. */ /* Generate the mangled name of DECL. */
static const char * static const char *
mangle_decl_string (decl) mangle_decl_string (const tree decl)
tree decl;
{ {
const char *result; const char *result;
...@@ -2446,8 +2396,7 @@ mangle_decl_string (decl) ...@@ -2446,8 +2396,7 @@ mangle_decl_string (decl)
/* Create an identifier for the external mangled name of DECL. */ /* Create an identifier for the external mangled name of DECL. */
void void
mangle_decl (decl) mangle_decl (const tree decl)
tree decl;
{ {
tree id = get_identifier (mangle_decl_string (decl)); tree id = get_identifier (mangle_decl_string (decl));
...@@ -2457,8 +2406,7 @@ mangle_decl (decl) ...@@ -2457,8 +2406,7 @@ mangle_decl (decl)
/* Generate the mangled representation of TYPE. */ /* Generate the mangled representation of TYPE. */
const char * const char *
mangle_type_string (type) mangle_type_string (const tree type)
tree type;
{ {
const char *result; const char *result;
...@@ -2473,8 +2421,7 @@ mangle_type_string (type) ...@@ -2473,8 +2421,7 @@ mangle_type_string (type)
/* Create an identifier for the mangled representation of TYPE. */ /* Create an identifier for the mangled representation of TYPE. */
tree tree
mangle_type (type) mangle_type (const tree type)
tree type;
{ {
return get_identifier (mangle_type_string (type)); return get_identifier (mangle_type_string (type));
} }
...@@ -2484,9 +2431,7 @@ mangle_type (type) ...@@ -2484,9 +2431,7 @@ mangle_type (type)
component. */ component. */
static tree static tree
mangle_special_for_type (type, code) mangle_special_for_type (const tree type, const char *code)
tree type;
const char *code;
{ {
const char *result; const char *result;
...@@ -2512,8 +2457,7 @@ mangle_special_for_type (type, code) ...@@ -2512,8 +2457,7 @@ mangle_special_for_type (type, code)
structure for TYPE. */ structure for TYPE. */
tree tree
mangle_typeinfo_for_type (type) mangle_typeinfo_for_type (const tree type)
tree type;
{ {
return mangle_special_for_type (type, "TI"); return mangle_special_for_type (type, "TI");
} }
...@@ -2522,8 +2466,7 @@ mangle_typeinfo_for_type (type) ...@@ -2522,8 +2466,7 @@ mangle_typeinfo_for_type (type)
the mangled name of TYPE. */ the mangled name of TYPE. */
tree tree
mangle_typeinfo_string_for_type (type) mangle_typeinfo_string_for_type (const tree type)
tree type;
{ {
return mangle_special_for_type (type, "TS"); return mangle_special_for_type (type, "TS");
} }
...@@ -2531,8 +2474,7 @@ mangle_typeinfo_string_for_type (type) ...@@ -2531,8 +2474,7 @@ mangle_typeinfo_string_for_type (type)
/* Create an identifier for the mangled name of the vtable for TYPE. */ /* Create an identifier for the mangled name of the vtable for TYPE. */
tree tree
mangle_vtbl_for_type (type) mangle_vtbl_for_type (const tree type)
tree type;
{ {
return mangle_special_for_type (type, "TV"); return mangle_special_for_type (type, "TV");
} }
...@@ -2540,8 +2482,7 @@ mangle_vtbl_for_type (type) ...@@ -2540,8 +2482,7 @@ mangle_vtbl_for_type (type)
/* Returns an identifier for the mangled name of the VTT for TYPE. */ /* Returns an identifier for the mangled name of the VTT for TYPE. */
tree tree
mangle_vtt_for_type (type) mangle_vtt_for_type (const tree type)
tree type;
{ {
return mangle_special_for_type (type, "TT"); return mangle_special_for_type (type, "TT");
} }
...@@ -2561,9 +2502,7 @@ mangle_vtt_for_type (type) ...@@ -2561,9 +2502,7 @@ mangle_vtt_for_type (type)
<special-name> ::= CT <type> <offset number> _ <base type> */ <special-name> ::= CT <type> <offset number> _ <base type> */
tree tree
mangle_ctor_vtbl_for_type (type, binfo) mangle_ctor_vtbl_for_type (const tree type, const tree binfo)
tree type;
tree binfo;
{ {
const char *result; const char *result;
...@@ -2588,9 +2527,7 @@ mangle_ctor_vtbl_for_type (type, binfo) ...@@ -2588,9 +2527,7 @@ mangle_ctor_vtbl_for_type (type, binfo)
::= v <fixed offset number> _ <virtual offset number> _ */ ::= v <fixed offset number> _ <virtual offset number> _ */
static void static void
mangle_call_offset (fixed_offset, virtual_offset) mangle_call_offset (const tree fixed_offset, const tree virtual_offset)
tree fixed_offset;
tree virtual_offset;
{ {
write_char (virtual_offset ? 'v' : 'h'); write_char (virtual_offset ? 'v' : 'h');
...@@ -2621,11 +2558,8 @@ mangle_call_offset (fixed_offset, virtual_offset) ...@@ -2621,11 +2558,8 @@ mangle_call_offset (fixed_offset, virtual_offset)
*/ */
tree tree
mangle_thunk (fn_decl, this_adjusting, fixed_offset, virtual_offset) mangle_thunk (tree fn_decl, const int this_adjusting, tree fixed_offset,
tree fn_decl; tree virtual_offset)
int this_adjusting;
tree fixed_offset;
tree virtual_offset;
{ {
const char *result; const char *result;
...@@ -2671,8 +2605,7 @@ mangle_thunk (fn_decl, this_adjusting, fixed_offset, virtual_offset) ...@@ -2671,8 +2605,7 @@ mangle_thunk (fn_decl, this_adjusting, fixed_offset, virtual_offset)
ABI spec; it is only used internally. */ ABI spec; it is only used internally. */
tree tree
mangle_conv_op_name_for_type (type) mangle_conv_op_name_for_type (const tree type)
tree type;
{ {
tree identifier; tree identifier;
const char *mangled_type; const char *mangled_type;
...@@ -2716,8 +2649,7 @@ mangle_conv_op_name_for_type (type) ...@@ -2716,8 +2649,7 @@ mangle_conv_op_name_for_type (type)
variable for indicated VARIABLE. */ variable for indicated VARIABLE. */
tree tree
mangle_guard_variable (variable) mangle_guard_variable (const tree variable)
tree variable;
{ {
start_mangling (variable); start_mangling (variable);
write_string ("_ZGV"); write_string ("_ZGV");
...@@ -2735,8 +2667,7 @@ mangle_guard_variable (variable) ...@@ -2735,8 +2667,7 @@ mangle_guard_variable (variable)
as well call them something readable. */ as well call them something readable. */
tree tree
mangle_ref_init_variable (variable) mangle_ref_init_variable (const tree variable)
tree variable;
{ {
start_mangling (variable); start_mangling (variable);
write_string ("_ZGR"); write_string ("_ZGR");
...@@ -2750,8 +2681,7 @@ mangle_ref_init_variable (variable) ...@@ -2750,8 +2681,7 @@ mangle_ref_init_variable (variable)
/* How to write the type codes for the integer Java type. */ /* How to write the type codes for the integer Java type. */
static void static void
write_java_integer_type_codes (type) write_java_integer_type_codes (const tree type)
tree type;
{ {
if (type == java_int_type_node) if (type == java_int_type_node)
write_char ('i'); write_char ('i');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment