aboutsummaryrefslogtreecommitdiff
path: root/gcc/gcc.c
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2021-03-17 16:36:44 +0100
committerMartin Liska <mliska@suse.cz>2021-05-10 09:33:29 +0200
commit6ba3079dce89d9b63bf5dbd5e320ea2bf96f196b (patch)
treefe403786765fe8f105492c94df12561b01c35cb8 /gcc/gcc.c
parentfea26bad2e5b9078d6a6b16d5e48653e31794273 (diff)
downloadgcc-6ba3079dce89d9b63bf5dbd5e320ea2bf96f196b.zip
gcc-6ba3079dce89d9b63bf5dbd5e320ea2bf96f196b.tar.gz
gcc-6ba3079dce89d9b63bf5dbd5e320ea2bf96f196b.tar.bz2
Come up with startswith function.
gcc/ada/ChangeLog: * gcc-interface/utils.c (def_builtin_1): Use startswith function instead of strncmp. gcc/analyzer/ChangeLog: * sm-file.cc (is_file_using_fn_p): Use startswith function instead of strncmp. gcc/ChangeLog: * builtins.c (is_builtin_name): Use startswith function instead of strncmp. * collect2.c (main): Likewise. (has_lto_section): Likewise. (scan_libraries): Likewise. * coverage.c (coverage_checksum_string): Likewise. (coverage_init): Likewise. * dwarf2out.c (is_cxx): Likewise. (gen_compile_unit_die): Likewise. * gcc-ar.c (main): Likewise. * gcc.c (init_spec): Likewise. (read_specs): Likewise. (execute): Likewise. (check_live_switch): Likewise. * genattrtab.c (write_attr_case): Likewise. (IS_ATTR_GROUP): Likewise. * gencfn-macros.c (main): Likewise. * gengtype.c (type_for_name): Likewise. (gen_rtx_next): Likewise. (get_file_langdir): Likewise. (write_local): Likewise. * genmatch.c (get_operator): Likewise. (get_operand_type): Likewise. (expr::gen_transform): Likewise. * genoutput.c (validate_optab_operands): Likewise. * incpath.c (add_sysroot_to_chain): Likewise. * langhooks.c (lang_GNU_C): Likewise. (lang_GNU_CXX): Likewise. (lang_GNU_Fortran): Likewise. (lang_GNU_OBJC): Likewise. * lto-wrapper.c (run_gcc): Likewise. * omp-general.c (omp_max_simt_vf): Likewise. * omp-low.c (omp_runtime_api_call): Likewise. * opts-common.c (parse_options_from_collect_gcc_options): Likewise. * read-rtl-function.c (function_reader::read_rtx_operand_r): Likewise. * real.c (real_from_string): Likewise. * selftest.c (assert_str_startswith): Likewise. * timevar.c (timer::validate_phases): Likewise. * tree.c (get_file_function_name): Likewise. * ubsan.c (ubsan_use_new_style_p): Likewise. * varasm.c (default_function_rodata_section): Likewise. (incorporeal_function_p): Likewise. (default_section_type_flags): Likewise. * system.h (startswith): Define startswith. gcc/c-family/ChangeLog: * c-ada-spec.c (print_destructor): Use startswith function instead of strncmp. (dump_ada_declaration): Likewise. * c-common.c (disable_builtin_function): Likewise. (def_builtin_1): Likewise. * c-format.c (check_tokens): Likewise. (check_plain): Likewise. (convert_format_name_to_system_name): Likewise. gcc/c/ChangeLog: * c-aux-info.c (affix_data_type): Use startswith function instead of strncmp. * c-typeck.c (build_function_call_vec): Likewise. * gimple-parser.c (c_parser_gimple_parse_bb_spec): Likewise. gcc/cp/ChangeLog: * decl.c (duplicate_decls): Use startswith function instead of strncmp. (cxx_builtin_function): Likewise. (omp_declare_variant_finalize_one): Likewise. (grokfndecl): Likewise. * error.c (dump_decl_name): Likewise. * mangle.c (find_decomp_unqualified_name): Likewise. (write_guarded_var_name): Likewise. (decl_tls_wrapper_p): Likewise. * parser.c (cp_parser_simple_type_specifier): Likewise. (cp_parser_tx_qualifier_opt): Likewise. * pt.c (template_parm_object_p): Likewise. (dguide_name_p): Likewise. gcc/d/ChangeLog: * d-builtins.cc (do_build_builtin_fn): Use startswith function instead of strncmp. * dmd/dinterpret.c (evaluateIfBuiltin): Likewise. * dmd/dmangle.c: Likewise. * dmd/hdrgen.c: Likewise. * dmd/identifier.c (Identifier::toHChars2): Likewise. gcc/fortran/ChangeLog: * decl.c (variable_decl): Use startswith function instead of strncmp. (gfc_match_end): Likewise. * gfortran.h (gfc_str_startswith): Likewise. * module.c (load_omp_udrs): Likewise. (read_module): Likewise. * options.c (gfc_handle_runtime_check_option): Likewise. * primary.c (match_arg_list_function): Likewise. * trans-decl.c (gfc_get_symbol_decl): Likewise. * trans-expr.c (gfc_conv_procedure_call): Likewise. * trans-intrinsic.c (gfc_conv_ieee_arithmetic_function): Likewise. gcc/go/ChangeLog: * gofrontend/runtime.cc (Runtime::name_to_code): Use startswith function instead of strncmp. gcc/objc/ChangeLog: * objc-act.c (objc_string_ref_type_p): Use startswith function instead of strncmp. * objc-encoding.c (encode_type): Likewise. * objc-next-runtime-abi-02.c (has_load_impl): Likewise.
Diffstat (limited to 'gcc/gcc.c')
-rw-r--r--gcc/gcc.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/gcc/gcc.c b/gcc/gcc.c
index bd561ac..4c1a659 100644
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -1906,7 +1906,7 @@ init_spec (void)
when given the proper command line arguments. */
while (*p)
{
- if (in_sep && *p == '-' && strncmp (p, "-lgcc", 5) == 0)
+ if (in_sep && *p == '-' && startswith (p, "-lgcc"))
{
init_gcc_specs (&obstack,
"-lgcc_s"
@@ -1929,7 +1929,7 @@ init_spec (void)
p += 5;
in_sep = 0;
}
- else if (in_sep && *p == 'l' && strncmp (p, "libgcc.a%s", 10) == 0)
+ else if (in_sep && *p == 'l' && startswith (p, "libgcc.a%s"))
{
/* Ug. We don't know shared library extensions. Hope that
systems that use this form don't do shared libraries. */
@@ -2384,7 +2384,7 @@ read_specs (const char *filename, bool main_p, bool user_p)
/* Skip '\n'. */
p++;
- if (!strncmp (p1, "%include", sizeof ("%include") - 1)
+ if (startswith (p1, "%include")
&& (p1[sizeof "%include" - 1] == ' '
|| p1[sizeof "%include" - 1] == '\t'))
{
@@ -2405,7 +2405,7 @@ read_specs (const char *filename, bool main_p, bool user_p)
read_specs (new_filename ? new_filename : p1, false, user_p);
continue;
}
- else if (!strncmp (p1, "%include_noerr", sizeof "%include_noerr" - 1)
+ else if (startswith (p1, "%include_noerr")
&& (p1[sizeof "%include_noerr" - 1] == ' '
|| p1[sizeof "%include_noerr" - 1] == '\t'))
{
@@ -2429,7 +2429,7 @@ read_specs (const char *filename, bool main_p, bool user_p)
fnotice (stderr, "could not find specs file %s\n", p1);
continue;
}
- else if (!strncmp (p1, "%rename", sizeof "%rename" - 1)
+ else if (startswith (p1, "%rename")
&& (p1[sizeof "%rename" - 1] == ' '
|| p1[sizeof "%rename" - 1] == '\t'))
{
@@ -3502,7 +3502,7 @@ execute (void)
&& WEXITSTATUS (status) == ICE_EXIT_CODE
&& i == 0
&& (p = strrchr (commands[0].argv[0], DIR_SEPARATOR))
- && ! strncmp (p + 1, "cc1", 3))
+ && startswith (p + 1, "cc1"))
try_generate_repro (commands[0].argv);
if (WEXITSTATUS (status) > greatest_status)
greatest_status = WEXITSTATUS (status);
@@ -7335,7 +7335,7 @@ check_live_switch (int switchnum, int prefix_length)
break;
case 'W': case 'f': case 'm': case 'g':
- if (! strncmp (name + 1, "no-", 3))
+ if (startswith (name + 1, "no-"))
{
/* We have Xno-YYY, search for XYYY. */
for (i = switchnum + 1; i < n_switches; i++)