From: Roger Sayle Date: Sat, 2 Dec 2023 11:15:14 +0000 (+0000) Subject: RISC-V: Improve style to work around PR 60994 in host compiler. X-Git-Tag: basepoints/gcc-15~4064 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=193ef02a7f4f3e5349ad9cf8d3d4df466a99b677;p=thirdparty%2Fgcc.git RISC-V: Improve style to work around PR 60994 in host compiler. This simple patch allows me to build a cross-compiler to riscv using older versions of RedHat's system compiler. The issue is PR c++/60994 where g++ doesn't like the same name (demand_flags) to be used by both a variable and a (enumeration) type, which is also undesirable from a (GNU) coding style perspective. One solution is to rename the type to demand_flags_t, but a less invasive change is to simply use another identifier for the problematic local variable, renaming demand_flags to dflags. 2023-12-02 Roger Sayle gcc/ChangeLog * config/riscv/riscv-vsetvl.cc (csetvl_info::parse_insn): Rename local variable from demand_flags to dflags, to avoid conflicting with (enumeration) type of the same name. --- diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc index 1da95daeeb03..484a8b3a5147 100644 --- a/gcc/config/riscv/riscv-vsetvl.cc +++ b/gcc/config/riscv/riscv-vsetvl.cc @@ -987,11 +987,11 @@ public: /* Determine the demand info of the RVV insn. */ m_max_sew = get_max_int_sew (); - unsigned demand_flags = 0; + unsigned dflags = 0; if (vector_config_insn_p (insn->rtl ())) { - demand_flags |= demand_flags::DEMAND_AVL_P; - demand_flags |= demand_flags::DEMAND_RATIO_P; + dflags |= demand_flags::DEMAND_AVL_P; + dflags |= demand_flags::DEMAND_RATIO_P; } else { @@ -1006,39 +1006,39 @@ public: available. */ if (has_non_zero_avl ()) - demand_flags |= demand_flags::DEMAND_NON_ZERO_AVL_P; + dflags |= demand_flags::DEMAND_NON_ZERO_AVL_P; else - demand_flags |= demand_flags::DEMAND_AVL_P; + dflags |= demand_flags::DEMAND_AVL_P; } else - demand_flags |= demand_flags::DEMAND_AVL_P; + dflags |= demand_flags::DEMAND_AVL_P; } if (get_attr_ratio (insn->rtl ()) != INVALID_ATTRIBUTE) - demand_flags |= demand_flags::DEMAND_RATIO_P; + dflags |= demand_flags::DEMAND_RATIO_P; else { if (scalar_move_insn_p (insn->rtl ()) && m_ta) { - demand_flags |= demand_flags::DEMAND_GE_SEW_P; + dflags |= demand_flags::DEMAND_GE_SEW_P; m_max_sew = get_attr_type (insn->rtl ()) == TYPE_VFMOVFV ? get_max_float_sew () : get_max_int_sew (); } else - demand_flags |= demand_flags::DEMAND_SEW_P; + dflags |= demand_flags::DEMAND_SEW_P; if (!ignore_vlmul_insn_p (insn->rtl ())) - demand_flags |= demand_flags::DEMAND_LMUL_P; + dflags |= demand_flags::DEMAND_LMUL_P; } if (!m_ta) - demand_flags |= demand_flags::DEMAND_TAIL_POLICY_P; + dflags |= demand_flags::DEMAND_TAIL_POLICY_P; if (!m_ma) - demand_flags |= demand_flags::DEMAND_MASK_POLICY_P; + dflags |= demand_flags::DEMAND_MASK_POLICY_P; } - normalize_demand (demand_flags); + normalize_demand (dflags); /* Optimize AVL from the vsetvl instruction. */ insn_info *def_insn = extract_single_source (get_avl_def ());