aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaveh R. Ghazi <ghazi@caip.rutgers.edu>2002-03-03 14:07:39 +0000
committerKaveh Ghazi <ghazi@gcc.gnu.org>2002-03-03 14:07:39 +0000
commitca7558fcc6fe1ccfcbc91c1f2017b6706eae4cf3 (patch)
tree22fa38b6c76c86b74f079f044047e56332102862
parentde2467532d9ac55ed1c208f5934d2273a544c35d (diff)
downloadgcc-ca7558fcc6fe1ccfcbc91c1f2017b6706eae4cf3.zip
gcc-ca7558fcc6fe1ccfcbc91c1f2017b6706eae4cf3.tar.gz
gcc-ca7558fcc6fe1ccfcbc91c1f2017b6706eae4cf3.tar.bz2
attribs.c (init_attributes, [...]): Use ARRAY_SIZE in lieu of explicit sizeof/sizeof.
* attribs.c (init_attributes, decl_attributes): Use ARRAY_SIZE in lieu of explicit sizeof/sizeof. * i386.c (override_options, ix86_init_mmx_sse_builtins, ix86_expand_builtin): Likewise. * mips.c (mips_add_gc_roots): Likewise. * mmix.c (mmix_output_condition): Likewise. * rs6000.c (rs6000_override_options, altivec_expand_builtin, altivec_init_builtins): Likewise. * sparc.c (mark_ultrasparc_pipeline_state): Likewise. * cppexp.c (Nsuff, parse_number): Likewise. * cppinit.c (builtin_array_end): Likewise. * gcc.c (n_default_compilers, process_command): Likewise. * genpreds.c (output_predicate_decls): Likewise. * ggc-page.c (NUM_EXTRA_ORDERS): Likewise. * lcm.c (N_ENTITIES): Likewise. * stor-layout.c (set_sizetype): Likewise. ada: * utils.c (init_gnat_to_gnu, init_gigi_decls): Use ARRAY_SIZE in lieu of explicit sizeof/sizeof. cp: * decl.c (cxx_init_decl_processing): Use ARRAY_SIZE in lieu of explicit sizeof/sizeof. * decl2.c (cxx_decode_option): Likewise. * lex.c (init_reswords, REDUCE_LENGTH, TOKEN_LENGTH): Likewise. java: * class.c (init_class_processing): Use ARRAY_SIZE in lieu of explicit sizeof/sizeof. * decl.c (java_init_decl_processing): Likewise. * jcf-parse.c (init_jcf_parse): Likewise. * parse.y (init_src_parse): Likewise. From-SVN: r50255
-rw-r--r--gcc/ChangeLog19
-rw-r--r--gcc/ada/ChangeLog5
-rw-r--r--gcc/ada/utils.c7
-rw-r--r--gcc/attribs.c26
-rw-r--r--gcc/config/i386/i386.c12
-rw-r--r--gcc/config/mips/mips.c2
-rw-r--r--gcc/config/mmix/mmix.c4
-rw-r--r--gcc/config/rs6000/rs6000.c26
-rw-r--r--gcc/config/sparc/sparc.c2
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/decl.c4
-rw-r--r--gcc/cp/decl2.c8
-rw-r--r--gcc/cp/lex.c7
-rw-r--r--gcc/cppexp.c7
-rw-r--r--gcc/cppinit.c3
-rw-r--r--gcc/gcc.c8
-rw-r--r--gcc/genpreds.c2
-rw-r--r--gcc/ggc-page.c3
-rw-r--r--gcc/java/ChangeLog8
-rw-r--r--gcc/java/class.c2
-rw-r--r--gcc/java/decl.c3
-rw-r--r--gcc/java/jcf-parse.c2
-rw-r--r--gcc/java/parse.y2
-rw-r--r--gcc/lcm.c2
-rw-r--r--gcc/stor-layout.c3
25 files changed, 94 insertions, 80 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index f425362..f2de82d 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,22 @@
+2002-03-03 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * attribs.c (init_attributes, decl_attributes): Use ARRAY_SIZE in
+ lieu of explicit sizeof/sizeof.
+ * i386.c (override_options, ix86_init_mmx_sse_builtins,
+ ix86_expand_builtin): Likewise.
+ * mips.c (mips_add_gc_roots): Likewise.
+ * mmix.c (mmix_output_condition): Likewise.
+ * rs6000.c (rs6000_override_options, altivec_expand_builtin,
+ altivec_init_builtins): Likewise.
+ * sparc.c (mark_ultrasparc_pipeline_state): Likewise.
+ * cppexp.c (Nsuff, parse_number): Likewise.
+ * cppinit.c (builtin_array_end): Likewise.
+ * gcc.c (n_default_compilers, process_command): Likewise.
+ * genpreds.c (output_predicate_decls): Likewise.
+ * ggc-page.c (NUM_EXTRA_ORDERS): Likewise.
+ * lcm.c (N_ENTITIES): Likewise.
+ * stor-layout.c (set_sizetype): Likewise.
+
2002-03-03 Richard Henderson <rth@redhat.com>
* toplev.c (rest_of_decl_compilation): Do not invoke make_decl_rtl
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 875b3d5..2c9d3fd 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,8 @@
+2002-03-03 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * utils.c (init_gnat_to_gnu, init_gigi_decls): Use ARRAY_SIZE in
+ lieu of explicit sizeof/sizeof.
+
2002-02-28 Neil Booth <neil@daikokuya.demon.co.uk>
* misc.c (copy_lang_decl): Remove.
diff --git a/gcc/ada/utils.c b/gcc/ada/utils.c
index ead4d02..224f431 100644
--- a/gcc/ada/utils.c
+++ b/gcc/ada/utils.c
@@ -6,7 +6,7 @@
* *
* C Implementation File *
* *
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
* *
* Copyright (C) 1992-2001, Free Software Foundation, Inc. *
* *
@@ -165,7 +165,7 @@ init_gnat_to_gnu ()
ggc_add_tree_root (&signed_and_unsigned_types[0][0],
(sizeof signed_and_unsigned_types
/ sizeof signed_and_unsigned_types[0][0]));
- ggc_add_tree_root (float_types, sizeof float_types / sizeof float_types[0]);
+ ggc_add_tree_root (float_types, ARRAY_SIZE (float_types));
ggc_add_root (&current_binding_level, 1, sizeof current_binding_level,
mark_binding_level);
@@ -692,8 +692,7 @@ init_gigi_decls (long_long_float_type, exception_type)
DECL_BUILT_IN_CLASS (setjmp_decl) = BUILT_IN_NORMAL;
DECL_FUNCTION_CODE (setjmp_decl) = BUILT_IN_SETJMP;
- ggc_add_tree_root (gnat_std_decls,
- sizeof gnat_std_decls / sizeof gnat_std_decls[0]);
+ ggc_add_tree_root (gnat_std_decls, ARRAY_SIZE (gnat_std_decls));
}
/* This routine is called in tree.c to print an error message for invalid use
diff --git a/gcc/attribs.c b/gcc/attribs.c
index ca5a10c..c1536f6 100644
--- a/gcc/attribs.c
+++ b/gcc/attribs.c
@@ -177,7 +177,7 @@ static void
init_attributes ()
{
#ifdef ENABLE_CHECKING
- int i;
+ size_t i;
#endif
attribute_tables[0]
@@ -188,9 +188,7 @@ init_attributes ()
#ifdef ENABLE_CHECKING
/* Make some sanity checks on the attribute tables. */
- for (i = 0;
- i < (int) (sizeof (attribute_tables) / sizeof (attribute_tables[0]));
- i++)
+ for (i = 0; i < ARRAY_SIZE (attribute_tables); i++)
{
int j;
@@ -222,9 +220,7 @@ init_attributes ()
}
/* Check that each name occurs just once in each table. */
- for (i = 0;
- i < (int) (sizeof (attribute_tables) / sizeof (attribute_tables[0]));
- i++)
+ for (i = 0; i < ARRAY_SIZE (attribute_tables); i++)
{
int j, k;
for (j = 0; attribute_tables[i][j].name != NULL; j++)
@@ -234,16 +230,11 @@ init_attributes ()
abort ();
}
/* Check that no name occurs in more than one table. */
- for (i = 0;
- i < (int) (sizeof (attribute_tables) / sizeof (attribute_tables[0]));
- i++)
+ for (i = 0; i < ARRAY_SIZE (attribute_tables); i++)
{
- int j, k, l;
+ size_t j, k, l;
- for (j = i + 1;
- j < ((int) (sizeof (attribute_tables)
- / sizeof (attribute_tables[0])));
- j++)
+ for (j = i + 1; j < ARRAY_SIZE (attribute_tables); j++)
for (k = 0; attribute_tables[i][k].name != NULL; k++)
for (l = 0; attribute_tables[j][l].name != NULL; l++)
if (!strcmp (attribute_tables[i][k].name,
@@ -294,10 +285,7 @@ decl_attributes (node, attributes, flags)
bool no_add_attrs = 0;
int i;
- for (i = 0;
- i < ((int) (sizeof (attribute_tables)
- / sizeof (attribute_tables[0])));
- i++)
+ for (i = 0; i < ARRAY_SIZE (attribute_tables); i++)
{
int j;
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 11c128c..2f7bb73 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -903,7 +903,7 @@ override_options ()
| PTA_3DNOW_A | PTA_SSE},
};
- int const pta_size = sizeof (processor_alias_table) / sizeof (struct pta);
+ int const pta_size = ARRAY_SIZE (processor_alias_table);
#ifdef SUBTARGET_OVERRIDE_OPTIONS
SUBTARGET_OVERRIDE_OPTIONS;
@@ -11181,7 +11181,7 @@ ix86_init_mmx_sse_builtins ()
/* Add all builtins that are more or less simple operations on two
operands. */
- for (i = 0, d = bdesc_2arg; i < sizeof (bdesc_2arg) / sizeof *d; i++, d++)
+ for (i = 0, d = bdesc_2arg; i < ARRAY_SIZE (bdesc_2arg); i++, d++)
{
/* Use one of the operands; the target can have a different mode for
mask-generating compares. */
@@ -11244,7 +11244,7 @@ ix86_init_mmx_sse_builtins ()
def_builtin (MASK_MMX, "__builtin_ia32_pmaddwd", v2si_ftype_v4hi_v4hi, IX86_BUILTIN_PMADDWD);
/* comi/ucomi insns. */
- for (i = 0, d = bdesc_comi; i < sizeof (bdesc_comi) / sizeof *d; i++, d++)
+ for (i = 0, d = bdesc_comi; i < ARRAY_SIZE (bdesc_comi); i++, d++)
def_builtin (d->mask, d->name, int_ftype_v4sf_v4sf, d->code);
def_builtin (MASK_MMX, "__builtin_ia32_packsswb", v8qi_ftype_v4hi_v4hi, IX86_BUILTIN_PACKSSWB);
@@ -12025,7 +12025,7 @@ ix86_expand_builtin (exp, target, subtarget, mode, ignore)
break;
}
- for (i = 0, d = bdesc_2arg; i < sizeof (bdesc_2arg) / sizeof *d; i++, d++)
+ for (i = 0, d = bdesc_2arg; i < ARRAY_SIZE (bdesc_2arg); i++, d++)
if (d->code == fcode)
{
/* Compares are treated specially. */
@@ -12038,11 +12038,11 @@ ix86_expand_builtin (exp, target, subtarget, mode, ignore)
return ix86_expand_binop_builtin (d->icode, arglist, target);
}
- for (i = 0, d = bdesc_1arg; i < sizeof (bdesc_1arg) / sizeof *d; i++, d++)
+ for (i = 0, d = bdesc_1arg; i < ARRAY_SIZE (bdesc_1arg); i++, d++)
if (d->code == fcode)
return ix86_expand_unop_builtin (d->icode, arglist, target, 0);
- for (i = 0, d = bdesc_comi; i < sizeof (bdesc_comi) / sizeof *d; i++, d++)
+ for (i = 0, d = bdesc_comi; i < ARRAY_SIZE (bdesc_comi); i++, d++)
if (d->code == fcode)
return ix86_expand_sse_comi (d, arglist, target);
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index 8ad2f9e..ea1a41d 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -9847,7 +9847,7 @@ mips_add_gc_roots ()
ggc_add_rtx_root (&mips_load_reg2, 1);
ggc_add_rtx_root (&mips_load_reg3, 1);
ggc_add_rtx_root (&mips_load_reg4, 1);
- ggc_add_rtx_root (branch_cmp, sizeof (branch_cmp) / sizeof (rtx));
+ ggc_add_rtx_root (branch_cmp, ARRAY_SIZE (branch_cmp));
ggc_add_rtx_root (&embedded_pic_fnaddr_rtx, 1);
ggc_add_rtx_root (&mips16_gp_pseudo_rtx, 1);
}
diff --git a/gcc/config/mmix/mmix.c b/gcc/config/mmix/mmix.c
index 7eb3e43..b1f7d3f 100644
--- a/gcc/config/mmix/mmix.c
+++ b/gcc/config/mmix/mmix.c
@@ -3087,13 +3087,13 @@ mmix_output_condition (stream, x, reversed)
{CCmode, cc_signed_convs},
{DImode, cc_di_convs}};
- unsigned int i;
+ size_t i;
int j;
enum machine_mode mode = GET_MODE (XEXP (x, 0));
RTX_CODE cc = GET_CODE (x);
- for (i = 0; i < sizeof (cc_convs)/sizeof(*cc_convs); i++)
+ for (i = 0; i < ARRAY_SIZE (cc_convs); i++)
{
if (mode == cc_convs[i].cc_mode)
{
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 140593f..b180577 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -410,7 +410,7 @@ rs6000_override_options (default_cpu)
MASK_POWERPC | MASK_SOFT_FLOAT | MASK_NEW_MNEMONICS,
POWER_MASKS | POWERPC_OPT_MASKS | MASK_POWERPC64}};
- size_t ptt_size = sizeof (processor_target_table) / sizeof (struct ptt);
+ const size_t ptt_size = ARRAY_SIZE (processor_target_table);
/* Save current -mmultiple/-mno-multiple status. */
int multiple = TARGET_MULTIPLE;
@@ -4018,7 +4018,7 @@ altivec_expand_builtin (exp, target)
/* Handle DST variants. */
d = (struct builtin_description *) bdesc_dst;
- for (i = 0; i < sizeof (bdesc_dst) / sizeof *d; i++, d++)
+ for (i = 0; i < ARRAY_SIZE (bdesc_dst); i++, d++)
if (d->code == fcode)
{
arg0 = TREE_VALUE (arglist);
@@ -4057,25 +4057,25 @@ altivec_expand_builtin (exp, target)
/* Expand abs* operations. */
d = (struct builtin_description *) bdesc_abs;
- for (i = 0; i < sizeof (bdesc_abs) / sizeof *d; i++, d++)
+ for (i = 0; i < ARRAY_SIZE (bdesc_abs); i++, d++)
if (d->code == fcode)
return altivec_expand_abs_builtin (d->icode, arglist, target);
/* Handle simple unary operations. */
d = (struct builtin_description *) bdesc_1arg;
- for (i = 0; i < sizeof (bdesc_1arg) / sizeof *d; i++, d++)
+ for (i = 0; i < ARRAY_SIZE (bdesc_1arg); i++, d++)
if (d->code == fcode)
return altivec_expand_unop_builtin (d->icode, arglist, target);
/* Handle simple binary operations. */
d = (struct builtin_description *) bdesc_2arg;
- for (i = 0; i < sizeof (bdesc_2arg) / sizeof *d; i++, d++)
+ for (i = 0; i < ARRAY_SIZE (bdesc_2arg); i++, d++)
if (d->code == fcode)
return altivec_expand_binop_builtin (d->icode, arglist, target);
/* Expand the AltiVec predicates. */
dp = (struct builtin_description_predicates *) bdesc_altivec_preds;
- for (i = 0; i < sizeof (bdesc_altivec_preds) / sizeof *dp; i++, dp++)
+ for (i = 0; i < ARRAY_SIZE (bdesc_altivec_preds); i++, dp++)
if (dp->code == fcode)
return altivec_expand_predicate_builtin (dp->icode, dp->opcode, arglist, target);
@@ -4110,7 +4110,7 @@ altivec_expand_builtin (exp, target)
/* Handle simple ternary operations. */
d = (struct builtin_description *) bdesc_3arg;
- for (i = 0; i < sizeof (bdesc_3arg) / sizeof *d; i++, d++)
+ for (i = 0; i < ARRAY_SIZE (bdesc_3arg); i++, d++)
if (d->code == fcode)
return altivec_expand_ternop_builtin (d->icode, arglist, target);
@@ -4606,7 +4606,7 @@ altivec_init_builtins (void)
/* Add the simple ternary operators. */
d = (struct builtin_description *) bdesc_3arg;
- for (i = 0; i < sizeof (bdesc_3arg) / sizeof *d; i++, d++)
+ for (i = 0; i < ARRAY_SIZE (bdesc_3arg); i++, d++)
{
enum machine_mode mode0, mode1, mode2, mode3;
@@ -4699,12 +4699,12 @@ altivec_init_builtins (void)
/* Add the DST variants. */
d = (struct builtin_description *) bdesc_dst;
- for (i = 0; i < sizeof (bdesc_dst) / sizeof *d; i++, d++)
+ for (i = 0; i < ARRAY_SIZE (bdesc_dst); i++, d++)
def_builtin (d->mask, d->name, void_ftype_pvoid_int_char, d->code);
/* Initialize the predicates. */
dp = (struct builtin_description_predicates *) bdesc_altivec_preds;
- for (i = 0; i < sizeof (bdesc_altivec_preds) / sizeof *dp; i++, dp++)
+ for (i = 0; i < ARRAY_SIZE (bdesc_altivec_preds); i++, dp++)
{
enum machine_mode mode1;
tree type;
@@ -4734,7 +4734,7 @@ altivec_init_builtins (void)
/* Add the simple binary operators. */
d = (struct builtin_description *) bdesc_2arg;
- for (i = 0; i < sizeof (bdesc_2arg) / sizeof *d; i++, d++)
+ for (i = 0; i < ARRAY_SIZE (bdesc_2arg); i++, d++)
{
enum machine_mode mode0, mode1, mode2;
tree type;
@@ -4852,7 +4852,7 @@ altivec_init_builtins (void)
/* Initialize the abs* operators. */
d = (struct builtin_description *) bdesc_abs;
- for (i = 0; i < sizeof (bdesc_abs) / sizeof *d; i++, d++)
+ for (i = 0; i < ARRAY_SIZE (bdesc_abs); i++, d++)
{
enum machine_mode mode0;
tree type;
@@ -4882,7 +4882,7 @@ altivec_init_builtins (void)
/* Add the simple unary operators. */
d = (struct builtin_description *) bdesc_1arg;
- for (i = 0; i < sizeof (bdesc_1arg) / sizeof *d; i++, d++)
+ for (i = 0; i < ARRAY_SIZE (bdesc_1arg); i++, d++)
{
enum machine_mode mode0, mode1;
tree type;
diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
index e101fa7..6358091 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -8466,7 +8466,7 @@ mark_ultrasparc_pipeline_state (arg)
size_t i;
ups = (struct ultrasparc_pipeline_state *) arg;
- for (i = 0; i < sizeof (ups->group) / sizeof (rtx); ++i)
+ for (i = 0; i < ARRAY_SIZE (ups->group); ++i)
ggc_mark_rtx (ups->group[i]);
}
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 013b826..56136be 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,10 @@
+2002-03-03 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * decl.c (cxx_init_decl_processing): Use ARRAY_SIZE in lieu of
+ explicit sizeof/sizeof.
+ * decl2.c (cxx_decode_option): Likewise.
+ * lex.c (init_reswords, REDUCE_LENGTH, TOKEN_LENGTH): Likewise.
+
2002-03-02 Nathan Sidwell <nathan@codesourcery.com>
PR c++/775
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 854a2c2..9eb31ba 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -6608,8 +6608,8 @@ cxx_init_decl_processing ()
flag_const_strings = 0;
/* Add GC roots for all of our global variables. */
- ggc_add_tree_root (c_global_trees, sizeof c_global_trees / sizeof(tree));
- ggc_add_tree_root (cp_global_trees, sizeof cp_global_trees / sizeof(tree));
+ ggc_add_tree_root (c_global_trees, ARRAY_SIZE (c_global_trees));
+ ggc_add_tree_root (cp_global_trees, ARRAY_SIZE (cp_global_trees));
ggc_add_tree_root (&integer_three_node, 1);
ggc_add_tree_root (&integer_two_node, 1);
ggc_add_tree_root (&signed_size_zero_node, 1);
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index ff6ae1e..71dc388 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -514,8 +514,7 @@ cxx_decode_option (argc, argv)
caller that the option was processed successfully. */
if (bsearch (&positive_option,
unsupported_options,
- (sizeof (unsupported_options)
- / sizeof (unsupported_options[0])),
+ ARRAY_SIZE (unsupported_options),
sizeof (unsupported_options[0]),
compare_options))
{
@@ -560,10 +559,7 @@ cxx_decode_option (argc, argv)
{
int found = 0;
- for (j = 0;
- !found && j < (sizeof (lang_f_options)
- / sizeof (lang_f_options[0]));
- j++)
+ for (j = 0; !found && j < ARRAY_SIZE (lang_f_options); j++)
{
if (!strcmp (p, lang_f_options[j].string))
{
diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c
index d338632..1eb7075 100644
--- a/gcc/cp/lex.c
+++ b/gcc/cp/lex.c
@@ -484,7 +484,6 @@ static const struct resword reswords[] =
{ "xor_eq", RID_XOR_EQ, D_OPNAME },
};
-#define N_reswords (sizeof reswords / sizeof (struct resword))
/* Table mapping from RID_* constants to yacc token numbers.
Unfortunately we have to have entries for all the keywords in all
@@ -639,7 +638,7 @@ init_reswords ()
all the trees it points to are permanently interned in the
get_identifier hash anyway. */
ridpointers = (tree *) xcalloc ((int) RID_MAX, sizeof (tree));
- for (i = 0; i < N_reswords; i++)
+ for (i = 0; i < ARRAY_SIZE (reswords); i++)
{
id = get_identifier (reswords[i].word);
C_RID_CODE (id) = reswords[i].rid;
@@ -812,8 +811,8 @@ static int *reduce_count;
int *token_count;
#if 0
-#define REDUCE_LENGTH (sizeof (yyr2) / sizeof (yyr2[0]))
-#define TOKEN_LENGTH (256 + sizeof (yytname) / sizeof (yytname[0]))
+#define REDUCE_LENGTH ARRAY_SIZE (yyr2)
+#define TOKEN_LENGTH (256 + ARRAY_SIZE (yytname))
#endif
#ifdef GATHER_STATISTICS
diff --git a/gcc/cppexp.c b/gcc/cppexp.c
index 5a58556..5766a79 100644
--- a/gcc/cppexp.c
+++ b/gcc/cppexp.c
@@ -83,7 +83,6 @@ static const struct suffix vsuf_3[] = {
{ "ull", 1, 2 }, { "ULL", 1, 2 }, { "uLL", 1, 2 }, { "Ull", 1, 2 },
{ "llu", 1, 2 }, { "LLU", 1, 2 }, { "LLu", 1, 2 }, { "llU", 1, 2 }
};
-#define Nsuff(tab) (sizeof tab / sizeof (struct suffix))
/* Parse and convert what is presumably an integer in TOK. Accepts
decimal, hex, or octal with or without size suffixes. Returned op
@@ -157,9 +156,9 @@ parse_number (pfile, tok)
See the suffix tables, above. */
switch (end - p)
{
- case 1: sufftab = vsuf_1; nsuff = Nsuff(vsuf_1); break;
- case 2: sufftab = vsuf_2; nsuff = Nsuff(vsuf_2); break;
- case 3: sufftab = vsuf_3; nsuff = Nsuff(vsuf_3); break;
+ case 1: sufftab = vsuf_1; nsuff = ARRAY_SIZE (vsuf_1); break;
+ case 2: sufftab = vsuf_2; nsuff = ARRAY_SIZE (vsuf_2); break;
+ case 3: sufftab = vsuf_3; nsuff = ARRAY_SIZE (vsuf_3); break;
default: goto invalid_suffix;
}
diff --git a/gcc/cppinit.c b/gcc/cppinit.c
index 70fc828..3868167 100644
--- a/gcc/cppinit.c
+++ b/gcc/cppinit.c
@@ -690,8 +690,7 @@ static const struct builtin builtin_array[] =
#undef C
#undef X
#undef O
-#define builtin_array_end \
- builtin_array + sizeof(builtin_array)/sizeof(struct builtin)
+#define builtin_array_end (builtin_array + ARRAY_SIZE (builtin_array))
/* Subroutine of cpp_read_main_file; reads the builtins table above and
enters them, and language-specific macros, into the hash table. */
diff --git a/gcc/gcc.c b/gcc/gcc.c
index 69e4f7f..ead8ffa 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -858,8 +858,7 @@ static const struct compiler default_compilers[] =
/* Number of elements in default_compilers, not counting the terminator. */
-static int n_default_compilers
- = (sizeof default_compilers / sizeof (struct compiler)) - 1;
+static const int n_default_compilers = ARRAY_SIZE (default_compilers) - 1;
/* A vector of options to give to the linker.
These options are accumulated by %x,
@@ -3686,8 +3685,7 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"
#ifdef MODIFY_TARGET_NAME
is_modify_target_name = 0;
- for (j = 0;
- j < sizeof modify_target / sizeof modify_target[0]; j++)
+ for (j = 0; j < ARRAY_SIZE (modify_target); j++)
if (! strcmp (argv[i], modify_target[j].sw))
{
char *new_name
@@ -3822,7 +3820,7 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"
#ifdef MODIFY_TARGET_NAME
is_modify_target_name = 0;
- for (j = 0; j < sizeof modify_target / sizeof modify_target[0]; j++)
+ for (j = 0; j < ARRAY_SIZE (modify_target); j++)
if (! strcmp (argv[i], modify_target[j].sw))
is_modify_target_name = 1;
diff --git a/gcc/genpreds.c b/gcc/genpreds.c
index f4ba1f9..cf8c0bd 100644
--- a/gcc/genpreds.c
+++ b/gcc/genpreds.c
@@ -43,7 +43,7 @@ output_predicate_decls ()
size_t i;
puts ("#ifdef RTX_CODE\n");
- for (i = 0; i < sizeof predicate / sizeof *predicate; i++)
+ for (i = 0; i < ARRAY_SIZE (predicate); i++)
printf ("extern int %s PARAMS ((rtx, enum machine_mode));\n",
predicate[i].name);
puts ("\n#endif /* RTX_CODE */\n");
diff --git a/gcc/ggc-page.c b/gcc/ggc-page.c
index ad3f815..db4266b 100644
--- a/gcc/ggc-page.c
+++ b/gcc/ggc-page.c
@@ -161,8 +161,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
/* The number of extra orders, not corresponding to power-of-two sized
objects. */
-#define NUM_EXTRA_ORDERS \
- (sizeof (extra_order_size_table) / sizeof (extra_order_size_table[0]))
+#define NUM_EXTRA_ORDERS ARRAY_SIZE (extra_order_size_table)
/* The Ith entry is the maximum size of an object to be stored in the
Ith extra order. Adding a new entry to this array is the *only*
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index 8db656d..6cd8b5f 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,11 @@
+2002-03-03 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * class.c (init_class_processing): Use ARRAY_SIZE in lieu of
+ explicit sizeof/sizeof.
+ * decl.c (java_init_decl_processing): Likewise.
+ * jcf-parse.c (init_jcf_parse): Likewise.
+ * parse.y (init_src_parse): Likewise.
+
2002-03-02 Per Bothner <per@bothner.com>
Make --CLASSPATH by a synonym for --classpath and -classpath.
diff --git a/gcc/java/class.c b/gcc/java/class.c
index ac97994..c8290ea 100644
--- a/gcc/java/class.c
+++ b/gcc/java/class.c
@@ -2325,7 +2325,7 @@ init_class_processing ()
registerClass_libfunc = gen_rtx (SYMBOL_REF, Pmode, "_Jv_RegisterClass");
registerResource_libfunc =
gen_rtx (SYMBOL_REF, Pmode, "_Jv_RegisterResource");
- ggc_add_tree_root (class_roots, sizeof (class_roots) / sizeof (tree));
+ ggc_add_tree_root (class_roots, ARRAY_SIZE (class_roots));
fields_ident = get_identifier ("fields");
info_ident = get_identifier ("info");
ggc_add_rtx_root (&registerClass_libfunc, 1);
diff --git a/gcc/java/decl.c b/gcc/java/decl.c
index eaa7c48..86dd5c0 100644
--- a/gcc/java/decl.c
+++ b/gcc/java/decl.c
@@ -907,8 +907,7 @@ java_init_decl_processing ()
init_jcf_parse ();
/* Register nodes with the garbage collector. */
- ggc_add_tree_root (java_global_trees,
- sizeof (java_global_trees) / sizeof (tree));
+ ggc_add_tree_root (java_global_trees, ARRAY_SIZE (java_global_trees));
ggc_add_tree_root (&decl_map, 1);
ggc_add_tree_root (&pending_local_decls, 1);
diff --git a/gcc/java/jcf-parse.c b/gcc/java/jcf-parse.c
index 484f79c..c2350a0 100644
--- a/gcc/java/jcf-parse.c
+++ b/gcc/java/jcf-parse.c
@@ -1326,7 +1326,7 @@ void
init_jcf_parse ()
{
/* Register roots with the garbage collector. */
- ggc_add_tree_root (parse_roots, sizeof (parse_roots) / sizeof(tree));
+ ggc_add_tree_root (parse_roots, ARRAY_SIZE (parse_roots));
ggc_add_root (&current_jcf, 1, sizeof (JCF), (void (*)(void *))ggc_mark_jcf);
diff --git a/gcc/java/parse.y b/gcc/java/parse.y
index 0b5be092..d21fe63 100644
--- a/gcc/java/parse.y
+++ b/gcc/java/parse.y
@@ -15997,7 +15997,7 @@ void
init_src_parse ()
{
/* Register roots with the garbage collector. */
- ggc_add_tree_root (src_parse_roots, sizeof (src_parse_roots) / sizeof(tree));
+ ggc_add_tree_root (src_parse_roots, ARRAY_SIZE (src_parse_roots));
}
diff --git a/gcc/lcm.c b/gcc/lcm.c
index f64c7ad..a7d1dac 100644
--- a/gcc/lcm.c
+++ b/gcc/lcm.c
@@ -1023,7 +1023,7 @@ optimize_mode_switching (file)
sbitmap *kill;
struct edge_list *edge_list;
static const int num_modes[] = NUM_MODES_FOR_MODE_SWITCHING;
-#define N_ENTITIES (sizeof num_modes / sizeof (int))
+#define N_ENTITIES ARRAY_SIZE (num_modes)
int entity_map[N_ENTITIES];
struct bb_info *bb_info[N_ENTITIES];
int i, j;
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
index 671d65a..4a8d7d0 100644
--- a/gcc/stor-layout.c
+++ b/gcc/stor-layout.c
@@ -1816,8 +1816,7 @@ set_sizetype (type)
TYPE_REFERENCE_TO (sizetype_tab[i]) = 0;
}
- ggc_add_tree_root ((tree *) &sizetype_tab,
- sizeof sizetype_tab / sizeof (tree));
+ ggc_add_tree_root ((tree *) &sizetype_tab, ARRAY_SIZE (sizetype_tab));
/* Go down each of the types we already made and set the proper type
for the sizes in them. */