On 10/7/2026 4:48 AM, Yonggang Luo wrote: > Add scripts/gen-target-info.py to generate declarations and definitions > for exact-target and base-family architecture checks from system target > names and their TARGET_BASE_ARCH values. > > Provide target_is_<arch>() and target_is_base_<family>() checks for an > explicit TargetInfo. Retain target_<arch>() and target_base_<family>() > as wrappers using the current target. > > Wire the generator into Meson using all system target definitions so > the available checks do not depend on --target-list. > > Signed-off-by: Yonggang Luo <[email protected]> > --- > include/qemu/target-info.h | 76 ++++------------------------- > meson.build | 16 ++++++ > scripts/gen-target-info.py | 99 ++++++++++++++++++++++++++++++++++++++ > target-info.c | 62 +----------------------- > 4 files changed, 125 insertions(+), 128 deletions(-) > create mode 100644 scripts/gen-target-info.py >
If I had to pick between simple and manual boilerplate, and a python script generating C code, I would tend to choose the former. In this case, the set of targets is bounded, so manual code is really the way to go for me. If the repetition is really unbearable, macros are a way to deal with this. However, note that we will not need all the target_X to be defined, so I would prefer to not see any new variant added as long as it's not used. Regards, Pierrick
