On Fri, Nov 7, 2025 at 8:28 AM Jeff Law <[email protected]> wrote: > > > > On 10/27/25 11:29 PM, Andrew Pinski wrote: > > Instead of a va_list here we can create a std::initializer_list that > > contains the > > arguments and pass that. > > This is just one quick version of what was mentioned during the Reviewing > > refactoring > > goals and acceptable abstractions. > > The generated code should be similar or slightly better. Plus there is > > extra checking > > of bounds of the std::initializer_list. > > > > I didn't remove the n argument from build_call_nary at this stage as I > > didn't want to change > > the calls to build_call_nary but I added a gcc_checking_assert to make sure > > the number passed > > is the number of arguments. > > > > gcc/ChangeLog: > > > > * tree.cc (build_call_nary): Remove decl. > > Add template definition that uses std::initializer_list<tree> > > and call build_call. > > (build_call): New declaration. > > * tree.h (build_call_nary): Remove. > > (build_call): New function. > Presumably the main gain here is the bounds checking. Regardless. OK.
The two gains here are bounds checking and type safety. The type safety comes from the conversion to tree statically. Anyways here is the version which I committed since I had an issue inside build_call when I posted this as RFC. Thanks, Andrew > > jeff
v2-0001-Move-build_call_nary-away-from-va_list.patch
Description: Binary data
