diff options
author | Martin Liska <mliska@suse.cz> | 2022-01-13 18:46:26 +0100 |
---|---|---|
committer | Martin Liska <mliska@suse.cz> | 2022-05-16 10:38:46 +0200 |
commit | ca32b29ec3e92dcf8dda5c2501d0baf9dd1cb09d (patch) | |
tree | 6a832b897b459fde27de4725ccce563deb22825c /gcc/config | |
parent | b4fb9f4f9a10d825302cfb5a0ecefa796570d8bc (diff) | |
download | gcc-ca32b29ec3e92dcf8dda5c2501d0baf9dd1cb09d.zip gcc-ca32b29ec3e92dcf8dda5c2501d0baf9dd1cb09d.tar.gz gcc-ca32b29ec3e92dcf8dda5c2501d0baf9dd1cb09d.tar.bz2 |
Use more ARRAY_SIZE.
gcc/ada/ChangeLog:
* locales.c (iso_639_1_to_639_3): Use ARRAY_SIZE.
(language_name_to_639_3): Likewise.
(country_name_to_3166): Likewise.
gcc/analyzer/ChangeLog:
* engine.cc (exploded_node::get_dot_fillcolor): Use ARRAY_SIZE.
* function-set.cc (test_stdio_example): Likewise.
* sm-file.cc (get_file_using_fns): Likewise.
* sm-malloc.cc (malloc_state_machine::unaffected_by_call_p): Likewise.
* sm-signal.cc (get_async_signal_unsafe_fns): Likewise.
gcc/ChangeLog:
* attribs.cc (diag_attr_exclusions): Use ARRAY_SIZE.
(decls_mismatched_attributes): Likewise.
* builtins.cc (c_strlen): Likewise.
* cfg.cc (DEF_BASIC_BLOCK_FLAG): Likewise.
* common/config/aarch64/aarch64-common.cc (aarch64_option_init_struct): Likewise.
* config/aarch64/aarch64-builtins.cc (aarch64_lookup_simd_builtin_type): Likewise.
(aarch64_init_simd_builtin_types): Likewise.
(aarch64_init_builtin_rsqrt): Likewise.
* config/aarch64/aarch64.cc (is_madd_op): Likewise.
* config/arm/arm-builtins.cc (arm_lookup_simd_builtin_type): Likewise.
(arm_init_simd_builtin_types): Likewise.
* config/avr/gen-avr-mmcu-texi.cc (mcus[ARRAY_SIZE): Likewise.
(c_prefix): Likewise.
(main): Likewise.
* config/c6x/c6x.cc (N_SAVE_ORDER): Likewise.
* config/darwin-c.cc (darwin_register_frameworks): Likewise.
* config/gcn/mkoffload.cc (process_obj): Likewise.
* config/i386/i386-builtins.cc (get_builtin_code_for_version): Likewise.
(fold_builtin_cpu): Likewise.
* config/m32c/m32c.cc (PUSHM_N): Likewise.
* config/nvptx/mkoffload.cc (process): Likewise.
* config/rs6000/driver-rs6000.cc (host_detect_local_cpu): Likewise.
* config/s390/s390.cc (NR_C_MODES): Likewise.
* config/tilepro/gen-mul-tables.cc (find_sequences): Likewise.
(create_insn_code_compression_table): Likewise.
* config/vms/vms.cc (NBR_CRTL_NAMES): Likewise.
* diagnostic-format-json.cc (json_from_expanded_location): Likewise.
* dwarf2out.cc (ARRAY_SIZE): Likewise.
* genhooks.cc (emit_documentation): Likewise.
(emit_init_macros): Likewise.
* gimple-ssa-sprintf.cc (format_floating): Likewise.
* gimple-ssa-warn-access.cc (memmodel_name): Likewise.
* godump.cc (keyword_hash_init): Likewise.
* hash-table.cc (hash_table_higher_prime_index): Likewise.
* input.cc (for_each_line_table_case): Likewise.
* ipa-free-lang-data.cc (free_lang_data): Likewise.
* ipa-inline.cc (sanitize_attrs_match_for_inline_p): Likewise.
* optc-save-gen.awk: Likewise.
* spellcheck.cc (test_metric_conditions): Likewise.
* tree-vect-slp-patterns.cc (sizeof): Likewise.
(ARRAY_SIZE): Likewise.
* tree.cc (build_common_tree_nodes): Likewise.
gcc/c-family/ChangeLog:
* c-common.cc (ARRAY_SIZE): Use ARRAY_SIZE.
(c_common_nodes_and_builtins): Likewise.
* c-format.cc (check_tokens): Likewise.
(check_plain): Likewise.
* c-pragma.cc (c_pp_lookup_pragma): Likewise.
(init_pragma): Likewise.
* known-headers.cc (get_string_macro_hint): Likewise.
(get_stdlib_header_for_name): Likewise.
* c-attribs.cc: Likewise.
gcc/c/ChangeLog:
* c-decl.cc (match_builtin_function_types): Use ARRAY_SIZE.
gcc/cp/ChangeLog:
* module.cc (depset::entity_kind_name): Use ARRAY_SIZE.
* name-lookup.cc (get_std_name_hint): Likewise.
* parser.cc (cp_parser_new): Likewise.
gcc/fortran/ChangeLog:
* frontend-passes.cc (gfc_code_walker): Use ARRAY_SIZE.
* openmp.cc (gfc_match_omp_context_selector_specification): Likewise.
* trans-intrinsic.cc (conv_intrinsic_ieee_builtin): Likewise.
* trans-types.cc (gfc_get_array_descr_info): Likewise.
gcc/jit/ChangeLog:
* jit-builtins.cc (find_builtin_by_name): Use ARRAY_SIZE.
(get_string_for_type_id): Likewise.
* jit-recording.cc (recording::context::context): Likewise.
gcc/lto/ChangeLog:
* lto-common.cc (lto_resolution_read): Use ARRAY_SIZE.
* lto-lang.cc (lto_init): Likewise.
Diffstat (limited to 'gcc/config')
-rw-r--r-- | gcc/config/aarch64/aarch64-builtins.cc | 6 | ||||
-rw-r--r-- | gcc/config/aarch64/aarch64.cc | 2 | ||||
-rw-r--r-- | gcc/config/arm/arm-builtins.cc | 4 | ||||
-rw-r--r-- | gcc/config/avr/gen-avr-mmcu-texi.cc | 8 | ||||
-rw-r--r-- | gcc/config/c6x/c6x.cc | 2 | ||||
-rw-r--r-- | gcc/config/darwin-c.cc | 2 | ||||
-rw-r--r-- | gcc/config/gcn/mkoffload.cc | 2 | ||||
-rw-r--r-- | gcc/config/i386/i386-builtins.cc | 6 | ||||
-rw-r--r-- | gcc/config/m32c/m32c.cc | 2 | ||||
-rw-r--r-- | gcc/config/nvptx/mkoffload.cc | 6 | ||||
-rw-r--r-- | gcc/config/rs6000/driver-rs6000.cc | 2 | ||||
-rw-r--r-- | gcc/config/s390/s390.cc | 2 | ||||
-rw-r--r-- | gcc/config/tilepro/gen-mul-tables.cc | 4 | ||||
-rw-r--r-- | gcc/config/vms/vms.cc | 2 |
14 files changed, 25 insertions, 25 deletions
diff --git a/gcc/config/aarch64/aarch64-builtins.cc b/gcc/config/aarch64/aarch64-builtins.cc index c21476d..e0a741a 100644 --- a/gcc/config/aarch64/aarch64-builtins.cc +++ b/gcc/config/aarch64/aarch64-builtins.cc @@ -832,7 +832,7 @@ aarch64_lookup_simd_builtin_type (machine_mode mode, enum aarch64_type_qualifiers q) { int i; - int nelts = sizeof (aarch64_simd_types) / sizeof (aarch64_simd_types[0]); + int nelts = ARRAY_SIZE (aarch64_simd_types); /* Non-poly scalar modes map to standard types not in the table. */ if (q != qualifier_poly && !VECTOR_MODE_P (mode)) @@ -869,7 +869,7 @@ static void aarch64_init_simd_builtin_types (void) { int i; - int nelts = sizeof (aarch64_simd_types) / sizeof (aarch64_simd_types[0]); + int nelts = ARRAY_SIZE (aarch64_simd_types); tree tdecl; /* Init all the element types built by the front-end. */ @@ -1434,7 +1434,7 @@ aarch64_init_builtin_rsqrt (void) }; builtin_decls_data *bdd = bdda; - builtin_decls_data *bdd_end = bdd + (sizeof (bdda) / sizeof (builtin_decls_data)); + builtin_decls_data *bdd_end = bdd + (ARRAY_SIZE (bdda)); for (; bdd < bdd_end; bdd++) { diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc index f4d2a80..2902f94 100644 --- a/gcc/config/aarch64/aarch64.cc +++ b/gcc/config/aarch64/aarch64.cc @@ -20755,7 +20755,7 @@ is_madd_op (enum attr_type t1) TYPE_SMMLA, TYPE_UMLAL, TYPE_UMLALS,TYPE_SMLSD, TYPE_SMLSDX, TYPE_SMLSLD }; - for (i = 0; i < sizeof (mlatypes) / sizeof (enum attr_type); i++) + for (i = 0; i < ARRAY_SIZE (mlatypes); i++) { if (t1 == mlatypes[i]) return true; diff --git a/gcc/config/arm/arm-builtins.cc b/gcc/config/arm/arm-builtins.cc index 36a40a1..d917137 100644 --- a/gcc/config/arm/arm-builtins.cc +++ b/gcc/config/arm/arm-builtins.cc @@ -1471,7 +1471,7 @@ arm_lookup_simd_builtin_type (machine_mode mode, enum arm_type_qualifiers q) { int i; - int nelts = sizeof (arm_simd_types) / sizeof (arm_simd_types[0]); + int nelts = ARRAY_SIZE (arm_simd_types); /* Non-poly scalar modes map to standard types not in the table. */ if (q != qualifier_poly && !VECTOR_MODE_P (mode)) @@ -1503,7 +1503,7 @@ static void arm_init_simd_builtin_types (void) { int i; - int nelts = sizeof (arm_simd_types) / sizeof (arm_simd_types[0]); + int nelts = ARRAY_SIZE (arm_simd_types); tree tdecl; /* Poly types are a world of their own. In order to maintain legacy diff --git a/gcc/config/avr/gen-avr-mmcu-texi.cc b/gcc/config/avr/gen-avr-mmcu-texi.cc index d9c3a30..a44e18e 100644 --- a/gcc/config/avr/gen-avr-mmcu-texi.cc +++ b/gcc/config/avr/gen-avr-mmcu-texi.cc @@ -23,10 +23,12 @@ #define IN_GEN_AVR_MMCU_TEXI +#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0])) + #include "avr-devices.cc" static const avr_mcu_t* -mcus[sizeof avr_mcu_types / sizeof avr_mcu_types[0]]; +mcus[ARRAY_SIZE (avr_mcu_types)]; static int letter (char c) { @@ -56,7 +58,7 @@ c_prefix (const char *str) "attiny", "atmega", "atxmega", "ata", "at90" }; - int i, n = (int) (sizeof (prefixes) / sizeof (*prefixes)); + int i, n = (int) (ARRAY_SIZE (prefixes)); for (i = 0; i < n; i++) if (str_prefix_p (str, prefixes[i])) @@ -185,7 +187,7 @@ int main (void) print_mcus (n_mcus); n_mcus = 0; - for (i = 0; i < sizeof (avr_texinfo) / sizeof (*avr_texinfo); i++) + for (i = 0; i < ARRAY_SIZE (avr_texinfo); i++) if (arch_id == avr_texinfo[i].arch_id) printf ("@item %s\n%s\n", mcu->name, avr_texinfo[i].texinfo); } diff --git a/gcc/config/c6x/c6x.cc b/gcc/config/c6x/c6x.cc index 7fe18d6..dc01a6e 100644 --- a/gcc/config/c6x/c6x.cc +++ b/gcc/config/c6x/c6x.cc @@ -2580,7 +2580,7 @@ static unsigned reg_save_order[] = REG_B14, REG_A15 }; -#define N_SAVE_ORDER (sizeof reg_save_order / sizeof *reg_save_order) +#define N_SAVE_ORDER (ARRAY_SIZE (reg_save_order)) /* Compute the layout of the stack frame and store it in FRAME. */ diff --git a/gcc/config/darwin-c.cc b/gcc/config/darwin-c.cc index 3770857..9203c84 100644 --- a/gcc/config/darwin-c.cc +++ b/gcc/config/darwin-c.cc @@ -505,7 +505,7 @@ darwin_register_frameworks (const char *sysroot, size_t i; /* Setup default search path for frameworks. */ - for (i=0; i<sizeof (framework_defaults)/sizeof(const char *); ++i) + for (i = 0; i < ARRAY_SIZE (framework_defaults); ++i) { char *str; if (sysroot) diff --git a/gcc/config/gcn/mkoffload.cc b/gcc/config/gcn/mkoffload.cc index 94ba7ff..9db2124 100644 --- a/gcc/config/gcn/mkoffload.cc +++ b/gcc/config/gcn/mkoffload.cc @@ -723,7 +723,7 @@ process_obj (FILE *in, FILE *cfile) " unsigned global_variable_count;\n" "} target_data = {\n" " &gcn_image,\n" - " sizeof (gcn_kernels) / sizeof (gcn_kernels[0]),\n" + " ARRAY_SIZE (gcn_kernels),\n" " gcn_kernels,\n" " gcn_num_vars\n" "};\n\n"); diff --git a/gcc/config/i386/i386-builtins.cc b/gcc/config/i386/i386-builtins.cc index 59c7da2..96743e6 100644 --- a/gcc/config/i386/i386-builtins.cc +++ b/gcc/config/i386/i386-builtins.cc @@ -1936,8 +1936,7 @@ get_builtin_code_for_version (tree decl, tree *predicate_list) enum feature_priority priority = P_NONE; - static unsigned int NUM_FEATURES - = sizeof (isa_names_table) / sizeof (_isa_names_table); + static unsigned int NUM_FEATURES = ARRAY_SIZE (isa_names_table); unsigned int i; @@ -2290,8 +2289,7 @@ fold_builtin_cpu (tree fndecl, tree *args) tree final; unsigned int field_val = 0; - unsigned int NUM_ISA_NAMES - = sizeof (isa_names_table) / sizeof (struct _isa_names_table); + unsigned int NUM_ISA_NAMES = ARRAY_SIZE (isa_names_table); for (i = 0; i < NUM_ISA_NAMES; i++) if (strcmp (isa_names_table[i].name, diff --git a/gcc/config/m32c/m32c.cc b/gcc/config/m32c/m32c.cc index 11ca9a4..5a19faa 100644 --- a/gcc/config/m32c/m32c.cc +++ b/gcc/config/m32c/m32c.cc @@ -1090,7 +1090,7 @@ static struct { FB_REGNO, 0x01, 2, 4 } }; -#define PUSHM_N (sizeof(pushm_info)/sizeof(pushm_info[0])) +#define PUSHM_N (ARRAY_SIZE (pushm_info)) /* Returns TRUE if we need to save/restore the given register. We save everything for exception handlers, so that any register can be diff --git a/gcc/config/nvptx/mkoffload.cc b/gcc/config/nvptx/mkoffload.cc index b28c1a3..fa3b4b7 100644 --- a/gcc/config/nvptx/mkoffload.cc +++ b/gcc/config/nvptx/mkoffload.cc @@ -316,11 +316,11 @@ process (FILE *in, FILE *out) " const struct nvptx_fn *fn_names;\n" " unsigned fn_num;\n" "} target_data = {\n" - " ptx_objs, sizeof (ptx_objs) / sizeof (ptx_objs[0]),\n" + " ptx_objs, ARRAY_SIZE (ptx_objs),\n" " var_mappings," - " sizeof (var_mappings) / sizeof (var_mappings[0]),\n" + " ARRAY_SIZE (var_mappings),\n" " func_mappings," - " sizeof (func_mappings) / sizeof (func_mappings[0])\n" + " ARRAY_SIZE (func_mappings)\n" "};\n\n"); fprintf (out, "#ifdef __cplusplus\n" diff --git a/gcc/config/rs6000/driver-rs6000.cc b/gcc/config/rs6000/driver-rs6000.cc index ec890e0..b871f0a 100644 --- a/gcc/config/rs6000/driver-rs6000.cc +++ b/gcc/config/rs6000/driver-rs6000.cc @@ -599,7 +599,7 @@ host_detect_local_cpu (int argc, const char **argv) if (assembler) { - for (i = 0; i < sizeof (asm_names) / sizeof (asm_names[0]); i++) + for (i = 0; i < ARRAY_SIZE (asm_names); i++) { if (!asm_names[i].cpu || !strcmp (asm_names[i].cpu, cpu)) return asm_names[i].asm_sw; diff --git a/gcc/config/s390/s390.cc b/gcc/config/s390/s390.cc index 45bbb6c..d46aba6 100644 --- a/gcc/config/s390/s390.cc +++ b/gcc/config/s390/s390.cc @@ -8769,7 +8769,7 @@ static machine_mode constant_modes[] = QImode, V1QImode }; -#define NR_C_MODES (sizeof (constant_modes) / sizeof (constant_modes[0])) +#define NR_C_MODES (ARRAY_SIZE (constant_modes)) struct constant { diff --git a/gcc/config/tilepro/gen-mul-tables.cc b/gcc/config/tilepro/gen-mul-tables.cc index c9649fb..798766a 100644 --- a/gcc/config/tilepro/gen-mul-tables.cc +++ b/gcc/config/tilepro/gen-mul-tables.cc @@ -462,7 +462,7 @@ find_sequences (ExpressionTree &s, ExpressionTreeMap &best_solution) const Operator *const prev_op = s.m_exprs[num_vals - 1].m_op; const int prev_top_index = (prev_op != NULL) ? prev_op->m_top_index : -1; - for (size_t f = 0; f < sizeof ops / sizeof ops[0]; f++) + for (size_t f = 0; f < ARRAY_SIZE (ops); f++) { const Operator *const op = &ops[f]; @@ -564,7 +564,7 @@ create_insn_code_compression_table () printf ("const enum insn_code %s_multiply_insn_seq_decode_opcode[] = {\n" " CODE_FOR_nothing /* must be first */ ", ARCH); - for (size_t i = 0; i < sizeof ops / sizeof ops[0]; i++) + for (size_t i = 0; i < ARRAY_SIZE (ops); i++) { Operator *op = &ops[i]; int index = -1; diff --git a/gcc/config/vms/vms.cc b/gcc/config/vms/vms.cc index 5d565e3..d0d44ba 100644 --- a/gcc/config/vms/vms.cc +++ b/gcc/config/vms/vms.cc @@ -99,7 +99,7 @@ static const struct vms_crtl_name vms_crtl_names[] = /* Number of entires in the above array. */ -#define NBR_CRTL_NAMES (sizeof (vms_crtl_names) / sizeof (*vms_crtl_names)) +#define NBR_CRTL_NAMES (ARRAY_SIZE (vms_crtl_names)) /* List of aliased identifiers. They must be persistent across gc. */ |