From e3d444a7dd824c3c79427a657e8a95d5711cb497 Mon Sep 17 00:00:00 2001 From: Kyrylo Tkachov Date: Thu, 21 Dec 2017 14:50:02 +0000 Subject: [arm] Fix assembler option rewrite alphabetical comparison * common/config/arm/arm-common.c (compare_opt_names): Add function comment. Use strcmp instead of manual loop. From-SVN: r255942 --- gcc/common/config/arm/arm-common.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'gcc/common') diff --git a/gcc/common/config/arm/arm-common.c b/gcc/common/config/arm/arm-common.c index d637427..6a1683e 100644 --- a/gcc/common/config/arm/arm-common.c +++ b/gcc/common/config/arm/arm-common.c @@ -116,14 +116,14 @@ arm_rewrite_mcpu (int argc, const char **argv) return arm_rewrite_selected_cpu (argv[argc - 1]); } +/* Comparator for arm_rewrite_selected_arch. Compare the two arch extension + strings FIRST and SECOND and return TRUE if FIRST is less than SECOND + alphabetically. */ + static bool compare_opt_names (const char *first, const char *second) { - for (int i = 0; ; i++) - if (first[i] == 0 - || first[i] < second[i]) - return true; - return false; + return strcmp (first, second) <= 0; } /* Rewrite the architecture string for passing to the assembler. -- cgit v1.1