libiberty.h (XOBFINISH): New.

libiberty/
2005-06-06  Gabriel Dos Reis  <gdr@integrable-solutions.net>

        * libiberty.h (XOBFINISH): New.

gcc/
2005-06-06  Gabriel Dos Reis  <gdr@integrable-solutions.net>

        * c-lex.c (lex_string): Use XOBFINISH.
        * collect2.c (extract_string, dump_file): Likewise.
        * dbxout.c (dbxout_finish_complex_stabs): Likewise.
        * gcc.c (init_spec, build_search_list, convert_filename,
        set_collect_gcc_options, do_spec_2, do_spec_1, main):
        * Likewise.
        * genpreds.c (write_predicate_subfunction): Likewise.
        * genflags.c (main): Likewise.
        * read-rtl.c (mode_attr_index, apply_macro_to_string,
        join_c_conditions, read_quoted_string, read_braced_string,
        read_rtx_1): Likewise.
        * stringpool.c (ggc_alloc_string): Likewise.
        * tlink.c (obstack_fgets, recompile_files): Likewise.

From-SVN: r100678
This commit is contained in:
Gabriel Dos Reis 2005-06-06 21:14:31 +00:00 committed by Gabriel Dos Reis
parent 4b794eaf73
commit 7973fd2aed
13 changed files with 58 additions and 39 deletions

View File

@ -1,3 +1,18 @@
2005-06-06 Gabriel Dos Reis <gdr@integrable-solutions.net>
* c-lex.c (lex_string): Use XOBFINISH.
* collect2.c (extract_string, dump_file): Likewise.
* dbxout.c (dbxout_finish_complex_stabs): Likewise.
* gcc.c (init_spec, build_search_list, convert_filename,
set_collect_gcc_options, do_spec_2, do_spec_1, main): Likewise.
* genpreds.c (write_predicate_subfunction): Likewise.
* genflags.c (main): Likewise.
* read-rtl.c (mode_attr_index, apply_macro_to_string,
join_c_conditions, read_quoted_string, read_braced_string,
read_rtx_1): Likewise.
* stringpool.c (ggc_alloc_string): Likewise.
* tlink.c (obstack_fgets, recompile_files): Likewise.
2005-06-06 Jakub Jelinek <jakub@redhat.com>
* intl.h (G_): New macro.

View File

@ -762,7 +762,7 @@ lex_string (const cpp_token *tok, tree *valp, bool objc_string)
/* We have read one more token than we want. */
_cpp_backup_tokens (parse_in, 1);
if (concats)
strs = (cpp_string *) obstack_finish (&str_ob);
strs = XOBFINISH (&str_ob, cpp_string *);
if (concats && !objc_string && !in_system_header)
warning (OPT_Wtraditional,

View File

@ -453,7 +453,7 @@ extract_string (const char **pp)
obstack_1grow (&temporary_obstack, '\0');
*pp = p;
return obstack_finish (&temporary_obstack);
return XOBFINISH (&temporary_obstack, char *);
}
void
@ -474,7 +474,7 @@ dump_file (const char *name, FILE *to)
const char *word, *p;
char *result;
obstack_1grow (&temporary_obstack, '\0');
word = obstack_finish (&temporary_obstack);
word = XOBFINISH (&temporary_obstack, const char *);
if (*word == '.')
++word, putc ('.', to);

View File

@ -856,7 +856,7 @@ dbxout_finish_complex_stabs (tree sym, STAB_CODE_TYPE code,
obstack_1grow (&stabstr_ob, '\0');
len = obstack_object_size (&stabstr_ob);
chunk = str = obstack_finish (&stabstr_ob);
chunk = str = XOBFINISH (&stabstr_ob, char *);
/* Within the buffer are a sequence of NUL-separated strings,
each of which is to be written out as a separate stab
@ -889,7 +889,7 @@ dbxout_finish_complex_stabs (tree sym, STAB_CODE_TYPE code,
comma than to do a two-character fputs. */
obstack_grow (&stabstr_ob, "\",", 2);
len = obstack_object_size (&stabstr_ob);
str = obstack_finish (&stabstr_ob);
str = XOBFINISH (&stabstr_ob, char *);
fwrite (str, 1, len, asm_out_file);
DBX_FINISH_STABS (sym, code, line, addr, label, number);

View File

@ -1736,7 +1736,7 @@ init_spec (void)
}
obstack_1grow (&obstack, '\0');
libgcc_spec = obstack_finish (&obstack);
libgcc_spec = XOBFINISH (&obstack, const char *);
}
#endif
#ifdef USE_AS_TRADITIONAL_FORMAT
@ -1745,14 +1745,14 @@ init_spec (void)
static const char tf[] = "--traditional-format ";
obstack_grow (&obstack, tf, sizeof(tf) - 1);
obstack_grow0 (&obstack, asm_spec, strlen (asm_spec));
asm_spec = obstack_finish (&obstack);
asm_spec = XOBFINISH (&obstack, const char *);
}
#endif
#ifdef LINK_EH_SPEC
/* Prepend LINK_EH_SPEC to whatever link_spec we had before. */
obstack_grow (&obstack, LINK_EH_SPEC, sizeof(LINK_EH_SPEC) - 1);
obstack_grow0 (&obstack, link_spec, strlen (link_spec));
link_spec = obstack_finish (&obstack);
link_spec = XOBFINISH (&obstack, const char *);
#endif
specs = sl;
@ -2393,7 +2393,7 @@ build_search_list (struct path_prefix *paths, const char *prefix,
}
obstack_1grow (&collect_obstack, '\0');
return obstack_finish (&collect_obstack);
return XOBFINISH (&collect_obstack, char *);
}
/* Rebuild the COMPILER_PATH and LIBRARY_PATH environment variables
@ -2980,7 +2980,7 @@ convert_filename (const char *name, int do_exe ATTRIBUTE_UNUSED,
{
obstack_grow (&obstack, name, len - 2);
obstack_grow0 (&obstack, TARGET_OBJECT_SUFFIX, strlen (TARGET_OBJECT_SUFFIX));
name = obstack_finish (&obstack);
name = XOBFINISH (&obstack, const char *);
}
#endif
@ -3001,7 +3001,7 @@ convert_filename (const char *name, int do_exe ATTRIBUTE_UNUSED,
obstack_grow (&obstack, name, len);
obstack_grow0 (&obstack, TARGET_EXECUTABLE_SUFFIX,
strlen (TARGET_EXECUTABLE_SUFFIX));
name = obstack_finish (&obstack);
name = XOBFINISH (&obstack, const char *);
#endif
return name;
@ -4154,7 +4154,7 @@ set_collect_gcc_options (void)
}
}
obstack_grow (&collect_obstack, "\0", 1);
putenv (obstack_finish (&collect_obstack));
putenv (XOBFINISH (&collect_obstack, char *));
}
/* Process a spec string, accumulating and running commands. */
@ -4253,7 +4253,7 @@ do_spec_2 (const char *spec)
if (arg_going)
{
obstack_1grow (&obstack, 0);
string = obstack_finish (&obstack);
string = XOBFINISH (&obstack, const char *);
if (this_is_library_file)
string = find_file (string);
store_arg (string, delete_this_arg, this_is_output_file);
@ -4488,7 +4488,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
if (arg_going)
{
obstack_1grow (&obstack, 0);
string = obstack_finish (&obstack);
string = XOBFINISH (&obstack, const char *);
if (this_is_library_file)
string = find_file (string);
store_arg (string, delete_this_arg, this_is_output_file);
@ -4533,7 +4533,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
if (arg_going)
{
obstack_1grow (&obstack, 0);
string = obstack_finish (&obstack);
string = XOBFINISH (&obstack, const char *);
if (this_is_library_file)
string = find_file (string);
store_arg (string, delete_this_arg, this_is_output_file);
@ -4552,7 +4552,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
if (arg_going)
{
obstack_1grow (&obstack, 0);
string = obstack_finish (&obstack);
string = XOBFINISH (&obstack, const char *);
if (this_is_library_file)
string = find_file (string);
store_arg (string, delete_this_arg, this_is_output_file);
@ -4914,7 +4914,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
if (arg_going)
{
obstack_1grow (&obstack, 0);
string = obstack_finish (&obstack);
string = XOBFINISH (&obstack, const char *);
if (this_is_library_file)
string = find_file (string);
store_arg (string, delete_this_arg, this_is_output_file);
@ -5243,7 +5243,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
if (processing_spec_function && arg_going)
{
obstack_1grow (&obstack, 0);
string = obstack_finish (&obstack);
string = XOBFINISH (&obstack, const char *);
if (this_is_library_file)
string = find_file (string);
store_arg (string, delete_this_arg, this_is_output_file);
@ -6037,21 +6037,21 @@ main (int argc, const char **argv)
obstack_grow (&multilib_obstack, p, strlen (p));
obstack_1grow (&multilib_obstack, 0);
multilib_select = obstack_finish (&multilib_obstack);
multilib_select = XOBFINISH (&multilib_obstack, const char *);
q = multilib_matches_raw;
while ((p = *q++) != (char *) 0)
obstack_grow (&multilib_obstack, p, strlen (p));
obstack_1grow (&multilib_obstack, 0);
multilib_matches = obstack_finish (&multilib_obstack);
multilib_matches = XOBFINISH (&multilib_obstack, const char *);
q = multilib_exclusions_raw;
while ((p = *q++) != (char *) 0)
obstack_grow (&multilib_obstack, p, strlen (p));
obstack_1grow (&multilib_obstack, 0);
multilib_exclusions = obstack_finish (&multilib_obstack);
multilib_exclusions = XOBFINISH (&multilib_obstack, const char *);
need_space = FALSE;
for (i = 0; i < ARRAY_SIZE (multilib_defaults_raw); i++)
@ -6065,7 +6065,7 @@ main (int argc, const char **argv)
}
obstack_1grow (&multilib_obstack, 0);
multilib_defaults = obstack_finish (&multilib_obstack);
multilib_defaults = XOBFINISH (&multilib_obstack, const char *);
}
/* Set up to remember the pathname of gcc and any options
@ -6074,7 +6074,7 @@ main (int argc, const char **argv)
obstack_init (&collect_obstack);
obstack_grow (&collect_obstack, "COLLECT_GCC=", sizeof ("COLLECT_GCC=") - 1);
obstack_grow (&collect_obstack, argv[0], strlen (argv[0]) + 1);
putenv (obstack_finish (&collect_obstack));
putenv (XOBFINISH (&collect_obstack, char *));
#ifdef INIT_ENVIRONMENT
/* Set up any other necessary machine specific environment variables. */
@ -6160,7 +6160,7 @@ main (int argc, const char **argv)
{
obstack_grow (&obstack, "%(sysroot_spec) ", strlen ("%(sysroot_spec) "));
obstack_grow0 (&obstack, link_spec, strlen (link_spec));
set_spec ("link", obstack_finish (&obstack));
set_spec ("link", XOBFINISH (&obstack, const char *));
}
#endif
@ -6349,7 +6349,7 @@ main (int argc, const char **argv)
obstack_init (&obstack);
do_spec_1 (THREAD_MODEL_SPEC, 0, thread_model);
obstack_1grow (&obstack, '\0');
thrmod = obstack_finish (&obstack);
thrmod = XOBFINISH (&obstack, const char *);
#else
thrmod = thread_model;
#endif
@ -7077,7 +7077,7 @@ set_multilib_dir (void)
obstack_grow (&multilib_obstack, start, end - start);
obstack_1grow (&multilib_obstack, 0);
mdswitches[i].str = obstack_finish (&multilib_obstack);
mdswitches[i].str = XOBFINISH (&multilib_obstack, const char *);
mdswitches[i++].len = end - start;
if (*end == '\0')

View File

@ -267,7 +267,7 @@ main (int argc, char **argv)
/* Print out the prototypes now. */
dummy = (rtx) 0;
obstack_grow (&obstack, &dummy, sizeof (rtx));
insns = (rtx *) obstack_finish (&obstack);
insns = XOBFINISH (&obstack, rtx *);
for (insn_ptr = insns; *insn_ptr; insn_ptr++)
gen_proto (*insn_ptr);

View File

@ -122,7 +122,7 @@ write_predicate_subfunction (struct pred_data *p)
obstack_grow (rtl_obstack, p->name, strlen (p->name));
obstack_grow (rtl_obstack, "_1 (op, mode)",
sizeof "_1 (op, mode)");
match_test_str = obstack_finish (rtl_obstack);
match_test_str = XOBFINISH (rtl_obstack, const char *);
/* Add the function-call expression to the complete expression to be
evaluated. */

View File

@ -321,7 +321,7 @@ mode_attr_index (struct map_value **mode_maps, const char *string)
/* Copy the attribute string into permanent storage, without the
angle brackets around it. */
obstack_grow0 (&string_obstack, string + 1, strlen (string) - 2);
p = (char *) obstack_finish (&string_obstack);
p = XOBFINISH (&string_obstack, char *);
mv = XNEW (struct map_value);
mv->number = *mode_maps == 0 ? 0 : (*mode_maps)->number + 1;
@ -404,7 +404,7 @@ apply_macro_to_string (const char *string, struct mapping *macro, int value)
if (base != copy)
{
obstack_grow (&string_obstack, base, strlen (base) + 1);
copy = obstack_finish (&string_obstack);
copy = XOBFINISH (&string_obstack, char *);
copy_rtx_ptr_loc (copy, string);
return copy;
}
@ -785,7 +785,7 @@ join_c_conditions (const char *cond1, const char *cond2)
obstack_ptr_grow (&joined_conditions_obstack, result);
obstack_ptr_grow (&joined_conditions_obstack, cond1);
obstack_ptr_grow (&joined_conditions_obstack, cond2);
entry = obstack_finish (&joined_conditions_obstack);
entry = XOBFINISH (&joined_conditions_obstack, const void **);
*htab_find_slot (joined_conditions, entry, INSERT) = entry;
return result;
}
@ -998,7 +998,7 @@ read_quoted_string (FILE *infile)
}
obstack_1grow (&string_obstack, 0);
return (char *) obstack_finish (&string_obstack);
return XOBFINISH (&string_obstack, char *);
}
/* Read a braced string (a la Tcl) onto the string obstack. Caller
@ -1036,7 +1036,7 @@ read_braced_string (FILE *infile)
}
obstack_1grow (&string_obstack, 0);
return (char *) obstack_finish (&string_obstack);
return XOBFINISH (&string_obstack, char *);
}
/* Read some kind of string constant. This is the high-level routine
@ -1581,7 +1581,7 @@ read_rtx_1 (FILE *infile, struct map_value **mode_maps)
obstack_grow (&string_obstack, fn, strlen (fn));
sprintf (line_name, ":%d", read_rtx_lineno);
obstack_grow (&string_obstack, line_name, strlen (line_name)+1);
stringbuf = (char *) obstack_finish (&string_obstack);
stringbuf = XOBFINISH (&string_obstack, char *);
}
if (star_if_braced)

View File

@ -95,7 +95,7 @@ ggc_alloc_string (const char *contents, int length)
return digit_string (contents[0] - '0');
obstack_grow0 (&string_stack, contents, length);
return obstack_finish (&string_stack);
return XOBFINISH (&string_stack, const char *);
}
/* Return an IDENTIFIER_NODE whose name is TEXT (a null-terminated string).

View File

@ -311,7 +311,7 @@ obstack_fgets (FILE *stream, struct obstack *ob)
if (obstack_object_size (ob) == 0)
return NULL;
obstack_1grow (ob, '\0');
return obstack_finish (ob);
return XOBFINISH (ob, char *);
}
static char *
@ -528,7 +528,7 @@ recompile_files (void)
done:
obstack_ptr_grow (&temporary_obstack, f->main);
obstack_ptr_grow (&temporary_obstack, NULL);
argv = obstack_finish (&temporary_obstack);
argv = XOBFINISH (&temporary_obstack, char **);
if (tlink_verbose)
fprintf (stderr, _("collect: recompiling %s\n"), f->main);

View File

@ -1094,7 +1094,7 @@ build_element_name (struct sra_elt *elt)
{
build_element_name_1 (elt);
obstack_1grow (&sra_obstack, '\0');
return obstack_finish (&sra_obstack);
return XOBFINISH (&sra_obstack, char *);
}
/* Instantiate an element as an independent variable. */

View File

@ -1,3 +1,7 @@
2005-06-06 Gabriel Dos Reis <gdr@integrable-solutions.net>
* libiberty.h (XOBFINISH): New.
2005-06-01 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* libiberty.h (vsnprintf): Add format attribute.

View File

@ -326,7 +326,7 @@ extern double physmem_available (void);
/* Type-safe obstack allocator. */
#define XOBNEW(O, T) ((T *) obstack_alloc ((O), sizeof (T)))
#define XOBFINISH(O, T) ((T) obstack_finish ((O)))
/* hex character manipulation routines */