From e3d444a7dd824c3c79427a657e8a95d5711cb497 Mon Sep 17 00:00:00 2001 From: Kyrylo Tkachov Date: Thu, 21 Dec 2017 14:50:02 +0000 Subject: [PATCH] [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/ChangeLog | 5 +++++ gcc/common/config/arm/arm-common.c | 10 +++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fd78d89..59b19b9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2017-12-21 Kyrylo Tkachov + + * common/config/arm/arm-common.c (compare_opt_names): Add function + comment. Use strcmp instead of manual loop. + 2017-12-21 Martin Liska PR gcov-profile/83509 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. -- 2.7.4