[Toybox] [PATCH] awk -- more patches

Ray Gardner raygard at gmail.com
Wed Oct 23 19:01:59 PDT 2024


On Wed, Oct 23, 2024 at 11:24 AM Rob Landley <rob at landley.net> wrote:

> On 10/18/24 18:09, Ray Gardner wrote:

> > I hope these can be applied
> > before the next toybox release.

> I applied the first 5 of this list, 6 is the compiler being stupid and
> I'd prefer to find a --fshut-up flag to make it stop. (I do
> "string"+offset in many places, and don't intend to stop. Dereference
> and then take the address of to humor compiler warnings is just silly.)

Agree, but see below.

> 7 starts with a comment change that seemed at first glance like part of
> 6, thought I'd ask.

The comment was in the wrong place to begin with (artifact of code
change long ago). Better left out. Probably lots of places I should
add comments though.

...

> Anyway, I'm not seeing that warning on android-ndk-r26d's llvm, do I
> need a newer one...? (I can apply just the parentheses removal but I
> didn't want to edit hunks out of your patch without asking.)

I know you don't like warnings about code that's not wrong to begin
with (agreed). It's your project and if you want to not keep in sync
with what I've done, I think I'll have to see what you do with my
patches and then maybe get my code in sync with yours.

ICYMI, FYI, and TL;DR: You may have noticed that toybox awk is
derivative of a standalone version. The standalone is originally in
several source files in a somewhat modular division and there's an awk
script that (with the Makefile) combines and converts the multi-file
version into a single "monolithic" file.

(BTW that monolithic file is in Marc Paquette's "Bestiary of
Single-File Implementations of Programming Languages"
(https://github.com/marcpaq/b1fipl), and you may be interested in
seeing his "Ancestry of Unix shells"
(https://github.com/marcpaq/shellancestry).

Another script converts the monolithic version into the toybox
version, mainly by dropping code in #ifndef TOYBOX...#endif sections.
I try to keep it clean for you.

But others have seen the standalone code. Gawk maintainer Arnold
Robbins noticed it, and mentioned it to Nelson H.F. Beebe (U. of
Utah math prof), who wrote me "I tried builds on a few systems at
first, and reported my findings to Arnold. The result were positive,
so I spent several more hours doing builds on a variety of Unix-family
operating systems, covering all of the major CPU families used on
desktops since the early 1990s."

Beebe is "probably one of the biggest users of awk in the world,
having written hundreds of thousands of lines of code in that
language." He did the first port of awk to PDP-10 in 1987.

He asked me to "fix" the clang warnings. I had not tried clang but
I got it so I could test it out on the standalone versions.

I can work on patching up my "source code build" so that the
standalone monolithic and toybox versions are separated. I'd
rather keep them in sync for now.

Higher priority for me for now is improving the random number
generator for both (they're separate now b/c I didn't want toybox to
have the extra code of the one I've got in the standalone, since
you're already using random() for other stuff), squashing bugs,
improving portability of the standalone, improving performance (I have
a guy asking if I can make it as fast as mawk -- as if). And doing
more of Prof. Beebe's suggestions.

Also, I'd like to explore making it smaller. I have an idea that's
(baked<<½) and may not go anywhere. But before getting into that, I'd
like to get awk on the track toward the posix folder and being built
default in toybox. What needs to happen? What can I do to help that?

> Rob

Ray


More information about the Toybox mailing list