aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
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 /gcc/cp
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
Diffstat (limited to 'gcc/cp')
-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
4 files changed, 14 insertions, 12 deletions
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