#include "libiberty.h"
-static char *ada_demangle PARAMS ((const char*, int));
+static char *ada_demangle PARAMS ((const char *, int));
#define min(X,Y) (((X) < (Y)) ? (X) : (Y))
recursively_demangle PARAMS ((struct work_stuff *, const char **, string *,
int));
+static void
+grow_vect PARAMS ((void **, size_t *, size_t, int));
+
/* Translate count to integer, consuming tokens in the process.
Conversion terminates on the first non-digit character.
char *ret;
struct work_stuff work[1];
memset ((char *) work, 0, sizeof (work));
- work -> options = options;
- if ((work -> options & DMGL_STYLE_MASK) == 0)
- work -> options |= (int) current_demangling_style & DMGL_STYLE_MASK;
+ work->options = options;
+ if ((work->options & DMGL_STYLE_MASK) == 0)
+ work->options |= (int) current_demangling_style & DMGL_STYLE_MASK;
/* The new-ABI demangling is implemented elsewhere. */
if (GNU_NEW_ABI_DEMANGLING)
/* Assuming *OLD_VECT points to an array of *SIZE objects of size
ELEMENT_SIZE, grow it to contain at least MIN_SIZE objects,
- updating *OLD_VECT and *SIZE as necessary. */
+ updating *OLD_VECT and *SIZE as necessary. */
+
static void
grow_vect (old_vect, size, min_size, element_size)
- void** old_vect;
- size_t* size;
+ void **old_vect;
+ size_t *size;
size_t min_size;
int element_size;
{
- if (*size < min_size) {
- *size *= 2;
- if (*size < min_size)
- *size = min_size;
- *old_vect = xrealloc (*old_vect, *size * element_size);
- }
+ if (*size < min_size)
+ {
+ *size *= 2;
+ if (*size < min_size)
+ *size = min_size;
+ *old_vect = xrealloc (*old_vect, *size * element_size);
+ }
}
/* Demangle ada names:
1. Discard final __{DIGIT}+ or ${DIGIT}+
2. Convert other instances of embedded "__" to `.'.
3. Discard leading _ada_.
- 4. Remove everything after first ___ if it is followed by
- 'X'.
+ 4. Remove everything after first ___ if it is followed by 'X'.
5. Put symbols that should be suppressed in <...> brackets.
- The resulting string is valid until the next call of ada_demangle.
-*/
+ The resulting string is valid until the next call of ada_demangle. */
+
static char *
ada_demangle (mangled, option)
- const char* mangled;
+ const char *mangled;
int option ATTRIBUTE_UNUSED;
{
int i, j;
int len0;
const char* p;
- char* demangled = NULL;
+ char *demangled = NULL;
int at_start_name;
int changed;
- char* demangling_buffer = NULL;
+ char *demangling_buffer = NULL;
size_t demangling_buffer_size = 0;
changed = 0;
goto Suppress;
}
- /* Make demangled big enough for possible expansion by operator name. */
- grow_vect ((void**) &(demangling_buffer),
+ /* Make demangled big enough for possible expansion by operator name. */
+ grow_vect ((void **) &(demangling_buffer),
&demangling_buffer_size, 2 * len0 + 1,
sizeof (char));
demangled = demangling_buffer;
- if (isdigit (mangled[len0 - 1])) {
- for (i = len0-2; i >= 0 && isdigit (mangled[i]); i -= 1)
+ if (isdigit ((unsigned char) mangled[len0 - 1])) {
+ for (i = len0 - 2; i >= 0 && isdigit ((unsigned char) mangled[i]); i -= 1)
;
- if (i > 1 && mangled[i] == '_' && mangled[i-1] == '_')
+ if (i > 1 && mangled[i] == '_' && mangled[i - 1] == '_')
{
len0 = i - 1;
changed = 1;
}
}
- for (i = 0, j = 0; i < len0 && ! isalpha (mangled[i]); i += 1, j += 1)
+ for (i = 0, j = 0; i < len0 && ! isalpha ((unsigned char)mangled[i]);
+ i += 1, j += 1)
demangled[j] = mangled[i];
at_start_name = 1;
{
at_start_name = 0;
- if (i < len0-2 && mangled[i] == '_' && mangled[i+1] == '_')
+ if (i < len0 - 2 && mangled[i] == '_' && mangled[i + 1] == '_')
{
demangled[j] = '.';
changed = at_start_name = 1;
demangled[j] = '\000';
for (i = 0; demangled[i] != '\0'; i += 1)
- if (isupper (demangled[i]) || demangled[i] == ' ')
+ if (isupper ((unsigned char)demangled[i]) || demangled[i] == ' ')
goto Suppress;
if (! changed)
return demangled;
Suppress:
- grow_vect ((void**) &(demangling_buffer),
+ grow_vect ((void **) &(demangling_buffer),
&demangling_buffer_size, strlen (mangled) + 3,
sizeof (char));
demangled = demangling_buffer;
string decl;
int success = 0;
char *demangled = NULL;
- int s1,s2,s3,s4;
+ int s1, s2, s3, s4;
s1 = work->constructor;
s2 = work->destructor;
s3 = work->static_type;
work->destructor = s2;
work->static_type = s3;
work->type_quals = s4;
- return (demangled);
+ return demangled;
}
else
{
string_appendn (declp, "", 1);
- demangled = declp -> b;
+ demangled = declp->b;
}
return (demangled);
}
case gnu_demangling:
case lucid_demangling:
case arm_demangling:
+ case java_demangling:
case edg_demangling:
valid_symbols = standard_symbol_characters ();
break;