Commit 95b2e554 by Laurynas Biveinis Committed by Laurynas Biveinis

c-format.c: Include alloc-pool.h.

2007-09-04  Laurynas Biveinis  <laurynas.biveinis@gmail.com>

	* c-format.c: Include alloc-pool.h.
	(check_format_info_main): New argument fwt_alloc.  Use allocation
	pool instead of GC.  Remove GC deallocation code.
	(check_format_arg): Create allocation pool, pass it to
	check_format_info_main and free it afterwards.
	* Makefile.in (c-format.o): Add alloc-pool.h dependency.

From-SVN: r128105
parent acd29efb
2007-09-04 Laurynas Biveinis <laurynas.biveinis@gmail.com>
* c-format.c: Include alloc-pool.h.
(check_format_info_main): New argument fwt_alloc. Use allocation
pool instead of GC. Remove GC deallocation code.
(check_format_arg): Create allocation pool, pass it to
check_format_info_main and free it afterwards.
* Makefile.in (c-format.o): Add alloc-pool.h dependency.
2007-09-05 Ben Elliston <bje@au.ibm.com> 2007-09-05 Ben Elliston <bje@au.ibm.com>
* config/rs6000/ppu_intrinsics.h (__protected_stream_count): * config/rs6000/ppu_intrinsics.h (__protected_stream_count):
......
...@@ -1810,7 +1810,8 @@ attribs.o : attribs.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ ...@@ -1810,7 +1810,8 @@ attribs.o : attribs.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
$(TARGET_H) langhooks.h $(CPPLIB_H) $(TARGET_H) langhooks.h $(CPPLIB_H)
c-format.o : c-format.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) langhooks.h \ c-format.o : c-format.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) langhooks.h \
$(C_COMMON_H) $(FLAGS_H) toplev.h intl.h $(DIAGNOSTIC_H) c-format.h $(C_COMMON_H) $(FLAGS_H) toplev.h intl.h $(DIAGNOSTIC_H) alloc-pool.h \
c-format.h
c-semantics.o : c-semantics.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \ c-semantics.o : c-semantics.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(TREE_H) $(FLAGS_H) toplev.h output.h $(RTL_H) $(GGC_H) \ $(TREE_H) $(FLAGS_H) toplev.h output.h $(RTL_H) $(GGC_H) \
......
...@@ -30,6 +30,7 @@ along with GCC; see the file COPYING3. If not see ...@@ -30,6 +30,7 @@ along with GCC; see the file COPYING3. If not see
#include "diagnostic.h" #include "diagnostic.h"
#include "langhooks.h" #include "langhooks.h"
#include "c-format.h" #include "c-format.h"
#include "alloc-pool.h"
/* Set format warning options according to a -Wformat=n option. */ /* Set format warning options according to a -Wformat=n option. */
...@@ -821,7 +822,7 @@ static void check_format_arg (void *, tree, unsigned HOST_WIDE_INT); ...@@ -821,7 +822,7 @@ static void check_format_arg (void *, tree, unsigned HOST_WIDE_INT);
static void check_format_info_main (format_check_results *, static void check_format_info_main (format_check_results *,
function_format_info *, function_format_info *,
const char *, int, tree, const char *, int, tree,
unsigned HOST_WIDE_INT); unsigned HOST_WIDE_INT, alloc_pool);
static void init_dollar_format_checking (int, tree); static void init_dollar_format_checking (int, tree);
static int maybe_read_dollar_number (const char **, int, static int maybe_read_dollar_number (const char **, int,
...@@ -1300,6 +1301,7 @@ check_format_arg (void *ctx, tree format_tree, ...@@ -1300,6 +1301,7 @@ check_format_arg (void *ctx, tree format_tree,
const char *format_chars; const char *format_chars;
tree array_size = 0; tree array_size = 0;
tree array_init; tree array_init;
alloc_pool fwt_pool;
if (integer_zerop (format_tree)) if (integer_zerop (format_tree))
{ {
...@@ -1424,8 +1426,11 @@ check_format_arg (void *ctx, tree format_tree, ...@@ -1424,8 +1426,11 @@ check_format_arg (void *ctx, tree format_tree,
will decrement it if it finds there are extra arguments, but this way will decrement it if it finds there are extra arguments, but this way
need not adjust it for every return. */ need not adjust it for every return. */
res->number_other++; res->number_other++;
fwt_pool = create_alloc_pool ("format_wanted_type pool",
sizeof (format_wanted_type), 10);
check_format_info_main (res, info, format_chars, format_length, check_format_info_main (res, info, format_chars, format_length,
params, arg_num); params, arg_num, fwt_pool);
free_alloc_pool (fwt_pool);
} }
...@@ -1440,7 +1445,7 @@ static void ...@@ -1440,7 +1445,7 @@ static void
check_format_info_main (format_check_results *res, check_format_info_main (format_check_results *res,
function_format_info *info, const char *format_chars, function_format_info *info, const char *format_chars,
int format_length, tree params, int format_length, tree params,
unsigned HOST_WIDE_INT arg_num) unsigned HOST_WIDE_INT arg_num, alloc_pool fwt_pool)
{ {
const char *orig_format_chars = format_chars; const char *orig_format_chars = format_chars;
tree first_fillin_param = params; tree first_fillin_param = params;
...@@ -2087,7 +2092,8 @@ check_format_info_main (format_check_results *res, ...@@ -2087,7 +2092,8 @@ check_format_info_main (format_check_results *res,
fci = fci->chain; fci = fci->chain;
if (fci) if (fci)
{ {
wanted_type_ptr = GGC_NEW (format_wanted_type); wanted_type_ptr = (format_wanted_type *)
pool_alloc (fwt_pool);
arg_num++; arg_num++;
wanted_type = *fci->types[length_chars_val].type; wanted_type = *fci->types[length_chars_val].type;
wanted_type_name = fci->types[length_chars_val].name; wanted_type_name = fci->types[length_chars_val].name;
...@@ -2098,17 +2104,6 @@ check_format_info_main (format_check_results *res, ...@@ -2098,17 +2104,6 @@ check_format_info_main (format_check_results *res,
if (first_wanted_type != 0) if (first_wanted_type != 0)
check_format_types (first_wanted_type, format_start, check_format_types (first_wanted_type, format_start,
format_chars - format_start); format_chars - format_start);
if (main_wanted_type.next != NULL)
{
format_wanted_type *wanted_type_ptr = main_wanted_type.next;
while (wanted_type_ptr)
{
format_wanted_type *next = wanted_type_ptr->next;
ggc_free (wanted_type_ptr);
wanted_type_ptr = next;
}
}
} }
} }
......
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