[gcc(refs/vendors/riscv/heads/gcc-15-with-riscv-opts)] RISC-V: Don't use structured binding in riscv-common.cc
Jeff Law
law@gcc.gnu.org
Sat Jan 17 06:57:52 GMT 2026
https://gcc.gnu.org/g:7dd5b77c0bf9db73db85e6956ad19a90e0fba988
commit 7dd5b77c0bf9db73db85e6956ad19a90e0fba988
Author: Kito Cheng <kito.cheng@sifive.com>
Date: Thu Jun 5 15:23:59 2025 +0800
RISC-V: Don't use structured binding in riscv-common.cc
It's new C++ language feature introduced in C++17, which is higher than
the build environment required by the GCC (C++14).
gcc/ChangeLog:
* common/config/riscv/riscv-common.cc: Remove structured binding
from the code.
(cherry picked from commit 35200a033dfcfe38ce5c066651f94e5475a40373)
Diff:
---
gcc/common/config/riscv/riscv-common.cc | 27 ++++++++++++++++++---------
1 file changed, 18 insertions(+), 9 deletions(-)
diff --git a/gcc/common/config/riscv/riscv-common.cc b/gcc/common/config/riscv/riscv-common.cc
index a6d8763f032b..6b5440365e33 100644
--- a/gcc/common/config/riscv/riscv-common.cc
+++ b/gcc/common/config/riscv/riscv-common.cc
@@ -1129,8 +1129,10 @@ riscv_subset_list::check_implied_ext ()
void
riscv_subset_list::handle_combine_ext ()
{
- for (const auto &[ext_name, ext_info] : riscv_ext_infos)
+ for (const auto &pair : riscv_ext_infos)
{
+ const std::string &ext_name = pair.first;
+ auto &ext_info = pair.second;
bool is_combined = true;
/* Skip if this extension don't need to combine. */
if (!ext_info.need_combine_p ())
@@ -1558,20 +1560,27 @@ riscv_set_arch_by_subset_list (riscv_subset_list *subset_list,
if (opts)
{
/* Clean up target flags before we set. */
- for (const auto &[ext_name, ext_info] : riscv_ext_infos)
- ext_info.clean_opts (opts);
+ for (const auto &pair : riscv_ext_infos)
+ {
+ auto &ext_info = pair.second;
+ ext_info.clean_opts (opts);
+ }
if (subset_list->xlen () == 32)
opts->x_riscv_isa_flags &= ~MASK_64BIT;
else if (subset_list->xlen () == 64)
opts->x_riscv_isa_flags |= MASK_64BIT;
- for (const auto &[ext_name, ext_info] : riscv_ext_infos)
- if (subset_list->lookup (ext_name.c_str ()))
- {
- /* Set the extension flag. */
- ext_info.set_opts (opts);
- }
+ for (const auto &pair : riscv_ext_infos)
+ {
+ const std::string &ext_name = pair.first;
+ auto &ext_info = pair.second;
+ if (subset_list->lookup (ext_name.c_str ()))
+ {
+ /* Set the extension flag. */
+ ext_info.set_opts (opts);
+ }
+ }
}
}
More information about the Gcc-cvs
mailing list