Re: [PATCH] sim: common: modernize gennltvals.sh

Mike Frysinger via Gdb-patches
2021-01-18T17:13:06Z

On 18 Jan 2021 09:04, Simon Marchi wrote:
> On 2021-01-17 5:10 a.m., Mike Frysinger via Gdb-patches wrote:
> > It's not 1996 anymore, so stop writing shell code like it is, and
> > rewrite it with modern POSIX shell standards. This makes it much
> > more user friendly.
> >
> > Then regenerate the file with latest newlib sources to verify.
> >
> > * Makefile.in (headers): Change args to gennltvals.sh.
> > * gennltvals.sh: Rewrite from scratch.
> > * gentvals.sh: Delete.
> > * nltvals.def: Regen.
>
> I suggest running shellcheck on the file an fixing what it complains about.

i had run shellcheck and the only warnings (about unquoted expansion)
i didn't think we worth fixing because of the limited scope of the
script. the variable in question isn't accepting user input, it's
operating on fixed inputs, and if we restrict ourselves to POSIX
shell (which i think we do), then our options are limited, and imo
the alternatives make it harder to read/understand.

i debated writing this in python3, but that seems even less uncommon
in the tree as a build tool.
-mike