aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/msp430
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2021-03-19 10:21:35 +0100
committerMartin Liska <mliska@suse.cz>2021-05-18 10:37:40 +0200
commitc0129e2d489cc0ab419c58c4f8451898c2b5e3ae (patch)
tree226825f086944da04ba34474db74fd9d9d67da07 /gcc/config/msp430
parentc81704b359283bb54696755ead881ab04136da94 (diff)
downloadgcc-c0129e2d489cc0ab419c58c4f8451898c2b5e3ae.zip
gcc-c0129e2d489cc0ab419c58c4f8451898c2b5e3ae.tar.gz
gcc-c0129e2d489cc0ab419c58c4f8451898c2b5e3ae.tar.bz2
Use startswith in targets.
gcc/ChangeLog: * common/config/aarch64/aarch64-common.c (aarch64_parse_extension): Use startswith function instead of strncmp. * common/config/bfin/bfin-common.c (bfin_handle_option): Likewise. * common/config/riscv/riscv-common.c (riscv_subset_list::parse): Likewise. * config/aarch64/aarch64-sve-builtins-shapes.cc (parse_type): Likewise. * config/aarch64/aarch64.c (aarch64_process_one_target_attr): Likewise. * config/alpha/alpha.c (alpha_elf_section_type_flags): Likewise. * config/arm/aarch-common.c (arm_md_asm_adjust): Likewise. * config/arm/arm.c (arm_file_start): Likewise. (arm_valid_target_attribute_rec): Likewise. (thumb1_md_asm_adjust): Likewise. * config/arm/driver-arm.c (host_detect_local_cpu): Likewise. * config/avr/avr.c (STR_PREFIX_P): Likewise. (avr_set_current_function): Likewise. (avr_handle_addr_attribute): Likewise. (avr_asm_output_aligned_decl_common): Likewise. (avr_asm_named_section): Likewise. (avr_section_type_flags): Likewise. (avr_asm_select_section): Likewise. * config/c6x/c6x.c (c6x_in_small_data_p): Likewise. (c6x_section_type_flags): Likewise. * config/darwin-c.c (darwin_cfstring_ref_p): Likewise. (darwin_objc_declare_unresolved_class_reference): Likewise. (darwin_objc_declare_class_definition): Likewise. * config/darwin.c (indirect_data): Likewise. (darwin_encode_section_info): Likewise. (darwin_objc2_section): Likewise. (darwin_objc1_section): Likewise. (machopic_select_section): Likewise. (darwin_globalize_label): Likewise. (darwin_label_is_anonymous_local_objc_name): Likewise. (darwin_asm_named_section): Likewise. (darwin_asm_output_dwarf_offset): Likewise. * config/frv/frv.c (frv_string_begins_with): Likewise. (frv_in_small_data_p): Likewise. * config/gcn/mkoffload.c (STR): Likewise. (main): Likewise. * config/i386/i386-builtins.c (get_builtin_code_for_version): Likewise. * config/i386/i386-options.c (ix86_option_override_internal): Likewise. * config/i386/i386.c (x86_64_elf_section_type_flags): Likewise. (ix86_md_asm_adjust): Likewise. * config/i386/intelmic-mkoffload.c (STR): Likewise. * config/i386/winnt.c (i386_pe_asm_named_section): Likewise. (i386_pe_file_end): Likewise. * config/ia64/ia64.c (ia64_in_small_data_p): Likewise. (ia64_section_type_flags): Likewise. * config/mips/driver-native.c (host_detect_local_cpu): Likewise. * config/mips/mips.c (mips_handle_interrupt_attr): Likewise. (mips16_stub_function_p): Likewise. (mips_function_rodata_section): Likewise. * config/msp430/msp430.c (msp430_mcu_name): Likewise. (msp430_function_section): Likewise. (msp430_section_type_flags): Likewise. (msp430_expand_helper): Likewise. * config/nios2/nios2.c (nios2_small_section_name_p): Likewise. (nios2_valid_target_attribute_rec): Likewise. * config/nvptx/mkoffload.c (process): Likewise. (STR): Likewise. * config/pa/som.h: Likewise. * config/pdp11/pdp11.c (pdp11_output_ident): Likewise. * config/riscv/riscv.c (riscv_elf_select_rtx_section): Likewise. * config/rs6000/rs6000.c (VTABLE_NAME_P): Likewise. (rs6000_inner_target_options): Likewise. * config/s390/driver-native.c (s390_host_detect_local_cpu): Likewise. * config/sparc/driver-sparc.c (host_detect_local_cpu): Likewise. * config/vax/vax.c (vax_output_int_move): Likewise. * config/vms/vms-ld.c (startswith): Likewise. (process_args): Likewise. (main): Likewise. * config/vms/vms.c: Likewise.
Diffstat (limited to 'gcc/config/msp430')
-rw-r--r--gcc/config/msp430/msp430.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/gcc/config/msp430/msp430.c b/gcc/config/msp430/msp430.c
index 581e051..1cdacb7 100644
--- a/gcc/config/msp430/msp430.c
+++ b/gcc/config/msp430/msp430.c
@@ -122,7 +122,7 @@ msp430_mcu_name (void)
/* The 'i' in the device name symbol for msp430i* devices must be lower
case, to match the expected symbol in msp430.h. */
- if (strncmp (target_mcu, "msp430i", 7) == 0)
+ if (startswith (target_mcu, "msp430i"))
{
snprintf (mcu_name, sizeof (mcu_name) - 1, "__MSP430i%s__",
target_mcu + 7);
@@ -2466,7 +2466,7 @@ msp430_function_section (tree decl, enum node_frequency freq, bool startup,
const char * prefix = gen_prefix (decl);
if (prefix == NULL
- || strncmp (name, prefix, strlen (prefix)) == 0)
+ || startswith (name, prefix))
return default_function_section (decl, freq, startup, exit);
name = ACONCAT ((prefix, name, NULL));
@@ -2479,11 +2479,11 @@ msp430_function_section (tree decl, enum node_frequency freq, bool startup,
unsigned int
msp430_section_type_flags (tree decl, const char * name, int reloc)
{
- if (strncmp (name, lower_prefix, strlen (lower_prefix)) == 0)
+ if (startswith (name, lower_prefix))
name += strlen (lower_prefix);
- else if (strncmp (name, upper_prefix, strlen (upper_prefix)) == 0)
+ else if (startswith (name, upper_prefix))
name += strlen (upper_prefix);
- else if (strncmp (name, either_prefix, strlen (either_prefix)) == 0)
+ else if (startswith (name, either_prefix))
name += strlen (either_prefix);
return default_section_type_flags (decl, name, reloc);
@@ -3243,8 +3243,7 @@ msp430_expand_helper (rtx *operands, const char *helper_name,
machine_mode arg0mode = GET_MODE (operands[0]);
machine_mode arg1mode = GET_MODE (operands[1]);
machine_mode arg2mode = GET_MODE (operands[2]);
- int expand_mpy = strncmp (helper_name, "__mspabi_mpy",
- sizeof ("__mspabi_mpy") - 1) == 0;
+ int expand_mpy = startswith (helper_name, "__mspabi_mpy");
/* This function has been used incorrectly if CONST_VARIANTS is TRUE for a
hwmpy function. */
gcc_assert (!(expand_mpy && const_variants));