From e91910d3576eeac714c93ec25ea3b15012007903 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Tue, 12 Jan 2021 13:20:18 +0100 Subject: [PATCH] options: properly compare string arguments Similarly to 7f967bd2a7ba156ede3fbb147e66dea5fb7137a6, we need to compare string with strcmp. gcc/ChangeLog: PR c++/97284 * optc-save-gen.awk: Compare also n_target_save vars with strcmp. --- gcc/optc-save-gen.awk | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gcc/optc-save-gen.awk b/gcc/optc-save-gen.awk index 85debfe0b64..b1f85928275 100644 --- a/gcc/optc-save-gen.awk +++ b/gcc/optc-save-gen.awk @@ -1036,8 +1036,10 @@ for (i = 0; i < n_target_save; i++) { type = var; sub("^.*[ *]", "", name) sub(" *" name "$", "", type) - if (target_save_decl[i] ~ "^const char \\*+[_" alnum "]+$") + if (target_save_decl[i] ~ "^const char \\*+[_" alnum "]+$") { var_target_str[n_target_str++] = name; + string_options_names[name]++ + } else { if (target_save_decl[i] ~ " .*\\[.+\\]+$") { size = name; @@ -1451,7 +1453,7 @@ for (i = 0; i < n_opts; i++) { continue; checked_options[name]++ - if (name in string_options_names) { + if (name in string_options_names || ("x_" name) in string_options_names) { print " if (ptr1->x_" name " != ptr2->x_" name ""; print " && (!ptr1->x_" name" || !ptr2->x_" name print " || strcmp (ptr1->x_" name", ptr2->x_" name ")))"; -- 2.30.2