zsh-workers
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* Re: More rabbit-holes with unset variables
  @ 2020-11-27 22:10  0%                       ` Felipe Contreras
    0 siblings, 1 reply; 200+ results
From: Felipe Contreras @ 2020-11-27 22:10 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: Zsh hackers list

On Fri, Nov 27, 2020 at 2:54 PM Bart Schaefer <schaefer@brasslantern.com> wrote:
>
> On Thu, Nov 26, 2020 at 5:30 PM Felipe Contreras
> <felipe.contreras@gmail.com> wrote:
> >
> > What zsh refers to as "scalar" internally is a string:
> >
> >   char *str; /* value if declared string  (PM_SCALAR)  */
> >
> > From Src/zsh.h (struct param).
>
> This is exactly the discussion I was trying to avoid when I said "in
> the abstract that doesn't matter".
>
> You can't just pull one field out of a union inside a struct and
> ignore the struct itself and the API for field access that goes with
> it.

I am not. I have been looking at the code and fixing some inconsistencies.

From what I can see PM_SCALAR is considered a string, and the thing
I'm putting more emphasis on is the comment: "value if declared
string".

> > So if you didn't mean string, what did you mean?
>
> I meant a struct param, containing the least specific thing so
> represented, as interpreted through all the layers of code that
> implement a dereference of its value when you write $var or any of its
> variations.  Again this doesn't actually matter, which is why I didn't
> spell it out.

The least specific thing--which happens when you do "static struct
param p"--sets the type to PM_SCALAR (0), which from what I can see
for all intents and purposes is a string.

> > And what did you mean by 'so a the only useful "declared but not set"
> > variable is a simple scalar'?
>
> As the very first message in this thread demonstrated, in both bash
> and ksh (call this "example one", and to be pedantic assume that X is
> not inheriting its name or value from somewhere):
>
> typeset -i X
> echo ${X-nil}
> X="garbage"
> echo ${X-nil}
>
> will output
>
> nil
> 0
>
> However (call this "example two"):
>
> typeset -i X
> unset X
> X="garbage"
> echo ${X-nil}
>
> outputs
>
> garbage
>
> The language you quoted from the posix proposal says "otherwise, the
> variable is initially unset".  Given that proposed language, example
> one is incorrect, because an "unset" variable should not retain its
> (in this example) integer properties when assigned a string.

I agree. I would say "imprecise" rather than "incorrect", since if all
these threads taught us anything is that it's not so clear to define
what we mean by "unset", "nil value", or "no value".

> > What simple scalar other than a string is useful "declared but not set"?
>
> Under this interpretation, there isn't any.  That's what I said.  In
> fact the last paragraph of the very first message in this thread:
>
> "Therefore, this isn't as simple as having zsh create an unset
> variable when typeset is given no assignment, because subsequent
> assignment has to preserve the type of the variable, which normally
> does not apply after unset."

So we can interpret what you said as 'so the only useful "declared but
not set" variable is a string' without losing any meaning.

Cheers.

-- 
Felipe Contreras



^ permalink raw reply	[relevance 0%]

* Re: Bug with unset variables
  @ 2020-11-28 12:05  4%                               ` Felipe Contreras
  0 siblings, 0 replies; 200+ results
From: Felipe Contreras @ 2020-11-28 12:05 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: Daniel Shahaf, Zsh hackers list

On Fri, Nov 27, 2020 at 6:25 PM Bart Schaefer <schaefer@brasslantern.com> wrote:

> On Fri, Nov 27, 2020 at 3:38 PM Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
> >
> > The best way to move forward would be to write a patch against the Test/
> > directory that specifies the proposed behaviour.  Use the "f" flag so
> > all newly-added tests will run, rather than just the first.
>
> There are existing tests that specifically check for the current
> behavior, so it's not as if this were simply overlooked.
>
> To write the proposed new test cases, we need to decide (this list may
> not be all-inclusive):

Yeah, I agree it's not as straightforward as it initially seemed.

I can write a test case for what I think should be the desired
behavior in the typical case: "typeset var" does *not* set var to an
empty string.

But that ignores most of the discussion that has already happened
here, and it seems in the Austin CSRG.

I bet it's possible to write the code that passes the above test-case,
but ten years from now--and if not, it will be twenty years from
now--somebody will try to add "local" to POSIX again, and zsh will
still be an inconsistent state.

Personally, I would rather attempt to do it right today, than add a
hack that sort of does what I initially wanted.

Maybe we are wasting time chasing multiple tails, but maybe we are
onto something.

Considering that POSIX hasn't managed to crack the problem after
essentially half a century, maybe a couple of mails in this mailing
list couldn't hurt.

When the solution requires creativity, you just can't know where it
could come from.

Cheers.

-- 
Felipe Contreras



^ permalink raw reply	[relevance 4%]

* Re: More typeset bugs: POSIX_BUILTINS
       [not found]     <CAH+w=7aYGZgF25Hypw=s31u5hfTT-Y+6pKzrCuD-1kB=1pShOg@mail.gmail.com>
@ 2020-11-29 20:12  5% ` Stephane Chazelas
  2020-11-29 20:18  0%   ` Bart Schaefer
  0 siblings, 1 reply; 200+ results
From: Stephane Chazelas @ 2020-11-29 20:12 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: Zsh hackers list

2020-11-29 10:19:44 -0800, Bart Schaefer:
> In printparamnode is this comment:
> 
>       * Special POSIX rules: show the parameter as readonly/exported
>       * even though it's unset, but with no value.
[...]
> % readonly -p OUTER
[...]
> % export -p INNER
[...]

FWIW, though I'd agree it's a bug, it's not a POSIX
non-compliance as the behaviour for "readonly/export -p var" is
unspecified by POSIX, POSIX only specifies "readonly/export -p"
without arguments.

AFAICT, zsh and yash are the only shells that output the
definition of HOME in export -p HOME.

-- 
Stephane


^ permalink raw reply	[relevance 5%]

* Re: More typeset bugs: POSIX_BUILTINS
  2020-11-29 20:12  5% ` More typeset bugs: POSIX_BUILTINS Stephane Chazelas
@ 2020-11-29 20:18  0%   ` Bart Schaefer
  2020-11-30 17:14  4%     ` Stephane Chazelas
  0 siblings, 1 reply; 200+ results
From: Bart Schaefer @ 2020-11-29 20:18 UTC (permalink / raw)
  To: Zsh hackers list

On Sun, Nov 29, 2020 at 12:12 PM Stephane Chazelas
<stephane@chazelas.org> wrote:
>
> FWIW, though I'd agree it's a bug, it's not a POSIX
> non-compliance as the behaviour for "readonly/export -p var" is
> unspecified by POSIX, POSIX only specifies "readonly/export -p"
> without arguments.

Both bash and ksh ignore -p for readonly/export when there are any
non-option arguments, and therefore create/assign the named variables.

So this is at least a ksh emulation incompatibility.


^ permalink raw reply	[relevance 0%]

* Re: More typeset bugs: POSIX_BUILTINS
  2020-11-29 20:18  0%   ` Bart Schaefer
@ 2020-11-30 17:14  4%     ` Stephane Chazelas
  0 siblings, 0 replies; 200+ results
From: Stephane Chazelas @ 2020-11-30 17:14 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: Zsh hackers list

2020-11-29 12:18:29 -0800, Bart Schaefer:
> On Sun, Nov 29, 2020 at 12:12 PM Stephane Chazelas
> <stephane@chazelas.org> wrote:
> >
> > FWIW, though I'd agree it's a bug, it's not a POSIX
> > non-compliance as the behaviour for "readonly/export -p var" is
> > unspecified by POSIX, POSIX only specifies "readonly/export -p"
> > without arguments.
> 
> Both bash and ksh ignore -p for readonly/export when there are any
> non-option arguments, and therefore create/assign the named variables.
> 
> So this is at least a ksh emulation incompatibility.

Yes, I had assumed "-p" was for "print", but it looks like it's
more for "POSIX" / "portable" (though neither bash nor zsh give
portable output upon "export -p" when not in posix mode)

With that in mind, it makes more sense now that 
export -p foo
could be expected to do anything else than print the definition
of foo.

Still, I can't see why anyone would write that as the "-p" has
no effect if the intention is to export foo.

While yash and zsh agree on "export -p HOME" printing the
definition of HOME, "export -p HOME=bar" sets HOME to bar
in yash and ignores -p, while in zsh, it prints the current
value of HOME and ignores =bar.

-- 
Stephane


^ permalink raw reply	[relevance 4%]

* Re: The emulation rabbit-hole RE typeset/unset
  @ 2020-12-01  8:49  3%                                   ` Felipe Contreras
  0 siblings, 0 replies; 200+ results
From: Felipe Contreras @ 2020-12-01  8:49 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: Zsh hackers list

On Sat, Nov 28, 2020 at 10:56 AM Bart Schaefer
<schaefer@brasslantern.com> wrote:
>
> On Sat, Nov 28, 2020 at 3:36 AM Felipe Contreras
> <felipe.contreras@gmail.com> wrote:
> >
> > An integer is not a "simple scalar", and seems to be useful unset.
> >
> > Or am I missing something?
>
> Two things.  Possibly three.
>
> One, 'the only useful "declared but not set" variable is a simple
> scalar' was a statement on the ambiguity of the austin-group proposal
> that you excerpted, which explicitly made "declared but not set"
> equivalent to "unset".

Yes, but this is a statement of fact. It either is true or it isn't.
And to me it looks like it isn't.

> Two, that neither bash nor ksh actually does make those two things
> equivalent.  Variables in bash and ksh can either have both properties
> and values, or only properties, or neither.  Variables in zsh
> currently have only the two states of both or neither, because the
> latter is the definition of being unset.
>
> This is what we've been saying all along -- zsh currently has no
> provision for representing "only properties", and consequently the
> only way to get any of the behavior of the properties settable by
> typeset options is to provide a default value.  The only thing zsh can
> currently represent independent of some value is function scope.

I'm not talking about what is currently the case in zsh. I'm talking
about what should ideally be the case. For bash, for ksh, for POSIX,
and consequently for zsh.

> Three, maybe, is that math expression context has a special definition
> of the meaning of an undeclared name, which is not the same as the
> definition in the rest of the shell.  It's not a parameter expansion
> in the normal sense.

No, but it's still useful.

Cheers.

-- 
Felipe Contreras


^ permalink raw reply	[relevance 3%]

* Re: [PATCH] First try of null typeset
  @ 2020-12-03  9:18  3%       ` Felipe Contreras
  0 siblings, 0 replies; 200+ results
From: Felipe Contreras @ 2020-12-03  9:18 UTC (permalink / raw)
  To: Roman Perepelitsa; +Cc: Bart Schaefer, zsh-workers

On Thu, Dec 3, 2020 at 2:44 AM Roman Perepelitsa
<roman.perepelitsa@gmail.com> wrote:
>
> On Wed, Dec 2, 2020 at 10:59 PM Felipe Contreras
> <felipe.contreras@gmail.com> wrote:
> >
> > On Wed, Dec 2, 2020 at 12:48 PM Bart Schaefer <schaefer@brasslantern.com> wrote:
> > >
> > > Applying the change to integers and floats is one of the reasons I
> > > went in the direction I did.
> >
> > Yes, I suspect that's the way it will eventually have to be done, but
> > others argued "typeset -i var" should initialize it to 0. So for those
> > my patch already does what is needed.
>
> I've two opinions here.
>
> The first is that it's not a good idea to introduce a mode in which
> `typeset var` declares an unset variable but `typeset -i var` doesn't.
> The motivation for changing the behavior of `typeset var` is to be
> more compatible with other shells. However, there is no shell where
> `typeset [flag]... var` leaves or doesn't leave the variable unset
> depending on flags.

That's *one* motivation, it's not the only motivation.

Another motivation is to do the right thing, which POSIX after decades
of discussion hasn't managed to agree on what is the right thing.

If zsh somehow managed to find the right thing, and the right thing is
for "typeset -i var" to set a value while "typeset var" doesn't, then
that would solve a lot of future problems.

Alas, I don't think that's the right thing.

> My second opinion on this matter is that it's not a good idea to
> change the behavior of `typeset -i var` in native mode with default
> options. The benefits (if any) of this change would be too small to
> justify braking user code.

Agreed, at least not now (maybe the next major version).

But it can be changed in some mode(s).

-- 
Felipe Contreras


^ permalink raw reply	[relevance 3%]

* Re: One possible answer to typeset vs. unset
  @ 2020-12-04 11:04  3%     ` Felipe Contreras
  2020-12-05  0:51  3%       ` Bart Schaefer
  0 siblings, 1 reply; 200+ results
From: Felipe Contreras @ 2020-12-04 11:04 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: Zsh hackers list

On Thu, Dec 3, 2020 at 3:19 PM Bart Schaefer <schaefer@brasslantern.com> wrote:
>
> On Tue, Dec 1, 2020 at 12:55 AM Felipe Contreras
> <felipe.contreras@gmail.com> wrote:
> >
> > I don't know what would be the proper solution for tied variables, but
> > I used this hack to make the tests pass:
>
> I looked at this for a while yesterday evening.  My conclusion is that
> tied variables are already a bit of a hack.

Indeed. It might not be worthwhile to look at them at this point.

> Consequently I don't know if your patch would cause a different test
> for unset-ness (that hasn't been written yet) to fail, but something
> like that patch may be unavoidable.

I can't parse that. What would such unset-ness test do?

Anyway. I don't see the two approaches particularly different. If
nobody can argue that "typeset var" and "typeset -i var" should behave
differently (one with no value and the other with value), then some
kind of flag like PM_DECLARED would be needed. I'll add that to my
approach.

Next, I think all the instances in which PM_UNSET is checked should be
verified, to see if PM_DECLAREDNULL makes sense in those. I'll do
that.

Next, we need a way to make sure $empty[(i|I)] returns something
sensible (that would be for both approaches).

And I think that's it. All that's left is deciding what flag would
turn this mode on.

Lastly, I don't know if there is any low-hanging fruit, for example;
doing the same as bash 5.0 with localvar_inherit and localvar_unset.
In my opinion localvar_inherit should also be the default (and
presumably that's what POSIX will eventually decide). I don't quite
get localvar_unset, but seems to also be a sensible default. Or maybe
that's an entirely new topic.

Cheers.

-- 
Felipe Contreras


^ permalink raw reply	[relevance 3%]

* Re: One possible answer to typeset vs. unset
  2020-12-04 11:04  3%     ` Felipe Contreras
@ 2020-12-05  0:51  3%       ` Bart Schaefer
  2020-12-23 23:00  0%         ` Felipe Contreras
  0 siblings, 1 reply; 200+ results
From: Bart Schaefer @ 2020-12-05  0:51 UTC (permalink / raw)
  To: Felipe Contreras; +Cc: Zsh hackers list

On Fri, Dec 4, 2020 at 3:04 AM Felipe Contreras
<felipe.contreras@gmail.com> wrote:
>
> Next, I think all the instances in which PM_UNSET is checked should be
> verified, to see if PM_DECLAREDNULL makes sense in those. I'll do
> that.

In cases I've discovered so far, it's actually more likely that one
has to check whether PM_UNSET and PM_DECLARED are boolean different,
rather than whether both are (not) set.

> Next, we need a way to make sure $empty[(i|I)] returns something
> sensible (that would be for both approaches).

That's the last thing on my list, too.

> And I think that's it. All that's left is deciding what flag would
> turn this mode on.

I'm leaning toward POSIXBUILTINS.

> Lastly, I don't know if there is any low-hanging fruit, for example;
> doing the same as bash 5.0 with localvar_inherit and localvar_unset.

I thoroughly dislike localvar_inherit.  I wonder if it's in bash 5.0
just to be able to compare the suggested semantics from that rejected
POSIX proposal we've previously discussed.  I may be biased by long
use of the zsh semantic, but treating global -> local like environ ->
global seems weird, unless there's also a way to "export" a local back
to global.

> I don't quite get localvar_unset, but seems to also be a sensible default.

If I'm reading the bash manual correctly, localvar_unset means that
"unset foo" behaves like "local foo; unset foo".  Thus (Chet will
probably correct me):

fn1() {
  unset foo
}
fn2() {
  local foo=something
  fn1
  echo ${foo-nil} # is nil
}
fn3() {
  local foo=something
  shopt localvar_unset
  fn1
  echo ${foo-nil} # is something
}


^ permalink raw reply	[relevance 3%]

* Re: One possible answer to typeset vs. unset
  2020-12-05  0:51  3%       ` Bart Schaefer
@ 2020-12-23 23:00  0%         ` Felipe Contreras
  0 siblings, 0 replies; 200+ results
From: Felipe Contreras @ 2020-12-23 23:00 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: Zsh hackers list

Hello Bart,

Sorry about the delay, I've been busy with other projects.

I merged my approach and your approach and I'll be sending a patch to
show the resulting differences.

On Fri, Dec 4, 2020 at 6:52 PM Bart Schaefer <schaefer@brasslantern.com> wrote:

> On Fri, Dec 4, 2020 at 3:04 AM Felipe Contreras
> <felipe.contreras@gmail.com> wrote:
> >
> > Next, I think all the instances in which PM_UNSET is checked should be
> > verified, to see if PM_DECLAREDNULL makes sense in those. I'll do
> > that.
>
> In cases I've discovered so far, it's actually more likely that one
> has to check whether PM_UNSET and PM_DECLARED are boolean different,
> rather than whether both are (not) set.

Literally the first instance of PM_USET I checked shows a discrepancy
between my approach and your approach.

  f () {
    local var
    print ${(t)var}
  }
  f

With my approach this prints "scalar-local" (I think correctly). With
your approach it doesn't print anything.

> > And I think that's it. All that's left is deciding what flag would
> > turn this mode on.
>
> I'm leaning toward POSIXBUILTINS.

Would ksh emulation enable this flag?

> > Lastly, I don't know if there is any low-hanging fruit, for example;
> > doing the same as bash 5.0 with localvar_inherit and localvar_unset.
>
> I thoroughly dislike localvar_inherit.  I wonder if it's in bash 5.0
> just to be able to compare the suggested semantics from that rejected
> POSIX proposal we've previously discussed.  I may be biased by long
> use of the zsh semantic, but treating global -> local like environ ->
> global seems weird, unless there's also a way to "export" a local back
> to global.

After considering it further I don't think it makes sense to have this
as default.

No other language does something like that.

> > I don't quite get localvar_unset, but seems to also be a sensible default.
>
> If I'm reading the bash manual correctly, localvar_unset means that
> "unset foo" behaves like "local foo; unset foo".  Thus (Chet will
> probably correct me):

If so I don't think it makes sense to have this as default.

-- 
Felipe Contreras


^ permalink raw reply	[relevance 0%]

* [PATCH] declarednull: felipec's approach
@ 2020-12-23 23:47  4% Felipe Contreras
  2020-12-27 23:04  3% ` Another push on declarednull branch Bart Schaefer
  0 siblings, 1 reply; 200+ results
From: Felipe Contreras @ 2020-12-23 23:47 UTC (permalink / raw)
  To: zsh-workers; +Cc: Bart Schaefer, Felipe Contreras

This patch merges Bart's approach with my approach, and should be
applied on top of the branch declarednull.

The main difference is that PM_DECLAREDNULL does not set PM_UNSET. So in
the two relevant places where PM_UNSET should be checked, PM_DELCAREDNULL
is checked too.

In my branch it's actually called PM_NULL because I think semantically
makes more sense. I just renamed it for this patch to minimize the diff.

A variable is initially declared with PM_NULL (same as PM_DECLAREDNULL),
then, once a value is a assigned, PM_NULL is removed.

That's it. Semantically it makes sense.

What doesn't make sense is to remove PM_DECLAREDNULL, because it's a
combination of PM_UNSET and PM_DECLARED. It makes sense to remove
PM_UNSET, but not to remove PM_DECLARED.

Why would this

  local var
  var=foobar

remove PM_DELCARED?

Additionally it's not clear why unset should clear the PM_DECLAREDNULL
flag. PM_UNSET is going to be immediately set anyway, and PM_DECLARED is
set only when there's no value (essentially PM_NULL), so it's kind of
returning to var='' (assuming there's a value).

I added a test that shows a discrepancy I found (${(t)var}) but there
could be many, may more. I only checked one instance of PM_UNSET.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 Src/builtin.c      |  2 +-
 Src/params.c       | 11 ++++-------
 Src/subst.c        |  2 +-
 Src/zsh.h          |  3 +--
 Test/E03posix.ztst |  8 ++++++++
 5 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/Src/builtin.c b/Src/builtin.c
index 1e950f122..988233504 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -2837,7 +2837,7 @@ bin_typeset(char *name, char **argv, LinkList assigns, Options ops, int func)
 	    unqueue_signals();
 	    return 1;
 	} else if (pm) {
-	    if ((!(pm->node.flags & PM_UNSET) || pm->node.flags & PM_DECLARED)
+	    if (!(pm->node.flags & PM_UNSET)
 		&& (locallevel == pm->level || !(on & PM_LOCAL))) {
 		if (pm->node.flags & PM_TIED) {
 		    if (PM_TYPE(pm->node.flags) != PM_SCALAR) {
diff --git a/Src/params.c b/Src/params.c
index c09a3eccf..8912a7f65 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -2093,8 +2093,7 @@ fetchvalue(Value v, char **pptr, int bracks, int flags)
 	if (sav)
 	    *s = sav;
 	*pptr = s;
-	if (!pm || ((pm->node.flags & PM_UNSET) &&
-		    !(pm->node.flags & PM_DECLARED)))
+	if (!pm || (pm->node.flags & PM_UNSET))
 	    return NULL;
 	if (v)
 	    memset(v, 0, sizeof(*v));
@@ -3625,7 +3624,6 @@ unsetparam_pm(Param pm, int altflag, int exp)
     else
 	altremove = NULL;
 
-    pm->node.flags &= ~PM_DECLARED;	/* like ksh, not like bash */
     if (!(pm->node.flags & PM_UNSET))
 	pm->gsu.s->unsetfn(pm, exp);
     if (pm->env)
@@ -5854,9 +5852,8 @@ printparamnode(HashNode hn, int printflags)
     Param peer = NULL;
 
     if (p->node.flags & PM_UNSET) {
-	if ((printflags & (PRINT_POSIX_READONLY|PRINT_POSIX_EXPORT) &&
-	     p->node.flags & (PM_READONLY|PM_EXPORTED)) ||
-	    (p->node.flags & PM_DECLAREDNULL) == PM_DECLAREDNULL) {
+	if (printflags & (PRINT_POSIX_READONLY|PRINT_POSIX_EXPORT) &&
+	    p->node.flags & (PM_READONLY|PM_EXPORTED)) {
 	    /*
 	     * Special POSIX rules: show the parameter as readonly/exported
 	     * even though it's unset, but with no value.
@@ -5971,7 +5968,7 @@ printparamnode(HashNode hn, int printflags)
 	}
     }
 
-    if ((printflags & PRINT_NAMEONLY) ||
+    if ((printflags & PRINT_NAMEONLY) || p->node.flags & PM_DECLAREDNULL ||
 	((p->node.flags & PM_HIDEVAL) && !(printflags & PRINT_INCLUDEVALUE)))
 	quotedzputs(p->node.nam, stdout);
     else {
diff --git a/Src/subst.c b/Src/subst.c
index 8f5bd355e..89d6abbba 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -2532,7 +2532,7 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags,
 			     (wantt ? -1 :
 			      ((unset(KSHARRAYS) || inbrace) ? 1 : -1)),
 			     scanflags)) ||
-	    (v->pm && (v->pm->node.flags & PM_UNSET)) ||
+	    (v->pm && ((v->pm->node.flags & PM_UNSET) || (v->pm->node.flags & PM_DECLAREDNULL))) ||
 	    (v->flags & VALFLAG_EMPTY))
 	    vunset = 1;
 
diff --git a/Src/zsh.h b/Src/zsh.h
index 6d7f517c6..97d3a142a 100644
--- a/Src/zsh.h
+++ b/Src/zsh.h
@@ -1929,10 +1929,8 @@ struct tieddata {
 				   made read-only by the user               */
 #define PM_READONLY_SPECIAL (PM_SPECIAL|PM_READONLY|PM_RO_BY_DESIGN)
 #define PM_DONTIMPORT	(1<<22)	/* do not import this variable              */
-#define PM_DECLARED	(1<<22) /* explicitly named with typeset            */
 #define PM_RESTRICTED	(1<<23) /* cannot be changed in restricted mode     */
 #define PM_UNSET	(1<<24)	/* has null value                           */
-#define PM_DECLAREDNULL (PM_DECLARED|PM_UNSET)
 #define PM_REMOVABLE	(1<<25)	/* special can be removed from paramtab     */
 #define PM_AUTOLOAD	(1<<26) /* autoloaded from module                   */
 #define PM_NORESTORE	(1<<27)	/* do not restore value of local special    */
@@ -1942,6 +1940,7 @@ struct tieddata {
 				 */
 #define PM_HASHELEM     (1<<28) /* is a hash-element */
 #define PM_NAMEDDIR     (1<<29) /* has a corresponding nameddirtab entry    */
+#define PM_DECLAREDNULL	(1<<30)	/* declared but null                        */
 
 /* The option string corresponds to the first of the variables above */
 #define TYPESET_OPTSTR "aiEFALRZlurtxUhHTkz"
diff --git a/Test/E03posix.ztst b/Test/E03posix.ztst
index 5e6eddeba..b66782eea 100644
--- a/Test/E03posix.ztst
+++ b/Test/E03posix.ztst
@@ -103,3 +103,11 @@
 >arg1 arg2
 >noktarg1
 >0 0
+
+  f () {
+    local var
+    print ${(t)var}
+  }
+  f
+0:(t) returns correct type
+>scalar-local
-- 
2.30.0.rc1



^ permalink raw reply	[relevance 4%]

* Another push on declarednull branch
  2020-12-23 23:47  4% [PATCH] declarednull: felipec's approach Felipe Contreras
@ 2020-12-27 23:04  3% ` Bart Schaefer
  0 siblings, 0 replies; 200+ results
From: Bart Schaefer @ 2020-12-27 23:04 UTC (permalink / raw)
  To: zsh-workers; +Cc: Felipe Contreras

On Wed, Dec 23, 2020 at 3:47 PM Felipe Contreras
<felipe.contreras@gmail.com> wrote:
>
> In my branch it's actually called PM_NULL because I think semantically
> makes more sense.

Note I'm not rejecting your diff, just fixing things I overlooked in my own.

I OR'd PM_UNSET into PM_DECLAREDNULL because I thought there would be
fewer (and/or less confusing) cases where PM_UNSET had to be ignored
than cases where both PM_UNSET and (new flag) had to be treated as
equivalent, but having found all (hopefully) of the former it's
probably a wash.  Maybe you can still generate a simpler patch.

Alternate names for PM_DECLARED would be welcome.  If I could turn
back time, I might use PM_NOTSET, and then PM_NULL ==
(PM_NOTSET|PM_UNSET).  In fact I already like that enough better that
I'd probably redo it that way before submitting a patch for master.

> I added a test that shows a discrepancy I found (${(t)var})

New push to declarednull branch (tip is now 20e4d07b0) fixes this.
Also added the test from Filipe's patch and another test for readonly
declarations.

Note that workers/47704 (POSIX "readonly -p") hasn't been
committed/pushed anywhere yet, and I don't think we discussed whether
that should do something to "typeset" in ksh emulation.

It may be several days before I can look at this again.


^ permalink raw reply	[relevance 3%]

* Re: [PATCH] declarednull: rename DECLARED to NULL
  @ 2021-01-03 18:26  3%     ` Bart Schaefer
  2021-01-04  6:17  0%       ` Daniel Shahaf
  0 siblings, 1 reply; 200+ results
From: Bart Schaefer @ 2021-01-03 18:26 UTC (permalink / raw)
  To: Felipe Contreras; +Cc: zsh-workers

On Sat, Jan 2, 2021 at 6:38 PM Felipe Contreras
<felipe.contreras@gmail.com> wrote:
>
> On Sat, Jan 2, 2021 at 7:18 PM Bart Schaefer <schaefer@brasslantern.com> wrote:
> >
> > if we go all the way back to the original
> > discussion about this, the point was that
> >
> > typeset var
> > print ${var-unset}
> >
> > should output "unset".  Correct?
>
> Yes, but that's only *one* of the considerations. It's still not
> perfectly clear what "typeset -p var" should output.

Hmm, sorry, I thought that was a solved problem.  Except for some
special cases like "readonly var", I thought it was pretty clear that
"typeset -p var" should output a semantically identical command to
that which declared the variable in the first place.  (Assuming
POSIX_BUILTINS, of course.)

> > unset var <- DEFAULT(off), UNSET(on) <- NULL(off)
>
> Nope. The value hasn't changed, it still has the "default" value.

"Default" here does not refer to the value (or at least, not to the
value alone).  A different example might be more obvious; if I do

integer var
unset var

then "var" is no longer an integer.  That is the default that has changed.

> I think this is playing ring-around-the-rosy; you are trying to find a
> word that signifies that no value has been assigned, even if the
> variable is "set"

No, that's not it.  I'm trying to find a word that describes the STATE
of the variable, independent of its value.  It happens that the "spec"
that we're importing from posix-ish shells means that this particular
state is always paired with the state of "unset-ness" but regardless
of your arguments of functional equivalence, neither of these states
is an actual value of NULL.

> So It seems your code and my code agree with the behavior of both A
> and B. The only unknown is what A and B mean.
>
> Agreed?

Yes, although I would not say "unknown".  More like "unnamed".  Also,
your script doesn't observe that "current zsh: B(on)" does not mean
the same thing that "patched zsh: B(on)" means (at least for my patch
and I think for yours).


^ permalink raw reply	[relevance 3%]

* [PATCH v3 0/1] Run pipeline command in subshell in sh mode
@ 2021-01-04  0:22  3% brian m. carlson
  2021-01-04  0:22  2% ` [PATCH v3 1/1] exec: run final pipeline command in a " brian m. carlson
  0 siblings, 1 reply; 200+ results
From: brian m. carlson @ 2021-01-04  0:22 UTC (permalink / raw)
  To: zsh-workers

Most sh implementations[0] run each command in a pipeline in a subshell,
although zsh (and AT&T ksh) do not: instead, they run the final command
in the main shell.  This leads to very different behavior when the final
command is a shell function which modifies variables.

zsh is starting to be used in some cases as /bin/sh, such as on macOS
Catalina.  Consequently, it makes sense to emulate the more common sh
behavior as much as possible when emulating sh, since that's the least
surprising behavior, and the behavior that many programs unwittingly
rely on.  This patch does exactly that.

With this patch, using "zsh --emulate sh" passes the Git testsuite.  I
expect that it will also be fully functional as /bin/sh on Debian,
although I have not tested.

There was some discussion about this change and it was agreed that it
was a good patch, but it needed a note in the incompatibilities section,
so I've added one.  I'm happy to hear about additional changes people
would like to see; I hope that I'll get around to them a little faster
this time.

v2 can be seen in the archives at
https://www.zsh.org/mla/workers/2020/msg00794.html.

I'm not subscribed to the list, so please CC me if you have questions or
comments.

Changes from v2:
* Update commit message to remove text about which there was
  disagreement (what POSIX actually says about this issue).
* Add note in incompatibilities section.

Changes from v1:
* Expanded commit message to make the code easier to reason about.

[0] bash, dash, posh, pdksh, mksh, busybox sh, FreeBSD's /bin/sh (ash),
    and OpenBSD's /bin/sh and ksh implementations.  I believe, but am
    not certain, that the original Bourne sh provided this behavior as
    well.

brian m. carlson (1):
  exec: run final pipeline command in a subshell in sh mode

 README               |  4 ++++
 Src/exec.c           | 10 ++++++----
 Test/B07emulate.ztst | 22 ++++++++++++++++++++++
 3 files changed, 32 insertions(+), 4 deletions(-)



^ permalink raw reply	[relevance 3%]

* [PATCH v3 1/1] exec: run final pipeline command in a subshell in sh mode
  2021-01-04  0:22  3% [PATCH v3 0/1] Run pipeline command in subshell in sh mode brian m. carlson
@ 2021-01-04  0:22  2% ` brian m. carlson
  2021-03-27 19:34  0%   ` Lawrence Velázquez
  0 siblings, 1 reply; 200+ results
From: brian m. carlson @ 2021-01-04  0:22 UTC (permalink / raw)
  To: zsh-workers

zsh typically runs the final command in a pipeline in the main shell
instead of a subshell.  However, POSIX specifies that all commands in a
pipeline run in a subshell, but permits zsh's behavior as an extension.
The default /bin/sh implementations on various Linux distros and the
BSDs always use a subshell for all components of a pipeline.

Since zsh may be used as /bin/sh in some cases (such as macOS Catalina),
it makes sense to have the common sh behavior when emulating sh, so do
that by checking for being the final item of a multi-item pipeline and
creating a subshell in that case.

From the comment above execpline(), we know the following:

  last1 is a flag that this command is the last command in a shell that
  is about to exit, so we can exec instead of forking.  It gets passed
  all the way down to execcmd() which actually makes the decision.  A 0
  is always passed if the command is not the last in the pipeline. […]
  If last1 is zero but the command is at the end of a pipeline, we pass
  2 down to execcmd().

So there are three cases to consider in this code:

• last1 is 0, which means we are not at the end of a pipeline, in which
  case we should not change behavior.
• last1 is 1, which means we are effectively running in a subshell,
  because nothing that happens due to the exec is going to affect the
  actual shell, since it will have been replaced.  So there is nothing
  to do here.
• last1 is 2, which means our command is at the end of the pipeline, so
  in sh mode we should create a subshell by forking.

input is nonzero if the input to this process is a pipe that we've
opened.  At the end of a multi-stage pipeline, it will necessarily be
nonzero.

Note that several of the tests may appear bizarre, since most developers
do not place useless variable assignments directly at the end of a
pipeline.  However, as the function tests demonstrate, there are cases
where assignments may occur when a shell function is used at the end of
a command.  The remaining assignment tests simply test additional cases,
such as the use of local, that would otherwise be untested.
---
 README               |  4 ++++
 Src/exec.c           | 10 ++++++----
 Test/B07emulate.ztst | 22 ++++++++++++++++++++++
 3 files changed, 32 insertions(+), 4 deletions(-)

diff --git a/README b/README
index 9b1b1605f..3877594ae 100644
--- a/README
+++ b/README
@@ -92,6 +92,10 @@ not set the new, fourth field will continue to work under both 5.8 and 5.9.
 (As it happens, adding a comma after "bold" will make both 5.8 and 5.9 do the
 right thing, but this should be viewed as an unsupported hack.)
 
+emulate sh: When zsh emulates sh, the final command in a pipeline is now run in
+a subshell.  This differs from the behavior in the native (zsh) mode, but is
+consistent with most other sh implementations.
+
 Incompatibilities between 5.7.1 and 5.8
 ---------------------------------------
 
diff --git a/Src/exec.c b/Src/exec.c
index ecad923de..0f6f48b23 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -2882,11 +2882,13 @@ execcmd_exec(Estate state, Execcmd_params eparams,
 	    pushnode(args, dupstring("fg"));
     }
 
-    if ((how & Z_ASYNC) || output) {
+    if ((how & Z_ASYNC) || output ||
+	(last1 == 2 && input && EMULATION(EMULATE_SH))) {
 	/*
-	 * If running in the background, or not the last command in a
-	 * pipeline, we don't need any of the rest of this function to
-	 * affect the state in the main shell, so fork immediately.
+	 * If running in the background, not the last command in a
+	 * pipeline, or the last command in a multi-stage pipeline
+	 * in sh mode, we don't need any of the rest of this function
+	 * to affect the state in the main shell, so fork immediately.
 	 *
 	 * In other cases we may need to process the command line
 	 * a bit further before we make the decision.
diff --git a/Test/B07emulate.ztst b/Test/B07emulate.ztst
index 7b1592fa9..45c39b51d 100644
--- a/Test/B07emulate.ztst
+++ b/Test/B07emulate.ztst
@@ -276,3 +276,25 @@ F:Some reserved tokens are handled in alias expansion
 0:--emulate followed by other options
 >yes
 >no
+
+  emulate sh -c '
+  foo () {
+    VAR=foo &&
+    echo $VAR | bar &&
+    echo "$VAR"
+  }
+  bar () {
+    tr f b &&
+    VAR="$(echo bar | tr r z)" &&
+    echo "$VAR"
+  }
+  foo
+  '
+  emulate sh -c 'func() { echo | local def="abc"; echo $def;}; func'
+  emulate sh -c 'abc="def"; echo | abc="ghi"; echo $abc'
+0:emulate sh uses subshell for last pipe entry
+>boo
+>baz
+>foo
+>
+>def


^ permalink raw reply	[relevance 2%]

* Re: [PATCH] declarednull: rename DECLARED to NULL
  2021-01-03 18:26  3%     ` Bart Schaefer
@ 2021-01-04  6:17  0%       ` Daniel Shahaf
    0 siblings, 1 reply; 200+ results
From: Daniel Shahaf @ 2021-01-04  6:17 UTC (permalink / raw)
  To: zsh-workers

Bart Schaefer wrote on Sun, Jan 03, 2021 at 10:26:48 -0800:
> No, that's not it.  I'm trying to find a word that describes the STATE
> of the variable, independent of its value.  It happens that the "spec"
> that we're importing from posix-ish shells means that this particular
> state is always paired with the state of "unset-ness" but regardless
> of your arguments of functional equivalence, neither of these states
> is an actual value of NULL.

Could you summarize the bits that need to be named and the corresponding shell
language incantations/semantics?

Is this anything like using «struct foo **p» in C to denote a single parameter
that has three possible states:
.
    (!p)
    (p && !*p)
    (p && *p)

> > So It seems your code and my code agree with the behavior of both A
> > and B. The only unknown is what A and B mean.
> >
> > Agreed?
> 
> Yes, although I would not say "unknown".  More like "unnamed".  Also,
> your script doesn't observe that "current zsh: B(on)" does not mean
> the same thing that "patched zsh: B(on)" means (at least for my patch
> and I think for yours).
> 


^ permalink raw reply	[relevance 0%]

* Re: [PATCH] Ignore EACCES when doing non-pure globbing
  @ 2021-01-12 23:47  3% ` Lawrence Velázquez
  2021-01-13  0:53  3%   ` Devin Hussey
  0 siblings, 1 reply; 200+ results
From: Lawrence Velázquez @ 2021-01-12 23:47 UTC (permalink / raw)
  To: Devin Hussey; +Cc: zsh-workers

> On Jan 12, 2021, at 5:42 PM, Devin Hussey <husseydevin@gmail.com> wrote:
> 
> Even if we can't access a parent folder, there is still a chance we can
> access a subdirectory.

I might be mistaken (entirely possible!), but this behavior seems
to violate POSIX volume 3 chapter 2 section 2.13.3, which states
in part that

	Specified patterns shall be matched against existing filenames
	and pathnames, as appropriate. Each component that contains a
	pattern character shall require read permission in the directory
	containing that component. Any component, except the last, that
	does not contain a pattern character shall require search permission.

(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_13_03)

vq

^ permalink raw reply	[relevance 3%]

* Re: [PATCH] Ignore EACCES when doing non-pure globbing
  2021-01-12 23:47  3% ` Lawrence Velázquez
@ 2021-01-13  0:53  3%   ` Devin Hussey
  2021-01-13  1:12  0%     ` Devin Hussey
  2021-01-13  1:26  3%     ` Mikael Magnusson
  0 siblings, 2 replies; 200+ results
From: Devin Hussey @ 2021-01-13  0:53 UTC (permalink / raw)
  To: Lawrence Velázquez; +Cc: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 1406 bytes --]

We are already violating POSIX with our globbing:

"If the pattern does not match any existing filenames or pathnames, the
pattern string shall be left unchanged."

Therefore, this:

zsh:1: no matches found: /tmp/inaccessible/a/*

is wrong, it should just print this:

/tmp/inaccessible/a/*

Also, at least with the implementation on my device, the glob() function
works fine as long as the folder has execute permission. (The sample was
wrong, it should be 111, not 000)

On Tue, Jan 12, 2021, 6:47 PM Lawrence Velázquez <vq@larryv.me> wrote:

> > On Jan 12, 2021, at 5:42 PM, Devin Hussey <husseydevin@gmail.com> wrote:
> >
> > Even if we can't access a parent folder, there is still a chance we can
> > access a subdirectory.
>
> I might be mistaken (entirely possible!), but this behavior seems
> to violate POSIX volume 3 chapter 2 section 2.13.3, which states
> in part that
>
>         Specified patterns shall be matched against existing filenames
>         and pathnames, as appropriate. Each component that contains a
>         pattern character shall require read permission in the directory
>         containing that component. Any component, except the last, that
>         does not contain a pattern character shall require search
> permission.
>
> (
> https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_13_03
> )
>
> vq

[-- Attachment #2: Type: text/html, Size: 2425 bytes --]

^ permalink raw reply	[relevance 3%]

* Re: [PATCH] Ignore EACCES when doing non-pure globbing
  2021-01-13  0:53  3%   ` Devin Hussey
@ 2021-01-13  1:12  0%     ` Devin Hussey
  2021-01-13  1:28  5%       ` Bart Schaefer
  2021-01-13  1:26  3%     ` Mikael Magnusson
  1 sibling, 1 reply; 200+ results
From: Devin Hussey @ 2021-01-13  1:12 UTC (permalink / raw)
  To: Lawrence Velázquez; +Cc: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 2011 bytes --]

Actually, scratch that, I can confirm that Android has their permissions
set to 711 on the /data folder. Otherwise we wouldn't be able to cd to
them. And the 1 bit *is* the searchable bit (not the executable bit) for
directories (TIL), so /data is searchable.

So, both the pre-patch and post-patch behaviors are noncompliant. The first
is too strict and this is too lenient (although I prefer more lenient than
strict). Back to the drawing board, I guess.

On Tue, Jan 12, 2021, 7:53 PM Devin Hussey <husseydevin@gmail.com> wrote:

> We are already violating POSIX with our globbing:
>
> "If the pattern does not match any existing filenames or pathnames, the
> pattern string shall be left unchanged."
>
> Therefore, this:
>
> zsh:1: no matches found: /tmp/inaccessible/a/*
>
> is wrong, it should just print this:
>
> /tmp/inaccessible/a/*
>
> Also, at least with the implementation on my device, the glob() function
> works fine as long as the folder has execute permission. (The sample was
> wrong, it should be 111, not 000)
>
> On Tue, Jan 12, 2021, 6:47 PM Lawrence Velázquez <vq@larryv.me> wrote:
>
>> > On Jan 12, 2021, at 5:42 PM, Devin Hussey <husseydevin@gmail.com>
>> wrote:
>> >
>> > Even if we can't access a parent folder, there is still a chance we can
>> > access a subdirectory.
>>
>> I might be mistaken (entirely possible!), but this behavior seems
>> to violate POSIX volume 3 chapter 2 section 2.13.3, which states
>> in part that
>>
>>         Specified patterns shall be matched against existing filenames
>>         and pathnames, as appropriate. Each component that contains a
>>         pattern character shall require read permission in the directory
>>         containing that component. Any component, except the last, that
>>         does not contain a pattern character shall require search
>> permission.
>>
>> (
>> https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_13_03
>> )
>>
>> vq
>
>

[-- Attachment #2: Type: text/html, Size: 3372 bytes --]

^ permalink raw reply	[relevance 0%]

* Re: [PATCH] Ignore EACCES when doing non-pure globbing
  2021-01-13  0:53  3%   ` Devin Hussey
  2021-01-13  1:12  0%     ` Devin Hussey
@ 2021-01-13  1:26  3%     ` Mikael Magnusson
       [not found]           ` <CAEtFKsuDqhu3USSVCcrt-8rkvA_yAkHt=eU+FY6=pNu+gVogMw@mail.gmail.com>
  1 sibling, 1 reply; 200+ results
From: Mikael Magnusson @ 2021-01-13  1:26 UTC (permalink / raw)
  To: Devin Hussey; +Cc: Lawrence Velázquez, zsh-workers

On 1/13/21, Devin Hussey <husseydevin@gmail.com> wrote:
> We are already violating POSIX with our globbing:
>
> "If the pattern does not match any existing filenames or pathnames, the
> pattern string shall be left unchanged."
>
> Therefore, this:
>
> zsh:1: no matches found: /tmp/inaccessible/a/*
>
> is wrong, it should just print this:
>
> /tmp/inaccessible/a/*

If you want the broken POSIX behavior you can say 'setopt nonomatch'.

> Also, at least with the implementation on my device, the glob() function
> works fine as long as the folder has execute permission. (The sample was
> wrong, it should be 111, not 000)

This makes quite a big difference indeed. Have you considered just not
unsetting caseglob?
Also of note (maybe) (without unsetting caseglob obviously) (and
setting extendedglob),
% echo $PWD/(#i)a*
/tmp/inaccessible/a/A /tmp/inaccessible/a/a
% echo (#i)$PWD/a*
zsh: no matches found: (#i)/tmp/inaccessible/a/a*

Eg, as long as you don't ask for case insensitiveness for the
unreadable segments, you're fine.

-- 
Mikael Magnusson


^ permalink raw reply	[relevance 3%]

* Re: [PATCH] Ignore EACCES when doing non-pure globbing
  2021-01-13  1:12  0%     ` Devin Hussey
@ 2021-01-13  1:28  5%       ` Bart Schaefer
  0 siblings, 0 replies; 200+ results
From: Bart Schaefer @ 2021-01-13  1:28 UTC (permalink / raw)
  To: Devin Hussey; +Cc: Lawrence Velázquez, zsh-workers

On Tue, Jan 12, 2021 at 5:12 PM Devin Hussey <husseydevin@gmail.com> wrote:
>
> So, both the pre-patch and post-patch behaviors are noncompliant. The first is too strict and this is too lenient (although I prefer more lenient than strict). Back to the drawing board, I guess.

There are options (shglob, shfileexpansion, no_nomatch, etc.)
controlling whether the globbing behavior does or does not conform to
POSIX.  It's not a problem that "no matches found" is printed when the
shell is not in POSIX mode.  It would be a problem if "too many"
matches were found when the shell IS in POSIX mode.  So it may be that
any patch here has to take one or more of those setopts into account.

That said, the POSIX requirement is only that any "component that
contains a pattern character" must have read permission on the
directory containing it.  A "component" here is what appears between
two "/" (or after the rightmost one).  So I don't think there was a
problem with that requirement.


^ permalink raw reply	[relevance 5%]

* Re: [PATCH] Ignore EACCES when doing non-pure globbing
       [not found]           ` <CAEtFKsuDqhu3USSVCcrt-8rkvA_yAkHt=eU+FY6=pNu+gVogMw@mail.gmail.com>
@ 2021-01-13  2:14  3%         ` Devin Hussey
  2021-01-13  3:01  0%           ` Devin Hussey
  0 siblings, 1 reply; 200+ results
From: Devin Hussey @ 2021-01-13  2:14 UTC (permalink / raw)
  To: Mikael Magnusson; +Cc: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 2010 bytes --]

Actually replied to the mailing list this time...

>Have you considered just not unsetting caseglob?

Brilliant solution.
"Doctor, it hurts when I do this."
"Then don't do that."

As for the compliant version, here is a much more "polite" version which
also avoids the awkward checks if lock != NULL (at the cost of reformatting
O.o).

/* Check for search permissions. If we don't have them, get out. */
if (access(fn, X_OK) != 0) {
    return;
}
/* Check for read permissions. If we have them, try to open the directory.
*/
if (access(fn, R_OK) == 0) {
    DIR *lock = diropen(fn);
    if (lock == NULL)
        return;

    while (...) { ... }
    closedir(lock);
}
if (subdirs) { ... }


% chmod 111 ..
% echo $PWD/*
/tmp/inaccessible/a/a /tmp/inaccessible/a/b /tmp/inaccessible/a/c
% chmod 000 ..
% echo $PWD/*
zsh: no matches found: /tmp/inaccessible/a/*

This matches the POSIX behavior of requiring parent directories to be
searchable, and is a little more respectful to filesystem permissions.

On Tue, Jan 12, 2021, 8:58 PM Devin Hussey <husseydevin@gmail.com> wrote:

> >Have you considered just not unsetting caseglob?
>
> Brilliant solution.
> "Doctor, it hurts when I do this."
> "Then don't do that."
>
> As for the compliant version, here is a much more "polite" version.
>
> This matches the behavior of the POSIX globs: with a non searchable
> directory, it returns no match, but doesn't require read access for parent
> directories.
>
> DIR *lock = NULL;
>
> /* Check for search permissions. If we don't have them, get out. */
> if (access(fn, X_OK) != 0) {
>     return;
> }
> /* Check for read permissions. If we have them, try to open the directory.
> */
> if (access(fn, R_OK) == 0) {
>     lock = diropen(fn);
>     /* Error */
>     if (lock == NULL)
>         return;
> }
> while (lock != NULL &&...
>
> % chmod 111 ..
> % echo $PWD/*
> /tmp/inaccessible/a/a /tmp/inaccessible/a/b /tmp/inaccessible/a/c
> % chmod 000 ..
> % echo $PWD/*
> zsh: no matches found: /tmp/inaccessible/a/*
>

[-- Attachment #2: Type: text/html, Size: 4410 bytes --]

^ permalink raw reply	[relevance 3%]

* Re: [PATCH] Ignore EACCES when doing non-pure globbing
  2021-01-13  2:14  3%         ` Devin Hussey
@ 2021-01-13  3:01  0%           ` Devin Hussey
  0 siblings, 0 replies; 200+ results
From: Devin Hussey @ 2021-01-13  3:01 UTC (permalink / raw)
  To: Mikael Magnusson; +Cc: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 2249 bytes --]

I am abandoning this hack in favor of the next patch.

On Tue, Jan 12, 2021, 9:14 PM Devin Hussey <husseydevin@gmail.com> wrote:

> Actually replied to the mailing list this time...
>
> >Have you considered just not unsetting caseglob?
>
> Brilliant solution.
> "Doctor, it hurts when I do this."
> "Then don't do that."
>
> As for the compliant version, here is a much more "polite" version which
> also avoids the awkward checks if lock != NULL (at the cost of reformatting
> O.o).
>
> /* Check for search permissions. If we don't have them, get out. */
> if (access(fn, X_OK) != 0) {
>     return;
> }
> /* Check for read permissions. If we have them, try to open the directory.
> */
> if (access(fn, R_OK) == 0) {
>     DIR *lock = diropen(fn);
>     if (lock == NULL)
>         return;
>
>     while (...) { ... }
>     closedir(lock);
> }
> if (subdirs) { ... }
>
>
> % chmod 111 ..
> % echo $PWD/*
> /tmp/inaccessible/a/a /tmp/inaccessible/a/b /tmp/inaccessible/a/c
> % chmod 000 ..
> % echo $PWD/*
> zsh: no matches found: /tmp/inaccessible/a/*
>
> This matches the POSIX behavior of requiring parent directories to be
> searchable, and is a little more respectful to filesystem permissions.
>
> On Tue, Jan 12, 2021, 8:58 PM Devin Hussey <husseydevin@gmail.com> wrote:
>
>> >Have you considered just not unsetting caseglob?
>>
>> Brilliant solution.
>> "Doctor, it hurts when I do this."
>> "Then don't do that."
>>
>> As for the compliant version, here is a much more "polite" version.
>>
>> This matches the behavior of the POSIX globs: with a non searchable
>> directory, it returns no match, but doesn't require read access for parent
>> directories.
>>
>> DIR *lock = NULL;
>>
>> /* Check for search permissions. If we don't have them, get out. */
>> if (access(fn, X_OK) != 0) {
>>     return;
>> }
>> /* Check for read permissions. If we have them, try to open the
>> directory. */
>> if (access(fn, R_OK) == 0) {
>>     lock = diropen(fn);
>>     /* Error */
>>     if (lock == NULL)
>>         return;
>> }
>> while (lock != NULL &&...
>>
>> % chmod 111 ..
>> % echo $PWD/*
>> /tmp/inaccessible/a/a /tmp/inaccessible/a/b /tmp/inaccessible/a/c
>> % chmod 000 ..
>> % echo $PWD/*
>> zsh: no matches found: /tmp/inaccessible/a/*
>>
>

[-- Attachment #2: Type: text/html, Size: 4836 bytes --]

^ permalink raw reply	[relevance 0%]

* [PATCH] Allow globbing with unreadable parent directories
@ 2021-01-13  3:04  2% Devin Hussey
  2021-01-13 22:27  3% ` Bart Schaefer
  0 siblings, 1 reply; 200+ results
From: Devin Hussey @ 2021-01-13  3:04 UTC (permalink / raw)
  To: zsh-workers

POSIX specifies that when globbing, parent directories only have to be
searchable, not readable.

Previously, globbing using NO_CASE_GLOB would fail if any of the parent
directories in the path were not readable.

This was a major issue primarily affecting Termux, a Linux environment
for Android.

Termux's $HOME is "/data/data/com.termux/files/home", and the issue is
that "/data" and sometimes even "/" are not readable without system/root
permission.

This made every full path glob with NO_CASE_GLOB fail, breaking many
scripts such as the Prezto prompt.

Now, zsh will correctly glob even if the parent directory is not readable,
while respecting the searchable bit.

See:
 - https://github.com/sorin-ionescu/prezto/issues/1560
 - https://github.com/termux/termux-packages/issues/1894

Signed-off-by: Devin Hussey <husseydevin@gmail.com>
---
 Src/glob.c | 169 ++++++++++++++++++++++++++++-------------------------
 1 file changed, 89 insertions(+), 80 deletions(-)

diff --git a/Src/glob.c b/Src/glob.c
index bee890caf..4f5c2cf8b 100644
--- a/Src/glob.c
+++ b/Src/glob.c
@@ -580,100 +580,109 @@ scanner(Complist q, int shortcircuit)
     } else {
 	/* Do pattern matching on current path section. */
 	char *fn = pathbuf[pathbufcwd] ? unmeta(pathbuf + pathbufcwd) : ".";
-	int dirs = !!q->next;
-	DIR *lock = opendir(fn);
 	char *subdirs = NULL;
 	int subdirlen = 0;

-	if (lock == NULL)
+	/* First check for search permission. */
+	if (access(fn, X_OK) != 0)
 	    return;
-	while ((fn = zreaddir(lock, 1)) && !errflag) {
-	    /* prefix and suffix are zle trickery */
-	    if (!dirs && !colonmod &&
-		((glob_pre && !strpfx(glob_pre, fn))
-		 || (glob_suf && !strsfx(glob_suf, fn))))
-		continue;
-	    errsfound = errssofar;
-	    if (pattry(p, fn)) {
-		/* if this name matches the pattern... */
-		if (pbcwdsav == pathbufcwd &&
-		    strlen(fn) + pathpos - pathbufcwd >= PATH_MAX) {
-		    int err;
-
-		    DPUTS(pathpos == pathbufcwd,
-			  "BUG: filename longer than PATH_MAX");
-		    err = lchdir(unmeta(pathbuf + pathbufcwd), &ds, 0);
-		    if (err == -1)
-			break;
-		    if (err) {
-			zerr("current directory lost during glob");
-			break;
+
+	/* Then, if we have read permission, try to open the directory. */
+	if (access(fn, R_OK) == 0) {
+	    int dirs = !!q->next;
+	    DIR *lock = opendir(fn);
+
+	    if (lock == NULL)
+		return;
+
+	    while ((fn = zreaddir(lock, 1)) && !errflag) {
+		/* prefix and suffix are zle trickery */
+		if (!dirs && !colonmod &&
+		    ((glob_pre && !strpfx(glob_pre, fn))
+		     || (glob_suf && !strsfx(glob_suf, fn))))
+		    continue;
+		errsfound = errssofar;
+		if (pattry(p, fn)) {
+		    /* if this name matches the pattern... */
+		    if (pbcwdsav == pathbufcwd &&
+			strlen(fn) + pathpos - pathbufcwd >= PATH_MAX) {
+			int err;
+
+			DPUTS(pathpos == pathbufcwd,
+			      "BUG: filename longer than PATH_MAX");
+			err = lchdir(unmeta(pathbuf + pathbufcwd), &ds, 0);
+			if (err == -1)
+			    break;
+			if (err) {
+			    zerr("current directory lost during glob");
+			    break;
+			}
+			pathbufcwd = pathpos;
 		    }
-		    pathbufcwd = pathpos;
-		}
-		if (dirs) {
-		    int l;
+		    if (dirs) {
+			int l;

-		    /*
-		     * If not the last component in the path:
-		     *
-		     * If we made an approximation in the new path segment,
-		     * then it is possible we made too many errors.  For
-		     * example, (ab)#(cb)# will match the directory abcb
-		     * with one error if allowed to, even though it can
-		     * match with none.  This will stop later parts of the
-		     * path matching, so we need to check by reducing the
-		     * maximum number of errors and seeing if the directory
-		     * still matches.  Luckily, this is not a terribly
-		     * common case, since complex patterns typically occur
-		     * in the last part of the path which is not affected
-		     * by this problem.
-		     */
-		    if (errsfound > errssofar) {
-			forceerrs = errsfound - 1;
-			while (forceerrs >= errssofar) {
-			    errsfound = errssofar;
-			    if (!pattry(p, fn))
-				break;
+			/*
+			 * If not the last component in the path:
+			 *
+			 * If we made an approximation in the new path segment,
+			 * then it is possible we made too many errors.  For
+			 * example, (ab)#(cb)# will match the directory abcb
+			 * with one error if allowed to, even though it can
+			 * match with none.  This will stop later parts of the
+			 * path matching, so we need to check by reducing the
+			 * maximum number of errors and seeing if the directory
+			 * still matches.  Luckily, this is not a terribly
+			 * common case, since complex patterns typically occur
+			 * in the last part of the path which is not affected
+			 * by this problem.
+			 */
+			if (errsfound > errssofar) {
 			    forceerrs = errsfound - 1;
+			    while (forceerrs >= errssofar) {
+				errsfound = errssofar;
+				if (!pattry(p, fn))
+				    break;
+				forceerrs = errsfound - 1;
+			    }
+			    errsfound = forceerrs + 1;
+			    forceerrs = -1;
 			}
-			errsfound = forceerrs + 1;
-			forceerrs = -1;
-		    }
-		    if (closure) {
-			/* if matching multiple directories */
-			struct stat buf;
-
-			if (statfullpath(fn, &buf, !q->follow)) {
-			    if (errno != ENOENT && errno != EINTR &&
-				errno != ENOTDIR && !errflag) {
-				zwarn("%e: %s", errno, fn);
+			if (closure) {
+			    /* if matching multiple directories */
+			    struct stat buf;
+
+			    if (statfullpath(fn, &buf, !q->follow)) {
+				if (errno != ENOENT && errno != EINTR &&
+				    errno != ENOTDIR && !errflag) {
+				    zwarn("%e: %s", errno, fn);
+				}
+				continue;
 			    }
-			    continue;
+			    if (!S_ISDIR(buf.st_mode))
+				continue;
+			}
+			l = strlen(fn) + 1;
+			subdirs = hrealloc(subdirs, subdirlen, subdirlen + l
+					   + sizeof(int));
+			strcpy(subdirs + subdirlen, fn);
+			subdirlen += l;
+			/* store the count of errors made so far, too */
+			memcpy(subdirs + subdirlen, (char *)&errsfound,
+			       sizeof(int));
+			subdirlen += sizeof(int);
+		    } else {
+			/* if the last filename component, just add it */
+			insert(fn, 1);
+			if (shortcircuit && shortcircuit == matchct) {
+			    closedir(lock);
+			    return;
 			}
-			if (!S_ISDIR(buf.st_mode))
-			    continue;
-		    }
-		    l = strlen(fn) + 1;
-		    subdirs = hrealloc(subdirs, subdirlen, subdirlen + l
-				       + sizeof(int));
-		    strcpy(subdirs + subdirlen, fn);
-		    subdirlen += l;
-		    /* store the count of errors made so far, too */
-		    memcpy(subdirs + subdirlen, (char *)&errsfound,
-			   sizeof(int));
-		    subdirlen += sizeof(int);
-		} else {
-		    /* if the last filename component, just add it */
-		    insert(fn, 1);
-		    if (shortcircuit && shortcircuit == matchct) {
-			closedir(lock);
-			return;
 		    }
 		}
 	    }
+	    closedir(lock);
 	}
-	closedir(lock);
 	if (subdirs) {
 	    int oppos = pathpos;

-- 
2.30.0


^ permalink raw reply	[relevance 2%]

* Re: [PATCH] Allow globbing with unreadable parent directories
  2021-01-13  3:04  2% [PATCH] Allow globbing with unreadable parent directories Devin Hussey
@ 2021-01-13 22:27  3% ` Bart Schaefer
  2021-01-14  0:27  3%   ` Devin Hussey
  0 siblings, 1 reply; 200+ results
From: Bart Schaefer @ 2021-01-13 22:27 UTC (permalink / raw)
  To: Devin Hussey; +Cc: zsh-workers

On Tue, Jan 12, 2021 at 7:04 PM Devin Hussey <husseydevin@gmail.com> wrote:
>
> POSIX specifies that when globbing, parent directories only have to be
> searchable, not readable.
>
> +       /* First check for search permission. */
> +       if (access(fn, X_OK) != 0)
>             return;

I don't think this is correct.  Even if it is strictly correct per
POSIX (which would seem strange to me), it should not be applied in
zsh native mode (see my previous email about setopts).

% mkdir /tmp/adirectory
% touch /tmp/adirectory/somefile
% chmod a-x /tmp/adirectory
% echo /tmp/adirectory/*
/tmp/adirectory/somefile
% echo /tmp/adirectory/*(.)
zsh: no match

Lack of search permission only means that you can't tell what kind of
file "somefile" is (you can't read its inode data, e.g., stat() it),
not that you can't see the name itself.

Compare "ls /tmp/adirectory" and "ls -l /tmp/adirectory" for a related example.

> +       /* Then, if we have read permission, try to open the directory. */
> +       if (access(fn, R_OK) == 0) {
> +           int dirs = !!q->next;
> +           DIR *lock = opendir(fn);

The access call here is redundant; opendir(fn) will fail if there is
not read permission.  Why do you believe the extra test is needed?

I think the rest is just re-indentation.  Did I miss an "else" clause
for the R_OK ?

Can you provide a specific test case that shows the difference in
behavior with and without this patch?  As far as I can tell, the patch
would only cause globbing to fail in more cases, not succeed where it
previously did not.


^ permalink raw reply	[relevance 3%]

* Re: [PATCH] Allow globbing with unreadable parent directories
  2021-01-13 22:27  3% ` Bart Schaefer
@ 2021-01-14  0:27  3%   ` Devin Hussey
    2021-01-14  4:04  0%     ` Bart Schaefer
  0 siblings, 2 replies; 200+ results
From: Devin Hussey @ 2021-01-14  0:27 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 2592 bytes --]

On Wed, Jan 13, 2021, 5:28 PM Bart Schaefer <schaefer@brasslantern.com>
wrote:

> On Tue, Jan 12, 2021 at 7:04 PM Devin Hussey <husseydevin@gmail.com>
> wrote:
> >
> > POSIX specifies that when globbing, parent directories only have to be
> > searchable, not readable.
> >
> > +       /* First check for search permission. */
> > +       if (access(fn, X_OK) != 0)
> >             return;
>
> I don't think this is correct.  Even if it is strictly correct per
> POSIX (which would seem strange to me), it should not be applied in
> zsh native mode (see my previous email about setopts).
>
> % mkdir /tmp/adirectory
> % touch /tmp/adirectory/somefile
> % chmod a-x /tmp/adirectory
> % echo /tmp/adirectory/*
> /tmp/adirectory/somefile
> % echo /tmp/adirectory/*(.)
> zsh: no match
>
> Lack of search permission only means that you can't tell what kind of
> file "somefile" is (you can't read its inode data, e.g., stat() it),
> not that you can't see the name itself.
>

This matches the behavior of the "pure" globber, POSIX, and literally every
other shell.

If we made it accept it unconditionally like my original solution, we would
end up with the *opposite* issue, where CASE_GLOB would fail on files where
NO_CASE_GLOB succeeds.

Case insensitivity should not change the output due to file permissions.

> +       /* Then, if we have read permission, try to open the directory. */
> > +       if (access(fn, R_OK) == 0) {
> > +           int dirs = !!q->next;
> > +           DIR *lock = opendir(fn);
>
> The access call here is redundant; opendir(fn) will fail if there is
> not read permission.  Why do you believe the extra test is needed?


opendir(fn) will also fail if the "folder" is a file.

However, you may be right, if the path is a file, the next access() will
definitely fail, so I could remove that and only return if we can't
access(fn, X_OK).

I think the rest is just re-indentation.  Did I miss an "else" clause
> for the R_OK ?
>

Yes it is just reindentation.

There is no else clause, it goes to the next section of the path if the
current directory is unreadable.


> Can you provide a specific test case that shows the difference in
> behavior with and without this patch?


I think I can throw something together, yes.

As far as I can tell, the patch

would only cause globbing to fail in more cases, not succeed where it
> previously did not.
>

No, that is definitely not the case.

opendir() would fail if either R_OK or X_OK was false, causing unreadable
folders to be a false negative.

This is allowing certain combinations where opendir() would fail.

>

[-- Attachment #2: Type: text/html, Size: 4979 bytes --]

^ permalink raw reply	[relevance 3%]

* Re: [PATCH] Allow globbing with unreadable parent directories
  @ 2021-01-14  2:22  3%       ` Devin Hussey
  2021-01-14  2:24  0%         ` Devin Hussey
  0 siblings, 1 reply; 200+ results
From: Devin Hussey @ 2021-01-14  2:22 UTC (permalink / raw)
  To: Lawrence Velázquez; +Cc: Bart Schaefer, zsh-workers

[-- Attachment #1: Type: text/plain, Size: 2889 bytes --]

On Wed, Jan 13, 2021, 8:33 PM Lawrence Velázquez <vq@larryv.me> wrote:

> > On Jan 13, 2021, at 7:27 PM, Devin Hussey <husseydevin@gmail.com> wrote:
> >
> >> On Wed, Jan 13, 2021, 5:28 PM Bart Schaefer <schaefer@brasslantern.com>
> wrote:
> >>
> >> As far as I can tell, the patch
> >> would only cause globbing to fail in more cases, not succeed where it
> >> previously did not.
> >
> > No, that is definitely not the case.
>
> But your patch *does* cause globbing to fail in cases for which it
> currently doesn't.
>
>         % mkdir -p notsearchable/{dir,DIR}
>         % touch notsearchable/{dir,DIR}/file
>         % chmod 600 notsearchable
>         % zsh -fc 'echo notsearchable/*'
>         notsearchable/DIR notsearchable/dir
>         % ./zsh-patched -fc 'echo notsearchable/*'
>         zsh:1: no matches found: notsearchable/*
>

Huh. Yeah, that is a bug.

I don't yet understand enough of the logic.

> opendir() would fail if either R_OK or X_OK was false, causing unreadable
> folders to be a false negative.
> >
> > This is allowing certain combinations where opendir() would fail.
>
> If I'm understanding your intention correctly, you would like
> "literal" segments (e.g., lacking special characters) of
> case-insensitive glob patterns to match literally if the "parent"
> lacks read permissions. This doesn't seem to work, though. Am I
> missing something?
>

That is correct.

To reiterate the problem:

 - Case-sensitive (and POSIX) globs seemingly only fail if the parent
directory is unsearchable or if the target directory is unreadable, as it
only opens the globbed directory.

 - The case-insensitive ("impure") glob will fail if ANY parent is
unreadable or unsearchable. This is because unlike the normal glob, the
impure glob will try to recursively opendir() from "/".

 - If I ignore EACCES entirely like in my first patch, case-insensitive
globs would succeed if the parent is unsearchable, causing the opposite bug
where case-sensitive globs fail.

 - The current patch does not handle the target directory being readable
but not searchable.

I admit that I know very little about the Zsh source tree, so I have tunnel
vision when it comes to the program logic. It is likely I who is missing
something obvious.

The only reason that I found the cause of this bug was via strace.

        % mkdir -p notreadable/dir
>         % touch notreadable/dir/file
>         % chmod 300 notreadable
>         % zsh -f +o CASE_GLOB -c 'echo notreadable/dir/*'
>         zsh:1: no matches found: notreadable/dir/*
>         % ./zsh-patched -f +o CASE_GLOB -c 'echo notreadable/dir/*'
>         zsh:1: no matches found: notreadable/dir/*


I didn't do anything that would directly affect CASE_GLOB, as CASE_GLOB
uses the "pure" codepath. It is expected that the behavior would not change.

[-- Attachment #2: Type: text/html, Size: 4529 bytes --]

^ permalink raw reply	[relevance 3%]

* Re: [PATCH] Allow globbing with unreadable parent directories
  2021-01-14  2:22  3%       ` Devin Hussey
@ 2021-01-14  2:24  0%         ` Devin Hussey
  0 siblings, 0 replies; 200+ results
From: Devin Hussey @ 2021-01-14  2:24 UTC (permalink / raw)
  To: Lawrence Velázquez; +Cc: Bart Schaefer, zsh-workers

[-- Attachment #1: Type: text/plain, Size: 3172 bytes --]

Nevermind, I'm dumb on that last part, I forgot that the shell option
syntax is backwards.

On Wed, Jan 13, 2021, 9:22 PM Devin Hussey <husseydevin@gmail.com> wrote:

>
> On Wed, Jan 13, 2021, 8:33 PM Lawrence Velázquez <vq@larryv.me> wrote:
>
>> > On Jan 13, 2021, at 7:27 PM, Devin Hussey <husseydevin@gmail.com>
>> wrote:
>> >
>> >> On Wed, Jan 13, 2021, 5:28 PM Bart Schaefer <schaefer@brasslantern.com>
>> wrote:
>> >>
>> >> As far as I can tell, the patch
>> >> would only cause globbing to fail in more cases, not succeed where it
>> >> previously did not.
>> >
>> > No, that is definitely not the case.
>>
>> But your patch *does* cause globbing to fail in cases for which it
>> currently doesn't.
>>
>>         % mkdir -p notsearchable/{dir,DIR}
>>         % touch notsearchable/{dir,DIR}/file
>>         % chmod 600 notsearchable
>>         % zsh -fc 'echo notsearchable/*'
>>         notsearchable/DIR notsearchable/dir
>>         % ./zsh-patched -fc 'echo notsearchable/*'
>>         zsh:1: no matches found: notsearchable/*
>>
>
> Huh. Yeah, that is a bug.
>
> I don't yet understand enough of the logic.
>
> > opendir() would fail if either R_OK or X_OK was false, causing
>> unreadable folders to be a false negative.
>> >
>> > This is allowing certain combinations where opendir() would fail.
>>
>> If I'm understanding your intention correctly, you would like
>> "literal" segments (e.g., lacking special characters) of
>> case-insensitive glob patterns to match literally if the "parent"
>> lacks read permissions. This doesn't seem to work, though. Am I
>> missing something?
>>
>
> That is correct.
>
> To reiterate the problem:
>
>  - Case-sensitive (and POSIX) globs seemingly only fail if the parent
> directory is unsearchable or if the target directory is unreadable, as it
> only opens the globbed directory.
>
>  - The case-insensitive ("impure") glob will fail if ANY parent is
> unreadable or unsearchable. This is because unlike the normal glob, the
> impure glob will try to recursively opendir() from "/".
>
>  - If I ignore EACCES entirely like in my first patch, case-insensitive
> globs would succeed if the parent is unsearchable, causing the opposite bug
> where case-sensitive globs fail.
>
>  - The current patch does not handle the target directory being readable
> but not searchable.
>
> I admit that I know very little about the Zsh source tree, so I have
> tunnel vision when it comes to the program logic. It is likely I who is
> missing something obvious.
>
> The only reason that I found the cause of this bug was via strace.
>
>         % mkdir -p notreadable/dir
>>         % touch notreadable/dir/file
>>         % chmod 300 notreadable
>>         % zsh -f +o CASE_GLOB -c 'echo notreadable/dir/*'
>>         zsh:1: no matches found: notreadable/dir/*
>>         % ./zsh-patched -f +o CASE_GLOB -c 'echo notreadable/dir/*'
>>         zsh:1: no matches found: notreadable/dir/*
>
>
> I didn't do anything that would directly affect CASE_GLOB, as CASE_GLOB
> uses the "pure" codepath. It is expected that the behavior would not change.
>

[-- Attachment #2: Type: text/html, Size: 4996 bytes --]

^ permalink raw reply	[relevance 0%]

* Re: [PATCH] Allow globbing with unreadable parent directories
  2021-01-14  0:27  3%   ` Devin Hussey
  @ 2021-01-14  4:04  0%     ` Bart Schaefer
  1 sibling, 0 replies; 200+ results
From: Bart Schaefer @ 2021-01-14  4:04 UTC (permalink / raw)
  To: Devin Hussey; +Cc: zsh-workers

On Wed, Jan 13, 2021 at 4:28 PM Devin Hussey <husseydevin@gmail.com> wrote:
>
> On Wed, Jan 13, 2021, 5:28 PM Bart Schaefer <schaefer@brasslantern.com> wrote:
>>
>> On Tue, Jan 12, 2021 at 7:04 PM Devin Hussey <husseydevin@gmail.com> wrote:
>> >
>> > POSIX specifies that when globbing, parent directories only have to be
>> > searchable, not readable.
>>
>> Lack of search permission only means that you can't tell what kind of
>> file "somefile" is (you can't read its inode data, e.g., stat() it),
>> not that you can't see the name itself.
>
> This matches the behavior of the "pure" globber, POSIX, and literally every other shell.

I tried the same test cases with "bash" and it behaved like
(unpatched) zsh.  Again, can you show me a counter-example?

> Case insensitivity should not change the output due to file permissions.

If that were a property of the filesystem, as for example on MacOS,
then I agree with you.

It's less clear when the filesystem is case-sensitive.  Why should
(#i)file not be the same as [Ff][Ii][Ll][Ee] ?

> opendir(fn) will also fail if the "folder" is a file.

Sure, but so might access(R_OK) ... and access(X_OK) might succeed on a file.

>> As far as I can tell, the patch
>> would only cause globbing to fail in more cases, not succeed where it
>> previously did not.
>
> No, that is definitely not the case.
>
> opendir() would fail if either R_OK or X_OK was false, causing unreadable folders to be a false negative.

I don't think that's true.  opendir() is fine with only R_OK.  Again,
try "ls" on a directory having mode 444.

What you cannot do is "ls -l parent/child" when parent is not searchable.

The actual problem is that PAT_PURES is never true when NO_CASE_GLOB
is set.  That means scanner() always passes through the branch that
attempts zreaddir()+pattry(), which fails when there is an unreadable
directory.  I'm not immediately sure how to fix that without
introducing a bug/vulnerability where a filename could be constructed
such that it literally matches the internal representation of a glob
pattern.


^ permalink raw reply	[relevance 0%]

* Re: Bug with assignments in some commands
  @ 2021-01-18 17:40  3%   ` Bart Schaefer
  0 siblings, 0 replies; 200+ results
From: Bart Schaefer @ 2021-01-18 17:40 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: Patrick Reader, zsh-workers

To expand on what PWS wrote:

echo "$((x++)), x is $x" | cat
echo "${x::=2}, x is $x" | cat

Those are both obvious subshells, forked to the left.  POSIX actually
says that ALL commands in a pipeline are to be subshells, but allows
exceptions.

cat <<<"$((x++))"
cat <<END
$((x++)), x is $x
END

Those should also be obvious, "cat" is an external command so the
entire thing (including the here-document input) is forked off.

<<<"$((x++)), x is $x"
<<END
$((x++)), x is $x
END

Those are less obvious, but they are equivalent to

$NULLCMD <<<"$((x++)), x is $x"
$NULLCMD <<END
$((x++)), x is $x
END

which are again forked as separate processes.


^ permalink raw reply	[relevance 3%]

* PATCH: Allow more scripts without #!
@ 2021-01-26  6:35  8% Justine Tunney
  2021-02-15 15:45  0% ` Daniel Shahaf
  0 siblings, 1 reply; 200+ results
From: Justine Tunney @ 2021-01-26  6:35 UTC (permalink / raw)
  To: zsh-workers


[-- Attachment #1.1: Type: text/plain, Size: 698 bytes --]

This change updates the binary safety check so that zsh can run shell
scripts with concatenated binary content within the first 128 bytes,
provided a line exists beforehand with a lowercase character or shell
expansion syntax. Note that this only impacts classic implicit shell
scripts which don't have a shebang line.

POSIX rules were updated to loosen binary restrictions and require this
behavior going forward. A similar change was made last year to the FreeBSD
Almquist Shell. It's needed by projects such as the Cosmopolitan C Library,
which creates polyglot executables that run on all operating systems.

I release this change into the public domain. See unlicense / creative
commons cc0.

[-- Attachment #1.2: Type: text/html, Size: 777 bytes --]

[-- Attachment #2: execve.patch --]
[-- Type: application/octet-stream, Size: 3388 bytes --]

commit 94a4bc14bb2e415ec3d10cf716512bd3e0d99f48
Author: Justine Tunney <jtunney@gmail.com>
Date:   Mon Jan 25 21:34:50 2021 -0800

    Allow more scripts without #!
    
    This change modifies the zsh binary safety check surrounding execve() so
    it can run shell scripts having concatenated binary content. We're using
    the same safety check as FreeBSD /bin/sh [1]. POSIX was recently revised
    to require this behavior:
    
        "The input file may be of any type, but the initial portion of the
         file intended to be parsed according to the shell grammar (XREF to
         XSH 2.10.2 Shell Grammar Rules) shall consist of characters and
         shall not contain the NUL character. The shell shall not enforce
         any line length limits."
    
        "Earlier versions of this standard required that input files to the
         shell be text files except that line lengths were unlimited.
         However, that was overly restrictive in relation to the fact that
         shells can parse a script without a trailing newline, and in
         relation to a common practice of concatenating a shell script
         ending with an 'exit' or 'exec $command' with a binary data payload
         to form a single-file self-extracting archive." [2] [3]
    
    One example use case of such scripts, is the Cosmopolitan C Library [4]
    which configuse the GNU Linker to output a polyglot shell+binary format
    that runs on Linux / Mac / Windows / FreeBSD / OpenBSD.
    
    [1] https://github.com/freebsd/freebsd-src/commit/9a1cd363318b7e9e70ef6af27d1675b371c16b1a
    [2] http://austingroupbugs.net/view.php?id=1250
    [3] http://austingroupbugs.net/view.php?id=1226#c4394
    [4] https://justine.lol/cosmopolitan/index.html

diff --git a/Src/exec.c b/Src/exec.c
index ecad923de..2301f85ad 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -547,10 +547,29 @@ zexecve(char *pth, char **argv, char **newenvp)
 			}
 		    }
 		} else if (eno == ENOEXEC) {
-		    for (t0 = 0; t0 != ct; t0++)
-			if (!execvebuf[t0])
-			    break;
-		    if (t0 == ct) {
+                    /* Perform binary safety check on classic shell    *
+                     * scripts (shebang wasn't introduced until UNIX   *
+                     * Seventh Edition). POSIX says we shall allow     *
+                     * execution of scripts with concatenated binary   *
+                     * and suggests checking a line exists before the  *
+                     * first NUL character with a lowercase letter or  *
+                     * expansion. This is consistent with FreeBSD sh.  */
+                    int isbinary, hasletter;
+                    if (!(ptr2 = memchr(execvebuf, '\0', ct))) {
+                        isbinary = 0;
+                    } else {
+                        isbinary = 1;
+                        hasletter = 0;
+                        for (ptr = execvebuf; ptr < ptr2; ptr++) {
+                            if (islower(*ptr) || *ptr == '$' || *ptr == '`')
+                                hasletter = 1;
+                            if (hasletter && *ptr == '\n') {
+                                isbinary = 0;
+                                break;
+                            }
+                        }
+                    }
+		    if (!isbinary) {
 			argv[-1] = "sh";
 			winch_unblock();
 			execve("/bin/sh", argv - 1, newenvp);

^ permalink raw reply	[relevance 8%]

* [PATCH] _awk: support gawk ver. 5
@ 2021-01-28  7:36 16% Jun T
  0 siblings, 0 replies; 200+ results
From: Jun T @ 2021-01-28  7:36 UTC (permalink / raw)
  To: zsh-workers

Just recognize ver.5; no other change.


diff --git a/Completion/Unix/Command/_awk b/Completion/Unix/Command/_awk
index dcb2a6c21..e8f4a2530 100644
--- a/Completion/Unix/Command/_awk
+++ b/Completion/Unix/Command/_awk
@@ -1,6 +1,6 @@
 #compdef awk gawk nawk
 
-# For gawk ver.3 and 4, in addition to POSIX.
+# For gawk ver.3 to 5, in addition to POSIX.
 #
 # gawk's options '-W ...' (such as '-W help') are not supported.
 # gawk3 has some synonyms for long options (e.g., --compat is a synonym
@@ -14,7 +14,7 @@ local variant curcontext="$curcontext" state state_descr line ret=1
 local -A opt_args
 local -a args
 
-_pick_variant -r variant gawk4='GNU Awk 4' gawk3='GNU Awk 3' posix --version
+_pick_variant -r variant gawk4='GNU Awk [45]' gawk3='GNU Awk 3' posix --version
 
 args=(
   {-F+,--field-separator}'[define input field separator by extended regex]:extended regular expression:'



^ permalink raw reply	[relevance 16%]

* Re: [PATCH] Tests for globbing below protected directories
  @ 2021-02-06 12:15  3%               ` Daniel Shahaf
  0 siblings, 0 replies; 200+ results
From: Daniel Shahaf @ 2021-02-06 12:15 UTC (permalink / raw)
  To: zsh-workers

Bart Schaefer wrote on Thu, Feb 04, 2021 at 13:34:47 -0800:
> On Thu, Feb 4, 2021 at 5:10 AM Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
> >
> > someone who learnt glob patterns as a black box might not be
> > familiar with the relevant syscall/permission semantics and thus may be
> > surprised by this behaviour.
> 
> Is there something you suggest we do about it?

No, unless it's technically a POSIX violation or something, in which case we
can take it from there.


^ permalink raw reply	[relevance 3%]

* Re: Rewrite of zsh-newuser-install
  @ 2021-02-09  6:00  3%                     ` Bart Schaefer
  2021-02-09  7:30  0%                       ` dana
  0 siblings, 1 reply; 200+ results
From: Bart Schaefer @ 2021-02-09  6:00 UTC (permalink / raw)
  To: dana; +Cc: Marlon Richert, Zsh hackers list

On Mon, Feb 8, 2021 at 8:51 PM dana <dana@dana.is> wrote:
>
> > zstyle ':completion:*' cache-path "${XDG_CACHE_HOME:-$HOME/.cache}/zcompcache"
> > compinit -d ${XDG_CACHE_HOME:-$HOME/.cache}/zcompdump
>
> I actually don't feel strongly about whether we respect XDGBDS or not.

I feel about it a lot like I feel about POSIX compatibility.  Read
into that as you will.

> * How should we handle systems that don't normally use XDGBDS? Should we just
>   force the issue and use it everywhere? Or should we have platform-specific
>   logic to fall back to ${ZDOTDIR:-$HOME}?

I would recommend ${XDG_CACHE_HOME:-${ZDOTDIR:-$HOME/.cache}} or
similar, now that you mention it.

> * I think the spec says applications should create the directories if they
>   don't exist, right? So shouldn't we `mkdir -pm 0700` them (or the defaults)
>   if necessary?

Thanks for catching that, yes.

> * I like the right-hand prompt and use it myself, but one disadvantage it has
>   is that it makes it annoying to copy and paste from your terminal.

I meant to mention

setopt TRANSIENT_RPROMPT

>   [...] i foresee a possible future where heaps of novice
>   users are including these long irritating strings of white space in their
>   support requests.

That's already a problem for some terminal types, especially when
copy-pasting a completion menu or the like.

> * I do like the idea of encoding the return status in the prompt. I don't feel
>   strongly about whether it's indicated by a colour, a symbol, and/or a
>   number. I'm pretty sure red/green is the most common type of
>   colour-blindness, though, so maybe a colour-only approach is not ideal.

I use reverse-video for this.

> * Whatever we pick for our prompt, should we maybe implement it using the
>   prompt-theme system?

That would make it less "abandonware" as it was previously accused of
being (tho if Debian uses it, it can't be considered completely
abandoned).

> > zstyle ':completion:*:(functions|parameters|users)' ignored-patterns '[[:punct:]]*[[:alnum:]]*'
>
> Not sure about this.

I was a little puzzled by "user names beginning with punctuation" but
let it go at the time.

> > export -T LS_COLORS ls_colors
> > export -T ZLS_COLORS zls_colors=(
>
> Nit-picking, but using export for this initially confused me. You're not
> exporting them (and don't want to). I think you should just use typeset.

Good catch.


^ permalink raw reply	[relevance 3%]

* Re: Rewrite of zsh-newuser-install
  2021-02-09  6:00  3%                     ` Bart Schaefer
@ 2021-02-09  7:30  0%                       ` dana
  0 siblings, 0 replies; 200+ results
From: dana @ 2021-02-09  7:30 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: Marlon Richert, Zsh hackers list

On 9 Feb 2021, at 00:00, Bart Schaefer <schaefer@brasslantern.com> wrote:
> I feel about it a lot like I feel about POSIX compatibility.  Read
> into that as you will.

🤔

On 9 Feb 2021, at 00:00, Bart Schaefer <schaefer@brasslantern.com> wrote:
>> * I think the spec says applications should create the directories if they
>>   don't exist, right? So shouldn't we `mkdir -pm 0700` them (or the defaults)
>>   if necessary?
>
> Thanks for catching that, yes.

Actually i think the standard is referring to creating application
*sub-directories* under the base ones (e.g., $XDG_CACHE_HOME/zsh). I guess
that's the usual way to do it. But yeah, either way we'd probably need to
handle directory creation if we weren't going to just use ${ZDOTDIR:-$HOME}.

On 9 Feb 2021, at 00:00, Bart Schaefer <schaefer@brasslantern.com> wrote:
> setopt TRANSIENT_RPROMPT

I wonder if that makes the proposed RPROMPT more or less useful though. The
thinking behind it seemed like you'd have the time there as an historical
record, and if you made it transient you'd only have the time the last command
finished executing / the current prompt appeared. And if you're in screen/tmux
or a graphical terminal, you probably already have a clock, so....

On 9 Feb 2021, at 00:00, Bart Schaefer <schaefer@brasslantern.com> wrote:
> I was a little puzzled by "user names beginning with punctuation" but
> let it go at the time.

I actually do hide them myself, because macOS has a huge amount of
irrelevant-to-me system users with names like _timed and _hidd. I'm just not
sure if it's a good idea for every user on every platform.

btw: An improvement to the (Z)LS_COLORS stuff would be to source from
dircolors where available. Debian just do `eval "$(dircolors -b)"`, but that
overrides/exports LS_COLORS, and i'm not sure we want to be in the business of
screwing with parameters that don't belong to the shell. (Now that i think of
it, even just doing the LS_COLORS tie command could cause later profile
additions to falsely assume that LS_COLORS was set by the user.) Maybe
something like this (untested):

  typeset -T ZLS_COLORS zls_colors=( 'any defaults here' )
  if (( $+LS_COLORS )) || (( ! $+commands[dircolors] )); then
    typeset -T LS_COLORS ls_colors
    zls_colors+=( $ls_colors )
  else
    zls_colors+=( ${(s<:>):-"$(
      eval "$( dircolors -b )"; print -r - $LS_COLORS
    )"} )
  fi

Not sure if it's worth checking for gdircolors (Homebrew name), but that's a
thought too

dana



^ permalink raw reply	[relevance 0%]

* Re: Block comments ala Ray
  @ 2021-02-12  7:40  3%       ` Stephane Chazelas
  0 siblings, 0 replies; 200+ results
From: Stephane Chazelas @ 2021-02-12  7:40 UTC (permalink / raw)
  To: Roman Perepelitsa; +Cc: Bart Schaefer, Zsh hackers list

2021-02-12 07:41:50 +0100, Roman Perepelitsa:
[...]
> And almost never like this:
> 
>   /*
>   Lorem ipsum
>   dolor sit amet
>   */
> 
> So block comments in my experience are most often used as if they were
> single-line comments.
[...]

Block comments are useful to comment out sections of code, as in

#if I_STILL_NEEDED_THIS

some
now dead
code

#endif /* I_STILL_NEEDED_THIS */

There's a POSIX sh equivalent for that though:

:||:<<'# some comment'

some
now dead
code

# some comment

(with the added benefit that you can just comment the :||: line
if you find that you want that code after all.

-- 
Stephane


^ permalink raw reply	[relevance 3%]

* Re: Block comments ala Ray
    @ 2021-02-12 15:24  3%     ` Matthew Martin
  1 sibling, 0 replies; 200+ results
From: Matthew Martin @ 2021-02-12 15:24 UTC (permalink / raw)
  To: zsh-workers

On Thu, Feb 11, 2021 at 10:17:10PM -0800, Bart Schaefer wrote:
> Do you have inline comments in the shell now?

echo foo `# a comment` bar

Might even be POSIX though I'm not a language lawyer.


^ permalink raw reply	[relevance 3%]

* Re: PATCH: Allow more scripts without #!
  2021-01-26  6:35  8% PATCH: Allow more scripts without #! Justine Tunney
@ 2021-02-15 15:45  0% ` Daniel Shahaf
  0 siblings, 0 replies; 200+ results
From: Daniel Shahaf @ 2021-02-15 15:45 UTC (permalink / raw)
  To: zsh-workers; +Cc: Justine Tunney

Ping.  This patch hasn't been reviewed.

Justine Tunney wrote on Mon, Jan 25, 2021 at 22:35:18 -0800:
> This change updates the binary safety check so that zsh can run shell
> scripts with concatenated binary content within the first 128 bytes,
> provided a line exists beforehand with a lowercase character or shell
> expansion syntax. Note that this only impacts classic implicit shell
> scripts which don't have a shebang line.
> 
> POSIX rules were updated to loosen binary restrictions and require this
> behavior going forward. A similar change was made last year to the FreeBSD
> Almquist Shell. It's needed by projects such as the Cosmopolitan C Library,
> which creates polyglot executables that run on all operating systems.
> 
> I release this change into the public domain. See unlicense / creative
> commons cc0.




^ permalink raw reply	[relevance 0%]

* [PATCH] add 'fc -s'
@ 2021-02-16 18:34  3% Martijn Dekker
  2021-02-17 10:22  0% ` Peter Stephenson
  0 siblings, 1 reply; 200+ results
From: Martijn Dekker @ 2021-02-16 18:34 UTC (permalink / raw)
  To: Zsh hackers list

[-- Attachment #1: Type: text/plain, Size: 587 bytes --]

POSIX specifies 'fc -s' as the option to re-execute the command without 
invoking an editor:
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/fc.html

Zsh doesn't have this option. This was reported by user doedoe18881 on 
Reddit:
https://www.reddit.com/r/zsh/comments/lkj7l9/fc_s_and_posix_compatibility/

It is an exact equivalent of zsh's 'fc -e -', so adding the option is 
trivial and the cost is negligible. Here's a patch.

- Martijn

-- 
||	modernish -- harness the shell
||	https://github.com/modernish/modernish
||
||	KornShell lives!
||	https://github.com/ksh93/ksh

[-- Attachment #2: fc_s.patch --]
[-- Type: text/plain, Size: 2251 bytes --]

diff --git a/Doc/Zsh/builtins.yo b/Doc/Zsh/builtins.yo
index ebb29f632..a7afe42cf 100644
--- a/Doc/Zsh/builtins.yo
+++ b/Doc/Zsh/builtins.yo
@@ -736,7 +736,7 @@ findex(fc)
 cindex(history, editing)
 cindex(editing history)
 redef(SPACES)(0)(tt(ifztexi(NOTRANS(@ @ @ @ @ @ ))ifnztexi(      )))
-xitem(tt(fc) [ tt(-e) var(ename) ] [ tt(-LI) ] [ tt(-m) var(match) ] [ var(old)tt(=)var(new) ... ] [ var(first) [ var(last) ] ])
+xitem(tt(fc) [ tt(-e) var(ename) ] [ tt(-s) ] [ tt(-LI) ] [ tt(-m) var(match) ] [ var(old)tt(=)var(new) ... ] [ var(first) [ var(last) ] ])
 xitem(tt(fc -l )[ tt(-LI) ] [ tt(-nrdfEiD) ] [ tt(-t) var(timefmt) ] [ tt(-m) var(match) ])
 xitem(SPACES()[ var(old)tt(=)var(new) ... ] [ var(first) [ var(last) ] ])
 xitem(tt(fc -p )[ tt(-a) ] [ var(filename) [ var(histsize) [ var(savehistsize) ] ] ])
@@ -783,6 +783,7 @@ the parameter tt(EDITOR) is used; if that is not set a builtin default,
 usually `tt(vi)' is used.  If var(ename) is `tt(-)', no editor is invoked.
 When editing is complete, the edited command is executed.
 
+The flag `tt(-s)' is equivalent to `tt(-e -)'.
 The flag tt(-r) reverses the order of the events and the
 flag tt(-n) suppresses event numbers when listing.
 
diff --git a/Src/builtin.c b/Src/builtin.c
index 35a0fb2db..3093a3056 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -71,7 +71,7 @@ static struct builtin builtins[] =
      * But that's actually not useful, so it's more consistent to
      * cause an error.
      */
-    BUILTIN("fc", 0, bin_fc, 0, -1, BIN_FC, "aAdDe:EfiIlLmnpPrRt:W", NULL),
+    BUILTIN("fc", 0, bin_fc, 0, -1, BIN_FC, "aAdDe:EfiIlLmnpPrRst:W", NULL),
     BUILTIN("fg", 0, bin_fg, 0, -1, BIN_FG, NULL, NULL),
     BUILTIN("float", BINF_PLUSOPTS | BINF_MAGICEQUALS | BINF_PSPECIAL | BINF_ASSIGN, (HandlerFunc)bin_typeset, 0, -1, 0, "E:%F:%HL:%R:%Z:%ghlp:%rtux", "E"),
     BUILTIN("functions", BINF_PLUSOPTS, bin_functions, 0, -1, 0, "ckmMstTuUWx:z", NULL),
@@ -1643,7 +1643,7 @@ bin_fc(char *nam, char **argv, Options ops, int func)
 	    if (!fclist(out, ops, first, last, asgf, pprog, 1)) {
 		char *editor;
 
-		if (func == BIN_R)
+		if (func == BIN_R || OPT_ISSET(ops, 's'))
 		    editor = "-";
 		else if (OPT_HASARG(ops, 'e'))
 		    editor = OPT_ARG(ops, 'e');

^ permalink raw reply	[relevance 3%]

* Re: [PATCH] add 'fc -s'
  2021-02-16 18:34  3% [PATCH] add 'fc -s' Martijn Dekker
@ 2021-02-17 10:22  0% ` Peter Stephenson
  0 siblings, 0 replies; 200+ results
From: Peter Stephenson @ 2021-02-17 10:22 UTC (permalink / raw)
  To: Martijn Dekker, Zsh hackers list

> On 16 February 2021 at 18:34 Martijn Dekker <martijn@inlv.org> wrote:
> POSIX specifies 'fc -s' as the option to re-execute the command without 
> invoking an editor:
> https://pubs.opengroup.org/onlinepubs/9699919799/utilities/fc.html
> 
> Zsh doesn't have this option. This was reported by user doedoe18881 on 
> Reddit:
> https://www.reddit.com/r/zsh/comments/lkj7l9/fc_s_and_posix_compatibility/
> 
> It is an exact equivalent of zsh's 'fc -e -', so adding the option is 
> trivial and the cost is negligible. Here's a patch.

Thanks, it's committed.

pws


^ permalink raw reply	[relevance 0%]

* Re: [PATCH 1/2] Introduce new completion for Linux task capabilities
  @ 2021-02-27 12:03  3%     ` Oliver Kiddle
  2021-03-21 12:54  5%       ` Arseny Maslennikov
  0 siblings, 1 reply; 200+ results
From: Oliver Kiddle @ 2021-02-27 12:03 UTC (permalink / raw)
  To: Arseny Maslennikov; +Cc: zsh-workers

Arseny Maslennikov wrote:
> On Fri, Feb 26, 2021 at 03:50:18PM +0000, Daniel Shahaf wrote:
> > Arseny Maslennikov wrote on Fri, Feb 26, 2021 at 10:55:57 +0300:
> > > The next patch introduces a completion for setpriv(1), which actively

Thanks for the contribution. I've reviewed the second patch that Daniel
left though in general it all looks very good and there isn't much need
to comment.

> > > uses _capability_names. As for _capabilities,

Are these POSIX capabilities? The term capabilities gets wider usage so
I'd be inclined to call the function _posix_capabilities despite that
being longer. As far as I can tell, unless you count Hurd, Linux is the
only implementation of POSIX capabilities so it is fine for this
to be in the Linux directory. That said, I'm not sure I would factor it
out of _setpriv until there's at least two users of it.

> > FWIW, I think it may well be possible to write _setpriv in terms of
> > _capabilities as a black box, using some combination of _sequence,
> > matchspecs, «compadd -P», et al..
>
> Do you mean invoking «_capabilities -O array_name» to pass the -O to
> compadd, and then using the array_name in _setpriv and possible future
> users?
> As far as I understand, in that case _capabilities will have to avoid
> looping over tag labels, i. e. calling _wanted, as it does now.

No. You would call _capabilities with compadd style options to deal with
the prefixes. You have the following:

  matches=( {-,+}"${(@)^caps#cap_}" )

So _capabilities is unsuited to _setpriv because you don't want the
cap_ prefix but do want - and + prefixes. Telling compadd/completion
functions to strip a prefix is somewhat messy, you can get close with
matching control (-M 'B:=cap_') but it continues to prefer the prefix
to be present. So I'd suggest that you chop off the initial "cap_" from
everything _capabilites completes.

Adding prefixes is easier. If some other function needs capabilities
with a cap_ prefix, that can then call it with -p 'cap_',

For the - and +, we can also add these as a prefix but in their case, -P
is more appropriate because the prefix is a separate thing and it may
even be better to strip them with compset and complete them
independently so that we can indicate that they are for removing and
adding capabilities.

> > > +if [[ $OSTYPE != linux* ]]; then
> > > +    _default; return
> > > +fi
> > 
> > Why?  The code doesn't use /proc or /sbin/some-linux-only-tool, and
> > having this guard prevents people on other OSTYPE's from completing «ssh
> > $linuxbox foo --with-capability=<TAB>».
>
> I intended to play nice in case unrelated "capabilities" are present (or
> introduced later) on those OSTYPE's and pulled Oliver's trick from the
> recently posted _unshare. There might be a better way to do it; I'm open
> to discussion.

Not sure I'd bother in this case as - given the lack of setpriv commands
on other operating systems - it is unlikely to be called other than in
a case like the ssh one Daniel mentions. It mattered in the case of
unshare because unshare does exist on other OSes as an unrelated command
to remove NFS exports.

> > Suggest to list these one per line, because:
> I'd personally like them being listed one per line, too. Will do.

I'd certainly avoid exceeding 80 columns unnecessarily but if it ends up
using a lot of vertical space, grouping similar ones or by first letter
is also fine.

Arseny Maslennikov [patch 2/2] wrote:
> +__setpriv_prctl_securebits_set_element() {

I wouldn't bother with the double-underscore prefix. _git did that and
seems to have been copied elsewhere but it doesn't really serve much
purpose. I think with git it was done to make a more obvious distinction
to subcommands than just whether it was _git_… or _git-…

I'd be inclined to just name it _setpriv_prctl_securebits as that is
what it appears to complete.

> +  bits=(noroot noroot_locked
> +        no_setuid_fixup no_setuid_fixup_locked

> +  _wanted minus-plus-securebits expl 'prctl securebits' \
> +    compadd "$@" -a - matches

Minor nitpick but Etc/completion-style-guide states four spaces of
indentation for continuation lines. My own personal taste includes a
particular dislike for the variable indentation that results from lining
things up with the syntactic construct on the previous line as in the
bits=( assignment.

Also, the description should be in the singular ('prctl securebit').
Yes, there may be multiple matches, and we may be in the middle of a
comma-separated list of them but only one is completed at a time

T'd be sufficient to use _description followed by compadd rather than
_wanted. There are aspects of nested tag loops that aren't ideal so
when you can know that completion is already within one tag loop (which
_arguments does), we don't need another one.

> +__setpriv_prctl_securebits_set() {
> +  _sequence __setpriv_prctl_securebits_set_element
> +}

You can call _sequence directly from the _arguments spec. I'd probably
just do that rather than having a separate function. Convention for
separate functions is a plural name, i.e. …_sets

> +__setpriv_caps_all() {
> +  # Nonlocal expl; _description call expected.

Is that necessary? Aren't descriptions passed through with "$@"?

> +__setpriv_cap_set_element() {
> +  # We pass through arguments from _sequence.
> +  local -a Oargv=( "$@" )
> +  _alternative -O Oargv \
> +    'special-actions:drop/obtain all caps:__setpriv_caps_all' \

Wouldn't :(-all +all) do for the action here instead of needing another
separate function.
There probably ought to be a nicer way to add special all/any elements
to a list because it comes up very often.

> +    'minus-plus-caps:capabilities:__setpriv_capability_expressions' \

Again, use singular form for the description.

> +local context state state_descr line
> +typeset -A opt_args

Given that you've not used states, these are superfluous.

> +  '(- : *)*'{-d,--dump}'[display the current privilege state]' \

The exclusion list here breaks the repeatability.
I did once look into making a special case for this in _arguments but it
wasn't trivial.

> +  '--clear-groups[clear supplementary groups]' \
> +  '--groups[set supplementary groups]:groups:_groups' \

How do you specify multiple supplementary groups? If --groups is
repeated, we need * at the beginning of the spec. Otherwise, is
_sequence needed.
Are there any mutual exclusions between it and --clear-groups,
--keep-groups and --init-groups.

> +  '--inh-caps[set inheritable caps]:capability set: __setpriv_cap_set' \
> +  '--ambient-caps[set ambient caps]:capability set: __setpriv_cap_set' \

Where the _arguments descriptions are being thrown out anyway, it may be
better to leave them out entirely and just have a single space.

> +  '--securebits[set "process securebits"]:prctl securebits:__setpriv_prctl_securebits_set' \

Starting with this one is a run of plural descriptions.

Oliver


^ permalink raw reply	[relevance 3%]

* Improvements to the gcc completion script
@ 2021-03-12  4:07  1% Jacob Gelbman
    0 siblings, 1 reply; 200+ results
From: Jacob Gelbman @ 2021-03-12  4:07 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: gcc.txt --]
[-- Type: text/plain, Size: 144993 bytes --]

#compdef gcc g++ cc c++ llvm-gcc llvm-g++ clang clang++ -value-,LDFLAGS,-default- -value-,CFLAGS,-default- -value-,CXXFLAGS,-default- -value-,CPPFLAGS,-default- -P gcc-* -P g++-* -P c++-*

local curcontext="$curcontext" state line ret=1 expl
local -a args args2 warnings arch
typeset -A opt_args

if [[ "$service" = -value-* ]]; then
  compset -q
  words=( fake "$words[@]" )
  (( CURRENT++ ))
  if [[ "$service" = *LDFLAGS ]]; then
    args2=( '-R:runtime path:->rundir' )
  else
    args2=()
  fi
else
  # On some systems (macOS), cc/gcc/g++ are actually clang; treat them accordingly
  [[ $service != clang* ]] &&
  _pick_variant clang=clang unix --version &&
  service=clang-$service

  args2=( '*:input file:_files' )
fi

args=()
case $MACHTYPE in

m68*)
  args=(
    -m68000 -m68020 -m68020-40 -m68030 -m68040 -m68881
    -mbitfield -mc68000 -mc68020 -mfpa -mnobitfield
    -mrtd -mshort -msoft-float
  )
  ;;

vax)
  args=(
    -mg -mgnu -munix
  )
  ;;

c[1234]*)
  args=(
    -mc1 -mc2 -mc32 -mc34 -mc38
    -margcount -mnoargcount
    -mlong32 -mlong64
    -mvolatile-cache -mvolatile-nocache
  )
  ;;

amd290?0)
  args=(
    -m29000 -m29050 -mbw -mnbw -mdw -mndw
    -mlarge -mnormal -msmall
    -mkernel-registers -mno-reuse-arg-regs
    -mno-stack-check -mno-storem-bug
    -mreuse-arg-regs -msoft-float -mstack-check
    -mstorem-bug -muser-registers
  )
  ;;

arm)
  args=(
    -mapcs -m2 -m3 -m6 -mbsd -mxopen -mno-symrename
    "-faapcs-bitfield-load[all volatile bit-field write generates at least one load]"
    "-faapcs-bitfield-width[volatile bit-field width is dictated by the field container type]"
    "-mcmse[allow use of CMSE]"
    "-mexecute-only[disallow generation of data access to code sections]"
    "-mno-movt[disallow use of movt/movw pairs]"
    "-mno-neg-immediates[disallow converting instructions with negative immediates to their negation]"
    "-mnocrc[disallow use of CRC instructions]"
    "-mrestrict-it[disallow generation of deprecated IT blocks for ARMv8]"
    "-mtp=[thread pointer access method]:arg"
    "-munaligned-access[allow memory accesses to be unaligned]"
  )
  ;;

m88k)
  args=(
    -m88000 -m88100 -m88110 -mbig-pic
    -mcheck-zero-division -mhandle-large-shift
    -midentify-revision -mno-check-zero-division
    -mno-ocs-debug-info -mno-ocs-frame-position
    -mno-optimize-arg-area -mno-serialize-volatile
    -mno-underscores -mocs-debug-info
    -mocs-frame-position -moptimize-arg-area
    -mserialize-volatile -msvr3
    -msvr4 -mtrap-large-shift -muse-div-instruction
    -mversion-03.00 -mwarn-passed-structs
    '-mshort-data--:maximum displacement:'
  )
  ;;

rs6000|powerpc*)
  arch=(rios1 rios2 rsc 501 603 604 power powerpc 403 common)
  args=(
    -mpower -mno-power -mpower2 -mno-power2
    -mpowerpc -mno-powerpc
    -mpowerpc-gpopt -mno-powerpc-gpopt
    -mpowerpc-gfxopt -mno-powerpc-gfxopt
    -mnew-mnemonics -mno-new-mnemonics
    -mfull-toc -mminimal-toc -mno-fop-in-toc -mno-sum-in-toc
    -msoft-float -mhard-float -mmultiple -mno-multiple
    -mstring -mno-string -mbit-align -mno-bit-align
    -mstrict-align -mno-strict-align -mrelocatable -mno-relocatable
    -mtoc -mno-toc -mtraceback -mno-traceback
    -mlittle -mlittle-endian -mbig -mbig-endian
    -mcall-aix -mcall-sysv -mprototype
    '-mcpu=:CPU type:->arch'
    "-maltivec[altivec]"
    "-mcmpb[cmpb]"
    "-mcrbits[crbits]"
    "-mcrypto[crypto]"
    "-mdirect-move[direct move]"
    "-mefpu2[efpu2]"
    "-mfloat128[float128]"
    "-mfprnd[fprnd]"
    "-mhtm[htm]"
    "-minvariant-function-descriptors[invariant function descriptors]"
    "-misel[isel]"
    "-mlongcall[longcall]"
    "-mmfocrf[mfocrf]"
    "-mmfcrf[mfcrf]"
    "-mmma[mma]"
    "-mpaired-vector-memops[paired vector memops]"
    "-mpcrel[pcrel]"
    "-mpopcntd[popcntd]"
    "-mpower10-vector[power10 vector]"
    "-mpower8-vector[power8 vector]"
    "-mpower9-vector[power9 vector]"
    "-mrop-protection[rop protection]"
    "-msecure-plt[secure plt]"
    "-mspe[spe]"
    "-mvsx[vsx]"
  )
  ;;

romp)
  args=(
    -mcall-lib-mul -mfp-arg-in-fpregs -mfp-arg-in-gregs
    -mfull-fp-blocks -mhc-struct-return -min-line-mul
    -mminimum-fp-blocks -mnohc-struct-return
  )
  ;;

mips*)
  arch=(r2000 r3000 r4000 r4400 r4600 r6000)
  args=(
    -membedded-pic -mgas -mgp32 -mgp64 -mhalf-pic -mhard-float -mint64 -mips1
    -mips2 -mips3 -mlong64 -mmemcpy -mmips-as -mmips-tfile -mno-abicalls
    -mno-embedded-data -mno-embedded-pic -mno-gpopt -mno-long-calls -mno-memcpy
    -mno-mips-tfile -mno-rnames -mno-stats -mrnames -msoft-float -m4650 -mmad
    -mstats -nocpp
    '-mcpu=:CPU type:->arch'
    "-mabicalls[enable SVR4-style position-independent code]"
    "-mabs=[abs]:arg"
    "-mcheck-zero-division[check zero division]"
    "-mcompact-branches=[compact branches]:arg"
    "-mdouble-float[double float]"
    "-mdsp[dsp]"
    "-mdspr2[dspr2]"
    "-membedded-data[place constants in the .rodata section instead of the .sdata section]"
    "-mextern-sdata[assume that externally defined data is in the small data]"
    "-mfp32[use 32-bit floating point registers]"
    "-mfp64[use 64-bit floating point registers]"
    "-mginv[ginv]"
    "-mgpopt[use GP relative accesses for symbols known to be in a small data section]"
    "-mindirect-jump=[change indirect jump instructions to inhibit speculation]:arg"
    "-mips16[ips16]"
    "-mldc1-sdc1[ldc1 sdc1]"
    "-mlocal-sdata[extend the -G behaviour to object local data]"
    "-mmadd4[enable the generation of 4-operand madd.s, madd.d, etc]"
    "-mmicromips[micromips]"
    "-mmsa[enable MSA ASE]"
    "-mmt[enable MT ASE]"
    "-mnan=[nan]:arg"
    "-mno-mips16[no mips16]"
    "-msingle-float[single float]"
    "-mvirt[virt]"
    "-mxgot[xgot]"
  )
  ;;

i[3456]86|x86_64)
  arch=(
    native i386 i486 i586 pentium pentium-mmx pentiumpro i686 pentium2 pentium3
    pentium3m pentium-m pentium4 pentium4m prescott nocona core2 corei7 corei7-avx
    core-avx-i core-avx2 atom k6 k6-2 k6-3 athlon athlon-tbird athlon-4 athlon-xp
    athlon-mp k8 opteron athlon64 athlon-fx k8-sse3 opteron-sse3 athlon64-sse3
    amdfam10 barcelona bdver1 bdver2 bdver3 btver1 btver2 winchip-c6 winchip2 c3
    c3-2 geode
  )
  args=(
    '-m128bit-long-double[sizeof(long double) is 16]'
    '-m16[generate 16bit i386 code]'
    '-m32[generate 32bit i386 code]'
    '-m3dnowa[support Athlon 3Dnow! built-in functions]'
    '-m3dnow[support 3DNow! built-in functions]'
    '-m64[generate 64bit x86-64 code]'
    '-m80387[use hardware fp]'
    '-m8bit-idiv[expand 32bit/64bit integer divide into 8bit unsigned integer divide with run-time check]'
    '-m96bit-long-double[sizeof(long double) is 12]'
    '-mabi=-[generate code that conforms to the given ABI]:abi:(ms sysv)'
    '-mabm[support code generation of Advanced Bit Manipulation (ABM) instructions]'
    '-maccumulate-outgoing-args[reserve space for outgoing arguments in the function prologue]'
    '-maddress-mode=-[use given address mode]:address mode:(short long)'
    '-madx[support flag-preserving add-carry instructions]'
    '-maes[support AES built-in functions and code generation]'
    '-malign-data=-[use the given data alignment]:type:(compat abi cacheline)'
    '-malign-double[align some doubles on dword boundary]'
    '-malign-functions=-[function starts are aligned to this power of 2]: **2 base for function alignment: '
    '-malign-jumps=-[jump targets are aligned to this power of 2]: **2 base for jump goal alignment: '
    '-malign-loops=-[loop code aligned to this power of 2]: **2 base for loop alignment: '
    '-malign-stringops[align destination of the string operations]'
    "-mamx-bf16[amx bf16]"
    "-mamx-int8[amx int8]"
    "-mamx-tile[amx tile]"
    '-mandroid[generate code for the Android platform]'
    '-march=-[generate instructions for CPU type]:CPU type:->archgeneric'
    '-masm=-[use given assembler dialect]:asm dialect:(att intel)'
    '-mavx256-split-unaligned-load[split 32-byte AVX unaligned load]'
    '-mavx256-split-unaligned-store[split 32-byte AVX unaligned store]'
    '-mavx2[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX and AVX2 built-in functions and code generation]'
    '-mavx5124fmaps[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2, AVX512F and AVX5124FMAPS built- in functions and code generation]'
    '-mavx5124vnniw[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2, AVX512F and AVX5124VNNIW built- in functions and code generation]'
    "-mavx512bf16[avx512bf16]"
    "-mavx512bitalg[avx512bitalg]"
    '-mavx512bw[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512BW built- in functions and code generation]'
    '-mavx512cd[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512CD built- in functions and code generation]'
    '-mavx512dq[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512DQ built- in functions and code generation]'
    '-mavx512er[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512ER built- in functions and code generation]'
    '-mavx512f[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F built-in functions and code generation]'
    '-mavx512ifma[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512IFMA built-in functions and code generation]'
    '-mavx512pf[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512PF built- in functions and code generation]'
    "-mavx512vbmi2[avx512vbmi2]"
    '-mavx512vbmi[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512VBMI built-in functions and code generation]'
    '-mavx512vl[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512VL built- in functions and code generation]'
    "-mavx512vnni[avx512vnni]"
    "-mavx512vp2intersect[avx512vp2intersect]"
    '-mavx512vpopcntdq[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2, AVX512F and AVX512VPOPCNTDQ built-in functions and code generation]'
    '-mavx[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2 and AVX built-in functions and code generation]'
    "-mavxvnni[avxvnni]"
    '-mbionic[use Bionic C library]'
    '-mbmi2[support BMI2 built-in functions and code generation]'
    '-mbmi[support BMI built-in functions and code generation]'
    '-mbranch-cost=-[branches are this expensive (1-5, arbitrary units)]:branch cost (1-5): '
    "-mcldemote[cldemote]"
    '-mcld[generate cld instruction in the function prologue]'
    '-mclflushopt[support CLFLUSHOPT instructions]'
    '-mclwb[support CLWB instruction]'
    '-mclzero[support CLZERO built-in functions and code generation]'
    '-mcmodel=-[use given x86-64 code model]:memory model:(32 small kernel medium large)'
    '-mcpu=-[set CPU type]:CPU type:->arch'
    '-mcrc32[support code generation of crc32 instruction]'
    '-mcx16[support code generation of cmpxchg16b instruction]'
    '-mdispatch-scheduler[do dispatch scheduling if processor is bdver1, bdver2, bdver3, bdver4 or znver1 and Haifa scheduling is selected]'
    "-menqcmd[enqcmd]"
    '-mf16c[support F16C built-in functions and code generation]'
    '-mfancy-math-387[generate sin, cos, sqrt for FPU]'
    '-mfentry[emit profiling counter call at function entry before prologue]'
    '-mfma4[support FMA4 built-in functions and code generation]'
    '-mfma[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX and FMA built-in functions and code generation]'
    '-mforce-drap[always use Dynamic Realigned Argument Pointer (DRAP) to realign stack]'
    '-mfpmath=-[generate floating point mathematics using given instruction set]:FPU type:(387 sse sse,387 both)'
    '-mfp-ret-in-387[return values of functions in FPU registers]'
    '-mfsgsbase[support FSGSBASE built-in functions and code generation]'
    '-mfunction-return=-[convert function return to call and return thunk]:choice:(keep thunk thunk-inline thunk-extern)'
    '-mfxsr[support FXSAVE and FXRSTOR instructions]'
    '-mgeneral-regs-only[generate code which uses only the general registers]'
    "-mgfni[gfni]"
    '-mglibc[use GNU C library]'
    '-mhard-float[use hardware fp]'
    '-mhle[support Hardware Lock Elision prefixes]'
    "-mhreset[hreset]"
    '-miamcu[generate code that conforms to Intel MCU psABI]'
    '-mieee-fp[use IEEE math for fp comparisons]'
    '-mincoming-stack-boundary=-[assume incoming stack aligned to this power of 2]:assumed size of boundary: '
    '-mindirect-branch=-[convert indirect call and jump to call and return thunks]:choice:(keep thunk thunk-inline thunk-extern)'
    '-mindirect-branch-register[force indirect call and jump via register]'
    '-minline-all-stringops[inline all known string operations]'
    '-minline-stringops-dynamically[inline memset/memcpy string operations, but perform inline version only for small blocks]'
    "-minvpcid[invpcid]"
    "-mkl[kl]"
    '-mlarge-data-threshold=-[data greater than given threshold will go into .ldata section in x86-64 medium model]:threshold: '
    '-mlong-double-128[use 128-bit long double]'
    '-mlong-double-64[use 64-bit long double]'
    '-mlong-double-80[use 80-bit long double]'
    '-mlwp[support LWP built-in functions and code generation]'
    '-mlzcnt[support LZCNT built-in function and code generation]'
    {'-mmemset-strategy=-','-mmemcpy-strategy=-'}'[specify memcpy expansion strategy when expected size is known]:strategy:'
    '-mmitigate-rop[attempt to avoid generating instruction sequences containing ret bytes]'
    '-mmmx[support MMX built-in functions]'
    '-mmovbe[support code generation of movbe instruction]'
    "-mmovdir64b[movdir64b]"
    "-mmovdiri[movdiri]"
    '-mmpx[support MPX code generation]'
    '-mms-bitfields[use native (MS) bitfield layout]'
    '-mmusl[use musl C library]'
    '-mmwaitx[support MWAITX and MONITORX built-in functions and code generation]'
    '-mno-default[clear all tune features]'
    '-mnop-mcount[generate mcount/__fentry__ calls as nops. To activate they need to be patched in]'
    '-mno-sse4[do not support SSE4.1 and SSE4.2 built-in functions and code generation]'
    '-momit-leaf-frame-pointer[omit the frame pointer in leaf functions]'
    '-mpc32[set 80387 floating-point precision to 32-bit]'
    '-mpc64[set 80387 floating-point precision to 64-bit]'
    '-mpc80[set 80387 floating-point precision to 80-bit]'
    '-mpclmul[support PCLMUL built-in functions and code generation]'
    "-mpconfig[pconfig]"
    '-mpku[support PKU built-in functions and code generation]'
    '-mpopcnt[support code generation of popcnt instruction]'
    '-mprefer-avx128[use 128-bit AVX instructions instead of 256-bit AVX instructions in the auto-vectorizer]'
    '-mpreferred-stack-boundary=-[attempt to keep stack aligned to this power of 2]:size of boundary: '
    '-mprefetchwt1[support PREFETCHWT1 built-in functions and code generation]'
    '-mprfchw[support PREFETCHW instruction]'
    "-mptwrite[ptwrite]"
    '-mpush-args[use push instructions to save outgoing arguments]'
    '-mrdpid[support RDPID built-in functions and code generation]'
    '-mrdrnd[support RDRND built-in functions and code generation]'
    '-mrdseed[support RDSEED instruction]'
    '-mrecip=-[control generation of reciprocal estimates]::instruction:(all none div divf divd rsqrt rsqrtf rsqrtd)' #TODO comma separated and can have !
    '-mrecip[generate reciprocals instead of divss and sqrtss]'
    '-mrecord-mcount[generate __mcount_loc section with all mcount or __fentry__ calls]'
    '-mred-zone[use red-zone in the x86-64 code]'
    '-mreg-alloc=[control the default allocation order of integer registers]:default register allocation order:'
    '-mregparm=-[number of registers used to pass integer arguments]:number of integer argument registers: '
    "-mretpoline-external-thunk[retpoline external thunk]"
    '-mrtd[alternate calling convention]'
    '-mrtm[support RTM built-in functions and code generation]'
    '-msahf[support code generation of sahf instruction in 64bit x86-64 code]'
    "-mserialize[serialize]"
    '-msgx[support SGX built-in functions and code generation]'
    '-msha[support SHA1 and SHA256 built-in functions and code generation]'
    "-mshstk[shstk]"
    '-mskip-rax-setup[skip setting up RAX register when passing variable arguments]'
    '-msoft-float[do not use hardware fp]'
    '-msse2avx[encode SSE instructions with VEX prefix]'
    '-msse2[support MMX, SSE and SSE2 built-in functions and code generation]'
    '-msse3[support MMX, SSE, SSE2 and SSE3 built-in functions and code generation]'
    '-msse4.1[support MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1 built-in functions and code generation]'
    '-msse4.2[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1 and SSE4.2 built-in functions and code generation]'
    '-msse4a[support MMX, SSE, SSE2, SSE3 and SSE4A built-in functions and code generation]'
    '-msse4[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1 and SSE4.2 built-in functions and code generation]'
    '-msseregparm[use SSE register passing conventions for SF and DF mode]'
    '-msse[support MMX and SSE built-in functions and code generation]'
    '-mssse3[support MMX, SSE, SSE2, SSE3 and SSSE3 built-in functions and code generation]'
    '-mstack-arg-probe[enable stack probing]'
    '-mstack-protector-guard=-[use given stack-protector guard]:guard:(global tls)'
    '-mstackrealign[realign stack in prologue]'
    '-mstringop-strategy=-[chose strategy to generate stringop using]:stringop strategy:(byte_loop libcall loop rep_4byte rep_8byte rep_byte unrolled_loop)'
    '-mstv[disable Scalar to Vector optimization pass transforming 64-bit integer computations into a vector ones]'
    '-mtbm[support TBM built-in functions and code generation]'
    '-mthreads[support thread-safe exception handling on MinGW]'
    '-mtls-dialect=-[use given thread-local storage dialect]:TLS dialect:(gnu gnu2)'
    '-mtls-direct-seg-refs[use direct references against %gs when accessing tls data]'
    "-mtsxldtrk[tsxldtrk]"
    #'-mtune-ctrl=-[fine grain control of tune features]:feature-list:' #for dev use only
    '-mtune=-[tune code for CPU type]:CPU type:->arch'
    '-muclibc[use uClibc C library]'
    "-muintr[uintr]"
    "-mvaes[vaes]"
    '-mveclibabi=-[vector library ABI to use]:vector library ABI:(acml svml)'
    '-mvect8-ret-in-mem[return 8-byte vectors in memory]'
    "-mvpclmulqdq[vpclmulqdq]"
    '-mvzeroupper[generate vzeroupper instruction before a transfer of control flow out of the function]'
    "-mwaitpkg[waitpkg]"
    "-mwbnoinvd[wbnoinvd]"
    "-mwidekl[widekl]"
    '-mx32[generate 32bit x86-64 code]'
    "-mx87[x87]"
    '-mxop[support XOP built-in functions and code generation]'
    '-mxsavec[support XSAVEC instructions]'
    '-mxsaveopt[support XSAVEOPT instruction]'
    '-mxsaves[support XSAVES and XRSTORS instructions]'
    '-mxsave[support XSAVE and XRSTOR instructions]'
  )
  ;;

hppa*)
  args=(
    -mdisable-fpregs -mdisable-indexing -mfast-indirect-calls
    -mgas -mjump-in-delay -mlong-millicode-calls -mno-disable-fpregs
    -mno-disable-indexing -mno-fast-indirect-calls -mno-gas
    -mno-jump-in-delay -mno-millicode-long-calls
    -mno-portable-runtime -mno-soft-float -msoft-float
    -mpa-risc-1-0 -mpa-risc-1-1 -mportable-runtime
    '-mschedule=:code scheduling constraints:(700 7100 7100LC)'
  )
  ;;

i960)
  args=(
    -m{ka,kb,mc,ca,cf,sa,sb}
    -masm-compat -mclean-linkage
    -mcode-align -mcomplex-addr -mleaf-procedures
    -mic-compat -mic2.0-compat -mic3.0-compat
    -mintel-asm -mno-clean-linkage -mno-code-align
    -mno-complex-addr -mno-leaf-procedures
    -mno-old-align -mno-strict-align -mno-tail-call
    -mnumerics -mold-align -msoft-float -mstrict-align
    -mtail-call
  )
  ;;

sparc)
  arch=(
    v7 cypress v8 supersparc sparclite f930 f934 hypersparc sparclite86x sparclet
    tsc701 v9 ultrasparc ultrasparc3
  )
  args=(
    -mapp-regs -mno-app-regs
    -mfpu -mhard-float
    -mno-fpu -msoft-float
    -mhard-quad-float
    -msoft-quad-float
    -mno-unaligned-doubles
    -munaligned-doubles
    -mfaster-structs -mno-faster-structs
    -mimpure-text
    '-mcpu=:CPU type:->arch'
    '-mtune=:CPU type:->arch'
    -mv8plus -mno-v8plus
    -mvis -mno-vis
    -mlittle-endian
    -m32 -m64
    '-mcmodel=:memory model:(medlow medmid medany embmedany)'
    -mstack-bias -mno-stack-bias
    -mv8
    -mcypress -mepilogue -mflat
    -mno-flat
    -mno-epilogue
    -msparclite -msupersparc
    -mmedlow -mmedany
    -mint32 -mint64 -mlong32 -mlong64
  )
  ;;

alpha*)
  args=(
    -mfp-regs -mno-fp-regs -mno-soft-float
    -msoft-float
  )
  ;;

clipper)
  args=(
    -mc300 -mc400
  )
  ;;

h8/300)
  args=(
    -mrelax -mh
  )
  ;;

aarch64)
  args=(
    "-mmark-bti-property[add .note.gnu.property with BTI to assembly files]"
    "-moutline[enable function outlining (AArch64 only)]"
    "-msve-vector-bits=[specify the size in bits of an SVE vector register]:bits"
  )
  ;;

amdgpu)
  args=(
    "-mcumode[specify CU wavefront execution mode]"
    "-mtgsplit[enable threadgroup split execution mode (AMDGPU only)]"
  )
  ;;

hexagon)
  args=(
    "-mieee-rnd-near[ieee rnd near]"
    "-mmemops[enable generation of memop instructions]"
    "-mnvj[enable generation of new-value jumps]"
    "-mnvs[enable generation of new-value stores]"
    "-mpackets[enable generation of instruction packets]"
    "-mhvx[enable Hexagon Vector eXtensions]"
    "-mhvx-length=[set Hexagon Vector Length]:arg"
    "-mhvx=[enable Hexagon Vector eXtensions]:arg"
  )
  ;;

webassembly*)
  args=(
    "-matomics[atomics]"
    "-mbulk-memory[bulk memory]"
    "-mexception-handling[exception handling]"
    "-mmultivalue[multivalue]"
    "-mmutable-globals[mutable globals]"
    "-mnontrapping-fptoint[no ntrapping fptoint]"
    "-mreference-types[reference types]"
    "-msign-ext[sign ext]"
    "-msimd128[simd128]"
    "-mtail-call[tail call]"
    "-munimplemented-simd128[unimplemented simd128]"
    "-mexec-model=[execution model]:arg"
  )
  ;;

riscv)
  args=(
    "-msave-restore[enable using library calls for save and restore]"
  )
  ;;
esac

if [[ "$service" = clang* ]]; then
  args+=(
    "-all_load[undocumented option]"
    "-allowable_client[undocumented option]:argument"
    "--analyzer-no-default-checks[analyzer does no default checks]"
    "--analyzer-output[static analyzer report output format]:format:(html plist plist-multi-file plist-html sarif sarif-html text)"
    "--analyze[run the static analyzer]"
    "-arch[arch]:argument"
    "-arch_errors_fatal[arch errors fatal]"
    "-arch_only[arch only]:argument"
    "-arcmt-migrate-emit-errors[emit ARC errors even if the migrator can fix them]"
    "-arcmt-migrate-report-output[output path for the plist report]:file:_files"
    "-a-[undocumented option]:argument"
    "--autocomplete=[autocomplete]:argument"
    "-bind_at_load[bind at load]"
    "--bootclasspath=[bootclasspath]:arg"
    "-bundle[bundle]"
    "-bundle_loader[bundle loader]:argument"
    "--CLASSPATH=[CLASSPATH]:arg"
    "--classpath=[classpath]:arg"
    "-cl-denorms-are-zero[allow denormals to be flushed to zero]"
    "-cl-fast-relaxed-math[cl fast relaxed math]"
    "-cl-finite-math-only[allow floating-point optimizations]"
    "-cl-fp32-correctly-rounded-divide-sqrt[specify that divide and sqrt are correctly rounded]"
    "-client_name[client name]:argument"
    "-cl-kernel-arg-info[generate kernel argument metadata]"
    "-cl-mad-enable[allow use of less precise MAD computations]"
    "-cl-no-signed-zeros[allow use of no signed zeros computations]"
    "-cl-no-stdinc[disables all standard includes]"
    "-cl-opt-disable[disables all optimizations]"
    "-cl-single-precision-constant[treat double float constant as single precision]"
    "-cl-std=[openCL language standard to compile for]:arg"
    "-cl-strict-aliasing[this option is added for compatibility with OpenCL 1.0]"
    "-cl-uniform-work-group-size[defines that the global work-size be uniform]"
    "-cl-unsafe-math-optimizations[allow unsafe floating-point optimizations]"
    "-compatibility_version[compatibility version]:compatibility version"
    "--config[specifies configuration file]:configuration file:_files"
    "--constant-cfstrings[use constant cfstrings]"
    "--coverage[coverage]"
    "-coverage[coverage]"
    "-cpp[cpp]"
    "--cuda-compile-host-device[compile CUDA code for both host and device]"
    "--cuda-device-only[compile CUDA code for device only]"
    "--cuda-gpu-arch=[cUDA offloading device architecture]:arg"
    "--cuda-host-only[compile CUDA code for host only]"
    "*--cuda-include-ptx=[include ptx for the following gpu architecture]:argument"
    "--cuda-noopt-device-debug[enable device-side debug info generation]"
    "--cuda-path=[cUDA installation path]:arg"
    "--cuda-path-ignore-env[ignore environment variables to detect CUDA installation]"
    "-cuid=[an id for compilation unit]:argument"
    "-current_version[current version]:current version"
    "-cxx-isystem[add directory to the C++ SYSTEM include search path]:directory:_files -/"
    "-dead_strip[dead strip]"
    "-dependency-dot[file to write dot-formatted header dependencies to]:file:_files"
    "-dependency-file[file to write dependency output to]:file:_files"
    "--dyld-prefix=[dyld prefix]:prefix"
    "--dylib_file[dyld file]:file:_files"
    "-dylinker[dylinker]"
    "-dylinker_install_name[dylinker install name]:name"
    "-dynamic[dynamic]"
    "-dynamiclib[dynamic lib]"
    "-EB[big endian]"
    "-EL[little endian]"
    "-emit-ast[emit Clang AST files for source inputs]"
    "-emit-interface-stubs[generate Interface Stub Files]"
    "-emit-llvm[use the LLVM representation for assembler and object files]"
    "-emit-merged-ifs[generate Interface Stub Files, emit merged text not binary]"
    "--emit-static-lib[enable linker job to emit a static library]"
    #"-enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang[trivial automatic variable initialization to zero is only here for benchmarks]"
    "--encoding=[encoding]:arg"
    "-exported_symbols_list[exported symbols list]:argument"
    "--extdirs=[extdirs]:arg"
    "--extra-warnings[enable extra warnings]"
    "-faccess-control[access control]"
    "-F+[add directory to framework search path]:framework directory:_files -/"
    "-faddrsig[emit an address-significance table]"
    "-faggressive-function-elimination[aggressive function elimination]"
    "-falign-commons[align commons]"
    "-faligned-allocation[aligned allocation]"
    "-faligned-new[enable C++17 aligned allocation functions]"
    "-fall-intrinsics[all intrinsics]"
    "-fallow-editor-placeholders[treat editor placeholders as valid source code]"
    "-fallow-unsupported[allow unsupported]"
    "-falternative-parameter-statement[enable the old style PARAMETER statement]"
    "-faltivec[altivec]"
    "-fansi-escape-codes[use ANSI escape codes for diagnostics]"
    "-fapple-kext[use Apple's kernel extensions ABI]"
    "-fapple-link-rtlib[force linking the clang builtins runtime library]"
    "-fapple-pragma-pack[enable Apple GCC-compatible #pragma pack handling]"
    "-fapplication-extension[restrict code to those available for App Extensions]"
    "-fasm-blocks[asm blocks]"
    "-fassume-sane-operator-new[assume sane operator new]"
    "-fast[ast]"
    "-fastcp[astcp]"
    "-fastf[astf]"
    "-fautolink[autolink]"
    "-fautomatic[automatic]"
    "-fauto-profile-accurate[auto profile accurate]"
    "-fauto-profile[auto profile]"
    "-fauto-profile=[enable sample-based profile guided optimizations]:arg"
    "-fbackslash[change the interpretation of backslashes in string literals]"
    "-fbacktrace[backtrace]"
    "-fbasic-block-sections=[generate labels for each basic block]:arg"
    "-fbinutils-version=[produced object files can use all ELF features supported by this version]:major.minor"
    "-fblas-matmul-limit=[blas matmul limit]:arg"
    "-fblocks[enable the blocks language feature]"
    "-fbootclasspath=[bootclasspath]:arg"
    "-fborland-extensions[accept non-standard constructs supported by the Borland compiler]"
    "-fbracket-depth=[bracket depth]:arg"
    "-fbuild-session-file=[use the last modification time of <file> as the build session timestamp]:file:_files"
    "-fbuild-session-timestamp=[time when the current build session started]:time since Epoch in seconds"
    "-fbuiltin-module-map[load the clang builtins module map file.]"
    "-fcaret-diagnostics[caret diagnostics]"
    "-fcaret-diagnostics[show diagnostic messages using a caret]"
    "-fcf-protection[cf protection]"
    "-fcf-protection=[instrument control-flow architecture protection. Options: return, branch, full, none]:arg"
    "-fcf-runtime-abi=[cf runtime abi]:arg"
    "-fchar8_t[enable C++ builtin type char8_t]"
    "-fcheck-array-temporaries[check array temporaries]"
    "-fcheck=[check]:arg"
    "-fclang-abi-compat=[attempt to match the ABI of Clang <version>]:version"
    "-fclasspath=[classpath]:arg"
    "-fcoarray=[coarray]:arg"
    "-fcolor-diagnostics[enable colors in diagnostics]"
    "-fcomment-block-commands=[treat each comma separated argument in <arg> as a documentation comment block command]:arg"
    "-fcompile-resource=[compile resource]:arg"
    "-fcomplete-member-pointers[require member pointer base types to be complete if they would be significant under the Microsoft ABI]"
    "-fconstant-cfstrings[constant cfstrings]"
    "-fconstant-string-class=[constant string class]:arg"
    "-fconstexpr-backtrace-limit=[constexpr backtrace limit]:arg"
    "-fconstexpr-depth=[constexpr depth]:arg"
    "-fconstexpr-steps=[constexpr steps]:arg"
    "-fconvergent-functions[assume functions may be convergent]"
    "-fconvert=[convert]:arg"
    "-fcoroutines-ts[enable support for the C++ Coroutines TS]"
    "-fcoverage-compilation-dir=[the compilation directory to embed in the coverage mapping]:arg"
    "-fcoverage-mapping[generate coverage mapping to enable code coverage analysis]"
    "-fcoverage-prefix-map=[remap file source paths in coverage mapping]:arg"
    "-fcrash-diagnostics-dir=[crash diagnostics dir]:arg"
    "-fcray-pointer[cray pointer]"
    "-fcreate-profile[create profile]"
    "-fcs-profile-generate[generate instrumented code to collect context sensitive execution counts]"
    "-fcs-profile-generate=[generate instrumented code to collect context sensitive execution counts]:directory:_files -/"
    "-fc\+\+-static-destructors[c++ static destructors]"
    "-fcuda-approx-transcendentals[use approximate transcendental functions]"
    "-fcuda-flush-denormals-to-zero[flush denormal floating point values to zero in CUDA device mode]"
    "-fcuda-rdc[cuda rdc]"
    "-fcuda-short-ptr[use 32-bit pointers for accessing const/local/shared address spaces]"
    "-fcxx-exceptions[enable C++ exceptions]"
    "-fcxx-modules[cxx modules]"
    "-fdebug-compilation-dir=[the compilation directory to embed in the debug info]:arg"
    "-fdebug-default-version=[default DWARF version to use]:arg"
    "-fdebug-dump-parse-tree[dump the parse tree]"
    "-fdebug-dump-provenance[dump provenance]"
    "-fdebug-dump-symbols[dump symbols after the semantic analysis]"
    "-fdebug-info-for-profiling[emit extra debug info to make sample profile more accurate]"
    "-fdebug-macro[emit macro debug information]"
    "-fdebug-measure-parse-tree[measure the parse tree]"
    "-fdebug-pass-arguments[debug pass arguments]"
    "-fdebug-pass-structure[debug pass structure]"
    "-fdebug-pre-fir-tree[dump the pre-FIR tree]"
    "-fdebug-ranges-base-address[use DWARF base address selection entries in .debug_ranges]"
    "-fdebug-unparse[unparse and stop]"
    "-fdebug-unparse-with-symbols[unparse and stop]"
    "-fdeclspec[allow __declspec as a keyword]"
    "-fdefault-double-8[set the default double precision kind to an 8 byte wide type]"
    "-fdefault-integer-8[set the default integer kind to an 8 byte wide type]"
    "-fdefault-real-8[set the default real kind to an 8 byte wide type]"
    "-fdelayed-template-parsing[parse templated function definitions at the end of the translation unit]"
    "-fdenormal-fp-math=[denormal fp math]:arg"
    "-fdepfile-entry=[depfile entry]:arg"
    "-fdiagnostics-absolute-paths[print absolute paths in diagnostics]"
    "-fdiagnostics-fixit-info[diagnostics fixit info]"
    "-fdiagnostics-fixit-info[supply fixit into with diagnostic messages]"
    "-fdiagnostics-format=[diagnostics format]:arg"
    "-fdiagnostics-hotness-threshold=[prevent optimization remarks from being output if they do not meet threshold]:value"
    "-fdiagnostics-parseable-fixits[print fixits in a machine parseable form]"
    "-fdiagnostics-print-source-range-info[print machine parseable information about source ranges]"
    "-fdiagnostics-print-source-range-info[print source range spans in numeric form]"
    "-fdiagnostics-show-category=[diagnostics show category]:arg"
    "-fdiagnostics-show-hotness[enable profile hotness information in diagnostic line]"
    "-fdiagnostics-show-note-include-stack[display include stacks for diagnostic notes]"
    "-fdiagnostics-show-option[enable -Woption information in diagnostic line]"
    "-fdiagnostics-show-template-tree[print a template comparison tree for differing templates]"
    "-fdigraphs[enable alternative token representations]"
    "-fdirect-access-external-data[don't use GOT indirection to reference external data symbols]"
    "-fdiscard-value-names[discard value names in LLVM IR]"
    "-fd-lines-as-code[d lines as code]"
    "-fd-lines-as-comments[d lines as comments]"
    "-fdollar-ok[dollar ok]"
    "-fdouble-square-bracket-attributes[enable double square bracket attributes]"
    "-fdump-fortran-optimized[dump fortran optimized]"
    "-fdump-fortran-original[dump fortran original]"
    "-fdump-parse-tree[dump parse tree]"
    "-fdwarf-directory-asm[DWARF directory asm]"
    "-fdwarf-exceptions[use DWARF style exceptions]"
    "-felide-constructors[elide constructors]"
    "-felide-type[elide types when printing diagnostics]"
    "-fembed-bitcode=[embed LLVM bitcode (option: off, all, bitcode, marker)]:option"
    "-fembed-bitcode[equivalent to -fembed-bitcode=all]"
    "-fembed-bitcode-marker[equivalent to -fembed-bitcode=marker]"
    "-femit-all-decls[emit all declarations]"
    "-femulated-tls[use emutls functions to access thread_local variables]"
    "-fenable-matrix[enable matrix data type and related builtin functions]"
    "-fencoding=[encoding]:arg"
    "-ferror-limit=[error limit]:arg"
    "-fescaping-block-tail-calls[escaping block tail calls]"
    "-fexperimental-isel[experimental isel]"
    "-fexperimental-new-constant-interpreter[enable the experimental new constant interpreter]"
    "-fexperimental-relative-c\+\+-abi-vtables[use the experimental C++ class ABI for classes with vtables]"
    "-fexperimental-strict-floating-point[enables experimental strict floating point in LLVM]"
    "-fextdirs=[extdirs]:arg"
    "-fexternal-blas[external blas]"
    "-ff2c[f2c]"
    "-ffile-compilation-dir=[the compilation directory to embed in the debug info]:arg"
    "-ffile-prefix-map=[remap file source paths in debug info and predefined preprocessor macros]:arg"
    "-ffine-grained-bitfield-accesses[use separate accesses for consecutive bitfield runs with legal widths and alignments]"
    "-ffinite-loops[assume all loops are finite]"
    "-ffixed-form[process source files in fixed form]"
    "-ffixed-line-length=[set column after which characters are ignored]:arg"
    "-ffixed-point[enable fixed point types]"
    "-fforce-dwarf-frame[always emit a debug frame section]"
    "-fforce-emit-vtables[emits more virtual tables to improve devirtualization]"
    "-fforce-enable-int128[enable support for int128_t type]"
    "-ffor-scope[for scope]"
    "-ffpe-trap=[fpe trap]:arg"
    "-ffp-exception-behavior=[specifies the exception behavior of floating-point operations]:arg"
    "-ffp-model=[controls the semantics of floating-point calculations]:arg"
    "-ffree-form[process source files in free form]"
    "-ffree-line-length-[free line length]:arg"
    "-ffrontend-optimize[frontend optimize]"
    "-fglobal-isel[enables the global instruction selector]"
    "-fgnuc-version=[sets various macros to claim compatibility with the given GCC version]:version"
    "-fgnu-inline-asm[gnu inline asm]"
    "-fgnu-keywords[allow GNU-extension keywords regardless of language standard]"
    "-fgnu-runtime[generate output compatible with the standard GNU Objective-C runtime]"
    "-fgpu-allow-device-init[allow device side init function in HIP]"
    "-fgpu-defer-diag[defer host/device related diagnostic messages for CUDA/HIP]"
    "-fgpu-rdc[generate relocatable device code, also known as separate compilation mode]"
    "-fgpu-sanitize[enable sanitizer for AMDGPU target]"
    "-fheinous-gnu-extensions[heinous GNU extensions]"
    "-fhip-new-launch-api,[-fno-hip-new-launch-api Use new kernel launching API for HIP]"
    "-fhonor-infinites[honor infinites]"
    "-fhonor-infinities[honor infinities]"
    "-fhonor-nans[honor nans]"
    "-fignore-exceptions[enable support for ignoring exception handling constructs]"
    "-filelist[ilelist]:arg"
    "-fimplicit-module-maps[implicit module maps]"
    "-fimplicit-modules[implicit modules]"
    "-fimplicit-none[no implicit typing allowed unless overridden by IMPLICIT statements]"
    "-findirect-virtual-calls[indirect virtual calls]"
    "-finit-character=[init character]:arg"
    "-finit-integer=[init integer]:arg"
    "-finit-local-zero[init local zero]"
    "-finit-logical=[init logical]:arg"
    "-finit-real=[init real]:arg"
    "-finline-hint-functions[inline functions which are (explicitly or implicitly) marked inline]"
    "-finstrument-function-entry-bare[instrument function entry only]"
    "-finstrument-functions-after-inlining[insert the calls after inlining]"
    "-finteger-4-integer-8[integer 4 integer 8]"
    "-fintegrated-as[enable the integrated assembler]"
    "-fintegrated-cc1[run cc1 in-process]"
    "-fintrinsic-modules-path[intrinsic modules path]"
    "-flarge-sizes[use INTEGER(KIND=8) for the result type in size-related intrinsics]"
    "-flat_namespace[flat namespace]"
    "-flegacy-pass-manager[use the legacy pass manager in LLVM]"
    "-flimited-precision=[limited precision]:arg"
    "-flogical-abbreviations[enable logical abbreviations]"
    "-flto=-[generate output files suitable for link time optimization]::style:(full thin)"
    "-flto-jobs=[controls the backend parallelism]:arg"
    "-fmacro-backtrace-limit=[macro backtrace limit]:limit"
    "-fmacro-prefix-map=[remap file source paths in predefined preprocessor macros]:arg"
    "-fmax-array-constructor=[max array constructor]:arg"
    "-fmax-identifier-length[max identifier length]"
    "-fmax-stack-var-size=[max stack var size]:arg"
    "-fmax-subrecord-length=[max subrecord length]:arg"
    "-fmax-tokens=[max total number of preprocessed tokens for -Wmax-tokens]:number"
    "-fmax-type-align=[specify the maximum alignment to enforce on pointers lacking an explicit alignment]:arg"
    "-fmemory-profile[enable heap memory profiling]"
    "-fmemory-profile=[enable heap memory profiling and dump results into <directory>]:directory:_files -/"
    "-fmodule-file-deps[module file deps]"
    "-fmodule-file=[specify the mapping of module name to precompiled module file]:file:_files"
    "-fmodule-implementation-of[module implementation of]:name"
    "-fmodule-map-file=[load this module map file]:file:_files"
    "-fmodule-maps[implicitly search the file system for module map files.]"
    "-fmodule-name=[specify the name of the module to build]:name"
    "-fmodule-private[module private]"
    "-fmodules-cache-path=[specify the module cache path]:directory:_files -/"
    "-fmodules-decluse[require declaration of modules used within a module]"
    "-fmodules-disable-diagnostic-validation[disable validation of the diagnostic options when loading the module]"
    "-fmodules[enable the modules language feature]"
    "-fmodules-ignore-macro=[ignore the definition of the given macro when building and loading modules]:macro"
    "-fmodules-prune-after=[specify the interval after which a module file will be considered unused]:seconds"
    "-fmodules-prune-interval=[specify the interval between attempts to prune the module cache]:seconds"
    "-fmodules-search-all[search even non-imported modules to resolve references]"
    "-fmodules-strict-decluse[requires all headers to be in modules]"
    "-fmodules-ts[enable support for the C++ Modules TS]"
    "-fmodules-user-build-path[specify the module user build path]:directory:_files -/"
    "-fmodules-validate-input-files-content[validate PCM input files based on content if mtime differs]"
    "-fmodules-validate-once-per-build-session[don't verify input files for the modules]"
    "-fmodules-validate-system-headers[validate the system headers that a module depends on when loading the module]"
    "-fms-compatibility[enable full Microsoft Visual C++ compatibility]"
    "-fms-compatibility-version=[microsoft compiler version number]:arg"
    "-fmsc-version=[microsoft compiler version number to report]:arg"
    "-fms-memptr-rep=[ms memptr rep]:arg"
    "-fms-volatile[ms volatile]"
    "-fnested-functions[nested functions]"
    "-fnew-alignment=[specifies the largest alignment guaranteed]:align"
    "-fnext-runtime[next runtime]"
    "-fno-builtin-[disable implicit builtin knowledge of a specific function]:arg"
    "-fno-crash-diagnostics[disable auto-generation of preprocessed source files and a script for reproduction during a clang crash]"
    "-fno-limit-debug-info[no limit debug info]"
    "-fno-max-type-align[no max type align]"
    "-fno_modules-validate-input-files-content[no modules validate input files content]"
    "-fno_pch-validate-input-files-content[no pch validate input files content]"
    "-fno-strict-modules-decluse[no strict modules decluse]"
    "-fno-temp-file[directly create compilation output files]"
    "-fno-working-directory[no working directory]"
    "-fnoxray-link-deps[no xray link deps]"
    "-fobjc-abi-version=-[set Objective-C ABI version]:version"
    "-fobjc-arc-exceptions[use EH-safe code when synthesizing retains and releases in -fobjc-arc]"
    "-fobjc-arc[synthesize retain and release calls for Objective-C pointers]"
    "-fobjc-convert-messages-to-runtime-calls[convert messages to runtime calls]"
    "-fobjc-encode-cxx-class-template-spec[fully encode C++ class template specialization]"
    "-fobjc-exceptions[enable Objective-C exceptions]"
    "-fobjc-infer-related-result-type[infer related result type]"
    "-fobjc-legacy-dispatch[use legacy dispatch]"
    "-fobjc-link-runtime[set link runtime]"
    "-fobjc-nonfragile-abi[set nonfragile abi]"
    "-fobjc-nonfragile-abi-version=-[set nonfragile abi version]:version"
    "-fobjc-runtime=-[specify the target Objective-C runtime kind and version]:runtime"
    "-fobjc-sender-dependent-dispatch[set sender dependent dispatch]"
    "-fobjc-weak[enable ARC-style weak references in Objective-C]"
    "-fopenmp-targets=[specify comma-separated list of triples OpenMP offloading targets to be supported]:targets"
    "-fopenmp-version=[openmp version]:version"
    "-foperator-arrow-depth=[operator arrow depth]:arg"
    "-foperator-names[treat C++ operator name keywords as synonyms for operators]"
    "-foptimization-record-file=[specify the output name of the file containing the optimization remarks]:file:_files"
    "-foptimization-record-passes=[only include passes which match a specified regex]:regex"
    "-force_cpusubtype_ALL[force cpusubtype all]"
    "-force_flat_namespace[force flat namespace]"
    "--force-link=[force link]:arg"
    "-force_load[force load]:argument"
    "-forder-file-instrumentation[generate instrumented code to collect order file]"
    "-foutput-class-dir=[output class dir]:arg"
    "-fpack-derived[pack derived]"
    "-fparse-all-comments[parse all comments]"
    "-fpascal-strings[recognize and construct Pascal-style string literals]"
    "-fpass-plugin=[load pass plugin from a dynamic shared object file]:dsopath"
    "-fpatchable-function-entry=[generate NOPs around function entry]:N,M"
    "-fpch-codegen[generate code for uses of this PCH]"
    "-fpch-debuginfo[generate debug info for types in an object file built from this PCH]"
    "-fpch-instantiate-templates[instantiate templates already while building a PCH]"
    "-fpch-validate-input-files-content[validate PCH input files based on content]"
    "-fprebuilt-implicit-modules[look up implicit modules]"
    "-fprebuilt-module-path=[specify the prebuilt module path]:directory:_files -/"
    "-fpreserve-as-comments[preserve as comments]"
    "-fproc-stat-report=[save subprocess statistics to the given file]:arg"
    "-fprofile-exclude-files=[exclude files from profile]:arg"
    "-fprofile-filter-files=[filter files for profile]:arg"
    "-fprofile-instr-generate[generate instrumented profile]"
    "-fprofile-instr-generate=[generate instrumented profile into file]:file:_files"
    "-fprofile-instr-use[profile instr use]"
    "-fprofile-instr-use=[use instrumentation data for profile-guided optimization]:arg"
    "-fprofile-list=[filename defining the list of items to instrument]:file:_files"
    "-fprofile-remapping-file=[use the remappings described in file in profile]:file:_files"
    "-fprofile-sample-accurate[specifies that the sample profile is accurate]"
    "-fprofile-sample-use[profile sample use]"
    "-fprofile-sample-use=[profile sample use]:arg"
    "-fprofile-update=[set update method of profile counters]:method"
    "-fprotect-parens[protect parens]"
    "-fpseudo-probe-for-profiling[emit pseudo probes for sample profiling]"
    "-framework[include framework found in search path]:framework:->framework"
    "-frange-check[range check]"
    "-freal-4-real-10[real 4 real 10]"
    "-freal-4-real-16[real 4 real 16]"
    "-freal-4-real-8[real 4 real 8]"
    "-freal-8-real-10[real 8 real 10]"
    "-freal-8-real-16[real 8 real 16]"
    "-freal-8-real-4[real 8 real 4]"
    "-frealloc-lhs[realloc lhs]"
    "-frecord-command-line[record command line]"
    "-frecord-marker=[record marker]:arg"
    "-frecursive[recursive]"
    "-fregister-global-dtors-with-atexit[use atexit to register global destructors]"
    "-frelaxed-template-template-args[enable C++17 relaxed template template argument matching]"
    "-frepack-arrays[repack arrays]"
    "-freroll-loops[turn on loop reroller]"
    "-fretain-comments-from-system-headers[retain comments from system headers]"
    "-frewrite-imports[rewrite imports]"
    "-frewrite-includes[rewrite includes]"
    "-frewrite-map-file=[rewrite map file]:arg"
    "-fropi[generate read-only position independent code (ARM only)]"
    "-frtlib-add-rpath[add -rpath with architecture-specific resource directory to the linker flags]"
    "-frtti-data[rtti data]"
    "-frwpi[generate read-write position independent code (ARM only)]"
    "-fsanitize-address-destructor-kind=[set destructor type used in ASan instrumentation]:kind"
    "-fsanitize-address-field-padding=[level of field padding for AddressSanitizer]:arg"
    "-fsanitize-address-globals-dead-stripping[enable linker dead stripping of globals in AddressSanitizer]"
    "-fsanitize-address-poison-custom-array-cookie[enable poisoning array cookies when using custom operator new in AddressSanitizer]"
    "-fsanitize-address-use-after-scope[enable use-after-scope detection in AddressSanitizer]"
    "-fsanitize-address-use-odr-indicator[enable ODR indicator globals]"
    "-fsanitize-blacklist=[path to blacklist file for sanitizers]:arg"
    "-fsanitize-cfi-canonical-jump-tables[make the jump table addresses canonical in the symbol table]"
    "-fsanitize-cfi-cross-dso[enable control flow integrity (CFI) checks for cross-DSO calls]"
    "-fsanitize-cfi-icall-generalize-pointers[generalize pointers in CFI indirect call type signature checks]"
    "-fsanitize-coverage-allowlist=[sanitize coverage allowlist]:arg"
    "-fsanitize-coverage-blacklist=[disable sanitizer coverage instrumentation]:arg"
    "-fsanitize-coverage-blocklist=[sanitize coverage blocklist]:arg"
    "-fsanitize-coverage=[specify the type of coverage instrumentation for Sanitizers]:arg1"
    "-fsanitize-coverage-whitelist=[restrict sanitizer coverage instrumentation]:arg"
    "-fsanitize-hwaddress-abi=[select the HWAddressSanitizer ABI to target]:arg"
    "-fsanitize-link-c\+\+-runtime[sanitize link c++ runtime]"
    "-fsanitize-link-runtime[sanitize link runtime]"
    "-fsanitize-memory-track-origins[enable origins tracking in MemorySanitizer]"
    "-fsanitize-memory-track-origins=[enable origins tracking in MemorySanitizer]:arg"
    "-fsanitize-memory-use-after-dtor[enable use-after-destroy detection in MemorySanitizer]"
    "-fsanitize-minimal-runtime[sanitize minimal runtime]"
    "-fsanitize-recover=[enable recovery for specified sanitizers]:arg1"
    "-fsanitize-recover[equivalent to -fsanitize-recover=all]"
    "-fsanitize-stats[enable sanitizer statistics gathering]"
    "-fsanitize-system-blacklist[path to system blacklist file for sanitizers]:file:_files"
    "-fsanitize-thread-atomics[enable atomic operations instrumentation in ThreadSanitizer (default)]"
    "-fsanitize-thread-func-entry-exit[enable function entry/exit instrumentation in ThreadSanitizer]"
    "-fsanitize-thread-memory-access[enable memory access instrumentation in ThreadSanitizer]"
    "-fsanitize-trap=[enable trapping for specified sanitizers]:arg1"
    "-fsanitize-trap[equivalent to -fsanitize-trap=all]"
    "-fsanitize-undefined-strip-path-components=[strip a given number of path components when emitting check metadata]:number"
    "-fsanitize-undefined-trap-on-error[equivalent to -fsanitize-trap=undefined]"
    "-fsave-optimization-record[generate a YAML optimization record file]"
    "-fsave-optimization-record=[generate an optimization record file in a specific format]:format"
    "-fsecond-underscore[second underscore]"
    "-fseh-exceptions[use SEH style exceptions]"
    "-fsemantic-interposition[semantic interposition]"
    "-fshow-column[show the column]"
    "-fshow-overloads=[which overload candidates to show when overload resolution fails]:arg"
    "-fshow-source-location[show source location]"
    "-fshow-source-location[show the source location]"
    "-fsignaling-math[signaling math]"
    "-fsign-zero[sign zero]"
    "-fsized-deallocation[enable C++14 sized global deallocation functions]"
    "-fsjlj-exceptions[use SjLj style exceptions]"
    "-fslp-vectorize[enable the superword-level parallelism vectorization passes]"
    "-fspell-checking-limit=[spell checking limit]:arg"
    "-fspell-checking[spell checking]"
    "-fsplit-dwarf-inlining[provide minimal debug info in the object]"
    "-fsplit-lto-unit[enables splitting of the LTO unit]"
    "-fsplit-machine-functions[enable late function splitting using profile information]"
    "-fstack-arrays[stack arrays]"
    "-fstack-clash-protection[enable stack clash protection]"
    "-fstack-size-section[emit section containing metadata on function stack sizes]"
    "-fstandalone-debug[emit full debug info for all types used by the program]"
    "-fstrict-float-cast-overflow[assume that overflowing float-to-int casts are undefined]"
    "-fstrict-return[strict return]"
    "-fstrict-vtable-pointers[enable optimizations based on the strict vtables]"
    "-fstruct-path-tbaa[struct path tbaa]"
    "-fsycl[enable SYCL kernels compilation for device]"
    "-fsymbol-partition=[symbol partition]:arg"
    "-fsystem-module[build this module as a system module. only used with -emit-module]"
    "-ftemplate-backtrace-limit=[template backtrace limit]:arg"
    "-ftemplate-depth-[template depth]:arg"
    "-ftemplate-depth=[template depth]:arg"
    "-fterminated-vtables[terminated vtables]"
    "-fthin-link-bitcode=[write minimized bitcode to <file>]:file:_files"
    "-fthinlto-index=[perform ThinLTO importing using provided index]:arg"
    "-fthreadsafe-statics[threadsafe statics]"
    "-ftime-trace-granularity=[minimum time granularity traced by time profiler]:microseconds"
    "-ftime-trace[turn on time profiler]"
    "-ftrap-function=[issue call to specified function rather than a trap instruction]:function name"
    "-ftrapv-handler=[specify the function to be called on overflow]:function name"
    "-ftrigraphs[process trigraph sequences]"
    "-ftrivial-auto-var-init=[initialize trivial automatic stack variables]:arg"
    "-ftrivial-auto-var-init-stop-after=[stop initializing trivial automatic stack variables after the specified number of instances]:arg"
    "-funderscoring[underscoring]"
    "-funique-basic-block-section-names[use unique names for basic block sections]"
    "-funique-internal-linkage-names[uniqueify Internal Linkage Symbol Names]"
    "-funique-section-names[unique section names]"
    "-funit-at-a-time[unit at a time]"
    "-fuse-cuid=[method to generate ids for compilation units for single source offloading languages CUDA and HIP]:argument"
    "-fuse-cxa-atexit[use cxa atexit]"
    "-fuse-init-array[use init array]"
    "-fuse-line-directives[use #line in preprocessed output]"
    "-fvalidate-ast-input-files-content[compute and store the hash of input files used to build an AST]"
    "-fveclib=[use the given vector functions library]:arg"
    "-fvectorize[enable the loop vectorization passes]"
    "-fvirtual-function-elimination[enables dead virtual function elimination optimization]"
    "-fvisibility-dllexport=[the visibility for dllexport defintions]:arg"
    "-fvisibility-externs-dllimport=[the visibility for dllimport external declarations]:arg"
    "-fvisibility-externs-nodllstorageclass=[the visibility for external declarations without an explicit DLL dllstorageclass]:arg"
    "-fvisibility-from-dllstorageclass[set the visiblity of symbols in the generated code from their DLL storage class]"
    "-fvisibility-global-new-delete-hidden[give global C++ operator new and delete declarations hidden visibility]"
    "-fvisibility-inlines-hidden[give inline C++ member functions hidden visibility by default]"
    "-fvisibility-inlines-hidden-static-local-var[visibility inlines hidden static local var]"
    "-fvisibility-ms-compat[give global types and functions a specific visibility]"
    "-fvisibility-nodllstorageclass=[the visibility for defintiions without an explicit DLL export class]:arg"
    "-fwasm-exceptions[use WebAssembly style exceptions]"
    "-fwhole-file[whole file]"
    "-fwhole-program-vtables[enables whole-program vtable optimization]"
    "-fwritable-strings[store string literals as writable data]"
    "-fxl-pragma-pack[enable IBM XL #pragma pack handling]"
    "-fxor-operator[enable .XOR. as a synonym of .NEQV.]"
    "-fxray-always-emit-customevents[always emit xray customevent calls]"
    "-fxray-always-emit-typedevents[always emit xray typedevents calls]"
    "-fxray-always-instrument=[file defining xray always instrument]:file:_files"
    "-fxray-attr-list=[file defining the list of xray attributes]:file:_files"
    "-fxray-function-groups=[only instrument 1 of N groups]:arg"
    "-fxray-function-index[xray function index]"
    "-fxray-ignore-loops[don't instrument functions with loops unless they also meet the minimum function size]"
    "-fxray-instruction-threshold=[sets the minimum function size to instrument with XRay]:arg"
    "-fxray-instrumentation-bundle=[select which XRay instrumentation points to emit]:arg"
    "-fxray-instrument[generate XRay instrumentation sleds on function entry and exit]"
    "-fxray-link-deps[tells clang to add the link dependencies for XRay]"
    "-fxray-modes=[list of modes to link in by default into XRay instrumented binaries]:arg"
    "-fxray-never-instrument=[file defining the whitelist for Xray attributes]:file:_files"
    "-fxray-selected-function-group=[select which group of functions to instrument]:arg"
    "-fzvector[enable System z vector language extension]"
    {-gcc-toolchain=,--gcc-toolchain=}"[use the gcc toolchain at the given directory]:directory:_files -/"
    "-gcodeview[generate CodeView debug information]"
    {-gcodeview-ghash,-gno-codeview-ghash}"[emit type record hashes is a .debug section]"
    "-gcolumn-info[column info]"
    "-gdwarf-aranges[DWARF aranges]"
    "-gembed-source[embed source text in DWARF debug sections]"
    "-gfull[emit debugging information for all symbols and types]"
    {-G-,-G=-,-msmall-data-limit=,-msmall-data-threshold}"[Put objects of at most size bytes into small data section]:size"
    "-ggnu-pubnames[gnu pubnames]"
    "-ginline-line-tables[inline line tables]"
    "-gline-directives-only[emit debug line info directives only]"
    "-gline-tables-only[line tables only]"
    "-glldb[lldb]"
    "-gmlt[emit debug line number tables only]"
    "-gmodules[generate debug info with external references]"
    "-gno-column-info[no column info]"
    "-gno-embed-source[no embed source]"
    "-gno-gnu-pubnames[no gnu pubnames]"
    "-gno-inline-line-tables[no inline line tables]"
    "-gno-record-command-line[no record command line]"
    "--gpu-instrument-lib=[instrument device library for HIP]:argument"
    "--gpu-max-threads-per-block=[default max threads per block for kernel launch bounds for HIP]"
    "-grecord-command-line[record command line]"
    "-gsce[sce]"
    "-gused[emit debugging information for symbols that are used]"
    "-gz=[DWARF debug sections compression type]:arg"
    "-gz[equivalent to -gz=zlib]"
    "-headerpad_max_install_names[headerpad max install names]:argument"
    "-help[display this information]"
    "--help-hidden[display help for hidden options]"
    "--hip-device-lib=[hIP device library]:arg"
    "--hip-device-lib-path=[hip device lib path]:arg"
    "--hip-link[link clang-offload-bundler bundles for HIP]"
    "--hip-version=[HIP version in the format of major.minor.patch]"
    "-ibuiltininc[enable builtin #include directories even when -nostdinc is used before or after -ibuiltininc]"
    "-iframework[add directory to SYSTEM framework search path]:arg"
    "-iframeworkwithsysroot[add directory to SYSTEM framework search path, absolute paths are relative to -isysroot]:directory:_files -/"
    "-image_base[image base]:argument"
    "-include-pch[include precompiled header file]:file:_files"
    "-index-header-map[make the next included directory (-I or -F) an indexer header map]"
    "-init[init]:arg"
    "-init[init]:argument"
    "-install_name[install name]:arg"
    "-install_name[install name]:argument"
    "-integrated-as[integrated as]"
    "-interface-stub-version=[interface stub version]:arg"
    "-interface-stub-version=[interface stub version]:argument"
    "-isystem-after[add directory to end of the SYSTEM include search path]:directory:_files -/"
    "-ivfsoverlay[overlay the virtual filesystem described by file over the real file system]:arg"
    "-iwithsysroot[add directory to SYSTEM include search path]:directory:_files -/"
    "-J[this option specifies where to put .mod files for compiled modules]:arg"
    "-keep_private_externs[keep private externs]"
    "-keep_private_externs[keep private externs]"
    "-lazy_framework[lazy framework]:arg"
    "-lazy_framework[lazy framework]:argument"
    "-lazy_library[lazy library]:arg"
    "-lazy_library[lazy library]:argument"
    "--ld-path=[ld path]:arg"
    "--libomptarget-amdgcn-bc-path=[path to libomptarget-amdgcn bitcode library]:arg"
    "--libomptarget-nvptx-bc-path=[path to libomptarget-nvptx bitcode library]:arg"
    "--library-directory=[add directory to library search path]:directory:_files -/"
    "-maix-struct-return[return all structs in memory]"
    "-malign-branch-boundary=[specify the boundary's size to align branches]:size"
    "-malign-branch=[specify types of branches to align]:arg"
    "-mappletvos-version-min=[appletvos version min]:arg"
    "-mappletvsimulator-version-min=[appletvsimulator version min]:arg"
    "-mbackchain[link stack frames through backchain on System Z]"
    "-mbig-endian[big endian]"
    "-mbranches-within-32B-boundaries[align selected branches within 32-byte boundary]"
    "-mbranch-protection=[enforce targets of indirect branches and function returns]:arg"
    "-mcode-object-v3[legacy option to specify code object ABI V3]"
    "-mcode-object-version=[specify code object ABI version]:version"
    "-mconsole[console]:arg"
    "-mcrc[allow use of CRC instructions]"
    "-mdefault-build-attributes[default build attributes]:arg"
    "-mdll[dll]:arg"
    "-mdouble=[force double to be 32 bits or 64 bits]:arg"
    "-mdynamic-no-pic[dynamic no pic]:arg"
    "-meabi[set EABI type]:arg"
    "-menable-experimental-extensions[enable use of experimental RISC-V extensions]"
    "-menable-unsafe-fp-math[allow unsafe floating-point math optimizations which may decrease precision]"
    "-mfix-cortex-a53-835769[workaround Cortex-A53 erratum 835769]"
    "-mfloat-abi=[float abi]:arg"
    "-mfpu=[fpu]:arg"
    "-mglobal-merge[enable merging of globals]"
    "-mharden-sls=[select straight-line speculation hardening scope]:arg"
    "--mhwdiv=[hwdiv]:arg"
    "-mhwdiv=[hwdiv]:arg"
    "-mhwmult=[hwmult]:arg"
    "-mignore-xcoff-visibility[do not emit the visibility attribute for asm]"
    "--migrate[run the migrator]"
    "-mimplicit-float[implicit float]"
    "-mimplicit-it=[implicit it]:arg"
    "-mincremental-linker-compatible[emit an object file which can be used with an incremental linker]"
    "-mios-simulator-version-min=[ios simulator version min]:arg"
    "-mios-version-min=[ios version min]:arg"
    "-miphoneos-version-min=[iphoneos version min]:arg"
    "-miphonesimulator-version-min=[iphonesimulator version min]:arg"
    "-mkernel[kernel]"
    "-mlinker-version=[linker version]:arg"
    "-mlittle-endian[little endian]"
    "-mllvm[additional arguments to forward to LLVM's option processing]:arg"
    "-mlong-calls[generate branches with extended addressability]"
    "-mlvi-cfi[enable only control-flow mitigations for Load Value Injection]"
    "-mlvi-hardening[enable all mitigations for Load Value Injection]"
    "-mmacos-version-min=[set Mac OS X deployment target]:arg"
    "-mmacosx-version-min=[macosx version min]:arg"
    "-mmcu=[mcu]:arg"
    "-module-dependency-dir[directory to dump module dependencies to]:arg"
    "-module-dir[odule dir]:dir"
    "-module-file-info[provide information about a particular module file]"
    "-moslib=[oslib]:arg"
    "-moutline-atomics[generate local calls to out-of-line atomic operations]"
    "-mpacked-stack[use packed stack layout]"
    "-mpad-max-prefix-size=[specify maximum number of prefixes to use for padding]:arg"
    "-mpie-copy-relocations[pie copy relocations]"
    "-mprefer-vector-width=[specifies preferred vector width]:arg"
    "-mqdsp6-compat[enable hexagon-qdsp6 backward compatibility]"
    "-mrelax-all[relax all machine instructions]"
    "-mrelax[enable linker relaxation]"
    "-mretpoline[retpoline]"
    "-mseses[enable speculative execution side effect suppression (SESES)]"
    "-msign-return-address=[select return address signing scope]:arg"
    "-msim[sim]"
    "-mspeculative-load-hardening[speculative load hardening]"
    "-mstack-alignment=[set the stack alignment]:arg"
    "-mstack-probe-size=[set the stack probe size]:size"
    "-mstack-protector-guard-offset=[use the given offset for addressing the stack-protector guard]:arg"
    "-mstack-protector-guard-reg=[use the given reg for addressing the stack-protector guard]:reg"
    "-msvr4-struct-return[return small structs in registers]"
    "-mthread-model[the thread model to use]:arg"
    "-mthumb[thumb]"
    "-mtls-size=[specify bit size of immediate TLS offsets]:arg"
    "-mtvos-simulator-version-min=[tvos simulator version min]:arg"
    "-mtvos-version-min=[tvos version min]:arg"
    "-multi_module[multi module]"
    "-multiply_defined[multiply defined]:arg"
    "-multiply_defined_unused[multiply defined unused]:arg"
    "-municode[unicode]:arg"
    "-munsafe-fp-atomics[enable unsafe floating point atomic instructions]"
    "-mv55[equivalent to -mcpu=hexagonv55]"
    "-mv5[equivalent to -mcpu=hexagonv5]"
    "-mv60[equivalent to -mcpu=hexagonv60]"
    "-mv62[equivalent to -mcpu=hexagonv62]"
    "-mv65[equivalent to -mcpu=hexagonv65]"
    "-mv66[equivalent to -mcpu=hexagonv66]"
    "-mv67[equivalent to -mcpu=hexagonv67]"
    "-mv67t[equivalent to -mcpu=hexagonv67t]"
    "-mv68[equivalent to -mcpu=hexagonv68]"
    "-mvx[vx]"
    "-mwarn-nonportable-cfstrings[warn nonportable cfstrings]"
    "-mwatchos-simulator-version-min=[watchos simulator version min]:arg"
    "-mwatchos-version-min=[watchos version min]:arg"
    "-mwatchsimulator-version-min=[watchsimulator version min]:arg"
    "-mwavefrontsize64[specify wavefront size 64 mode]"
    "-mwindows[windows]:arg"
    "-mzvector[zvector]"
    "-nobuiltininc[do not search builtin directory for include files]"
    "-nocpp[no cpp]"
    "-nocudainc[do not add include paths for CUDA/HIP and do not include the default CUDA/HIP wrapper headers]"
    "*--no-cuda-include-ptx=[do not include ptx for the following gpu architecture]:argument"
    "-nocudalib[do not link device library for CUDA/HIP device compilation]"
    "--no-cuda-noopt-device-debug[disable device-side debug info generation]"
    "--no-cuda-version-check[don't error out if the detected version of the CUDA install is too low for the requested CUDA gpu architecture]"
    "-no_dead_strip_inits_and_terms[no dead strip inits and terms]"
    "-nofixprebinding[no fixprebinding]"
    "-nogpuinc[no gpuinc]"
    "-nogpulib[no gpulib]"
    "--no-integrated-cpp[no integrated cpp]"
    "-no-integrated-cpp[no integrated cpp]"
    "-nolibc[no libc]"
    "-nomultidefs[no multidefs]"
    "--no-offload-arch=[no offload arch]:arg"
    "-no-pie[no pie]"
    "-nopie[no pie]"
    "-noprebind[no prebind]"
    "-noprofilelib[no profilelib]"
    "-no-pthread[no pthread]"
    "-noseglinkedit[no seglinkedit]"
    "--no-standard-libraries[no standard libraries]"
    "-nostdinc\+\+[disable standard #include directories for the C++ standard library]"
    "-nostdlibinc[do not search standard system directories for include files]"
    "-nostdlib\+\+[no stdlib++]"
    "--no-system-header-prefix=[no system header prefix]:prefix"
    "--no-undefined[no undefined]"
    "-objcmt-atomic-property[make migration to atomic properties]"
    "-objcmt-migrate-all[enable migration to modern ObjC]"
    "-objcmt-migrate-annotation[enable migration to property and method annotations]"
    "-objcmt-migrate-designated-init[enable migration to infer NS_DESIGNATED_INITIALIZER for initializer methods]"
    "-objcmt-migrate-instancetype[enable migration to infer instancetype for method result type]"
    "-objcmt-migrate-literals[enable migration to modern ObjC literals]"
    "-objcmt-migrate-ns-macros[enable migration to NS_ENUM/NS_OPTIONS macros]"
    "-objcmt-migrate-property-dot-syntax[enable migration of setter/getter messages to property-dot syntax]"
    "-objcmt-migrate-property[enable migration to modern ObjC property]"
    "-objcmt-migrate-protocol-conformance[enable migration to add protocol conformance on classes]"
    "-objcmt-migrate-readonly-property[enable migration to modern ObjC readonly property]"
    "-objcmt-migrate-readwrite-property[enable migration to modern ObjC readwrite property]"
    "-objcmt-migrate-subscripting[enable migration to modern ObjC subscripting]"
    "-objcmt-ns-nonatomic-iosonly[enable migration to use NS_NONATOMIC_IOSONLY macro for setting property's atomic attribute]"
    "-objcmt-returns-innerpointer-property[enable migration to annotate property with NS_RETURNS_INNER_POINTER]"
    "-objcmt-whitelist-dir-path=[objcmt whitelist dir path]:arg"
    "-objcmt-white-list-dir-path=[only modify files with a filename contained in the provided directory path]:arg"
    "-ObjC[treat source files as Objective-C]"
    "-ObjC\+\+[treat source files as Objective-C++]"
    "-object[object]"
    "--offload-arch=[offload arch]:arg"
    "--output-class-directory=[output class directory]:arg"
    "-pagezero_size[pagezero size]:arg"
    "-pg[enable mcount instrumentation]"
    {-p,--profile}"[enable function profiling for prof]"
    "-prebind_all_twolevel_modules[prebind all twolevel modules]"
    "-prebind[prebind]"
    "--precompile[only precompile the input]"
    "-preload[preload]"
    "--print-diagnostic-categories[print diagnostic categories]"
    "-print-effective-triple[print effective triple]"
    "--print-effective-triple[print the effective target triple]"
    "--print-file-name=[print the full library path of <file>]:file:_files"
    "-print-ivar-layout[enable Objective-C Ivar layout bitmap print trace]"
    "--print-libgcc-file-name[print the library path for the currently used compiler runtime library]"
    "--print-multi-directory[print multi directory]"
    "--print-multi-lib[print multi lib]"
    "--print-prog-name=[print the full program path of <name>]:name"
    "-print-resource-dir[print resource dir]"
    "--print-resource-dir[print the resource directory pathname]"
    "--print-search-dirs[print the paths used for finding libraries and programs]"
    "--print-supported-cpus[print supported cpus]"
    "-print-supported-cpus[print supported cpus]"
    "-print-targets[print targets]"
    "--print-targets[print the registered targets]"
    "-print-target-triple[print target triple]"
    "--print-target-triple[print the normalized target triple]"
    "-private_bundle[private bundle]"
    "--profile-blocks[undocumented option]"
    "-pthreads[pthreads]"
    "-pthread[support POSIX threads in generated code]"
    "--ptxas-path=[path to ptxas (used for compiling CUDA code)]:arg"
    "-Qunused-arguments[don't emit warning for unused driver arguments]"
    "-read_only_relocs[read only relocs]:arg"
    "-relocatable-pch[relocatable pch]"
    "--relocatable-pch[whether to build a relocatable precompiled header]"
    "-R[enable the specified remark]:remark"
    "--resource=[resource]:arg"
    "-rewrite-legacy-objc[rewrite Legacy Objective-C source to C++]"
    "-rewrite-objc[rewrite Objective-C source to C++]"
    "--rocm-device-lib-path=[rOCm device library path]:arg"
    "--rocm-path=[rOCm installation path]:arg"
    "-Rpass-analysis=[report transformation analysis from optimization passes]:regex"
    "-Rpass-missed=[report missed transformations by optimization passes]:arg"
    "-Rpass=[report transformations performed by optimization passes]:arg"
    "-rpath[rpath]:arg"
    "-r[product a relocatable object as output]"
    "--rtlib=[compiler runtime library to use]:arg"
    "-rtlib=[rtlib]:arg"
    "--save-stats=[save llvm statistics]:arg"
    "-sectalign[<arg2> <arg3>]:arg1"
    "-sectcreate[<arg2> <arg3>]:arg1"
    "-sectobjectsymbols[<arg2>]:arg1"
    "-sectorder[<arg2> <arg3>]:arg1"
    "-seg1addr[seg1addr]:arg"
    "-segaddr[<arg2>]:arg1"
    "-seg_addr_table_filename[seg addr table filename]:arg"
    "-seg_addr_table[seg addr table]:arg"
    "-segcreate[<arg2> <arg3>]:arg1"
    "-seglinkedit[seglinkedit]"
    "-segprot[<arg2> <arg3>]:arg1"
    "-segs_read_only_addr[segs read only addr]:arg"
    "-segs_read_[segs read]:arg"
    "-segs_read_write_addr[segs read write addr]:arg"
    "--serialize-diagnostics[serialize compiler diagnostics to a file]:arg"
    "-serialize-diagnostics[serialize diagnostics]:arg"
    "-shared-libasan[dynamically link the sanitizer runtime]"
    "-shared-libsan[shared libsan]"
    "--shared[shared]"
    "--signed-char[signed char]"
    "-single_module[single module]"
    "--specs=[specs]:arg"
    "-static-libgfortran[static libgfortran]"
    "-static-libsan[statically link the sanitizer runtime]"
    "-static-libstdc\+\+[static libstdc++]"
    "-static-openmp[use the static host OpenMP runtime while linking.]"
    "-static-pie[static pie]"
    "--static[static]"
    "-std-default=[std default]:arg"
    "--stdlib=[c++ standard library to use]:arg"
    "-stdlib\+\+-isystem[use directory as the C++ standard library include path]:directory:_files -/"
    "-stdlib=[stdlib]:arg"
    "-sub_library[sub library]:arg"
    "-sub_umbrella[sub umbrella]:arg"
    "-sycl-std=[SYCL language standard to compile for]:standard"
    "--system-header-prefix=[treat all #include paths starting with <prefix> as including a system header]:prefix"
    "-target[generate code for the given target]:arg"
    "--target=[target]:arg"
    "-Tbss[set starting address of BSS to <addr>]:addr"
    "-Tdata[set starting address of DATA to <addr>]:addr"
    "--traditional[traditional]"
    "-traditional[traditional]"
    "-Ttext[set starting address of TEXT to <addr>]:addr"
    "-t[undocumented option]"
    "-twolevel_namespace_hints[twolevel namespace hints]"
    "-twolevel_namespace[twolevel namespace]"
    "-umbrella[umbrella]:arg"
    "-undefined[undefined]:arg"
    "-unexported_symbols_list[unexported symbols list]:arg"
    "--unsigned-char[unsigned char]"
    "--unwindlib=[unwind library to use]:arg"
    "-unwindlib=[unwindlib]:arg"
    "--verify-debug-info[verify the binary representation of debug output]"
    "-verify-pch[load and verify that a pre-compiled header file is not stale]"
    "--warn-=-[enable the specified warning]:warning:->warning"
    "-weak_framework[weak framework]:arg"
    "-weak_library[weak library]:arg"
    "-weak-l[weak l]:arg"
    "-weak_reference_mismatches[weak reference mismatches]:arg"
    "-whatsloaded[whatsloaded]"
    "-whyload[whyload]"
    "-working-directory=[resolve file paths relative to the specified directory]:arg"
    "-Xanalyzer[pass <arg> to the static analyzer]:arg"
    "-Xarch_device[pass arg to CUDA/HIP device compilation]:argument"
    "-Xarch_host[pass arg to CUDA/HIP host compilation]:argument"
    "-Xclang[pass <arg> to the clang compiler]:arg"
    "-Xcuda-fatbinary[pass arg to fatbinary invocation]:argument"
    "-Xcuda-ptxas[pass arg to the ptxas assemler]:argument"
    "-Xflang[pass <arg> to the flang compiler]:arg"
    "-Xopenmp-target[pass arg to the the target offloading toolchain]:argument"
    "-y[the action to perform on the input]:arg"
    "-Z-[undocumented option]:argument"
  )
else
  args+=(
    "--dump=[dump information]:argument"
    '-flto=-[enable link-time optimization]::jobs:'
    '*--help=-[display this information]:class:->help'
  )
fi

local -a sanitizers
sanitizers=(
  address alignment bool bounds enum float-cast-overflow float-divide-by-zero
  integer-divide-by-zero memory nonnull-attribute null nullability-arg
  nullability-assign nullability-return object-size pointer-overflow return
  unsigned-integer-overflow returns-nonnull-attribute shift signed-integer-overflow
  unreachable vla-bound vptr
)

local -a languages
languages=(
  c c-header cpp-output c++ c++-header c++-cpp-output objective-c objective-c-header
  objective-c-cpp-output objective-c++ objective-c++-header objective-c++-cpp-output
  assembler assembler-with-cpp ada f77 f77-cpp-input f95 f95-cpp-input go java
  brig none
)

# warnings (from --help=warnings), note some -W options are listed by --help=common instead
warnings+=(
  '-Wabi-tag[warn if a subobject has an abi_tag attribute that the complete object type does not have]'
  '-Wabi[warn about things that will change when compiling with an ABI-compliant compiler]::'
  '-Waddress[warn about suspicious uses of memory addresses]'
  '-Waggregate-return[warn about returning structures, unions or arrays]'
  '-Waggressive-loop-optimizations[warn if a loop with constant number of iterations triggers undefined behavior]'
  '-Waliasing[warn about possible aliasing of dummy arguments]'
  '-Walign-commons[warn about alignment of COMMON blocks]'
  '-Waligned-new=[warn even if '\'new\'' uses a class member allocation function]:none|global|all: '
  '-Wall[enable most warning messages]'
  '-Walloca-larger-than=[warn on unbounded uses of alloca, and on bounded uses of alloca whose bound can be larger than <number> bytes]:bytes: '
  '-Walloca[warn on any use of alloca]'
  '-Walloc-size-larger-than=[warn for calls to allocation functions that attempt to allocate objects larger than the specified number of bytes]:bytes: '
  '-Walloc-zero[warn for calls to allocation functions that specify zero bytes]'
  '-Wampersand[warn about missing ampersand in continued character constants]'
  '-Wargument-mismatch[warn about type and rank mismatches between arguments and parameters]'
  '-Warray-bounds[warn if an array is accessed out of bounds]'
  '-Warray-bounds=[warn if an array is accessed out of bounds]:level:(1 2)'
  '-Warray-temporaries[warn about creation of array temporaries]'
  '-Wassign-intercept[warn whenever an Objective-C assignment is being intercepted by the garbage collector]'
  '-Wattributes[warn about inappropriate attribute usage]'
  '-Wbad-function-cast[warn about casting functions to incompatible types]'
  '-Wbool-compare[warn about boolean expression compared with an integer value different from true/false]'
  '-Wbool-operation[warn about certain operations on boolean expressions]'
  '-Wbuiltin-declaration-mismatch[warn when a built-in function is declared with the wrong signature]'
  '-Wbuiltin-macro-redefined[warn when a built-in preprocessor macro is undefined or redefined]'
  '-Wc++0x-compat[deprecated in favor of -Wc++11-compat]'
  '-Wc++11-compat[warn about C++ constructs whose meaning differs between ISO C++ 1998 and ISO C++ 2011]'
  '-Wc++14-compat[warn about C++ constructs whose meaning differs between ISO C++ 2011 and ISO C++ 2014]'
  '-Wc++1z-compat[warn about C++ constructs whose meaning differs between ISO C++ 2014 and (forthcoming) ISO C++ 201z(7?)]'
  '-Wc90-c99-compat[warn about features not present in ISO C90, but present in ISO C99]'
  '-Wc99-c11-compat[warn about features not present in ISO C99, but present in ISO C11]'
  '-Wcast-align[warn about pointer casts which increase alignment]'
  '-Wcast-qual[warn about casts which discard qualifiers]'
  '-Wc-binding-type[warn if the type of a variable might be not interoperable with C]'
  '-Wc++-compat[warn about C constructs that are not in the common subset of C and C++]'
  '-Wcharacter-truncation[warn about truncated character expressions]'
  '-Wchar-subscripts[warn about subscripts whose type is "char"]'
  '-Wchkp[warn about memory access errors found by Pointer Bounds Checker]'
  '-Wclobbered[warn about variables that might be changed by "longjmp" or "vfork"]'
  '-Wcomments[synonym for -Wcomment]'
  '-Wcomment[warn about possibly nested block comments, and C++ comments spanning more than one physical line]'
  '-Wcompare-reals[warn about equality comparisons involving REAL or COMPLEX expressions]'
  '-Wconditionally-supported[warn for conditionally-supported constructs]'
  '-Wconversion-extra[warn about most implicit conversions]'
  '-Wconversion-null[warn for converting NULL from/to a non-pointer type]'
  '-Wconversion[warn for implicit type conversions that may change a value]'
  '-Wcoverage-mismatch[warn in case profiles in -fprofile-use do not match]'
  '-Wcpp[warn when a #warning directive is encountered]'
  '-Wctor-dtor-privacy[warn when all constructors and destructors are private]'
  '-Wdangling-else[warn about dangling else]'
  '-Wdate-time[warn about __TIME__, __DATE__ and __TIMESTAMP__ usage]'
  '-Wdeclaration-after-statement[warn when a declaration is found after a statement]'
  '-Wdelete-incomplete[warn when deleting a pointer to incomplete type]'
  '-Wdelete-non-virtual-dtor[warn about deleting polymorphic objects with non- virtual destructors]'
  '-Wdeprecated-declarations[warn about uses of __attribute__((deprecated)) declarations]'
  '-Wdeprecated[warn if a deprecated compiler feature, class, method, or field is used]'
  '-Wdesignated-init[warn about positional initialization of structs requiring designated initializers]'
  '-Wdisabled-optimization[warn when an optimization pass is disabled]'
  '-Wdiscarded-array-qualifiers[warn if qualifiers on arrays which are pointer targets are discarded]'
  '-Wdiscarded-qualifiers[warn if type qualifiers on pointers are discarded]'
  '-Wdiv-by-zero[warn about compile-time integer division by zero]'
  '-Wdouble-promotion[warn about implicit conversions from "float" to "double"]'
  '-Wduplicated-branches[warn about duplicated branches in if-else statements]'
  '-Wduplicated-cond[warn about duplicated conditions in an if-else-if chain]'
  '-Wduplicate-decl-specifier[warn when a declaration has duplicate const, volatile, restrict or _Atomic specifier]'
  '-Weffc\+\+[warn about violations of Effective C++ style rules]'
  '-Wempty-body[warn about an empty body in an if or else statement]'
  '-Wendif-labels[warn about stray tokens after #else and #endif]'
  '-Wenum-compare[warn about comparison of different enum types]'
  # '-Werror-implicit-function-declaration[this switch is deprecated; use -Werror=implicit-fun]' # this still exists but makes completing -Werror= less convenient
  '-Wexpansion-to-defined[warn if "defined" is used outside #if]'
  '-Wextra[print extra (possibly unwanted) warnings]'
  '-Wfloat-conversion[warn for implicit type conversions that cause loss of floating point precision]'
  '-Wfloat-equal[warn if testing floating point numbers for equality]'
  '-Wformat-contains-nul[warn about format strings that contain NUL bytes]'
  '-Wformat-extra-args[warn if passing too many arguments to a function for its format string]'
  '-Wformat-nonliteral[warn about format strings that are not literals]'
  '-Wformat-overflow[warn about function calls with format strings that write past the end of the destination region]'
  '-Wformat-overflow=[warn about function calls with format strings that write past the end of the destination region]:level:(1 2)'
  '-Wformat-security[warn about possible security problems with format functions]'
  '-Wformat-signedness[warn about sign differences with format functions]'
  '-Wformat-truncation[warn about calls to snprintf and similar functions that truncate output. Same as -Wformat- truncation=1.  Same as -Wformat-truncation=]'
  '-Wformat-truncation=[warn about calls to snprintf and similar functions that truncate output]:level:(1 2)'
  '-Wformat=[warn about printf/scanf/strftime/strfmon format string anomalies]::level:(1 2)'
  '-Wformat-y2k[warn about strftime formats yielding 2-digit years]'
  '-Wformat-zero-length[warn about zero-length formats]'
  '-Wframe-address[warn when __builtin_frame_address or __builtin_return_address is used unsafely]'
  '-Wframe-larger-than=[warn if a function'\''s stack frame requires more than <number> bytes]:bytes: '
  '-Wfree-nonheap-object[warn when attempting to free a non-heap object]'
  '-Wfunction-elimination[warn about function call elimination]'
  '-Whsa[warn when a function cannot be expanded to HSAIL]'
  '-Wignored-attributes[warn whenever attributes are ignored]'
  '-Wignored-qualifiers[warn whenever type qualifiers are ignored]'
  '-Wimplicit-fallthrough=[warn when a switch case falls through]:level:(1 2 3 4 5)'
  '-Wimplicit-function-declaration[warn about implicit function declarations]'
  '-Wimplicit-interface[warn about calls with implicit interface]'
  '-Wimplicit-int[warn when a declaration does not specify a type]'
  '-Wimplicit-procedure[warn about called procedures not explicitly declared]'
  '-Wimplicit[warn about implicit declarations]'
  '-Wimport[warn about imports]'
  '-Wincompatible-pointer-types[warn when there is a conversion between pointers that have incompatible types]'
  '-Winherited-variadic-ctor[warn about C++11 inheriting constructors when the base has a variadic constructor]'
  '-Winit-self[warn about variables which are initialized to themselves]'
  '-Winline[warn when an inlined function cannot be inlined]'
  '-Wint-conversion[warn about incompatible integer to pointer and pointer to integer conversions]'
  '-Winteger-division[warn about constant integer divisions with truncated results]'
  '-Wint-in-bool-context[warn for suspicious integer expressions in boolean context]'
  '-Wintrinsic-shadow[warn if a user-procedure has the same name as an intrinsic]'
  '-Wintrinsics-std[warn on intrinsics not part of the selected standard]'
  '-Wint-to-pointer-cast[warn when there is a cast to a pointer from an integer of a different size]'
  '-Winvalid-memory-model[warn when an atomic memory model parameter is known to be outside the valid range]'
  '-Winvalid-offsetof[warn about invalid uses of the "offsetof" macro]'
  '-Winvalid-pch[warn about PCH files that are found but not used]'
  '-Wjump-misses-init[warn when a jump misses a variable initialization]'
  '-Wlarger-than=[warn if an object is larger than <number> bytes]:bytes: '
  '-Wline-truncation[warn about truncated source lines]'
  '-Wliteral-suffix[warn when a string or character literal is followed by a ud-suffix which does not begin with an underscore]'
  '-Wlogical-not-parentheses[warn when logical not is used on the left hand side operand of a comparison]'
  '-Wlogical-op[warn when a logical operator is suspiciously always evaluating to true or false]'
  '-Wlong-long[do not warn about using "long long" when -pedantic]'
  '-Wlto-type-mismatch[during link time optimization warn about mismatched types of global declarations]'
  '-Wmain[warn about suspicious declarations of "main"]'
  '-Wmaybe-uninitialized[warn about maybe uninitialized automatic variables]'
  '-Wmemset-elt-size[warn about suspicious calls to memset where the third argument contains the number of elements not multiplied by the element size]'
  '-Wmemset-transposed-args[warn about suspicious calls to memset where the third argument is constant literal zero and the second is not]'
  '-Wmisleading-indentation[warn when the indentation of the code does not reflect the block structure]'
  '-Wmissing-braces[warn about possibly missing braces around initializers]'
  '-Wmissing-declarations[warn about global functions without previous declarations]'
  '-Wmissing-field-initializers[warn about missing fields in struct initializers]'
  '-Wmissing-include-dirs[warn about user-specified include directories that do not exist]'
  '-Wmissing-parameter-type[warn about function parameters declared without a type specifier in K&R-style functions]'
  '-Wmissing-prototypes[warn about global functions without prototypes]'
  '-Wmudflap[warn about constructs not instrumented by -fmudflap]'
  '-Wmultichar[warn about use of multi-character character constants]'
  '-Wmultiple-inheritance[warn on direct multiple inheritance]'
  '-Wnamespaces[warn on namespace definition]'
  '-Wnarrowing[warn about narrowing conversions within { } that are ill-formed in C++11]'
  '-Wnested-externs[warn about "extern" declarations not at file scope]'
  '-Wnoexcept-type[warn if C++1z noexcept function type will change the mangled name of a symbol]'
  '-Wnoexcept[warn when a noexcept expression evaluates to false even though the expression can''t actually throw]'
  '-Wnonnull-compare[warn if comparing pointer parameter with nonnull attribute with NULL]'
  '-Wnonnull[warn about NULL being passed to argument slots marked as requiring non-NULL]'
  '-Wnonportable-cfstrings[warn on CFStrings containing nonportable characters]'
  '-Wnon-template-friend[warn when non-templatized friend functions are declared within a template]'
  '-Wnon-virtual-dtor[warn about non-virtual destructors]'
  '-Wnormalized=-[warn about non-normalised Unicode strings]:normalization:((id\:allow\ some\ non-nfc\ characters\ that\ are\ valid\ identifiers nfc\:only\ allow\ NFC nfkc\:only\ allow\ NFKC none\:allow\ any\ normalization)): '
  '-Wnull-dereference[warn if dereferencing a NULL pointer may lead to erroneous or undefined behavior]'
  '-Wodr[warn about some C++ One Definition Rule violations during link time optimization]'
  '-Wold-style-cast[warn if a C-style cast is used in a program]'
  '-Wold-style-declaration[warn for obsolescent usage in a declaration]'
  '-Wold-style-definition[warn if an old-style parameter definition is used]'
  '-Wopenmp-simd[warn if a simd directive is overridden by the vectorizer cost model]'
  '-Woverflow[warn about overflow in arithmetic expressions]'
  '-Woverlength-strings[warn if a string is longer than the maximum portable length specified by the standard]'
  '-Woverloaded-virtual[warn about overloaded virtual function names]'
  '-Woverride-init-side-effects[warn about overriding initializers with side effects]'
  '-Woverride-init[warn about overriding initializers without side effects]'
  '-Wpacked-bitfield-compat[warn about packed bit-fields whose offset changed in GCC 4.4]'
  '-Wpacked[warn when the packed attribute has no effect on struct layout]'
  '-Wpadded[warn when padding is required to align structure members]'
  '-Wparentheses[warn about possibly missing parentheses]'
  '-Wpedantic[issue warnings needed for strict compliance to the standard]'
  '-Wplacement-new=[warn for placement new expressions with undefined behavior]::level:(1 2)'
  '-Wpmf-conversions[warn when converting the type of pointers to member functions]'
  '-Wpointer-arith[warn about function pointer arithmetic]'
  '-Wpointer-compare[warn when a pointer is compared with a zero character constant]'
  '-Wpointer-sign[warn when a pointer differs in signedness in an assignment]'
  '-Wpointer-to-int-cast[warn when a pointer is cast to an integer of a different size]'
  '-Wpoison-system-directories[warn for -I and -L options using system directories if cross compiling]'
  '-Wpragmas[warn about misuses of pragmas]'
  '-Wproperty-assign-default[warn if a property for an Objective-C object has no assign semantics specified]'
  '-Wprotocol[warn if inherited methods are unimplemented]'
  '-Wpsabi[warn about psabi]'
  '-Wrealloc-lhs-all[warn when a left-hand-side variable is reallocated]'
  '-Wrealloc-lhs[warn when a left-hand-side array variable is reallocated]'
  '-Wreal-q-constant[warn about real-literal-constants with '\'q\'' exponent-letter]'
  '-Wredundant-decls[warn about multiple declarations of the same object]'
  '-Wregister[warn about uses of register storage specifier]'
  '-Wreorder[warn when the compiler reorders code]'
  '-Wrestrict[warn when an argument passed to a restrict- qualified parameter aliases with another argument]'
  '-Wreturn-local-addr[warn about returning a pointer/reference to a local or temporary variable]'
  '-Wreturn-type[warn whenever a function'\''s return type defaults to "int" (C), or about inconsistent return types (C++)]'
  '-Wscalar-storage-order[warn on suspicious constructs involving reverse scalar storage order]'
  '-Wselector[warn if a selector has multiple methods]'
  '-Wsequence-point[warn about possible violations of sequence point rules]'
  '-Wshadow-ivar[warn if a local declaration hides an instance variable]'
  '-Wshadow[warn when one variable shadows another.  Same as  -Wshadow=global]'
  '-Wshift-count-negative[warn if shift count is negative]'
  '-Wshift-count-overflow[warn if shift count >= width of type]'
  '-Wshift-negative-value[warn if left shifting a negative value]'
  '-Wshift-overflow[warn if left shift of a signed value overflows.  Same as -Wshift-overflow=]'
  '-Wshift-overflow=[warn if left shift of a signed value overflows]:level:(1 2)'
  '-Wsign-compare[warn about signed-unsigned comparisons]'
  '-Wsign-conversion[warn for implicit type conversions between signed and unsigned integers]'
  '-Wsign-promo[warn when overload promotes from unsigned to signed]'
  '-Wsized-deallocation[warn about missing sized deallocation functions]'
  '-Wsizeof-array-argument[warn when sizeof is applied on a parameter declared as an array]'
  '-Wsizeof-pointer-memaccess[warn about suspicious length parameters to certain string functions if the argument uses sizeof]'
  '-Wstack-protector[warn when not issuing stack smashing protection for some reason]'
  '-Wstack-usage=[warn if stack usage might be larger than specified amount]:bytes: '
  '-Wstrict-aliasing[warn about code which might break strict aliasing rules]'
  '-Wstrict-aliasing=-[warn about code which might break strict aliasing rules]:level of checking (higher is more accurate):(1 2 3)'
  '-Wstrict-null-sentinel[warn about uncasted NULL used as sentinel]'
  '-Wstrict-overflow[warn about optimizations that assume that signed overflow is undefined]'
  '-Wstrict-overflow=-[warn about optimizations that assume that signed overflow is undefined]:level of checking (higher finds more cases):(1 2 3 4 5)'
  '-Wstrict-prototypes[warn about unprototyped function declarations]'
  '-Wstrict-selector-match[warn if type signatures of candidate methods do not match exactly]'
  '-Wstringop-overflow=[under the control of Object Size type, warn about buffer overflow in string manipulation functions like memcpy and strcpy]:level:(1 2 3 4)'
  '-Wstringop-overflow[warn about buffer overflow in string manipulation functions like memcpy and strcpy.  Same as  -Wstringop-overflow=]'
  '-Wsubobject-linkage[warn if a class type has a base or a field whose type uses the anonymous namespace or depends on a type with no linkage]'
  '*-Wsuggest-attribute=-[warn about functions that might be candidates for attributes]:attribute:(pure const noreturn format)'
  '-Wsuggest-final-methods[warn about C++ virtual methods where adding final keyword would improve code quality]'
  '-Wsuggest-final-types[warn about C++ polymorphic types where adding final keyword would improve code quality]'
  '-Wsuggest-override[suggest that the override keyword be used when the declaration of a virtual function overrides another]'
  '-Wsurprising[warn about "suspicious" constructs]'
  '-Wswitch-bool[warn about switches with boolean controlling expression]'
  '-Wswitch-default[warn about enumerated switches missing a "default-" statement]'
  '-Wswitch-enum[warn about all enumerated switches missing a specific case]'
  '-Wswitch-unreachable[warn about statements between switch'\''s controlling expression and the first case]'
  '-Wswitch[warn about enumerated switches, with no default, missing a case]'
  '-Wsync-nand[warn when __sync_fetch_and_nand and __sync_nand_and_fetch built-in functions are used]'
  '-Wsynth[deprecated. This switch has no effect]'
  '-Wsystem-headers[do not suppress warnings from system headers]'
  '-Wtabs[permit nonconforming uses of the tab character]'
  '-Wtarget-lifetime[warn if the pointer in a pointer assignment might outlive its target]'
  '-Wtautological-compare[warn if a comparison always evaluates to true or false]'
  '-Wtemplates[warn on primary template declaration]'
  '-Wterminate[warn if a throw expression will always result in a call to terminate()]'
  '-W[this switch is deprecated; use -Wextra instead]'
  '-Wtraditional-conversion[warn of prototypes causing type conversions different from what would happen in the absence of prototype]'
  '-Wtraditional[warn about features not present in traditional C]'
  '-Wtrampolines[warn whenever a trampoline is generated]'
  '-Wtrigraphs[warn if trigraphs are encountered that might affect the meaning of the program]'
  '-Wtype-limits[warn if a comparison is always true or always false due to the limited range of the data type]'
  '-Wundeclared-selector[warn about @selector()s without previously declared methods]'
  '-Wundefined-do-loop[warn about an invalid DO loop]'
  '-Wundef[warn if an undefined macro is used in an #if directive]'
  '-Wunderflow[warn about underflow of numerical constant expressions]'
  '-Wuninitialized[warn about uninitialized automatic variables]'
  '-Wunknown-pragmas[warn about unrecognized pragmas]'
  '-Wunsafe-loop-optimizations[warn if the loop cannot be optimized due to nontrivial assumptions]'
  '-Wunsuffixed-float-constants[warn about unsuffixed float constants]'
  '-Wunused-but-set-parameter[warn when a function parameter is only set, otherwise unused]'
  '-Wunused-but-set-variable[warn when a variable is only set, otherwise unused]'
  '-Wunused-const-variable[warn when a const variable is unused.  Same as  -Wunused-const-variable=]'
  '-Wunused-const-variable=[warn when a const variable is unused]:level:(1 2)'
  '-Wunused-dummy-argument[warn about unused dummy arguments]'
  '-Wunused[enable all -Wunused- warnings]'
  '-Wunused-function[warn when a function is unused]'
  '-Wunused-label[warn when a label is unused]'
  '-Wunused-local-typedefs[warn when typedefs locally defined in a function are not used]'
  '-Wunused-macros[warn about macros defined in the main file that are not used]'
  '-Wunused-parameter[warn when a function parameter is unused]'
  '-Wunused-result[warn if a caller of a function, marked with attribute warn_unused_result, does not use its return value]'
  '-Wunused-value[warn when an expression value is unused]'
  '-Wunused-variable[warn when a variable is unused]'
  '-Wuseless-cast[warn about useless casts]'
  '-Wuse-without-only[warn about USE statements that have no ONLY qualifier]'
  '-Wvarargs[warn about questionable usage of the macros used to retrieve variable arguments]'
  '-Wvariadic-macros[warn about using variadic macros]'
  '-Wvector-operation-performance[warn when a vector operation is compiled outside the SIMD]'
  '-Wvirtual-inheritance[warn on direct virtual inheritance]'
  '-Wvirtual-move-assign[warn if a virtual base has a non-trivial move assignment operator]'
  '-Wvla-larger-than=[warn on unbounded uses of variable-length arrays, and on bounded uses of variable-length arrays whose bound can be larger than <number> bytes]:bytes: ' 
  '-Wvla[warn if a variable length array is used]'
  '-Wvolatile-register-var[warn when a register variable is declared volatile]'
  '-Wwrite-strings[in C++, nonzero means warn about deprecated conversion from string literals to '\''char *'\''.  In C, similar warning, except that the conversion is]'
  '-Wzero-as-null-pointer-constant[warn when a literal '\''0'\'' is used as null pointer]'
  '-Wzerotrip[warn about zero-trip DO loops]'
)

# clang specific warnings
if [[ "$service" = clang* ]]; then
  warnings+=(
    '-Wlarge-by-value-copy=[warn on large by value copy]:argument'
    '-Wunreachable-code-aggressive[controls -Wunreachable-code, -Wunreachable-code-break, -Wunreachable-code-return]'
    '-Wunreachable-code-break[warn when break will never be executed]'
    '-Wunreachable-code-loop-increment[warn when loop will be executed only once]'
    '-Wunreachable-code-return[warn when return will not be executed]'
    '-Wunreachable-code[warn on code that will not be executed]'
  )
else
  warnings+=(
    '-Wunreachable-code[does nothing. Preserved for backward compatibility]'
  )
fi

args+=(
  {'*-A-','*--assert='}'[make an assertion]:define assertion:'
  "--all-warnings[display all warnings]"
  {-ansi,--ansi}"[same as -std=c89 or -std=c++98]"
  '-aux-info[emit declaration information into <file>]:file:_files'
  {'-B-','--prefix='}'[add <prefix> to the compiler'\''s search paths]:executable prefix:_files -/'
  '-b[specify target machine to compile to]:target machine:'
  {-CC,--comments-in-macros}'[do not discard comments, including macro expansion]'
  {-C,--comments}'[do not discard comments during preprocess]'
  {-c,--compile}'[compile and assemble, but do not link]'
  {'*-D-','*--define-macro='}'[define a macro]:define macro:'
  '-d-[dump the state of the preprocessor]:dump:->dump'
  '--dependencies[generate Makefile dependencies]'
  '-dumpbase[set the file basename to be used for dumps]:file:_files'
  '-dumpdir[set the directory name to be used for dumps]:file:_files -/'
  '-dumpmachine[display the compiler'\''s target processor]'
  '-dumpspecs[display all of the built in spec strings]'
  '-dumpversion[display the version of the compiler]'
  '+e-[control how virtual function definitions are used]:virtual function definitions in classes:((0\:only\ interface 1\:generate\ code))'
  {-e,--entry}"[specify program entry point is entry]:entry"
  {-E,--preprocess}'[preprocess only; do not compile, assemble or link]'
  '-fabi-version=-[use version <n> of the C++ ABI (default: 2)]:ABI version:(1 2 3 4 5 6)'
  "-fada-spec-parent=[dump Ada specs as child units of given parent]"
  '-faggressive-loop-optimizations[aggressively optimize loops using language constraints]'
  '-falign-functions[align the start of functions]'
  '-falign-jumps[align labels which are only reached by jumping]'
  '-falign-labels[align all labels]'
  '-falign-loops[align the start of loops]'
  "-fallow-parameterless-variadic-functions[allow variadic functions without named parameter]"
  "-fasm[recognize the asm keyword]"
  '-fassociative-math[allow optimization for floating-point arithmetic which may change the result of the operation due to rounding]'
  '-fasynchronous-unwind-tables[generate unwind tables that are exact at each instruction boundary]'
  '-fauto-inc-dec[generate auto-inc/dec instructions]'
  '-fbounds-check[generate code to check bounds before indexing arrays]'
  '-fbranch-count-reg[replace add, compare, branch with branch on count register]'
  '-fbranch-probabilities[use profiling information for branch probabilities]'
  '-fbranch-target-load-optimize2[perform branch target load optimization after prologue / epilogue threading]'
  '-fbranch-target-load-optimize[perform branch target load optimization before prologue / epilogue threading]'
  '-fbtr-bb-exclusive[restrict target load migration not to re-use registers in any basic block]'
  "-fbuilding-libgcc[specify building libgcc]"
  "-fbuiltin[recognize builtin functions]"
  '-fcaller-saves[save registers around function calls]'
  '-fcall-saved--[mark <register> as being preserved across functions]:register'
  '-fcall-used--[mark <register> as being corrupted by function calls]:register'
  "-fcanonical-system-headers[where shorter use canonicalized paths to system headers]"
  '-fcheck-data-deps[compare the results of several data dependence analyzers]'
  "-fcheck-pointer-bounds[add pointer bounds checker instrumentation]"
  "-fchkp-check-incomplete-type[generate pointer bounds check for variables with incomplete type]"
  "-fchkp-check-read[generate checks for all read accesses to memory]"
  "-fchkp-check-write[generate checks for all write accesses to memory]"
  "-fchkp-first-field-has-own-bounds[forces checker to use narrowed bounds for address of the first field]"
  "-fchkp-instrument-calls[generate bounds passing for calls]"
  "-fchkp-instrument-marked-only[instrument only functions marked with bnd_instrument attribute]"
  "-fchkp-narrow-bounds[control how checker handle pointers to object fields]"
  "-fchkp-narrow-to-innermost-array[forces checker to use bounds of the innermost arrays in case of nested static array access]"
  "-fchkp-optimize[allow checker optimizations]"
  "-fchkp-store-bounds[generate bounds stores for pointer writes]"
  "-fchkp-treat-zero-dynamic-size-as-infinite[with this option zero size obtained dynamically for objects with incomplete type will be treated as infinite]"
  "-fchkp-use-fast-string-functions[allow to use *_nobnd versions of string functions]"
  "-fchkp-use-nochk-string-functions[allow to use *_nochk versions of string functions]"
  "-fchkp-use-static-bounds[use statically initialized variable for vars bounds instead of generating them each time it is required]"
  "-fchkp-use-static-const-bounds[use statically initialized variable for constant bounds]"
  "-fchkp-use-wrappers[transform instrumented builtin calls into calls to wrappers]"
  "-fchkp-zero-input-bounds-for-main[use zero bounds for all incoming arguments in main function]"
  "-fcilkplus[enable Cilk Plus]"
  '-fcode-hoisting[enable code hoisting]'
  '-fcombine-stack-adjustments[looks for opportunities to reduce stack adjustments and stack references]'
  '-fcommon[do not put uninitialized globals in the common section]'
  '-fcompare-debug=-[compile with and without e.g. -gtoggle, and compare the final-insns dump]:opts:' #TODO: complete gcc options here
  '-fcompare-debug-second[run only the second compilation of -fcompare-debug]'
  '-fcompare-elim[perform comparison elimination after register allocation has finished]'
  "-fcond-mismatch[allow the arguments of the ? operator to have different types]"
  '-fconserve-stack[do not perform optimizations increasing noticeably stack usage]'
  '-fcprop-registers[perform a register copy-propagation optimization pass]'
  '-fcrossjumping[perform cross-jumping optimization]'
  '-fcse-follow-jumps[when running CSE, follow jumps to their targets]'
  '-fcx-fortran-rules[complex multiplication and division follow Fortran rules]'
  '-fcx-limited-range[omit range reduction step when performing complex division]'
  '-fdata-sections[place data items into their own section]'
  '-fdbg-cnt=-[,<counter>-<limit>,...) Set the debug counter limit]:counter\:limit,...: ' #TODO: gcc -fdbg-cnt-list -x c /dev/null -o /dev/null -c
  '-fdbg-cnt-list[list all available debugging counters with their limits and counts]'
  '-fdce[use the RTL dead code elimination pass]'
  "-fdebug-cpp[emit debug annotations during preprocessing]"
  '-fdebug-prefix-map=-[map one directory name to another in debug information]:/old/dir=/new/dir:->dirtodir'
  '-fdebug-types-section[output .debug_types section when using DWARF v4 debuginfo]'
  '-fdefer-pop[defer popping functions args from stack until later]'
  '-fdelayed-branch[attempt to fill delay slots of branch instructions]'
  '-fdelete-dead-exceptions[delete dead instructions that may throw exceptions]'
  '-fdelete-null-pointer-checks[delete useless null pointer checks]'
  '-fdevirtualize-speculatively[perform speculative devirtualization]'
  '-fdevirtualize[try to convert virtual calls to direct ones]'
  '-fdiagnostics-color=-[colorize diagnostics]::color:(never always auto)'
  '-fdiagnostics-generate-patch[print fix-it hints to stderr in unified diff format]'
  '-fdiagnostics-parseable-fixits[print fixit hints in machine-readable form]'
  '-fdiagnostics-show-caret[show the source line with a caret indicating the column]'
  '-fdiagnostics-show-location=-[how often to emit source location at the beginning of line-wrapped diagnostics]:source location:(once every-line)'
  '-fdiagnostics-show-option[amend appropriate diagnostic messages with the command line option that controls them]'
  "-fdirectives-only[preprocess directives only]"
  "-fdollars-in-identifiers[permit $ as an identifier character]"
  '-fdse[use the RTL dead store elimination pass]'
  "-fdump-ada-spec-slim[write all declarations as Ada code for the given file only]"
  "-fdump-ada-spec[write all declarations as Ada code transitively]"
  '-fdump-final-insns=-[dump to filename the insns at the end of translation]:filename:_files'
  '-fdump-go-spec=-[write all declarations to file as Go code]:filename:_files'
  '-fdump-noaddr[suppress output of addresses in debugging dumps]'
  '-fdump-passes[dump optimization passes]'
  '-fdump-unnumbered-links[suppress output of previous and next insn numbers in debugging dumps]'
  '-fdump-unnumbered[suppress output of instruction numbers, line number notes and addresses in debugging dumps]'
  '-fdwarf2-cfi-asm[enable CFI tables via GAS assembler directives]'
  '-fearly-inlining[perform early inlining]'
  '-feliminate-dwarf2-dups[perform DWARF2 duplicate elimination]'
  '-feliminate-unused-debug-symbols[perform unused type elimination in debug info]'
  '-feliminate-unused-debug-types[perform unused type elimination in debug info]'
  '-femit-class-debug-always[do not suppress C++ class debug information]'
  "-femit-struct-debug-baseonly[aggressive reduced debug info for structs]"
  "-femit-struct-debug-detailed=[detailed reduced debug info for structs]:spec list"
  "-femit-struct-debug-reduced[conservative reduced debug info for structs]"
  '-fexceptions[enable exception handling]'
  '-fexcess-precision=-[specify handling of excess floating-point precision]:precision handling:(fast standard)'
  "-fexec-charset=[convert all strings and character constants to character set]:character set"
  '-fexpensive-optimizations[perform a number of minor, expensive optimizations]'
  "-fextended-identifiers[permit universal character names in identifiers]"
  '-ffast-math[sets -fno-math-errno, -funsafe-math-optimizations, -ffinite-math-only, -fno-rounding-math, -fno-signaling-nans and -fcx-limited-range]'
  '-ffat-lto-objects[output lto objects containing both the intermediate language and binary output]'
  '-ffinite-math-only[assume no NaNs or infinities are generated]'
  '-ffixed--[mark <register> as being unavailable to the compiler]:register'
  '-ffloat-store[don'\''t allocate floats and doubles in extended- precision registers]'
  '-fforward-propagate[perform a forward propagation pass on RTL]'
  '-ffp-contract=-[perform floating- point expression contraction (default: fast)]:style:(on off fast)'
  '-ffp-contract=[perform floating-point expression contraction]:style:(off on fast)'
  '-ffp-int-builtin-inexact[allow built-in functions ceil, floor, round, trunc to raise "inexact" exceptions]'
  "-ffreestanding[do not assume that standard C libraries and main exist]"
  '-ffunction-cse[allow function addresses to be held in registers]'
  '-ffunction-sections[place each function into its own section]'
  '-fgcse-after-reload[perform global common subexpression elimination after register allocation has finished]'
  '-fgcse-las[perform redundant load after store elimination in global common subexpression elimination]'
  '-fgcse-lm[perform enhanced load motion during global common subexpression elimination]'
  '-fgcse[perform global common subexpression elimination]'
  '-fgcse-sm[perform store motion after global common subexpression elimination]'
  "-fgnu89-inline[use traditional GNU semantics for inline functions]"
  '-fgnu-tm[enable support for GNU transactional memory]'
  '-fgraphite[enable in and out of Graphite representation]'
  '-fgraphite-identity[enable Graphite Identity transformation]'
  '-fguess-branch-probability[enable guessing of branch probabilities]'
  '-fhoist-adjacent-loads[enable hoisting adjacent loads to encourage generating conditional move instructions]'
  "-fhosted[assume normal C execution environment]"
  '-fif-conversion2[perform conversion of conditional jumps to conditional execution]'
  '-fif-conversion[perform conversion of conditional jumps to branchless equivalents]'
  '-findirect-inlining[perform indirect inlining]'
  '-finhibit-size-directive[do not generate .size directives]'
  '-finline-atomics[inline __atomic operations when a lock free instruction sequence is available]'
  '-finline[enable inlining of function declared "inline", disabling disables all inlining]'
  '-finline-functions-called-once[integrate functions only required by their single caller]'
  '-finline-functions[integrate functions not declared "inline" into their callers when profitable]'
  '-finline-limit=-[limit the size of inlined functions to <number>]:number: '
  '-finline-small-functions[integrate functions into their callers when code size is known not to grow]'
  "-finput-charset=[specify the default character set for source files]:character set"
  '-finstrument-functions-exclude-file-list=-[do not instrument functions listed in files]:comma-separated file list:->commafiles'
  '-finstrument-functions-exclude-function-list=-[do not instrument listed functions]:comma-separated list of syms: '
  '-finstrument-functions[instrument function entry and exit with profiling calls]'
  '-fipa-bit-cp[perform interprocedural bitwise constant propagation]'
  '-fipa-cp-clone[perform cloning to make Interprocedural constant propagation stronger]'
  '-fipa-cp[perform interprocedural constant propagation]'
  '-fipa-icf-functions[perform Identical Code Folding for functions]'
  '-fipa-icf[perform Identical Code Folding for functions and read-only variables]'
  '-fipa-icf-variables[perform Identical Code Folding for variables]'
  '-fipa-profile[perform interprocedural profile propagation]'
  '-fipa-pta[perform interprocedural points-to analysis]'
  '-fipa-pure-const[discover pure and const functions]'
  '-fipa-ra[use caller save register across calls if possible]'
  '-fipa-reference[discover readonly and non addressable static variables]'
  '-fipa-sra[perform interprocedural reduction of aggregates]'
  '-fipa-vrp[perform IPA Value Range Propagation]'
  '-fira-algorithm=[set the used IRA algorithm]:algorithm:(cb priority)'
  '-fira-hoist-pressure[use IRA based register pressure calculation in RTL hoist optimizations]'
  '-fira-loop-pressure[use IRA based register pressure calculation in RTL loop optimizations]'
  '-fira-region=-[set regions for IRA]:region:(all mixed one)'
  '-fira-region=[set regions for IRA]:region:(one all mixed)'
  '-fira-share-save-slots[share slots for saving different hard registers]'
  '-fira-share-spill-slots[share stack slots for spilled pseudo-registers]'
  '-fira-verbose=-[control IRA'\''s level of diagnostic messages]:verbosity: '
  '-fisolate-erroneous-paths-attribute[detect paths that trigger erroneous or undefined behavior due to a null value being used in a way forbidden by a returns_nonnull or]'
  '-fisolate-erroneous-paths-dereference[detect paths that trigger erroneous or undefined behavior due to dereferencing a null pointer.  Isolate those paths from the main]'
  '-fivopts[optimize induction variables on trees]'
  '-fjump-tables[use jump tables for sufficiently large switch statements]'
  '-fkeep-inline-functions[generate code for functions even if they are fully inlined]'
  '-fkeep-static-consts[emit static const variables even if they are not used]'
  "-flax-vector-conversions[allow implicit conversions between vectors with differing numbers of subparts and/or differing element types]"
  '-fleading-underscore[give external symbols a leading underscore]'
  '-flifetime-dse[tell DSE that the storage for a C++ object is dead when the constructor starts and when the destructor finishes]'
  '-flive-range-shrinkage[relief of register pressure through live range shrinkage]'
  '-floop-nest-optimize[enable the loop nest optimizer]'
  '-floop-parallelize-all[mark all loops as parallel]'
  '-flra-remat[do CFG-sensitive rematerialization in LRA]'
  '-flto-compression-level=-[use specified zlib compression level for IL]:compression level: '
  '-flto-odr-type-merging[merge C++ types using One Definition Rule]'
  '-flto-partition=-[partition symbols and vars at linktime based on object files they originate from]:partitioning algorithm:(1to1 balanced max one none)'
  '-flto-report[report various link-time optimization statistics]'
  '-fmath-errno[set errno after built-in math functions]'
  '-fmax-errors=-[maximum number of errors to report]:errors: '
  '-fmem-report[report on permanent memory allocation]'
  '-fmem-report-wpa[report on permanent memory allocation in WPA only]'
  '-fmerge-all-constants[attempt to merge identical constants and constant variables]'
  '-fmerge-constants[attempt to merge identical constants across compilation units]'
  '-fmerge-debug-strings[attempt to merge identical debug strings across compilation units]'
  '-fmessage-length=-[limit diagnostics to <number> characters per line.  0 suppresses line-wrapping]:length: '
  '-fmodulo-sched-allow-regmoves[perform SMS based modulo scheduling with register moves allowed]'
  '-fmodulo-sched[perform SMS based modulo scheduling before the first scheduling pass]'
  '-fmove-loop-invariants[move loop invariant computations out of loops]'
  "-fms-extensions[don't warn about uses of Microsoft extensions]"
  "-fmudflapir[this switch lacks documentation]"
  "-fmudflap[this switch lacks documentation]"
  "-fmudflapth[this switch lacks documentation]"
  '-fnon-call-exceptions[support synchronous non-call exceptions]'
  '-fno-stack-limit[do not limit the size of the stack]'
  '-fno-threadsafe-statics[do not generate thread-safe code for initializing local statics]'
  '-fnothrow-opt[treat a throw() exception specification as noexcept to improve code size]'
  '-fomit-frame-pointer[when possible do not generate stack frames]'
  "-fopenacc[enable OpenACC]"
  "-fopenmp[enable OpenMP (implies -frecursive in Fortran)]"
  "-fopenmp-simd[enable OpenMP's SIMD directives]"
  '-foptimize-sibling-calls[optimize sibling and tail recursive calls]'
  '-foptimize-strlen[enable string length optimizations on trees]'
  '-fopt-info[enable all optimization info dumps on stderr]'
  '-fopt-info-type=-[dump compiler optimization details]:filename:_files'
  '-fpack-struct[pack structure members together without holes]'
  '-fpack-struct=[set initial maximum structure member alignment]:alignment (power of 2): '
  '-fpartial-inlining[perform partial inlining]'
  '-fpcc-struct-return[return small aggregates in memory, not registers]'
  "-fpch-deps[this switch lacks documentation]"
  "-fpch-preprocess[look for and use PCH files even when preprocessing]"
  '-fpeel-loops[perform loop peeling]'
  '-fpeephole2[enable an RTL peephole pass before sched2]'
  '-fpeephole[enable machine specific peephole optimizations]'
  '-fPIC[generate position-independent code if possible (large mode)]'
  '-fpic[generate position-independent code if possible (small mode)]'
  '-fPIE[generate position-independent code for executables if possible (large mode)]'
  '-fpie[generate position-independent code for executables if possible (small mode)]'
  "-fplan9-extensions[enable Plan 9 language extensions]"
  '-fplt[use PLT for PIC calls (-fno-plt- load the address from GOT at call site)]'
  '-fplugin-arg--[specify argument <key>=<value> for plugin <name>]:-fplugin-arg-name-key=value: ' #TODO
  '-fplugin=-[specify a plugin to load]:plugin: ' # TODO: complete plugins?
  '-fpost-ipa-mem-report[report on memory allocation before interprocedural optimization]'
  '-fpredictive-commoning[run predictive commoning optimization]'
  '-fprefetch-loop-arrays[generate prefetch instructions, if available, for arrays in loops]'
  '-fpre-ipa-mem-report[report on memory allocation before interprocedural optimization]'
  "-fpreprocessed[treat the input file as already preprocessed]"
  '-fprintf-return-value[treat known sprintf return values as constants]'
  '-fprofile-arcs[insert arc-based program profiling code]'
  '-fprofile-correction[enable correction of flow inconsistent profile data input]'
  '-fprofile-dir=-[set the top-level directory for storing the profile data]:profile directory:_files -/'
  '-fprofile[enable basic program profiling code]'
  '-fprofile-generate[enable common options for generating profile info for profile feedback directed optimizations]'
  '-fprofile-report[report on consistency of profile]'
  '-fprofile-use[enable common options for performing profile feedback directed optimizations]'
  '-fprofile-values[insert code to profile values of expressions]'
  '-frandom-seed=-[use <string> as random seed]:seed: '
  '-freciprocal-math[same as -fassociative-math for expressions which include division]'
  '-frecord-gcc-switches[record gcc command line switches in the object file]'
  '-free[turn on Redundant Extensions Elimination pass]'
  '-freg-struct-return[return small aggregates in registers]'
  '-frename-registers[perform a register renaming optimization pass]'
  '-freorder-blocks-algorithm=[set the used basic block reordering algorithm]:algorithm:(simple stc)'
  '-freorder-blocks-and-partition[reorder basic blocks and partition into hot and cold sections]'
  '-freorder-blocks[reorder basic blocks to improve code placement]'
  '-freorder-functions[reorder functions to improve code placement]'
  '-frequire-return-statement[functions which return values must end with return statements]'
  '-frerun-cse-after-loop[add a common subexpression elimination pass after loop optimizations]'
  '-freschedule-modulo-scheduled-loops[enable/disable the traditional scheduling in loops that already passed modulo scheduling]'
  '-frounding-math[disable optimizations that assume default FP rounding behavior]'
  '-frtti[generate run time type descriptor information]'
  "-fsanitize=-[enable AddressSanitizer, a memory error detector]:style:($sanitizers)"
  '-fsched2-use-superblocks[if scheduling post reload, do superblock scheduling]'
  '-fsched-critical-path-heuristic[enable the critical path heuristic in the scheduler]'
  '-fsched-dep-count-heuristic[enable the dependent count heuristic in the scheduler]'
  '-fsched-group-heuristic[enable the group heuristic in the scheduler]'
  '-fsched-interblock[enable scheduling across basic blocks]'
  '-fsched-last-insn-heuristic[enable the last instruction heuristic in the scheduler]'
  '-fsched-pressure[enable register pressure sensitive insn scheduling]'
  '-fsched-rank-heuristic[enable the rank heuristic in the scheduler]'
  '-fsched-spec[allow speculative motion of non-loads]'
  '-fsched-spec-insn-heuristic[enable the speculative instruction heuristic in the scheduler]'
  '-fsched-spec-load[allow speculative motion of some loads]'
  '-fsched-spec-load-dangerous[allow speculative motion of more loads]'
  '-fsched-stalled-insns[allow premature scheduling of queued insns]'
  '-fsched-stalled-insns-dep[set dependence distance checking in premature scheduling of queued insns]'
  '-fsched-stalled-insns-dep=[set dependence distance checking in premature scheduling of queued insns]:insns:'
  '-fsched-stalled-insns-dep=-[set dependence distance checking in premature scheduling of queued insns]:instructions: '
  '-fsched-stalled-insns=[set number of queued insns that can be prematurely scheduled]:insns:'
  '-fsched-stalled-insns=-[set number of queued insns that can be prematurely scheduled]:instructions: '
  '-fschedule-fusion[perform a target dependent instruction fusion optimization pass]'
  '-fschedule-insns2[reschedule instructions after register allocation]'
  '-fschedule-insns[reschedule instructions before register allocation]'
  '-fsched-verbose=-[set the verbosity level of the scheduler]:verbosity: '
  '-fsection-anchors[access data in the same section from shared anchor points]'
  '-fselective-scheduling2[run selective scheduling after reload]'
  '-fselective-scheduling[schedule instructions using selective scheduling algorithm]'
  '-fsel-sched-pipelining-outer-loops[perform software pipelining of outer loops during selective scheduling]'
  '-fsel-sched-pipelining[perform software pipelining of inner loops during selective scheduling]'
  '-fsel-sched-reschedule-pipelined[reschedule pipelined regions without pipelining]'
  "-fshort-double[use the same size for double as for float]"
  '-fshort-enums[use the narrowest integer type possible for enumeration types]'
  '-fshort-wchar[force the underlying type for "wchar_t" to be "unsigned short"]'
  '-fshow-column[show column numbers in diagnostics, when available]'
  '-fshrink-wrap[emit function prologues only before parts of the function that need it, rather than at the top of the function]'
  '-fshrink-wrap-separate[shrink-wrap parts of the prologue and epilogue separately]'
  '-fsignaling-nans[disable optimizations observable by IEEE signaling NaNs]'
  "-fsigned-bitfields[when signed or unsigned is not given make the bitfield signed]"
  "-fsigned-char[make char signed by default]"
  '-fsigned-zeros[disable floating point optimizations that ignore the IEEE signedness of zero]'
  '-fsimd-cost-model=[specifies the vectorization cost model for code marked with a simd directive]:model:(unlimited dynamic cheap)'
  '-fsingle-precision-constant[convert floating point constants to single precision constants]'
  '-fsplit-ivs-in-unroller[split lifetimes of induction variables when loops are unrolled]'
  '-fsplit-loops[perform loop splitting]'
  '-fsplit-paths[split paths leading to loop backedges]'
  '-fsplit-stack[generate discontiguous stack frames]'
  '-fsplit-wide-types[split wide types into independent registers]'
  '-fssa-backprop[enable backward propagation of use properties at the SSA level]'
  '-fssa-phiopt[optimize conditional patterns using SSA PHI nodes]'
  '-fstack-check=-[insert stack checking code into the program.  -fstack-check=specific if to argument given]:type:(none generic specific)'
  '-fstack-limit-register=-[trap if the stack goes past <register>]:register: '
  '-fstack-limit-symbol=-[trap if the stack goes past symbol <name>]:name: '
  '-fstack-protector-all[use a stack protection method for every function]'
  '-fstack-protector-explicit[use stack protection method only for functions with the stack_protect attribute]'
  '-fstack-protector-strong[use a smart stack protection method for certain functions]'
  '-fstack-protector[use propolice as a stack protection method]'
  '-fstack-reuse=[set stack reuse level for local variables]:level:(all named_vars none)'
  '-fstack-reuse=-[set stack reuse level for local variables]:reuse-level:(all named_vars none)'
  '-fstack-usage[output stack usage information on a per-function basis]'
  '-fstdarg-opt[optimize amount of stdarg registers saved to stack at start of function]'
  '-fstore-merging[merge adjacent stores]'
  '-fstrict-aliasing[assume strict aliasing rules apply]'
  '-fstrict-enums[assume that values of enumeration type are always within the minimum range of that type]'
  '-fstrict-overflow[treat signed overflow as undefined]'
  '-fstrict-volatile-bitfields[force bitfield accesses to match their type width]'
  '-fsync-libcalls[implement __atomic operations via libcalls to legacy __sync functions]'
  '-fsyntax-only[check for syntax errors, then stop]'
  "-ftabstop=[distance between tab stops for column reporting]:number"
  '-ftest-coverage[create data files needed by "gcov"]'
  '-fthread-jumps[perform jump threading optimizations]'
  '-ftime-report[report the time taken by each compiler pass]'
  '-ftls-model=-[set the default thread-local storage code generation model]:TLS model:(global-dynamic local-dynamic initial-exec local-exec)'
  '-ftracer[perform superblock formation via tail duplication]'
  "-ftrack-macro-expansion=[track locations of tokens coming from macro expansion and display them in error messages]::argument"
  '-ftrapping-math[assume floating-point operations can trap]'
  '-ftrapv[trap for signed overflow in addition, subtraction and multiplication]'
  '-ftree-bit-ccp[enable SSA-BIT-CCP optimization on trees]'
  '-ftree-builtin-call-dce[enable conditional dead code elimination for builtin calls]'
  '-ftree-ccp[enable SSA-CCP optimization on trees]'
  '-ftree-ch[enable loop header copying on trees]'
  '-ftree-coalesce-vars[enable SSA coalescing of user variables]'
  '-ftree-copy-prop[enable copy propagation on trees]'
  '-ftree-cselim[transform condition stores into unconditional ones]'
  '-ftree-dce[enable SSA dead code elimination optimization on trees]'
  '-ftree-dominator-opts[enable dominator optimizations]'
  '-ftree-dse[enable dead store elimination]'
  '-ftree-forwprop[enable forward propagation on trees]'
  '-ftree-fre[enable Full Redundancy Elimination (FRE) on trees]'
  '-ftree-loop-distribute-patterns[enable loop distribution for patterns transformed into a library call]'
  '-ftree-loop-distribution[enable loop distribution on trees]'
  '-ftree-loop-if-convert[convert conditional jumps in innermost loops to branchless equivalents]'
  '-ftree-loop-im[enable loop invariant motion on trees]'
  '-ftree-loop-ivcanon[create canonical induction variables in loops]'
  '-ftree-loop-linear[enable loop interchange transforms.  Same as  -floop-interchange]'
  '-ftree-loop-optimize[enable loop optimizations on tree level]'
  '-ftree-loop-vectorize[enable loop vectorization on trees]'
  '-ftree-lrs[perform live range splitting during the SSA- >normal pass]'
  '-ftree-parallelize-loops=[enable automatic parallelization of loops]'
  '-ftree-parallelize-loops=-[enable automatic parallelization of loops]:threads: '
  '-ftree-partial-pre[in SSA-PRE optimization on trees, enable partial- partial redundancy elimination]'
  '-ftree-phiprop[enable hoisting loads from conditional pointers]'
  '-ftree-pre[enable SSA-PRE optimization on trees]'
  '-ftree-pta[perform function-local points-to analysis on trees]'
  '-ftree-reassoc[enable reassociation on tree level]'
  '-ftree-scev-cprop[enable copy propagation of scalar-evolution information]'
  '-ftree-sink[enable SSA code sinking on trees]'
  '-ftree-slp-vectorize[enable basic block vectorization (SLP) on trees]'
  '-ftree-slsr[perform straight-line strength reduction]'
  '-ftree-sra[perform scalar replacement of aggregates]'
  '-ftree-switch-conversion[perform conversions of switch initializations]'
  '-ftree-tail-merge[enable tail merging on trees]'
  '-ftree-ter[replace temporary expressions in the SSA->normal pass]'
  '-ftree-vectorize[enable vectorization on trees]'
  '-ftree-vrp[perform Value Range Propagation on trees]'
  '-funconstrained-commons[assume common declarations may be overridden with ones with a larger trailing array]'
  '-funroll-all-loops[perform loop unrolling for all loops]'
  '-funroll-loops[perform loop unrolling when iteration count is known]'
  '-funsafe-loop-optimizations[allow loop optimizations to assume that the loops behave in normal way]'
  '-funsafe-math-optimizations[allow math optimizations that may violate IEEE or ISO standards]'
  "-funsigned-bitfields[when signed or unsigned is not given make the bitfield unsigned]"
  "-funsigned-char[make char unsigned by default]"
  '-funswitch-loops[perform loop unswitching]'
  '-funwind-tables[just generate unwind tables for exception handling]'
  '-fuse-ld=-[use the specified linker instead of the default linker]:linker:(bfd gold)'
  '-fuse-linker-plugin[use linker plugin during link-time optimization]'
  '-fvariable-expansion-in-unroller[apply variable expansion when loops are unrolled]'
  '-fvar-tracking-assignments[perform variable tracking by annotating assignments]'
  '-fvar-tracking-assignments-toggle[toggle -fvar-tracking-assignments]'
  '-fvar-tracking[perform variable tracking]'
  '-fvar-tracking-uninit[perform variable tracking and also tag variables that are uninitialized]'
  '-fvect-cost-model=[specifies the cost model for vectorization]:model:(unlimited dynamic cheap)'
  '-fverbose-asm[add extra commentary to assembler output]'
  '-fvisibility=-[set the default symbol visibility]:visibility:(default internal hidden protected)'
  '-fvpt[use expression value profiles in optimizations]'
  '-fweb[construct webs and split unrelated uses of single variable]'
  '-fwhole-program[perform whole program optimizations]'
  "-fwide-exec-charset=[convert all wide strings and character constants to character set]:character set"
  "-fworking-directory[generate a #line directive pointing at the current working directory]"
  '-fwrapv[assume signed arithmetic overflow wraps around]'
  '-fzero-initialized-in-bss[put zero initialized data in the bss section]'
  {-g-,--debug=}'[generate debug information]::debugging information type or level:(0 1 2 3 gdb gdb0 gdb1 gdb2 gdb3 coff stabs stabs+ dwarf dwarf+ dwarf-2 dwarf-3 dwarf-4 dwarf-5 dwarf32 dwarf64 xcoff xcoff+)'
  '-gno-pubnames[don'\''t generate DWARF pubnames and pubtypes sections]'
  '-gno-record-gcc-switches[don'\''t record gcc command line switches in DWARF DW_AT_producer]'
  '-gno-split-dwarf[don'\''t generate debug information in separate .dwo files]'
  '-gno-strict-dwarf[emit DWARF additions beyond selected version]'
  '-gpubnames[generate DWARF pubnames and pubtypes sections]'
  '-grecord-gcc-switches[record gcc command line switches in DWARF DW_AT_producer]'
  '-gsplit-dwarf[generate debug information in separate .dwo files]'
  '-gstrict-dwarf[don'\''t emit DWARF additions beyond selected version]'
  '-gtoggle[toggle debug information generation]'
  '-gvms[generate debug information in VMS format]'
  '--help[display this information]'
  {-H,--trace-includes}'[print name of each header file used]'
  {'*-idirafter','*--include-directory-after='}'[add directory after include search path]:second include path directory:_files -/'
  {'*-I-','*--include-directory='}'[add directory to include search path]:header file search path:_files -/'
  {'*-imacros','*--imacros='}'[include macros from file before parsing]:macro input file:_files -g \*.h\(-.\)'
  '-imultiarch[set <dir> to be the multiarch include subdirectory]:directory:_files -/' #XXX not in manpage
  "-imultilib=[set dir to be the multilib include subdirectory]:dir:_files -/"
  "--include-barrier[restrict all prior -I flags to double-quoted inclusion and remove current directory from include path]"
  {'*-include=','*--include='}'[include file before parsing]:include file:_files -g \*.h\(-.\)'
  '-iplugindir=-[set <dir> to be the default plugin directory]:directory:_files -/'
  {'*-iprefix','*--include-prefix='}'[set the -iwithprefix prefix]:prefix:_files'
  "-iquote=[add dir to the end of the quote include path]:dir:_files -/"
  "-isysroot=[set dir to be the system root directory]:dir:_files -/"
  '*-isystem[add directory to system include search path]:second include path directory (system):_files -/'
  {'*-iwithprefixbefore','*--include-with-prefix-before='}'[set directory to include search path with prefix]:main include path directory:_files -/'
  {'*-iwithprefix','*--include-with-prefix=','*--include-with-prefix-after='}'[set directory to system include search path with prefix]:second include path directory:_files -/'
  '*-L-[add directory to library search path]:library search path:_files -/'
  "-lang-asm[set lang asm]"
  '*-l+[include library found in search path]:library:->library'
  "-MF[write dependency output to the given file]:file:_files"
  "-MJ[write a compilation database entry per input]"
  "-MQ[add a make-quoted target]:target"
  '*-M-[set flags for generating Makefile dependencies]::output dependencies:->dependencies'
  "-MT[add an unquoted target]:target"
  '-no-canonical-prefixes[do not canonicalize paths when building relative prefixes to other gcc components]'
  '-nodefaultlibs[do not use the standard system libraries when linking]'
  '-nostartfiles[do not use the standard system startup files when linking]'
  {-nostdinc,--no-standard-includes}"[do not search standard system directories or compiler builtin directories for include files]"
  '-nostdlib[do not use standard system startup files or libraries when linking]'
  {-O-,--optimize=-}'[control the optimization]::optimization level:((0 1 2 3 g\:optimize\ for\ debugging\ experience s\:optimize\ for\ space fast\:optimize\ for\ speed\ disregarding\ exact\ standards\ compliance))'
  {-o,--output=}'[write output to file]:output file:_files -g "^*.(c|h|cc|C|cxx|cpp|hpp)(-.)"'
  "--output-pch=[output pch]"
  '--param[set parameter <param> to value.  See manpage for a complete list of parameters]:name=value'
  '-pass-exit-codes[exit with highest error code from a phase]'
  {-pedantic-errors,--pedantic-errors}'[like -pedantic but issue them as errors]'
  {-pedantic,--pedantic}'[issue all mandatory diagnostics in the C standard]'
  '(-pg)-p[enable function profiling for prof]'
  '-pie[create a position independent executable]'
  {-pipe,--pipe}'[use pipes rather than intermediate files]'
  {-P,--no-line-commands}'[inhibit generation of linkemakers during preprocess]'
  '(-p)-pg[enable function profiling for gprof]'
  '-###[print commands to run this compilation]'
  '-print-file-name=-[display the full path to library <library>]:library:->library'
  '-print-libgcc-file-name[display the name of the compiler'\''s companion library]'
  "--print-missing-file-dependencies[print missing file dependencies]"
  '-print-multiarch[display the target'\''s normalized GNU triplet, used as a component in the library path]'
  '-print-multi-directory[display the root directory for versions of libgcc]'
  '-print-multi-lib[display the mapping between command line options and multiple library search directories]'
  '-print-multi-os-directory[display the relative path to OS libraries]'
  '-print-prog-name=-[display the full path to compiler component <program>]:program:'
  '-print-search-dirs[display the directories in the compiler'\''s search path]'
  '-print-sysroot[display the target libraries directory]'
  '-print-sysroot-headers-suffix[display the sysroot suffix used to find headers]'
  {-Qn,-fno-ident}"[do not emit metadata containing compiler name and version]"
  '-quiet[do not display functions compiled or elapsed time]'
  {-Qy,-fident}"[emit metadata containing compiler name and version]"
  '-rdynamic[pass the flag -export-dynamic to the ELF linker, on targets that support it]'
  "-remap[remap file names when including files]"
  {-S,--assemble}'[compile only; do not assemble or link]'
  '-save-stats=-[save code generation statistics]:location:(cwd obj)'
  '-save-temps[do not delete intermediate files]'
  '-shared[create a shared library]'
  '-shared-libgcc[force shared libgcc]'
  '*-specs=-[override built-in specs with the contents of <file>]:file:_files'
  '-s[remove all symbol table and relocation information from the executable]'
  '-static-libgcc[force static libgcc]'
  '-static[on systems that support dynamic linking, this prevents linking with the shared libraries]'
  {'-std=-','--std='}'[assume that the input sources are for specified standard]:standard:(c90 c89 iso9899\:1990 iso9899\:199409 c99 iso9899\:1999 c11 iso9899\:2011 gnu90 gnu89 gnu99 gnu11 c++98 c++03 gnu++98 gnu++03 c++11 gnu++11 c++1y gnu++1y c++14 gnu++14 c++1z gnu++1z c++17 iso9899\:2017 gnu++17 c++2a gnu++2a)'
  '-symbolic[bind references to global symbols when building a shared object]'
  '--sysroot=-[use <directory> as the root directory for headers and libraries]:directory:_files -/'
  '--target-help[display target specific command line options]'
  '-time[time the execution of each subprocess]'
  {-traditional-cpp,--traditional-cpp}"[use traditional preprocessor]"
  {-trigraphs,--trigraphs}"[process trigraph sequences]"
  '-T[specify linker script]:linker script:_files'
  "-undef[do not predefine system specific and gcc specific macros]"
  '*-u[pretend symbol to be undefined]:symbol:'
  "--user-dependencies[print user dependencies]"
  {'*-U-','*--undefine-macro='}'[undefine a macro]:undefine macro:'
  '-version[display the compiler'\''s version]'
  '--version[display version information]'
  '-V[specify compiler version]:compiler version:'
  {-v,--verbose}'[enable verbose output]'
  '*-Wa,-[pass arguments to the assembler]:assembler option:'
  '--warn--[enable the specified warning]:warning:->warning'
  '-Werror=-[treat specified warning as error (or all if none specified)]::warning:->warning'
  '-Wfatal-errors[exit on the first error occurred]'
  '*-Wl,-[pass arguments to the linker]:linker option:'
  {-w,--no-warnings}'[suppress warnings]'
  '*-Wp,-[pass arguments to the preprocessor]:preprocessor option:'
  "--write-dependencies[write a depfile containing user and system dependencies]"
  "--write-user-dependencies[write a depfile containing user dependencies]"
  '*-Xassembler[pass argument to the assembler]:assembler option:'
  '*-Xlinker[pass argument to the linker]:linker option:'
  '*-Xpreprocessor[pass argument to the preprocessor]:preprocessor option:'
  '-x[specify the language of the following input files]:input file language:('"$languages"')'
)

# not meant for end users
#'-fdisable--pass=-[disables an optimization pass]:range1+range2: '
#'-fdisable-[disables an optimization pass]'
#'-fenable--pass=-[enables an optimization pass]:range1+range2: '
#'-fenable-[enables an optimization pass]'
#'-fdump-<type>[dump various compiler internals to a file]'

args+=($warnings)

# How to mostly autogenerate the above stuff:
# joinhelplines() { sed '$!N;s/^\(  -.*\)\n  \s*\([^-]\)/\1 \2/;P;D' }
# gcc-x86() { gcc --help=target,\^undocumented | joinhelplines | joinhelplines }
# compdef _gnu_generic gcc-x86
# printf '%s\n' ${(onq-)_args_cache_gcc_x86}
_arguments -C -M 'L:|-{fWm}no-=-{fWm} r:|=*' \
  "$args[@]" \
  "$args2[@]" && ret=0

case "$state" in
dump)
  local -a dump_values=(
    'A[verbose assembly output]'
    'D[macro definitions and normal output]'
    'I[include directives and normal output]'
    'J[after last jump optimization]'
    'L[after loop optimization]'
    'M[only macro definitions]'
    'N[macro names]'
    'R[after second instruction scheduling pass]'
    'S[after first instruction scheduling pass]'
    'a[all dumps]'
    'c[after instruction combination]'
    'd[after delayed branch scheduling]'
    'f[after flow analysis]'
    'g[after global register allocation]'
    'j[after jump optimization]'
    'k[after conversion from registers to stack]'
    'l[after local register allocation]'
    'm[print memory usage statistics]'
    'p[annotate assembler output]'
    'r[after RTL generation]'
    's[after CSE]'
    't[after second CSE pass]'
    'x[only generate RTL]'
    'y[debugging information during parsing]'
  )
  _values -s '' 'dump information' $dump_values && ret=0
  ;;
dependencies)
  local -a dependencies=(
    "D:generate make dependencies and compile"
    "G:treat missing header files as generated"
    "M:only user header files"
    "MD:output to file"
    "P:generate phony targets for all headers"
    "V:use NMake/Jom format for the depfile"
  )
  _describe dependencies dependencies && ret=0
  ;;
library)
  local -a library_path
  if [[ -n "$LD_LIBRARY_PATH" ]]; then
    library_path=(${=LD_LIBRARY_PATH//:/ })
  else
    library_path=(
      "/usr/lib"
      "/usr/local/lib"
      "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib"
    )
  fi
  _wanted libraries expl library \
      compadd - $library_path/lib*.(a|so*|dylib)(:t:fr:s/lib//) && ret=0
  ;;
rundir)
  compset -P '*:'
  compset -S ':*'
  _files -/ -S/ -r '\n\t\- /:' "$@" && ret=0
  ;;
help)
  _values -s , 'help' \
    optimizers warnings target params common \
    c c++ objc objc++ lto ada adascil adawhy fortran go java \
    {\^,}undocumented {\^,}joined {\^,}separate \
  && ret=0
  ;;
dirtodir)
  compset -P '*='
  _files -/ && ret=0
  ;;
commafiles)
  compset -P '*,'
  _files && ret=0
  ;;
framework)
  local -a framework_path=(
    /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks
  )
  local path
  local -a frameworks
  for path in $framework_path; do
    frameworks+=($path/*.framework(:t:r))
  done
  _wanted frameworks expl framework compadd -a frameworks && ret=0
  ;;
warning)
  local -a warning_names
  for warning in $warnings; do
    if [[ "$warning" = (#b)-W([^=\[]##)[^\[]#\[(*)\]* ]]; then
      warning_names+=("$match[1]:$match[2]")
    fi
  done
  _describe warning warning_names && ret=0
  ;;
arch)
  _wanted cputypes expl "CPU type" compadd -a arch && ret=0
  ;;
archgeneric)
  arch+=(generic)
  _wanted cputypes expl "CPU type" compadd -a arch && ret=0
  ;;
esac

return ret


[-- Attachment #2: Type: text/plain, Size: 4409 bytes --]



I made some improvements to the _gcc completion script to better handle macOS and clang. Hopefully, you like them.

Enabled The -l option to complete .dylib files as well as .so* and .a.

Allowed the -l option to take an argument right after it, and gave it a description. For example -ly or -lz.

The current completion for the argument of -l wouldn't work if the $LD_LIBRARY_PATH had more than one path in it, because paths are separated by : traditionally in that variable, so I made sure completion works if there are :'s in it. Also I added /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib to the default path since that's the one macOS uses.

Added the -framework option, and completed the names of frameworks it can take. frameworks are macOS's style of library.

Added all the -fobjc- options like -fobjc-arc, -fobjc-abi-version, -fobjc-runtime, -F, etc.

Added the -e, --entry option to the generic section since it was missing before.

Added the --include option, it already had -include, but I found --include while looking at the clang docs, and verified it also works with gcc, so I put it right next to the -include option.

I changed the input file type because sometimes it's useful to include library files on the command line, and these have extensions .so*, .a, .dylib, or even with no extension like in mac's frameworks. I thought it better if it just completed all files and not just .c, .cpp, .m, etc.

Gave option descriptions to the options that didn't have one before, like -o, -d, -g, -O, -Wl

Lowercased the first letter of all the option descriptions. This seems to be convention in other scripts like _find, _chmod, and _git.

I removed -fprint-source-range-info, I didnt see it in the clang docs, and the option doesn't work. It probably meant -fdiagnostics-print-source-range-info.

I removed the matchspec "r:|[_-]=*" from the _arguments call because there were certain options where I would try to complete them, and they positioned the cursor elsewhere unexpectedly. for example, I wrote "clang --opt<tab>" and after it completed up until --optimiz, it positioned me on the second - when I expected to be at the end of the fully completed option, --optimize=. also it didn't fully complete, it left it at --optimiz.

I combined options whose descriptions used to be "same as -x". So -O and --optimize, -w and --no-warnings, -v and --verbose.

I added options from "gcc --help=c", that didn't already exist, such as -ansi, --all-warnings, --assert, and others.

I needed to add a dependency flag for the -M option, so instead of adding it to the existing list ((...)), I coverted that action to ->dependency style action, and added the new value at the end of the script. The new flags are -MD and -MP.

I sorted all the -Wwarning-name options, it makes it easier to look through the list.

I added a completion for arguments to -Werror= which is used to turn warnings into errors, it has to extract the name of the warning from all the -Wwarning options, for example -Wvla will cause -Werror=vla to be a completion. To do this I had to extract the warnings arguments into their own array, and make sure they are separated from other -W options that are not warnings, such as -Werror, -Wfatal-errors, and -Wl.

I use this same completion for the --warn-name options.

I removed duplicate options --verbose, -fassociative-math, -fauto-inc-dec, -fdelete-dead-exceptions, -ffunction-cse, -fgraphite, -findirect-inlining, -fira-loop-pressure, -fira-share-save-slots, -fira-share-spill-slots, -fmodulo-sched-allow-regmoves, -fopt-info,
-fpartial-inlining, -freciprocal-math, -fstack-protector-all, -fstack-protector, -fstrict-overflow, -fstrict-volatile-bitfields, -ftracer, -Weffc++.

I found the grouping of options based on which --help=type wasn't all that useful and made it harder to spot the duplicates. The options are still grouped by: target dependent options, clang only options, gcc only options, warnings, then all the rest, because they need to be.

I went over every option listed on https://clang.llvm.org/docs/ClangCommandLineReference.html, and made sure to add them, If I saw that gcc supported the option, I added it to a common location, if not, I added it to only clang's completion. This adds a large number of options, we may want to comment some of these out.

Thanks for looking at all this.


^ permalink raw reply	[relevance 1%]

* Re: Bug + patch: `zstyle ':completion:*' menu select=long-list` fails to start menu selection
  @ 2021-03-12 14:14  3%                     ` Daniel Shahaf
  2021-03-12 20:53  0%                       ` Mikael Magnusson
       [not found]                           ` <884654866.425858.1615560127191@mail2.virginmedia.com>
  0 siblings, 2 replies; 200+ results
From: Daniel Shahaf @ 2021-03-12 14:14 UTC (permalink / raw)
  To: zsh-workers

Peter Stephenson wrote on Fri, 12 Mar 2021 13:36 +00:00:
> 
> > On 12 March 2021 at 13:11 Marlon Richert <marlon.richert@gmail.com> wrote:
> > 
> > 
> > I found the culprit: I had
> > 
> > export GREP_OPTIONS='--color=always'
> > 
> > in my `.zshrc` file and that mangled the .mdd file names.
> 
> It's probably worth having the following.  It doesn't cover all the
> possible cases where you can get into trouble, but it's a useful
> blanket for the standard case where everything is done immediately
> from configure.
> 

I'm not sure I agree.

- This seems to be a cases of "hard cases make bad law".  Setting
  --color=always in the environment will break any script that expects
  grep(1)'s standard semantics, not just configure.  The patch just
  papers over the problem.

- We shouldn't second-guess the user.  If the user has GREP_OPTIONS set
  in the environment, that might actually be needed in order to have
  grep(1) behave correctly.  What if some system uses GREP_OPTIONS to
  make its grep(1) tool behave POSIX compatibly?

- If this fix is needed, we should send it to autoconf upstream to be
  incorporated into AC_PROG_GREP.

Instead, I propose:

- Audit configure.ac and make sure we use $GREP rather than grep.
  Perhaps push this into the makefiles and build scripts too.

- Consider issueing a notice if GREP_OPTIONS is set, or proposing to
  upstream to have AC_PROG_GREP do so.

- Sending a documentation patch to grep(1)'s man page to point out that
  using --color=always globally or on the left hand side of a pipe is
  inadvisable.

Makes sense?

Cheers,

Daniel


> diff --git a/configure.ac b/configure.ac
> index 16dafac05..41006d67d 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -30,6 +30,9 @@ AC_CONFIG_SRCDIR([Src/zsh.h])
>  AC_PREREQ([2.69])
>  AC_CONFIG_HEADER(config.h)
>  
> +dnl Configure uses grep widely, make sure output is uncorrupted.
> +unset GREP_OPTIONS
> +
>  dnl What version of zsh are we building ?
>  . ${srcdir}/Config/version.mk
>  echo "configuring for zsh $VERSION"
> 
>


^ permalink raw reply	[relevance 3%]

* Re: Bug + patch: `zstyle ':completion:*' menu select=long-list` fails to start menu selection
  2021-03-12 14:14  3%                     ` Daniel Shahaf
@ 2021-03-12 20:53  0%                       ` Mikael Magnusson
       [not found]                           ` <884654866.425858.1615560127191@mail2.virginmedia.com>
  1 sibling, 0 replies; 200+ results
From: Mikael Magnusson @ 2021-03-12 20:53 UTC (permalink / raw)
  To: Daniel Shahaf; +Cc: zsh-workers

On 3/12/21, Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
> Peter Stephenson wrote on Fri, 12 Mar 2021 13:36 +00:00:
>>
>> > On 12 March 2021 at 13:11 Marlon Richert <marlon.richert@gmail.com>
>> > wrote:
>> >
>> >
>> > I found the culprit: I had
>> >
>> > export GREP_OPTIONS='--color=always'
>> >
>> > in my `.zshrc` file and that mangled the .mdd file names.
>>
>> It's probably worth having the following.  It doesn't cover all the
>> possible cases where you can get into trouble, but it's a useful
>> blanket for the standard case where everything is done immediately
>> from configure.
>>
>
> I'm not sure I agree.
>
> - This seems to be a cases of "hard cases make bad law".  Setting
>   --color=always in the environment will break any script that expects
>   grep(1)'s standard semantics, not just configure.  The patch just
>   papers over the problem.
>
> - We shouldn't second-guess the user.  If the user has GREP_OPTIONS set
>   in the environment, that might actually be needed in order to have
>   grep(1) behave correctly.  What if some system uses GREP_OPTIONS to
>   make its grep(1) tool behave POSIX compatibly?
>
> - If this fix is needed, we should send it to autoconf upstream to be
>   incorporated into AC_PROG_GREP.
>
> Instead, I propose:
>
> - Audit configure.ac and make sure we use $GREP rather than grep.
>   Perhaps push this into the makefiles and build scripts too.
>
> - Consider issueing a notice if GREP_OPTIONS is set, or proposing to
>   upstream to have AC_PROG_GREP do so.
>
> - Sending a documentation patch to grep(1)'s man page to point out that
>   using --color=always globally or on the left hand side of a pipe is
>   inadvisable.

For what it's worth, my grep (GNU grep 3.1) says this when I use GREP_OPTIONS:
% GREP_OPTIONS=hi grep
grep: warning: GREP_OPTIONS is deprecated; please use an alias or script

-- 
Mikael Magnusson


^ permalink raw reply	[relevance 0%]

* Re: Bug + patch: `zstyle ':completion:*' menu select=long-list` fails to start menu selection
       [not found]                           ` <884654866.425858.1615560127191@mail2.virginmedia.com>
@ 2021-03-13 13:40  0%                         ` Daniel Shahaf
  0 siblings, 0 replies; 200+ results
From: Daniel Shahaf @ 2021-03-13 13:40 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: zsh-workers

Replying on-list with permission and fullquote.

Peter Stephenson wrote on Fri, 12 Mar 2021 14:42 +00:00:
> > On 12 March 2021 at 14:14 Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
> > Peter Stephenson wrote on Fri, 12 Mar 2021 13:36 +00:00:
> > > 
> > > > On 12 March 2021 at 13:11 Marlon Richert <marlon.richert@gmail.com> wrote:
> > > > 
> > > > 
> > > > I found the culprit: I had
> > > > 
> > > > export GREP_OPTIONS='--color=always'
> > > > 
> > > > in my `.zshrc` file and that mangled the .mdd file names.
> > > 
> > > It's probably worth having the following.  It doesn't cover all the
> > > possible cases where you can get into trouble, but it's a useful
> > > blanket for the standard case where everything is done immediately
> > > from configure.
> > > 
> > 
> > I'm not sure I agree.
> > 
> > - This seems to be a cases of "hard cases make bad law".  Setting
> >   --color=always in the environment will break any script that expects
> >   grep(1)'s standard semantics, not just configure.  The patch just
> >   papers over the problem.
> > 
> > - We shouldn't second-guess the user.  If the user has GREP_OPTIONS set
> >   in the environment, that might actually be needed in order to have
> >   grep(1) behave correctly.  What if some system uses GREP_OPTIONS to
> >   make its grep(1) tool behave POSIX compatibly?
> 
> I think that's missing the point of the patch, which is that for anyone
> setting up zsh, configure should just run in a sandbox with whatever is
> going on outside irrelevant to it;

It is an API promise of autoconf that AC_PROG_GREP will use the
environment variable $GREP to find a grep program.

I would therefore expect «GREP=/bin/foo GREP_OPTIONS=bar ./configure» to
also be supported, even for values of foo other than GNU grep.

> it's an implementation detail that it's a shell script at all.

Well, yes, configure could be implemented in Rust for all anyone cares,
but it would still have to obey that API promise about the "GREP"
environment variable.

> GREP_OPTIONS is a user extension, there's no
> question of it being needed for POSIX --- GNU do things this way exactly so
> that if you have a vanilla environment it is basically (but not necessarily
> completely, as this is a complicated area) POSIXy.
> 

In GNU's case, yes, but non-GNU implementations of grep may also use
envvars named GREP_OPTIONS, and your patch could easily break those.

Even with GNU grep, I could imagine someone setting
GREP_OPTIONS=--exclude='.git', and then a configure script using «grep -R»
if $GREP happened to be GNU grep.  (even if zsh's configure script doesn't do that)

Also, someone might run «CC=/my/wrapper ./configure» where /my/wrapper
is a shell script that uses grep and relies on GREP_OPTIONS being set.

> If you do feel the need to pursue a more complicated path, however, you're
> welcome to do so and I'll keep out of the way.
> 

Let's take a step back, please.  You proposed a change.  I don't think
that change is a good one to make.  For instance, consider that if the
patch is a good change, it would need to be applied to every single
configure script out there; actually, to _every single portable script_
that uses grep.

I view the issue as a bug in Marlon's dotfiles; a bug which he has
discovered and fixed.  The failure mode wasn't ideal, of course, and we
could look into improving that; for example, by s/grep/$GREP/ as I
suggested and proposing a "look for colour codes in the output" logic to
AC_PROG_GREP.

I did propose further alternatives upthread and I welcome feedback and
questions on them.

And needless to say, I didn't mean to discourage you from participating.

> > - If this fix is needed, we should send it to autoconf upstream to be
> >   incorporated into AC_PROG_GREP.
> 
> That does sound entirely reasonable, if no one's noticed yet.

*nod*

Cheers,

Daniel


^ permalink raw reply	[relevance 0%]

* Re: [PATCH 1/2] Introduce new completion for Linux task capabilities
  2021-02-27 12:03  3%     ` Oliver Kiddle
@ 2021-03-21 12:54  5%       ` Arseny Maslennikov
  0 siblings, 0 replies; 200+ results
From: Arseny Maslennikov @ 2021-03-21 12:54 UTC (permalink / raw)
  To: Oliver Kiddle; +Cc: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 10675 bytes --]

On Sat, Feb 27, 2021 at 01:03:53PM +0100, Oliver Kiddle wrote:
> Arseny Maslennikov wrote:
> > On Fri, Feb 26, 2021 at 03:50:18PM +0000, Daniel Shahaf wrote:
> > > Arseny Maslennikov wrote on Fri, Feb 26, 2021 at 10:55:57 +0300:
> > > > The next patch introduces a completion for setpriv(1), which actively
> 
> Thanks for the contribution. I've reviewed the second patch that Daniel
> left though in general it all looks very good and there isn't much need
> to comment.
> 
> > > > uses _capability_names. As for _capabilities,
> 
> Are these POSIX capabilities?

The corresponding POSIX draft standard was actually withdrawn.

Even if we imagine it wasn't, however, as time passes, new capabilities
are regularly being introduced to Linux, and I'm not sure if POSIX
capabilities would reflect the additions soon enough for the supported
capability sets to not diverge significantly. It's not like Linux
development follows POSIX, but the other way around — the bits that make
their way to popular Unix-like systems are codified as parts of the
POSIX standard.

> The term capabilities gets wider usage so
> I'd be inclined to call the function _posix_capabilities despite that
> being longer. As far as I can tell, unless you count Hurd, Linux is the
> only implementation of POSIX capabilities so it is fine for this
> to be in the Linux directory. That said, I'm not sure I would factor it
> out of _setpriv until there's at least two users of it.

After pondering this question, I get your point. I'm now inclined to
agree with you on the _posix_capabilities name, since it clearly conveys
what kind of capabilities the completion function is about, if and only
if the aforementioned POSIX draft is resurrected in some way.

If «_capabilities» is still too unclear, I suggest «_task_capabilities».

> 
> > > FWIW, I think it may well be possible to write _setpriv in terms of
> > > _capabilities as a black box, using some combination of _sequence,
> > > matchspecs, «compadd -P», et al..
> >
> > Do you mean invoking «_capabilities -O array_name» to pass the -O to
> > compadd, and then using the array_name in _setpriv and possible future
> > users?
> > As far as I understand, in that case _capabilities will have to avoid
> > looping over tag labels, i. e. calling _wanted, as it does now.
> 
> No. You would call _capabilities with compadd style options to deal with
> the prefixes. You have the following:
> 
>   matches=( {-,+}"${(@)^caps#cap_}" )
> 
> So _capabilities is unsuited to _setpriv because you don't want the
> cap_ prefix but do want - and + prefixes. Telling compadd/completion
> functions to strip a prefix is somewhat messy, you can get close with
> matching control (-M 'B:=cap_') but it continues to prefer the prefix
> to be present. So I'd suggest that you chop off the initial "cap_" from
> everything _capabilites completes.
> 
> Adding prefixes is easier. If some other function needs capabilities
> with a cap_ prefix, that can then call it with -p 'cap_',
> 
> For the - and +, we can also add these as a prefix but in their case, -P
> is more appropriate because the prefix is a separate thing and it may
> even be better to strip them with compset and complete them
> independently so that we can indicate that they are for removing and
> adding capabilities.

OK, I managed to make this work with «compset -P [+-]» and eliminate the
need for _capability_names; I'm going to send the revised patch shortly.
Thanks a lot for the thorough explanation!

> 
> > > > +if [[ $OSTYPE != linux* ]]; then
> > > > +    _default; return
> > > > +fi
> > > 
> > > Why?  The code doesn't use /proc or /sbin/some-linux-only-tool, and
> > > having this guard prevents people on other OSTYPE's from completing «ssh
> > > $linuxbox foo --with-capability=<TAB>».
> >
> > I intended to play nice in case unrelated "capabilities" are present (or
> > introduced later) on those OSTYPE's and pulled Oliver's trick from the
> > recently posted _unshare. There might be a better way to do it; I'm open
> > to discussion.
> 
> Not sure I'd bother in this case as - given the lack of setpriv commands
> on other operating systems - it is unlikely to be called other than in
> a case like the ssh one Daniel mentions. It mattered in the case of
> unshare because unshare does exist on other OSes as an unrelated command
> to remove NFS exports.

OK, I'll remove that check until this is a problem.

> 
> > > Suggest to list these one per line, because:
> > I'd personally like them being listed one per line, too. Will do.
> 
> I'd certainly avoid exceeding 80 columns unnecessarily but if it ends up
> using a lot of vertical space, grouping similar ones or by first letter
> is also fine.
> 
> Arseny Maslennikov [patch 2/2] wrote:
> > +__setpriv_prctl_securebits_set_element() {
> 
> I wouldn't bother with the double-underscore prefix. _git did that and
> seems to have been copied elsewhere but it doesn't really serve much
> purpose. I think with git it was done to make a more obvious distinction
> to subcommands than just whether it was _git_… or _git-…

I wanted that prefix to denote a quasi-namespace of sorts, since zsh
does not have a concept of local functions. E. g.:
* _setpriv is a "front-end" completion function, as is _git, _signals, ...
  One underscore.
* __setpriv_death_signals is an implementation detail of _setpriv that
  completes a death signal and depends on how it is called (is it
  expected to call _description? is it expected to loop over labels?), so
  it has _setpriv directly in the name after the initial underscore.

Something like this was my initial understanding of how _git and all the
functions that followed suit use __.

> 
> I'd be inclined to just name it _setpriv_prctl_securebits as that is
> what it appears to complete.

This would be an appropriate name if it generated matches from the bits
array, i. e. the securebit names themselves as matches. Instead, the
function has to append '-' or '+' to each securebit name.

> 
> > +  bits=(noroot noroot_locked
> > +        no_setuid_fixup no_setuid_fixup_locked
> 
> > +  _wanted minus-plus-securebits expl 'prctl securebits' \
> > +    compadd "$@" -a - matches
> 
> Minor nitpick but Etc/completion-style-guide states four spaces of
> indentation for continuation lines. My own personal taste includes a
> particular dislike for the variable indentation that results from lining
> things up with the syntactic construct on the previous line as in the
> bits=( assignment.
> 
> Also, the description should be in the singular ('prctl securebit').
> Yes, there may be multiple matches, and we may be in the middle of a
> comma-separated list of them but only one is completed at a time.

OK, I'm going to fix all the description strings to be in the singular.
To be fair, in the wild and likely even in the completion functions
bundled with zsh I've seen both plural and singular forms there.

> 
> T'd be sufficient to use _description followed by compadd rather than
> _wanted. There are aspects of nested tag loops that aren't ideal so
> when you can know that completion is already within one tag loop (which
> _arguments does), we don't need another one.
> 
> > +__setpriv_prctl_securebits_set() {
> > +  _sequence __setpriv_prctl_securebits_set_element
> > +}
> 
> You can call _sequence directly from the _arguments spec. I'd probably
> just do that rather than having a separate function. Convention for

I do not really have a preference for separate functions or inlining
calls/matches in the optspec. Separate function names, though, are
particularly easy to locate in the xtraced output generated by
_complete_debug, and they're often shorter than the one-liner they
implement so the separate name makes the optspec line easier to fit in
80 cols or whatever's the limit, so they got that going for them.

> separate functions is a plural name, i.e. …_sets

So «: : _sequence __setpriv_prctl_securebit_set_elements». That's all
right to me, but the full line for --securebits would be 97 columns
long.
The longest line is 105, so not really a problem, I guess...

> 
> > +__setpriv_caps_all() {
> > +  # Nonlocal expl; _description call expected.
> 
> Is that necessary? Aren't descriptions passed through with "$@"?

I checked with _complete_debug; they indeed are.

> 
> > +__setpriv_cap_set_element() {
> > +  # We pass through arguments added by _sequence.
> > +  local -a Oargv=( "$@" )
> > +  _alternative -O Oargv \
> > +    'special-actions:drop/obtain all caps:__setpriv_caps_all' \
> 
> Wouldn't :(-all +all) do for the action here instead of needing another
> separate function.
> There probably ought to be a nicer way to add special all/any elements
> to a list because it comes up very often.
> 
> > +    'minus-plus-caps:capabilities:__setpriv_capability_expressions' \
> 
> Again, use singular form for the description.
> 
> > +local context state state_descr line
> > +typeset -A opt_args
> 
> Given that you've not used states, these are superfluous.
> 
> > +  '(- : *)*'{-d,--dump}'[display the current privilege state]' \
> 
> The exclusion list here breaks the repeatability.
> I did once look into making a special case for this in _arguments but it
> wasn't trivial.

The cleanest way to fix this that comes to my mind is to introduce a
state here and call
    _arguments '*'{-d,--dump}'[display the current privilege state]'
from the handler.
I'll send that as a separate patch in the series.

> 
> > +  '--clear-groups[clear supplementary groups]' \
> > +  '--groups[set supplementary groups]:groups:_groups' \
> 
> How do you specify multiple supplementary groups? If --groups is
> repeated, we need * at the beginning of the spec. Otherwise, is
> _sequence needed.

I forgot to use _sequence there.

> Are there any mutual exclusions between it and --clear-groups,
> --keep-groups and --init-groups.

Turns out they all mutually exclude each other. Added.

> 
> > +  '--inh-caps[set inheritable caps]:capability set: __setpriv_cap_set' \
> > +  '--ambient-caps[set ambient caps]:capability set: __setpriv_cap_set' \
> 
> Where the _arguments descriptions are being thrown out anyway, it may be
> better to leave them out entirely and just have a single space.

Done everywhere in the code.

> 
> > +  '--securebits[set "process securebits"]:prctl securebits:__setpriv_prctl_securebits_set' \
> 
> Starting with this one is a run of plural descriptions.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[relevance 5%]

* [PATCH v2 1/3] Introduce new completion for Linux task capabilities
@ 2021-03-21 13:01  5% Arseny Maslennikov
  0 siblings, 0 replies; 200+ results
From: Arseny Maslennikov @ 2021-03-21 13:01 UTC (permalink / raw)
  To: zsh-workers; +Cc: Arseny Maslennikov

This is intended for use on Linux-based systems only.

The next patch introduces a completion for setpriv(1), which actively
uses this function. I believe some utilities that handle caps
may want to use it as well, albeit indirectly (neither setpriv(1) nor
setcap/getcap(8), for instance, want to offer the cap names themselves
as completion results; instead they want to prefix each name or a
comma-separated sequence of names).
---
Changes since v1:
* _capability_names is no longer shipped; users are encouraged to use
  _capabilities with compadd options as a match provider.

 Completion/Linux/Type/_capabilities | 65 +++++++++++++++++++++++++++++
 1 file changed, 65 insertions(+)
 create mode 100644 Completion/Linux/Type/_capabilities

diff --git a/Completion/Linux/Type/_capabilities b/Completion/Linux/Type/_capabilities
new file mode 100644
index 000000000..8cb31878f
--- /dev/null
+++ b/Completion/Linux/Type/_capabilities
@@ -0,0 +1,65 @@
+#autoload
+
+# This function completes POSIX capabilities for Linux.
+# Many command line utilities expect different syntax to encode various kinds
+# of capability names or sets, so this function tries to be as generic as
+# possible. It accepts compadd options to allow variations on the exact
+# generated completion matches.
+#
+# Usage examples:
+#
+# Complete full capability names:
+#   _capabilities -p cap_
+# Sort the completion list by capability number:
+#   _capabilities -o nosort
+
+# The list of Linux capabilities is taken from include/uapi/linux/capability.h
+# and subject to the following pipe filter:
+# grep 'define CAP' | sed -r 's/^[[:space:]]*#define[[:space:]]+CAP_//; s/[[:space:]]+[0-9]+$//' | tr '[[:upper:]]' '[[:lower:]]'
+local -a caplist=(
+  chown
+  dac_override
+  dac_read_search
+  fowner
+  fsetid
+  kill
+  setgid
+  setuid
+  setpcap
+  linux_immutable
+  net_bind_service
+  net_broadcast
+  net_admin
+  net_raw
+  ipc_lock
+  ipc_owner
+  sys_module
+  sys_rawio
+  sys_chroot
+  sys_ptrace
+  sys_pacct
+  sys_admin
+  sys_boot
+  sys_nice
+  sys_resource
+  sys_time
+  sys_tty_config
+  mknod
+  lease
+  audit_write
+  audit_control
+  setfcap
+  mac_override
+  mac_admin
+  syslog
+  wake_alarm
+  block_suspend
+  audit_read
+  perfmon
+  bpf
+  checkpoint_restore
+)
+local -a expl
+
+_description capabilities expl "Linux capability"
+compadd "${(@)expl}" "$@" -a - caplist
-- 
2.31.0



^ permalink raw reply	[relevance 5%]

* Re: Improvements to the gcc completion script
  @ 2021-03-22  2:29  1%     ` Jacob Gelbman
    1 sibling, 0 replies; 200+ results
From: Jacob Gelbman @ 2021-03-22  2:29 UTC (permalink / raw)
  To: Jun T; +Cc: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 5173 bytes --]

And the script: 

> On Mar 21, 2021, at 10:28 PM, Jacob Gelbman <gelbman@gmail.com> wrote:
> 
> 
> 
>> On Mar 18, 2021, at 11:51 PM, Jun T <takimoto-j@kba.biglobe.ne.jp <mailto:takimoto-j@kba.biglobe.ne.jp>> wrote:
>> 
>> Thank you for lots of improvements!
>> 
>> Please consider the following points (some of them already existed
>> before your improvements):
>> 
>> 
>> In args for clang (line 509 and below), there are several duplicated options
>> such as -fshow-source-location, -lazy_framework, etc.
> 
> Thanks, not sure how I completely missed some of these duplicates. -fshow-source-location, -lazy_framework, -fcaret-diagnostics, -fdiagnostics-fixit-info, -fdiagnostics-print-source-range-info, -init, -install_name, -interface-stub-version, -keep_private_externs, -lazy_library.
> 
>> 
>> Some options (such as -fauto-profile) can take optional argument.
>> For these, it would be better to use
>> --fauto-profile=-::message:action
>> instead of duplicating it with and without arg.
>> 
> 
> I combined these options into one option with an optional argument: -fauto-profile, -fcf-protection, -fmemory-profile, -fprofile-instr-generate, -fprofile-instr-use, -fprofile-sample-use, -fsanitize-memory-track-origins, -fsanitize-recover, -fsanitize-trap, -fsave-optimization-record, -gz
> 
> I made sure -ftemplate-depth takes the extra - at the end, this option should look like -ftemplate-depth-5 not -ftemplate-depth5.
> 
>> 
>> I think LD_LIBRARY_PATH is not used at link time (it is used only at run time),
>> and we can ignore it when completing libraries ( -l<TAB> ). Is this correct?
> 
> I thought the same but wasn't 100% sure, so I left it in, but I tried it and it doesn't work, so I removed using this variable.
> 
>> 
>> TODO (you can left this for someone else):
>> Add directories specified by -L/path/to/dir on the command line to library_path.
> 
> I did it.
> 
>> 
>> 
>>> Added the -framework option, and completed the names of frameworks it can take. frameworks are macOS's style of library.
>> 
>> -F, -iframework and -iframeworkwithsysroot can be specified multiple times.
>> Please use '*-F' etc for optspec.
>> For -iframework you can use '_files -/' as action (like -F).
> 
> Okay.
> 
>> # -iframeworkwithsysroot is meaningful only with -isysroot, and, ideally,
>> # '-iframeworkwithsysroot <TAB>' should offer directory relative to isysroot.
>> # But I think such an elaboration would not be necessary.
>> 
>> -framework, -lazy_framework and -weak_framework can also be specified multiple times.
>> The latter two can use '->framework' as action (as -framework).
> 
> Okay.
> 
>> 
>> It would be better to include Framework-related stuff only if '$OSTYPE = darwin*'.
> 
> I think clang on linux would recognize the -framework option and pass it on to the linker, which would probably fail. but, I think there's a way of setting up linux to be able to compile Objective-C programs with frameworks using gnustep or some other collection. I've never done it though.
> 
>> 
>> I don't have any detailed knowledge of how Apple's command line tools work,
>> but probably it would better to use the output of 'xcrun --show-sdk-path' instead of 
>> /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk.
> 
> I would use use clang -Wl,-v but it could be a bit tricky to get it to cache correctly, so I left that one be for now.
>> 
>> TODO: Add directory specified by -F/path/to/dir to framework_path
> 
> I did this.
> 
>> 
>>> I changed the input file type because sometimes it's useful to include library files on the command line, and these have extensions .so*, .a, .dylib, or even with no extension like in mac's frameworks. I thought it better if it just completed all files and not just .c, .cpp, .m, etc.
>> 
>> I believe most users will not like this. Instead, please use something like 
>> zstyle ':completion:*:*:gcc:argument-rest:*' file-patterns '*'
>> for your personal customization.
> 
> I put it back to the way it was, but my vote is to change it.
> 
>> 
>> 
>>> I removed the matchspec "r:|[_-]=*" from the _arguments call because there were certain options where I would try to complete them, and they positioned the cursor elsewhere unexpectedly. for example, I wrote "clang --opt<tab>" and after it completed up until --optimiz, it positioned me on the second - when I expected to be at the end of the fully completed option, --optimize=. also it didn't fully complete, it left it at --optimiz.
>> 
>> I can't reproduce your problem.
>> The matcher 'r:|[_-]=*' is quite useful and better not to be removed since it allows
>> gcc -fd-s-l<TAB>
>> to be completed to
>> gcc -fdiagnostics-show-location=
>> 
> 
> I miswrote how to reproduce it. You type --opti<tab>, not --opt<tab>, then you'll see it position the cursor -<here>-optimiz. This sort of thing is especially annoying if you bind tab to expand-or-complete-prefix.
> 
>> 
>>> I added a completion for arguments to -Werror= ... (snip)
>> 
>> Thanks. I think -Werror can also be specified multiple times ('*-Werror=-').
> 
> I fixed it.
> 
>> 
>> ----
>> Jun


[-- Attachment #2.1: Type: text/html, Size: 227 bytes --]

[-- Attachment #2.2: gcc.txt --]
[-- Type: text/plain, Size: 144510 bytes --]

#compdef gcc g++ cc c++ llvm-gcc llvm-g++ clang clang++ -value-,LDFLAGS,-default- -value-,CFLAGS,-default- -value-,CXXFLAGS,-default- -value-,CPPFLAGS,-default- -P gcc-* -P g++-* -P c++-*

local curcontext="$curcontext" state line ret=1 expl
local -a args args2 warnings arch
typeset -A opt_args

if [[ "$service" = -value-* ]]; then
  compset -q
  words=( fake "$words[@]" )
  (( CURRENT++ ))
  if [[ "$service" = *LDFLAGS ]]; then
    args2=( '-R:runtime path:->rundir' )
  else
    args2=()
  fi
else
  # On some systems (macOS), cc/gcc/g++ are actually clang; treat them accordingly
  [[ $service != clang* ]] &&
  _pick_variant clang=clang unix --version &&
  service=clang-$service

  # args2=( '*:input file:_files' )
  args2=( '*:input file:_files -g "*.([cCmisSoak]|cc|cpp|cxx|ii|k[ih])(-.)"' )
fi

args=()
case $MACHTYPE in

m68*)
  args=(
    -m68000 -m68020 -m68020-40 -m68030 -m68040 -m68881
    -mbitfield -mc68000 -mc68020 -mfpa -mnobitfield
    -mrtd -mshort -msoft-float
  )
  ;;

vax)
  args=(
    -mg -mgnu -munix
  )
  ;;

c[1234]*)
  args=(
    -mc1 -mc2 -mc32 -mc34 -mc38
    -margcount -mnoargcount
    -mlong32 -mlong64
    -mvolatile-cache -mvolatile-nocache
  )
  ;;

amd290?0)
  args=(
    -m29000 -m29050 -mbw -mnbw -mdw -mndw
    -mlarge -mnormal -msmall
    -mkernel-registers -mno-reuse-arg-regs
    -mno-stack-check -mno-storem-bug
    -mreuse-arg-regs -msoft-float -mstack-check
    -mstorem-bug -muser-registers
  )
  ;;

arm)
  args=(
    -mapcs -m2 -m3 -m6 -mbsd -mxopen -mno-symrename
    "-faapcs-bitfield-load[all volatile bit-field write generates at least one load]"
    "-faapcs-bitfield-width[volatile bit-field width is dictated by the field container type]"
    "-mcmse[allow use of CMSE]"
    "-mexecute-only[disallow generation of data access to code sections]"
    "-mno-movt[disallow use of movt/movw pairs]"
    "-mno-neg-immediates[disallow converting instructions with negative immediates to their negation]"
    "-mnocrc[disallow use of CRC instructions]"
    "-mrestrict-it[disallow generation of deprecated IT blocks for ARMv8]"
    "-mtp=[thread pointer access method]:arg"
    "-munaligned-access[allow memory accesses to be unaligned]"
  )
  ;;

m88k)
  args=(
    -m88000 -m88100 -m88110 -mbig-pic
    -mcheck-zero-division -mhandle-large-shift
    -midentify-revision -mno-check-zero-division
    -mno-ocs-debug-info -mno-ocs-frame-position
    -mno-optimize-arg-area -mno-serialize-volatile
    -mno-underscores -mocs-debug-info
    -mocs-frame-position -moptimize-arg-area
    -mserialize-volatile -msvr3
    -msvr4 -mtrap-large-shift -muse-div-instruction
    -mversion-03.00 -mwarn-passed-structs
    '-mshort-data--:maximum displacement:'
  )
  ;;

rs6000|powerpc*)
  arch=(rios1 rios2 rsc 501 603 604 power powerpc 403 common)
  args=(
    -mpower -mno-power -mpower2 -mno-power2
    -mpowerpc -mno-powerpc
    -mpowerpc-gpopt -mno-powerpc-gpopt
    -mpowerpc-gfxopt -mno-powerpc-gfxopt
    -mnew-mnemonics -mno-new-mnemonics
    -mfull-toc -mminimal-toc -mno-fop-in-toc -mno-sum-in-toc
    -msoft-float -mhard-float -mmultiple -mno-multiple
    -mstring -mno-string -mbit-align -mno-bit-align
    -mstrict-align -mno-strict-align -mrelocatable -mno-relocatable
    -mtoc -mno-toc -mtraceback -mno-traceback
    -mlittle -mlittle-endian -mbig -mbig-endian
    -mcall-aix -mcall-sysv -mprototype
    '-mcpu=:CPU type:->arch'
    "-maltivec[altivec]"
    "-mcmpb[cmpb]"
    "-mcrbits[crbits]"
    "-mcrypto[crypto]"
    "-mdirect-move[direct move]"
    "-mefpu2[efpu2]"
    "-mfloat128[float128]"
    "-mfprnd[fprnd]"
    "-mhtm[htm]"
    "-minvariant-function-descriptors[invariant function descriptors]"
    "-misel[isel]"
    "-mlongcall[longcall]"
    "-mmfocrf[mfocrf]"
    "-mmfcrf[mfcrf]"
    "-mmma[mma]"
    "-mpaired-vector-memops[paired vector memops]"
    "-mpcrel[pcrel]"
    "-mpopcntd[popcntd]"
    "-mpower10-vector[power10 vector]"
    "-mpower8-vector[power8 vector]"
    "-mpower9-vector[power9 vector]"
    "-mrop-protection[rop protection]"
    "-msecure-plt[secure plt]"
    "-mspe[spe]"
    "-mvsx[vsx]"
  )
  ;;

romp)
  args=(
    -mcall-lib-mul -mfp-arg-in-fpregs -mfp-arg-in-gregs
    -mfull-fp-blocks -mhc-struct-return -min-line-mul
    -mminimum-fp-blocks -mnohc-struct-return
  )
  ;;

mips*)
  arch=(r2000 r3000 r4000 r4400 r4600 r6000)
  args=(
    -membedded-pic -mgas -mgp32 -mgp64 -mhalf-pic -mhard-float -mint64 -mips1
    -mips2 -mips3 -mlong64 -mmemcpy -mmips-as -mmips-tfile -mno-abicalls
    -mno-embedded-data -mno-embedded-pic -mno-gpopt -mno-long-calls -mno-memcpy
    -mno-mips-tfile -mno-rnames -mno-stats -mrnames -msoft-float -m4650 -mmad
    -mstats -nocpp
    '-mcpu=:CPU type:->arch'
    "-mabicalls[enable SVR4-style position-independent code]"
    "-mabs=[abs]:arg"
    "-mcheck-zero-division[check zero division]"
    "-mcompact-branches=[compact branches]:arg"
    "-mdouble-float[double float]"
    "-mdsp[dsp]"
    "-mdspr2[dspr2]"
    "-membedded-data[place constants in the .rodata section instead of the .sdata section]"
    "-mextern-sdata[assume that externally defined data is in the small data]"
    "-mfp32[use 32-bit floating point registers]"
    "-mfp64[use 64-bit floating point registers]"
    "-mginv[ginv]"
    "-mgpopt[use GP relative accesses for symbols known to be in a small data section]"
    "-mindirect-jump=[change indirect jump instructions to inhibit speculation]:arg"
    "-mips16[ips16]"
    "-mldc1-sdc1[ldc1 sdc1]"
    "-mlocal-sdata[extend the -G behaviour to object local data]"
    "-mmadd4[enable the generation of 4-operand madd.s, madd.d, etc]"
    "-mmicromips[micromips]"
    "-mmsa[enable MSA ASE]"
    "-mmt[enable MT ASE]"
    "-mnan=[nan]:arg"
    "-mno-mips16[no mips16]"
    "-msingle-float[single float]"
    "-mvirt[virt]"
    "-mxgot[xgot]"
  )
  ;;

i[3456]86|x86_64)
  arch=(
    native i386 i486 i586 pentium pentium-mmx pentiumpro i686 pentium2 pentium3
    pentium3m pentium-m pentium4 pentium4m prescott nocona core2 corei7 corei7-avx
    core-avx-i core-avx2 atom k6 k6-2 k6-3 athlon athlon-tbird athlon-4 athlon-xp
    athlon-mp k8 opteron athlon64 athlon-fx k8-sse3 opteron-sse3 athlon64-sse3
    amdfam10 barcelona bdver1 bdver2 bdver3 btver1 btver2 winchip-c6 winchip2 c3
    c3-2 geode
  )
  args=(
    '-m128bit-long-double[sizeof(long double) is 16]'
    '-m16[generate 16bit i386 code]'
    '-m32[generate 32bit i386 code]'
    '-m3dnowa[support Athlon 3Dnow! built-in functions]'
    '-m3dnow[support 3DNow! built-in functions]'
    '-m64[generate 64bit x86-64 code]'
    '-m80387[use hardware fp]'
    '-m8bit-idiv[expand 32bit/64bit integer divide into 8bit unsigned integer divide with run-time check]'
    '-m96bit-long-double[sizeof(long double) is 12]'
    '-mabi=-[generate code that conforms to the given ABI]:abi:(ms sysv)'
    '-mabm[support code generation of Advanced Bit Manipulation (ABM) instructions]'
    '-maccumulate-outgoing-args[reserve space for outgoing arguments in the function prologue]'
    '-maddress-mode=-[use given address mode]:address mode:(short long)'
    '-madx[support flag-preserving add-carry instructions]'
    '-maes[support AES built-in functions and code generation]'
    '-malign-data=-[use the given data alignment]:type:(compat abi cacheline)'
    '-malign-double[align some doubles on dword boundary]'
    '-malign-functions=-[function starts are aligned to this power of 2]: **2 base for function alignment: '
    '-malign-jumps=-[jump targets are aligned to this power of 2]: **2 base for jump goal alignment: '
    '-malign-loops=-[loop code aligned to this power of 2]: **2 base for loop alignment: '
    '-malign-stringops[align destination of the string operations]'
    "-mamx-bf16[amx bf16]"
    "-mamx-int8[amx int8]"
    "-mamx-tile[amx tile]"
    '-mandroid[generate code for the Android platform]'
    '-march=-[generate instructions for CPU type]:CPU type:->archgeneric'
    '-masm=-[use given assembler dialect]:asm dialect:(att intel)'
    '-mavx256-split-unaligned-load[split 32-byte AVX unaligned load]'
    '-mavx256-split-unaligned-store[split 32-byte AVX unaligned store]'
    '-mavx2[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX and AVX2 built-in functions and code generation]'
    '-mavx5124fmaps[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2, AVX512F and AVX5124FMAPS built- in functions and code generation]'
    '-mavx5124vnniw[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2, AVX512F and AVX5124VNNIW built- in functions and code generation]'
    "-mavx512bf16[avx512bf16]"
    "-mavx512bitalg[avx512bitalg]"
    '-mavx512bw[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512BW built- in functions and code generation]'
    '-mavx512cd[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512CD built- in functions and code generation]'
    '-mavx512dq[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512DQ built- in functions and code generation]'
    '-mavx512er[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512ER built- in functions and code generation]'
    '-mavx512f[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F built-in functions and code generation]'
    '-mavx512ifma[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512IFMA built-in functions and code generation]'
    '-mavx512pf[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512PF built- in functions and code generation]'
    "-mavx512vbmi2[avx512vbmi2]"
    '-mavx512vbmi[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512VBMI built-in functions and code generation]'
    '-mavx512vl[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512VL built- in functions and code generation]'
    "-mavx512vnni[avx512vnni]"
    "-mavx512vp2intersect[avx512vp2intersect]"
    '-mavx512vpopcntdq[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2, AVX512F and AVX512VPOPCNTDQ built-in functions and code generation]'
    '-mavx[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2 and AVX built-in functions and code generation]'
    "-mavxvnni[avxvnni]"
    '-mbionic[use Bionic C library]'
    '-mbmi2[support BMI2 built-in functions and code generation]'
    '-mbmi[support BMI built-in functions and code generation]'
    '-mbranch-cost=-[branches are this expensive (1-5, arbitrary units)]:branch cost (1-5): '
    "-mcldemote[cldemote]"
    '-mcld[generate cld instruction in the function prologue]'
    '-mclflushopt[support CLFLUSHOPT instructions]'
    '-mclwb[support CLWB instruction]'
    '-mclzero[support CLZERO built-in functions and code generation]'
    '-mcmodel=-[use given x86-64 code model]:memory model:(32 small kernel medium large)'
    '-mcpu=-[set CPU type]:CPU type:->arch'
    '-mcrc32[support code generation of crc32 instruction]'
    '-mcx16[support code generation of cmpxchg16b instruction]'
    '-mdispatch-scheduler[do dispatch scheduling if processor is bdver1, bdver2, bdver3, bdver4 or znver1 and Haifa scheduling is selected]'
    "-menqcmd[enqcmd]"
    '-mf16c[support F16C built-in functions and code generation]'
    '-mfancy-math-387[generate sin, cos, sqrt for FPU]'
    '-mfentry[emit profiling counter call at function entry before prologue]'
    '-mfma4[support FMA4 built-in functions and code generation]'
    '-mfma[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX and FMA built-in functions and code generation]'
    '-mforce-drap[always use Dynamic Realigned Argument Pointer (DRAP) to realign stack]'
    '-mfpmath=-[generate floating point mathematics using given instruction set]:FPU type:(387 sse sse,387 both)'
    '-mfp-ret-in-387[return values of functions in FPU registers]'
    '-mfsgsbase[support FSGSBASE built-in functions and code generation]'
    '-mfunction-return=-[convert function return to call and return thunk]:choice:(keep thunk thunk-inline thunk-extern)'
    '-mfxsr[support FXSAVE and FXRSTOR instructions]'
    '-mgeneral-regs-only[generate code which uses only the general registers]'
    "-mgfni[gfni]"
    '-mglibc[use GNU C library]'
    '-mhard-float[use hardware fp]'
    '-mhle[support Hardware Lock Elision prefixes]'
    "-mhreset[hreset]"
    '-miamcu[generate code that conforms to Intel MCU psABI]'
    '-mieee-fp[use IEEE math for fp comparisons]'
    '-mincoming-stack-boundary=-[assume incoming stack aligned to this power of 2]:assumed size of boundary: '
    '-mindirect-branch=-[convert indirect call and jump to call and return thunks]:choice:(keep thunk thunk-inline thunk-extern)'
    '-mindirect-branch-register[force indirect call and jump via register]'
    '-minline-all-stringops[inline all known string operations]'
    '-minline-stringops-dynamically[inline memset/memcpy string operations, but perform inline version only for small blocks]'
    "-minvpcid[invpcid]"
    "-mkl[kl]"
    '-mlarge-data-threshold=-[data greater than given threshold will go into .ldata section in x86-64 medium model]:threshold: '
    '-mlong-double-128[use 128-bit long double]'
    '-mlong-double-64[use 64-bit long double]'
    '-mlong-double-80[use 80-bit long double]'
    '-mlwp[support LWP built-in functions and code generation]'
    '-mlzcnt[support LZCNT built-in function and code generation]'
    {'-mmemset-strategy=-','-mmemcpy-strategy=-'}'[specify memcpy expansion strategy when expected size is known]:strategy:'
    '-mmitigate-rop[attempt to avoid generating instruction sequences containing ret bytes]'
    '-mmmx[support MMX built-in functions]'
    '-mmovbe[support code generation of movbe instruction]'
    "-mmovdir64b[movdir64b]"
    "-mmovdiri[movdiri]"
    '-mmpx[support MPX code generation]'
    '-mms-bitfields[use native (MS) bitfield layout]'
    '-mmusl[use musl C library]'
    '-mmwaitx[support MWAITX and MONITORX built-in functions and code generation]'
    '-mno-default[clear all tune features]'
    '-mnop-mcount[generate mcount/__fentry__ calls as nops. To activate they need to be patched in]'
    '-mno-sse4[do not support SSE4.1 and SSE4.2 built-in functions and code generation]'
    '-momit-leaf-frame-pointer[omit the frame pointer in leaf functions]'
    '-mpc32[set 80387 floating-point precision to 32-bit]'
    '-mpc64[set 80387 floating-point precision to 64-bit]'
    '-mpc80[set 80387 floating-point precision to 80-bit]'
    '-mpclmul[support PCLMUL built-in functions and code generation]'
    "-mpconfig[pconfig]"
    '-mpku[support PKU built-in functions and code generation]'
    '-mpopcnt[support code generation of popcnt instruction]'
    '-mprefer-avx128[use 128-bit AVX instructions instead of 256-bit AVX instructions in the auto-vectorizer]'
    '-mpreferred-stack-boundary=-[attempt to keep stack aligned to this power of 2]:size of boundary: '
    '-mprefetchwt1[support PREFETCHWT1 built-in functions and code generation]'
    '-mprfchw[support PREFETCHW instruction]'
    "-mptwrite[ptwrite]"
    '-mpush-args[use push instructions to save outgoing arguments]'
    '-mrdpid[support RDPID built-in functions and code generation]'
    '-mrdrnd[support RDRND built-in functions and code generation]'
    '-mrdseed[support RDSEED instruction]'
    '-mrecip=-[control generation of reciprocal estimates]::instruction:(all none div divf divd rsqrt rsqrtf rsqrtd)' #TODO comma separated and can have !
    '-mrecip[generate reciprocals instead of divss and sqrtss]'
    '-mrecord-mcount[generate __mcount_loc section with all mcount or __fentry__ calls]'
    '-mred-zone[use red-zone in the x86-64 code]'
    '-mreg-alloc=[control the default allocation order of integer registers]:default register allocation order:'
    '-mregparm=-[number of registers used to pass integer arguments]:number of integer argument registers: '
    "-mretpoline-external-thunk[retpoline external thunk]"
    '-mrtd[alternate calling convention]'
    '-mrtm[support RTM built-in functions and code generation]'
    '-msahf[support code generation of sahf instruction in 64bit x86-64 code]'
    "-mserialize[serialize]"
    '-msgx[support SGX built-in functions and code generation]'
    '-msha[support SHA1 and SHA256 built-in functions and code generation]'
    "-mshstk[shstk]"
    '-mskip-rax-setup[skip setting up RAX register when passing variable arguments]'
    '-msoft-float[do not use hardware fp]'
    '-msse2avx[encode SSE instructions with VEX prefix]'
    '-msse2[support MMX, SSE and SSE2 built-in functions and code generation]'
    '-msse3[support MMX, SSE, SSE2 and SSE3 built-in functions and code generation]'
    '-msse4.1[support MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1 built-in functions and code generation]'
    '-msse4.2[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1 and SSE4.2 built-in functions and code generation]'
    '-msse4a[support MMX, SSE, SSE2, SSE3 and SSE4A built-in functions and code generation]'
    '-msse4[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1 and SSE4.2 built-in functions and code generation]'
    '-msseregparm[use SSE register passing conventions for SF and DF mode]'
    '-msse[support MMX and SSE built-in functions and code generation]'
    '-mssse3[support MMX, SSE, SSE2, SSE3 and SSSE3 built-in functions and code generation]'
    '-mstack-arg-probe[enable stack probing]'
    '-mstack-protector-guard=-[use given stack-protector guard]:guard:(global tls)'
    '-mstackrealign[realign stack in prologue]'
    '-mstringop-strategy=-[chose strategy to generate stringop using]:stringop strategy:(byte_loop libcall loop rep_4byte rep_8byte rep_byte unrolled_loop)'
    '-mstv[disable Scalar to Vector optimization pass transforming 64-bit integer computations into a vector ones]'
    '-mtbm[support TBM built-in functions and code generation]'
    '-mthreads[support thread-safe exception handling on MinGW]'
    '-mtls-dialect=-[use given thread-local storage dialect]:TLS dialect:(gnu gnu2)'
    '-mtls-direct-seg-refs[use direct references against %gs when accessing tls data]'
    "-mtsxldtrk[tsxldtrk]"
    #'-mtune-ctrl=-[fine grain control of tune features]:feature-list:' #for dev use only
    '-mtune=-[tune code for CPU type]:CPU type:->arch'
    '-muclibc[use uClibc C library]'
    "-muintr[uintr]"
    "-mvaes[vaes]"
    '-mveclibabi=-[vector library ABI to use]:vector library ABI:(acml svml)'
    '-mvect8-ret-in-mem[return 8-byte vectors in memory]'
    "-mvpclmulqdq[vpclmulqdq]"
    '-mvzeroupper[generate vzeroupper instruction before a transfer of control flow out of the function]'
    "-mwaitpkg[waitpkg]"
    "-mwbnoinvd[wbnoinvd]"
    "-mwidekl[widekl]"
    '-mx32[generate 32bit x86-64 code]'
    "-mx87[x87]"
    '-mxop[support XOP built-in functions and code generation]'
    '-mxsavec[support XSAVEC instructions]'
    '-mxsaveopt[support XSAVEOPT instruction]'
    '-mxsaves[support XSAVES and XRSTORS instructions]'
    '-mxsave[support XSAVE and XRSTOR instructions]'
  )
  ;;

hppa*)
  args=(
    -mdisable-fpregs -mdisable-indexing -mfast-indirect-calls
    -mgas -mjump-in-delay -mlong-millicode-calls -mno-disable-fpregs
    -mno-disable-indexing -mno-fast-indirect-calls -mno-gas
    -mno-jump-in-delay -mno-millicode-long-calls
    -mno-portable-runtime -mno-soft-float -msoft-float
    -mpa-risc-1-0 -mpa-risc-1-1 -mportable-runtime
    '-mschedule=:code scheduling constraints:(700 7100 7100LC)'
  )
  ;;

i960)
  args=(
    -m{ka,kb,mc,ca,cf,sa,sb}
    -masm-compat -mclean-linkage
    -mcode-align -mcomplex-addr -mleaf-procedures
    -mic-compat -mic2.0-compat -mic3.0-compat
    -mintel-asm -mno-clean-linkage -mno-code-align
    -mno-complex-addr -mno-leaf-procedures
    -mno-old-align -mno-strict-align -mno-tail-call
    -mnumerics -mold-align -msoft-float -mstrict-align
    -mtail-call
  )
  ;;

sparc)
  arch=(
    v7 cypress v8 supersparc sparclite f930 f934 hypersparc sparclite86x sparclet
    tsc701 v9 ultrasparc ultrasparc3
  )
  args=(
    -mapp-regs -mno-app-regs
    -mfpu -mhard-float
    -mno-fpu -msoft-float
    -mhard-quad-float
    -msoft-quad-float
    -mno-unaligned-doubles
    -munaligned-doubles
    -mfaster-structs -mno-faster-structs
    -mimpure-text
    '-mcpu=:CPU type:->arch'
    '-mtune=:CPU type:->arch'
    -mv8plus -mno-v8plus
    -mvis -mno-vis
    -mlittle-endian
    -m32 -m64
    '-mcmodel=:memory model:(medlow medmid medany embmedany)'
    -mstack-bias -mno-stack-bias
    -mv8
    -mcypress -mepilogue -mflat
    -mno-flat
    -mno-epilogue
    -msparclite -msupersparc
    -mmedlow -mmedany
    -mint32 -mint64 -mlong32 -mlong64
  )
  ;;

alpha*)
  args=(
    -mfp-regs -mno-fp-regs -mno-soft-float
    -msoft-float
  )
  ;;

clipper)
  args=(
    -mc300 -mc400
  )
  ;;

h8/300)
  args=(
    -mrelax -mh
  )
  ;;

aarch64)
  args=(
    "-mmark-bti-property[add .note.gnu.property with BTI to assembly files]"
    "-moutline[enable function outlining (AArch64 only)]"
    "-msve-vector-bits=[specify the size in bits of an SVE vector register]:bits"
  )
  ;;

amdgpu)
  args=(
    "-mcumode[specify CU wavefront execution mode]"
    "-mtgsplit[enable threadgroup split execution mode (AMDGPU only)]"
  )
  ;;

hexagon)
  args=(
    "-mieee-rnd-near[ieee rnd near]"
    "-mmemops[enable generation of memop instructions]"
    "-mnvj[enable generation of new-value jumps]"
    "-mnvs[enable generation of new-value stores]"
    "-mpackets[enable generation of instruction packets]"
    "-mhvx[enable Hexagon Vector eXtensions]"
    "-mhvx-length=[set Hexagon Vector Length]:arg"
    "-mhvx=[enable Hexagon Vector eXtensions]:arg"
  )
  ;;

webassembly*)
  args=(
    "-matomics[atomics]"
    "-mbulk-memory[bulk memory]"
    "-mexception-handling[exception handling]"
    "-mmultivalue[multivalue]"
    "-mmutable-globals[mutable globals]"
    "-mnontrapping-fptoint[no ntrapping fptoint]"
    "-mreference-types[reference types]"
    "-msign-ext[sign ext]"
    "-msimd128[simd128]"
    "-mtail-call[tail call]"
    "-munimplemented-simd128[unimplemented simd128]"
    "-mexec-model=[execution model]:arg"
  )
  ;;

riscv)
  args=(
    "-msave-restore[enable using library calls for save and restore]"
  )
  ;;
esac

if [[ "$service" = clang* ]]; then
  args+=(
    "-all_load[undocumented option]"
    "-allowable_client[undocumented option]:argument"
    "--analyzer-no-default-checks[analyzer does no default checks]"
    "--analyzer-output[static analyzer report output format]:format:(html plist plist-multi-file plist-html sarif sarif-html text)"
    "--analyze[run the static analyzer]"
    "-arch[arch]:argument"
    "-arch_errors_fatal[arch errors fatal]"
    "-arch_only[arch only]:argument"
    "-arcmt-migrate-emit-errors[emit ARC errors even if the migrator can fix them]"
    "-arcmt-migrate-report-output[output path for the plist report]:file:_files"
    "-a-[undocumented option]:argument"
    "--autocomplete=[autocomplete]:argument"
    "-bind_at_load[bind at load]"
    "--bootclasspath=[bootclasspath]:arg"
    "-bundle[bundle]"
    "-bundle_loader[bundle loader]:argument"
    "--CLASSPATH=[CLASSPATH]:arg"
    "--classpath=[classpath]:arg"
    "-cl-denorms-are-zero[allow denormals to be flushed to zero]"
    "-cl-fast-relaxed-math[cl fast relaxed math]"
    "-cl-finite-math-only[allow floating-point optimizations]"
    "-cl-fp32-correctly-rounded-divide-sqrt[specify that divide and sqrt are correctly rounded]"
    "-client_name[client name]:argument"
    "-cl-kernel-arg-info[generate kernel argument metadata]"
    "-cl-mad-enable[allow use of less precise MAD computations]"
    "-cl-no-signed-zeros[allow use of no signed zeros computations]"
    "-cl-no-stdinc[disables all standard includes]"
    "-cl-opt-disable[disables all optimizations]"
    "-cl-single-precision-constant[treat double float constant as single precision]"
    "-cl-std=[openCL language standard to compile for]:arg"
    "-cl-strict-aliasing[this option is added for compatibility with OpenCL 1.0]"
    "-cl-uniform-work-group-size[defines that the global work-size be uniform]"
    "-cl-unsafe-math-optimizations[allow unsafe floating-point optimizations]"
    "-compatibility_version[compatibility version]:compatibility version"
    "--config[specifies configuration file]:configuration file:_files"
    "--constant-cfstrings[use constant cfstrings]"
    "--coverage[coverage]"
    "-coverage[coverage]"
    "-cpp[cpp]"
    "--cuda-compile-host-device[compile CUDA code for both host and device]"
    "--cuda-device-only[compile CUDA code for device only]"
    "--cuda-gpu-arch=[cUDA offloading device architecture]:arg"
    "--cuda-host-only[compile CUDA code for host only]"
    "*--cuda-include-ptx=[include ptx for the following gpu architecture]:argument"
    "--cuda-noopt-device-debug[enable device-side debug info generation]"
    "--cuda-path=[cUDA installation path]:arg"
    "--cuda-path-ignore-env[ignore environment variables to detect CUDA installation]"
    "-cuid=[an id for compilation unit]:argument"
    "-current_version[current version]:current version"
    "-cxx-isystem[add directory to the C++ SYSTEM include search path]:directory:_files -/"
    "-dead_strip[dead strip]"
    "-dependency-dot[file to write dot-formatted header dependencies to]:file:_files"
    "-dependency-file[file to write dependency output to]:file:_files"
    "--dyld-prefix=[dyld prefix]:prefix"
    "--dylib_file[dyld file]:file:_files"
    "-dylinker[dylinker]"
    "-dylinker_install_name[dylinker install name]:name"
    "-dynamic[dynamic]"
    "-dynamiclib[dynamic lib]"
    "-EB[big endian]"
    "-EL[little endian]"
    "-emit-ast[emit Clang AST files for source inputs]"
    "-emit-interface-stubs[generate Interface Stub Files]"
    "-emit-llvm[use the LLVM representation for assembler and object files]"
    "-emit-merged-ifs[generate Interface Stub Files, emit merged text not binary]"
    "--emit-static-lib[enable linker job to emit a static library]"
    #"-enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang[trivial automatic variable initialization to zero is only here for benchmarks]"
    "--encoding=[encoding]:arg"
    "-exported_symbols_list[exported symbols list]:argument"
    "--extdirs=[extdirs]:arg"
    "--extra-warnings[enable extra warnings]"
    "-faccess-control[access control]"
    "*-F+[add directory to framework search path]:framework directory:_files -/"
    "-faddrsig[emit an address-significance table]"
    "-faggressive-function-elimination[aggressive function elimination]"
    "-falign-commons[align commons]"
    "-faligned-allocation[aligned allocation]"
    "-faligned-new[enable C++17 aligned allocation functions]"
    "-fall-intrinsics[all intrinsics]"
    "-fallow-editor-placeholders[treat editor placeholders as valid source code]"
    "-fallow-unsupported[allow unsupported]"
    "-falternative-parameter-statement[enable the old style PARAMETER statement]"
    "-faltivec[altivec]"
    "-fansi-escape-codes[use ANSI escape codes for diagnostics]"
    "-fapple-kext[use Apple's kernel extensions ABI]"
    "-fapple-link-rtlib[force linking the clang builtins runtime library]"
    "-fapple-pragma-pack[enable Apple GCC-compatible #pragma pack handling]"
    "-fapplication-extension[restrict code to those available for App Extensions]"
    "-fasm-blocks[asm blocks]"
    "-fassume-sane-operator-new[assume sane operator new]"
    "-fast[ast]"
    "-fastcp[astcp]"
    "-fastf[astf]"
    "-fautolink[autolink]"
    "-fautomatic[automatic]"
    "-fauto-profile-accurate[auto profile accurate]"
    "-fauto-profile=[enable sample-based profile guided optimizations]::arg"
    "-fbackslash[change the interpretation of backslashes in string literals]"
    "-fbacktrace[backtrace]"
    "-fbasic-block-sections=[generate labels for each basic block]:arg"
    "-fbinutils-version=[produced object files can use all ELF features supported by this version]:major.minor"
    "-fblas-matmul-limit=[blas matmul limit]:arg"
    "-fblocks[enable the blocks language feature]"
    "-fbootclasspath=[bootclasspath]:arg"
    "-fborland-extensions[accept non-standard constructs supported by the Borland compiler]"
    "-fbracket-depth=[bracket depth]:arg"
    "-fbuild-session-file=[use the last modification time of <file> as the build session timestamp]:file:_files"
    "-fbuild-session-timestamp=[time when the current build session started]:time since Epoch in seconds"
    "-fbuiltin-module-map[load the clang builtins module map file]"
    "-fcaret-diagnostics[show diagnostic messages using a caret]"
    "-fcf-protection=[instrument control-flow architecture protection]::arg (options\: return, branch, full, none)"
    "-fcf-runtime-abi=[cf runtime abi]:arg"
    "-fchar8_t[enable C++ builtin type char8_t]"
    "-fcheck-array-temporaries[check array temporaries]"
    "-fcheck=[check]:arg"
    "-fclang-abi-compat=[attempt to match the ABI of Clang <version>]:version"
    "-fclasspath=[classpath]:arg"
    "-fcoarray=[coarray]:arg"
    "-fcolor-diagnostics[enable colors in diagnostics]"
    "-fcomment-block-commands=[treat each comma separated argument in <arg> as a documentation comment block command]:arg"
    "-fcompile-resource=[compile resource]:arg"
    "-fcomplete-member-pointers[require member pointer base types to be complete if they would be significant under the Microsoft ABI]"
    "-fconstant-cfstrings[constant cfstrings]"
    "-fconstant-string-class=[constant string class]:arg"
    "-fconstexpr-backtrace-limit=[constexpr backtrace limit]:arg"
    "-fconstexpr-depth=[constexpr depth]:arg"
    "-fconstexpr-steps=[constexpr steps]:arg"
    "-fconvergent-functions[assume functions may be convergent]"
    "-fconvert=[convert]:arg"
    "-fcoroutines-ts[enable support for the C++ Coroutines TS]"
    "-fcoverage-compilation-dir=[the compilation directory to embed in the coverage mapping]:arg"
    "-fcoverage-mapping[generate coverage mapping to enable code coverage analysis]"
    "-fcoverage-prefix-map=[remap file source paths in coverage mapping]:arg"
    "-fcrash-diagnostics-dir=[crash diagnostics dir]:arg"
    "-fcray-pointer[cray pointer]"
    "-fcreate-profile[create profile]"
    "-fcs-profile-generate[generate instrumented code to collect context sensitive execution counts]"
    "-fcs-profile-generate=[generate instrumented code to collect context sensitive execution counts]:directory:_files -/"
    "-fc\+\+-static-destructors[c++ static destructors]"
    "-fcuda-approx-transcendentals[use approximate transcendental functions]"
    "-fcuda-flush-denormals-to-zero[flush denormal floating point values to zero in CUDA device mode]"
    "-fcuda-rdc[cuda rdc]"
    "-fcuda-short-ptr[use 32-bit pointers for accessing const/local/shared address spaces]"
    "-fcxx-exceptions[enable C++ exceptions]"
    "-fcxx-modules[cxx modules]"
    "-fdebug-compilation-dir=[the compilation directory to embed in the debug info]:arg"
    "-fdebug-default-version=[default DWARF version to use]:arg"
    "-fdebug-dump-parse-tree[dump the parse tree]"
    "-fdebug-dump-provenance[dump provenance]"
    "-fdebug-dump-symbols[dump symbols after the semantic analysis]"
    "-fdebug-info-for-profiling[emit extra debug info to make sample profile more accurate]"
    "-fdebug-macro[emit macro debug information]"
    "-fdebug-measure-parse-tree[measure the parse tree]"
    "-fdebug-pass-arguments[debug pass arguments]"
    "-fdebug-pass-structure[debug pass structure]"
    "-fdebug-pre-fir-tree[dump the pre-FIR tree]"
    "-fdebug-ranges-base-address[use DWARF base address selection entries in .debug_ranges]"
    "-fdebug-unparse[unparse and stop]"
    "-fdebug-unparse-with-symbols[unparse and stop]"
    "-fdeclspec[allow __declspec as a keyword]"
    "-fdefault-double-8[set the default double precision kind to an 8 byte wide type]"
    "-fdefault-integer-8[set the default integer kind to an 8 byte wide type]"
    "-fdefault-real-8[set the default real kind to an 8 byte wide type]"
    "-fdelayed-template-parsing[parse templated function definitions at the end of the translation unit]"
    "-fdenormal-fp-math=[denormal fp math]:arg"
    "-fdepfile-entry=[depfile entry]:arg"
    "-fdiagnostics-absolute-paths[print absolute paths in diagnostics]"
    "-fdiagnostics-fixit-info[supply fixit into with diagnostic messages]"
    "-fdiagnostics-format=[diagnostics format]:arg"
    "-fdiagnostics-hotness-threshold=[prevent optimization remarks from being output if they do not meet threshold]:value"
    "-fdiagnostics-parseable-fixits[print fixits in a machine parseable form]"
    "-fdiagnostics-print-source-range-info[print source range spans in numeric form]"
    "-fdiagnostics-show-category=[diagnostics show category]:arg"
    "-fdiagnostics-show-hotness[enable profile hotness information in diagnostic line]"
    "-fdiagnostics-show-note-include-stack[display include stacks for diagnostic notes]"
    "-fdiagnostics-show-option[enable -Woption information in diagnostic line]"
    "-fdiagnostics-show-template-tree[print a template comparison tree for differing templates]"
    "-fdigraphs[enable alternative token representations]"
    "-fdirect-access-external-data[don't use GOT indirection to reference external data symbols]"
    "-fdiscard-value-names[discard value names in LLVM IR]"
    "-fd-lines-as-code[d lines as code]"
    "-fd-lines-as-comments[d lines as comments]"
    "-fdollar-ok[dollar ok]"
    "-fdouble-square-bracket-attributes[enable double square bracket attributes]"
    "-fdump-fortran-optimized[dump fortran optimized]"
    "-fdump-fortran-original[dump fortran original]"
    "-fdump-parse-tree[dump parse tree]"
    "-fdwarf-directory-asm[DWARF directory asm]"
    "-fdwarf-exceptions[use DWARF style exceptions]"
    "-felide-constructors[elide constructors]"
    "-felide-type[elide types when printing diagnostics]"
    "-fembed-bitcode=[embed LLVM bitcode (option: off, all, bitcode, marker)]:option"
    "-fembed-bitcode[equivalent to -fembed-bitcode=all]"
    "-fembed-bitcode-marker[equivalent to -fembed-bitcode=marker]"
    "-femit-all-decls[emit all declarations]"
    "-femulated-tls[use emutls functions to access thread_local variables]"
    "-fenable-matrix[enable matrix data type and related builtin functions]"
    "-fencoding=[encoding]:arg"
    "-ferror-limit=[error limit]:arg"
    "-fescaping-block-tail-calls[escaping block tail calls]"
    "-fexperimental-isel[experimental isel]"
    "-fexperimental-new-constant-interpreter[enable the experimental new constant interpreter]"
    "-fexperimental-relative-c\+\+-abi-vtables[use the experimental C++ class ABI for classes with vtables]"
    "-fexperimental-strict-floating-point[enables experimental strict floating point in LLVM]"
    "-fextdirs=[extdirs]:arg"
    "-fexternal-blas[external blas]"
    "-ff2c[f2c]"
    "-ffile-compilation-dir=[the compilation directory to embed in the debug info]:arg"
    "-ffile-prefix-map=[remap file source paths in debug info and predefined preprocessor macros]:arg"
    "-ffine-grained-bitfield-accesses[use separate accesses for consecutive bitfield runs with legal widths and alignments]"
    "-ffinite-loops[assume all loops are finite]"
    "-ffixed-form[process source files in fixed form]"
    "-ffixed-line-length=[set column after which characters are ignored]:arg"
    "-ffixed-point[enable fixed point types]"
    "-fforce-dwarf-frame[always emit a debug frame section]"
    "-fforce-emit-vtables[emits more virtual tables to improve devirtualization]"
    "-fforce-enable-int128[enable support for int128_t type]"
    "-ffor-scope[for scope]"
    "-ffpe-trap=[fpe trap]:arg"
    "-ffp-exception-behavior=[specifies the exception behavior of floating-point operations]:arg"
    "-ffp-model=[controls the semantics of floating-point calculations]:arg"
    "-ffree-form[process source files in free form]"
    "-ffree-line-length-[free line length]:arg"
    "-ffrontend-optimize[frontend optimize]"
    "-fglobal-isel[enables the global instruction selector]"
    "-fgnuc-version=[sets various macros to claim compatibility with the given GCC version]:version"
    "-fgnu-inline-asm[gnu inline asm]"
    "-fgnu-keywords[allow GNU-extension keywords regardless of language standard]"
    "-fgnu-runtime[generate output compatible with the standard GNU Objective-C runtime]"
    "-fgpu-allow-device-init[allow device side init function in HIP]"
    "-fgpu-defer-diag[defer host/device related diagnostic messages for CUDA/HIP]"
    "-fgpu-rdc[generate relocatable device code, also known as separate compilation mode]"
    "-fgpu-sanitize[enable sanitizer for AMDGPU target]"
    "-fheinous-gnu-extensions[heinous GNU extensions]"
    "-fhip-new-launch-api,[-fno-hip-new-launch-api Use new kernel launching API for HIP]"
    "-fhonor-infinites[honor infinites]"
    "-fhonor-infinities[honor infinities]"
    "-fhonor-nans[honor nans]"
    "-fignore-exceptions[enable support for ignoring exception handling constructs]"
    "-filelist[ilelist]:arg"
    "-fimplicit-module-maps[implicit module maps]"
    "-fimplicit-modules[implicit modules]"
    "-fimplicit-none[no implicit typing allowed unless overridden by IMPLICIT statements]"
    "-findirect-virtual-calls[indirect virtual calls]"
    "-finit-character=[init character]:arg"
    "-finit-integer=[init integer]:arg"
    "-finit-local-zero[init local zero]"
    "-finit-logical=[init logical]:arg"
    "-finit-real=[init real]:arg"
    "-finline-hint-functions[inline functions which are (explicitly or implicitly) marked inline]"
    "-finstrument-function-entry-bare[instrument function entry only]"
    "-finstrument-functions-after-inlining[insert the calls after inlining]"
    "-finteger-4-integer-8[integer 4 integer 8]"
    "-fintegrated-as[enable the integrated assembler]"
    "-fintegrated-cc1[run cc1 in-process]"
    "-fintrinsic-modules-path[intrinsic modules path]"
    "-flarge-sizes[use INTEGER(KIND=8) for the result type in size-related intrinsics]"
    "-flat_namespace[flat namespace]"
    "-flegacy-pass-manager[use the legacy pass manager in LLVM]"
    "-flimited-precision=[limited precision]:arg"
    "-flogical-abbreviations[enable logical abbreviations]"
    "-flto=-[generate output files suitable for link time optimization]::style:(full thin)"
    "-flto-jobs=[controls the backend parallelism]:arg"
    "-fmacro-backtrace-limit=[macro backtrace limit]:limit"
    "-fmacro-prefix-map=[remap file source paths in predefined preprocessor macros]:arg"
    "-fmax-array-constructor=[max array constructor]:arg"
    "-fmax-identifier-length[max identifier length]"
    "-fmax-stack-var-size=[max stack var size]:arg"
    "-fmax-subrecord-length=[max subrecord length]:arg"
    "-fmax-tokens=[max total number of preprocessed tokens for -Wmax-tokens]:number"
    "-fmax-type-align=[specify the maximum alignment to enforce on pointers lacking an explicit alignment]:arg"
    "-fmemory-profile=[enable heap memory profiling and dump results into <directory>]::directory:_files -/"
    "-fmodule-file-deps[module file deps]"
    "-fmodule-file=[specify the mapping of module name to precompiled module file]:file:_files"
    "-fmodule-implementation-of[module implementation of]:name"
    "-fmodule-map-file=[load this module map file]:file:_files"
    "-fmodule-maps[implicitly search the file system for module map files.]"
    "-fmodule-name=[specify the name of the module to build]:name"
    "-fmodule-private[module private]"
    "-fmodules-cache-path=[specify the module cache path]:directory:_files -/"
    "-fmodules-decluse[require declaration of modules used within a module]"
    "-fmodules-disable-diagnostic-validation[disable validation of the diagnostic options when loading the module]"
    "-fmodules[enable the modules language feature]"
    "-fmodules-ignore-macro=[ignore the definition of the given macro when building and loading modules]:macro"
    "-fmodules-prune-after=[specify the interval after which a module file will be considered unused]:seconds"
    "-fmodules-prune-interval=[specify the interval between attempts to prune the module cache]:seconds"
    "-fmodules-search-all[search even non-imported modules to resolve references]"
    "-fmodules-strict-decluse[requires all headers to be in modules]"
    "-fmodules-ts[enable support for the C++ Modules TS]"
    "-fmodules-user-build-path[specify the module user build path]:directory:_files -/"
    "-fmodules-validate-input-files-content[validate PCM input files based on content if mtime differs]"
    "-fmodules-validate-once-per-build-session[don't verify input files for the modules]"
    "-fmodules-validate-system-headers[validate the system headers that a module depends on when loading the module]"
    "-fms-compatibility[enable full Microsoft Visual C++ compatibility]"
    "-fms-compatibility-version=[microsoft compiler version number]:arg"
    "-fmsc-version=[microsoft compiler version number to report]:arg"
    "-fms-memptr-rep=[ms memptr rep]:arg"
    "-fms-volatile[ms volatile]"
    "-fnested-functions[nested functions]"
    "-fnew-alignment=[specifies the largest alignment guaranteed]:align"
    "-fnext-runtime[next runtime]"
    "-fno-builtin-[disable implicit builtin knowledge of a specific function]:arg"
    "-fno-crash-diagnostics[disable auto-generation of preprocessed source files and a script for reproduction during a clang crash]"
    "-fno-limit-debug-info[no limit debug info]"
    "-fno-max-type-align[no max type align]"
    "-fno_modules-validate-input-files-content[no modules validate input files content]"
    "-fno_pch-validate-input-files-content[no pch validate input files content]"
    "-fno-strict-modules-decluse[no strict modules decluse]"
    "-fno-temp-file[directly create compilation output files]"
    "-fno-working-directory[no working directory]"
    "-fnoxray-link-deps[no xray link deps]"
    "-fobjc-abi-version=-[set Objective-C ABI version]:version"
    "-fobjc-arc-exceptions[use EH-safe code when synthesizing retains and releases in -fobjc-arc]"
    "-fobjc-arc[synthesize retain and release calls for Objective-C pointers]"
    "-fobjc-convert-messages-to-runtime-calls[convert messages to runtime calls]"
    "-fobjc-encode-cxx-class-template-spec[fully encode C++ class template specialization]"
    "-fobjc-exceptions[enable Objective-C exceptions]"
    "-fobjc-infer-related-result-type[infer related result type]"
    "-fobjc-legacy-dispatch[use legacy dispatch]"
    "-fobjc-link-runtime[set link runtime]"
    "-fobjc-nonfragile-abi[set nonfragile abi]"
    "-fobjc-nonfragile-abi-version=-[set nonfragile abi version]:version"
    "-fobjc-runtime=-[specify the target Objective-C runtime kind and version]:runtime"
    "-fobjc-sender-dependent-dispatch[set sender dependent dispatch]"
    "-fobjc-weak[enable ARC-style weak references in Objective-C]"
    "-fopenmp-targets=[specify comma-separated list of triples OpenMP offloading targets to be supported]:targets"
    "-fopenmp-version=[openmp version]:version"
    "-foperator-arrow-depth=[operator arrow depth]:arg"
    "-foperator-names[treat C++ operator name keywords as synonyms for operators]"
    "-foptimization-record-file=[specify the output name of the file containing the optimization remarks]:file:_files"
    "-foptimization-record-passes=[only include passes which match a specified regex]:regex"
    "-force_cpusubtype_ALL[force cpusubtype all]"
    "-force_flat_namespace[force flat namespace]"
    "--force-link=[force link]:arg"
    "-force_load[force load]:argument"
    "-forder-file-instrumentation[generate instrumented code to collect order file]"
    "-foutput-class-dir=[output class dir]:arg"
    "-fpack-derived[pack derived]"
    "-fparse-all-comments[parse all comments]"
    "-fpascal-strings[recognize and construct Pascal-style string literals]"
    "-fpass-plugin=[load pass plugin from a dynamic shared object file]:dsopath"
    "-fpatchable-function-entry=[generate NOPs around function entry]:N,M"
    "-fpch-codegen[generate code for uses of this PCH]"
    "-fpch-debuginfo[generate debug info for types in an object file built from this PCH]"
    "-fpch-instantiate-templates[instantiate templates already while building a PCH]"
    "-fpch-validate-input-files-content[validate PCH input files based on content]"
    "-fprebuilt-implicit-modules[look up implicit modules]"
    "-fprebuilt-module-path=[specify the prebuilt module path]:directory:_files -/"
    "-fpreserve-as-comments[preserve as comments]"
    "-fproc-stat-report=[save subprocess statistics to the given file]:arg"
    "-fprofile-exclude-files=[exclude files from profile]:arg"
    "-fprofile-filter-files=[filter files for profile]:arg"
    "-fprofile-instr-generate=[generate instrumented profile into file]::file:_files"
    "-fprofile-instr-use=[use instrumentation data for profile-guided optimization]::arg"
    "-fprofile-list=[filename defining the list of items to instrument]:file:_files"
    "-fprofile-remapping-file=[use the remappings described in file in profile]:file:_files"
    "-fprofile-sample-accurate[specifies that the sample profile is accurate]"
    "-fprofile-sample-use=[profile sample use]::arg"
    "-fprofile-update=[set update method of profile counters]:method"
    "-fprotect-parens[protect parens]"
    "-fpseudo-probe-for-profiling[emit pseudo probes for sample profiling]"
    "*-framework[include framework found in search path]:framework:->framework"
    "-frange-check[range check]"
    "-freal-4-real-10[real 4 real 10]"
    "-freal-4-real-16[real 4 real 16]"
    "-freal-4-real-8[real 4 real 8]"
    "-freal-8-real-10[real 8 real 10]"
    "-freal-8-real-16[real 8 real 16]"
    "-freal-8-real-4[real 8 real 4]"
    "-frealloc-lhs[realloc lhs]"
    "-frecord-command-line[record command line]"
    "-frecord-marker=[record marker]:arg"
    "-frecursive[recursive]"
    "-fregister-global-dtors-with-atexit[use atexit to register global destructors]"
    "-frelaxed-template-template-args[enable C++17 relaxed template template argument matching]"
    "-frepack-arrays[repack arrays]"
    "-freroll-loops[turn on loop reroller]"
    "-fretain-comments-from-system-headers[retain comments from system headers]"
    "-frewrite-imports[rewrite imports]"
    "-frewrite-includes[rewrite includes]"
    "-frewrite-map-file=[rewrite map file]:arg"
    "-fropi[generate read-only position independent code (ARM only)]"
    "-frtlib-add-rpath[add -rpath with architecture-specific resource directory to the linker flags]"
    "-frtti-data[rtti data]"
    "-frwpi[generate read-write position independent code (ARM only)]"
    "-fsanitize-address-destructor-kind=[set destructor type used in ASan instrumentation]:kind"
    "-fsanitize-address-field-padding=[level of field padding for AddressSanitizer]:arg"
    "-fsanitize-address-globals-dead-stripping[enable linker dead stripping of globals in AddressSanitizer]"
    "-fsanitize-address-poison-custom-array-cookie[enable poisoning array cookies when using custom operator new in AddressSanitizer]"
    "-fsanitize-address-use-after-scope[enable use-after-scope detection in AddressSanitizer]"
    "-fsanitize-address-use-odr-indicator[enable ODR indicator globals]"
    "-fsanitize-blacklist=[path to blacklist file for sanitizers]:arg"
    "-fsanitize-cfi-canonical-jump-tables[make the jump table addresses canonical in the symbol table]"
    "-fsanitize-cfi-cross-dso[enable control flow integrity (CFI) checks for cross-DSO calls]"
    "-fsanitize-cfi-icall-generalize-pointers[generalize pointers in CFI indirect call type signature checks]"
    "-fsanitize-coverage-allowlist=[sanitize coverage allowlist]:arg"
    "-fsanitize-coverage-blacklist=[disable sanitizer coverage instrumentation]:arg"
    "-fsanitize-coverage-blocklist=[sanitize coverage blocklist]:arg"
    "-fsanitize-coverage=[specify the type of coverage instrumentation for Sanitizers]:arg"
    "-fsanitize-coverage-whitelist=[restrict sanitizer coverage instrumentation]:arg"
    "-fsanitize-hwaddress-abi=[select the HWAddressSanitizer ABI to target]:arg"
    "-fsanitize-link-c\+\+-runtime[sanitize link c++ runtime]"
    "-fsanitize-link-runtime[sanitize link runtime]"
    "-fsanitize-memory-track-origins=[enable origins tracking in MemorySanitizer]::arg"
    "-fsanitize-memory-use-after-dtor[enable use-after-destroy detection in MemorySanitizer]"
    "-fsanitize-minimal-runtime[sanitize minimal runtime]"
    "-fsanitize-recover=[enable recovery for specified sanitizers]::arg"
    "-fsanitize-stats[enable sanitizer statistics gathering]"
    "-fsanitize-system-blacklist[path to system blacklist file for sanitizers]:file:_files"
    "-fsanitize-thread-atomics[enable atomic operations instrumentation in ThreadSanitizer (default)]"
    "-fsanitize-thread-func-entry-exit[enable function entry/exit instrumentation in ThreadSanitizer]"
    "-fsanitize-thread-memory-access[enable memory access instrumentation in ThreadSanitizer]"
    "-fsanitize-trap=[enable trapping for specified sanitizers]::arg"
    "-fsanitize-undefined-strip-path-components=[strip a given number of path components when emitting check metadata]:number"
    "-fsanitize-undefined-trap-on-error[equivalent to -fsanitize-trap=undefined]"
    "-fsave-optimization-record=[generate an optimization record file in a specific format]::format"
    "-fsecond-underscore[second underscore]"
    "-fseh-exceptions[use SEH style exceptions]"
    "-fsemantic-interposition[semantic interposition]"
    "-fshow-column[show the column]"
    "-fshow-overloads=[which overload candidates to show when overload resolution fails]:arg"
    "-fshow-source-location[show source location]"
    "-fsignaling-math[signaling math]"
    "-fsign-zero[sign zero]"
    "-fsized-deallocation[enable C++14 sized global deallocation functions]"
    "-fsjlj-exceptions[use SjLj style exceptions]"
    "-fslp-vectorize[enable the superword-level parallelism vectorization passes]"
    "-fspell-checking-limit=[spell checking limit]:arg"
    "-fspell-checking[spell checking]"
    "-fsplit-dwarf-inlining[provide minimal debug info in the object]"
    "-fsplit-lto-unit[enables splitting of the LTO unit]"
    "-fsplit-machine-functions[enable late function splitting using profile information]"
    "-fstack-arrays[stack arrays]"
    "-fstack-clash-protection[enable stack clash protection]"
    "-fstack-size-section[emit section containing metadata on function stack sizes]"
    "-fstandalone-debug[emit full debug info for all types used by the program]"
    "-fstrict-float-cast-overflow[assume that overflowing float-to-int casts are undefined]"
    "-fstrict-return[strict return]"
    "-fstrict-vtable-pointers[enable optimizations based on the strict vtables]"
    "-fstruct-path-tbaa[struct path tbaa]"
    "-fsycl[enable SYCL kernels compilation for device]"
    "-fsymbol-partition=[symbol partition]:arg"
    "-fsystem-module[build this module as a system module. only used with -emit-module]"
    "-ftemplate-backtrace-limit=[template backtrace limit]:arg"
    "-ftemplate-depth--[template depth]:arg"
    "-ftemplate-depth=[template depth]:arg"
    "-fterminated-vtables[terminated vtables]"
    "-fthin-link-bitcode=[write minimized bitcode to <file>]:file:_files"
    "-fthinlto-index=[perform ThinLTO importing using provided index]:arg"
    "-fthreadsafe-statics[threadsafe statics]"
    "-ftime-trace-granularity=[minimum time granularity traced by time profiler]:microseconds"
    "-ftime-trace[turn on time profiler]"
    "-ftrap-function=[issue call to specified function rather than a trap instruction]:function name"
    "-ftrapv-handler=[specify the function to be called on overflow]:function name"
    "-ftrigraphs[process trigraph sequences]"
    "-ftrivial-auto-var-init=[initialize trivial automatic stack variables]:arg"
    "-ftrivial-auto-var-init-stop-after=[stop initializing trivial automatic stack variables after the specified number of instances]:arg"
    "-funderscoring[underscoring]"
    "-funique-basic-block-section-names[use unique names for basic block sections]"
    "-funique-internal-linkage-names[uniqueify Internal Linkage Symbol Names]"
    "-funique-section-names[unique section names]"
    "-funit-at-a-time[unit at a time]"
    "-fuse-cuid=[method to generate ids for compilation units for single source offloading languages CUDA and HIP]:argument"
    "-fuse-cxa-atexit[use cxa atexit]"
    "-fuse-init-array[use init array]"
    "-fuse-line-directives[use #line in preprocessed output]"
    "-fvalidate-ast-input-files-content[compute and store the hash of input files used to build an AST]"
    "-fveclib=[use the given vector functions library]:arg"
    "-fvectorize[enable the loop vectorization passes]"
    "-fvirtual-function-elimination[enables dead virtual function elimination optimization]"
    "-fvisibility-dllexport=[the visibility for dllexport defintions]:arg"
    "-fvisibility-externs-dllimport=[the visibility for dllimport external declarations]:arg"
    "-fvisibility-externs-nodllstorageclass=[the visibility for external declarations without an explicit DLL dllstorageclass]:arg"
    "-fvisibility-from-dllstorageclass[set the visiblity of symbols in the generated code from their DLL storage class]"
    "-fvisibility-global-new-delete-hidden[give global C++ operator new and delete declarations hidden visibility]"
    "-fvisibility-inlines-hidden[give inline C++ member functions hidden visibility by default]"
    "-fvisibility-inlines-hidden-static-local-var[visibility inlines hidden static local var]"
    "-fvisibility-ms-compat[give global types and functions a specific visibility]"
    "-fvisibility-nodllstorageclass=[the visibility for defintiions without an explicit DLL export class]:arg"
    "-fwasm-exceptions[use WebAssembly style exceptions]"
    "-fwhole-file[whole file]"
    "-fwhole-program-vtables[enables whole-program vtable optimization]"
    "-fwritable-strings[store string literals as writable data]"
    "-fxl-pragma-pack[enable IBM XL #pragma pack handling]"
    "-fxor-operator[enable .XOR. as a synonym of .NEQV.]"
    "-fxray-always-emit-customevents[always emit xray customevent calls]"
    "-fxray-always-emit-typedevents[always emit xray typedevents calls]"
    "-fxray-always-instrument=[file defining xray always instrument]:file:_files"
    "-fxray-attr-list=[file defining the list of xray attributes]:file:_files"
    "-fxray-function-groups=[only instrument 1 of N groups]:arg"
    "-fxray-function-index[xray function index]"
    "-fxray-ignore-loops[don't instrument functions with loops unless they also meet the minimum function size]"
    "-fxray-instruction-threshold=[sets the minimum function size to instrument with XRay]:arg"
    "-fxray-instrumentation-bundle=[select which XRay instrumentation points to emit]:arg"
    "-fxray-instrument[generate XRay instrumentation sleds on function entry and exit]"
    "-fxray-link-deps[tells clang to add the link dependencies for XRay]"
    "-fxray-modes=[list of modes to link in by default into XRay instrumented binaries]:arg"
    "-fxray-never-instrument=[file defining the whitelist for Xray attributes]:file:_files"
    "-fxray-selected-function-group=[select which group of functions to instrument]:arg"
    "-fzvector[enable System z vector language extension]"
    {-gcc-toolchain=,--gcc-toolchain=}"[use the gcc toolchain at the given directory]:directory:_files -/"
    "-gcodeview[generate CodeView debug information]"
    {-gcodeview-ghash,-gno-codeview-ghash}"[emit type record hashes is a .debug section]"
    "-gcolumn-info[column info]"
    "-gdwarf-aranges[DWARF aranges]"
    "-gembed-source[embed source text in DWARF debug sections]"
    "-gfull[emit debugging information for all symbols and types]"
    {-G-,-G=-,-msmall-data-limit=,-msmall-data-threshold}"[Put objects of at most size bytes into small data section]:size"
    "-ggnu-pubnames[gnu pubnames]"
    "-ginline-line-tables[inline line tables]"
    "-gline-directives-only[emit debug line info directives only]"
    "-gline-tables-only[line tables only]"
    "-glldb[lldb]"
    "-gmlt[emit debug line number tables only]"
    "-gmodules[generate debug info with external references]"
    "-gno-column-info[no column info]"
    "-gno-embed-source[no embed source]"
    "-gno-gnu-pubnames[no gnu pubnames]"
    "-gno-inline-line-tables[no inline line tables]"
    "-gno-record-command-line[no record command line]"
    "--gpu-instrument-lib=[instrument device library for HIP]:argument"
    "--gpu-max-threads-per-block=[default max threads per block for kernel launch bounds for HIP]"
    "-grecord-command-line[record command line]"
    "-gsce[sce]"
    "-gused[emit debugging information for symbols that are used]"
    "-gz=[DWARF debug sections compression type]::arg"
    "-headerpad_max_install_names[headerpad max install names]:argument"
    "-help[display this information]"
    "--help-hidden[display help for hidden options]"
    "--hip-device-lib=[hIP device library]:arg"
    "--hip-device-lib-path=[hip device lib path]:arg"
    "--hip-link[link clang-offload-bundler bundles for HIP]"
    "--hip-version=[HIP version in the format of major.minor.patch]"
    "-ibuiltininc[enable builtin #include directories even when -nostdinc is used before or after -ibuiltininc]"
    "-iframework[add directory to SYSTEM framework search path]:directory:_files -/"
    "-iframeworkwithsysroot[add directory to SYSTEM framework search path, absolute paths are relative to -isysroot]:directory:_files -/"
    "-image_base[image base]:argument"
    "-include-pch[include precompiled header file]:file:_files"
    "-index-header-map[make the next included directory (-I or -F) an indexer header map]"
    "-init[init]:arg"
    "-install_name[install name]:arg"
    "-integrated-as[integrated as]"
    "-interface-stub-version=[interface stub version]:arg"
    "-isystem-after[add directory to end of the SYSTEM include search path]:directory:_files -/"
    "-ivfsoverlay[overlay the virtual filesystem described by file over the real file system]:arg"
    "-iwithsysroot[add directory to SYSTEM include search path]:directory:_files -/"
    "-J[this option specifies where to put .mod files for compiled modules]:arg"
    "-keep_private_externs[keep private externs]"
    "*-lazy_framework[lazy framework]:framework:->framework"
    "*-lazy_library[lazy library]:arg"
    "--ld-path=[ld path]:arg"
    "--libomptarget-amdgcn-bc-path=[path to libomptarget-amdgcn bitcode library]:arg"
    "--libomptarget-nvptx-bc-path=[path to libomptarget-nvptx bitcode library]:arg"
    "--library-directory=[add directory to library search path]:directory:_files -/"
    "-maix-struct-return[return all structs in memory]"
    "-malign-branch-boundary=[specify the boundary's size to align branches]:size"
    "-malign-branch=[specify types of branches to align]:arg"
    "-mappletvos-version-min=[appletvos version min]:arg"
    "-mappletvsimulator-version-min=[appletvsimulator version min]:arg"
    "-mbackchain[link stack frames through backchain on System Z]"
    "-mbig-endian[big endian]"
    "-mbranches-within-32B-boundaries[align selected branches within 32-byte boundary]"
    "-mbranch-protection=[enforce targets of indirect branches and function returns]:arg"
    "-mcode-object-v3[legacy option to specify code object ABI V3]"
    "-mcode-object-version=[specify code object ABI version]:version"
    "-mconsole[console]:arg"
    "-mcrc[allow use of CRC instructions]"
    "-mdefault-build-attributes[default build attributes]:arg"
    "-mdll[dll]:arg"
    "-mdouble=[force double to be 32 bits or 64 bits]:arg"
    "-mdynamic-no-pic[dynamic no pic]:arg"
    "-meabi[set EABI type]:arg"
    "-menable-experimental-extensions[enable use of experimental RISC-V extensions]"
    "-menable-unsafe-fp-math[allow unsafe floating-point math optimizations which may decrease precision]"
    "-mfix-cortex-a53-835769[workaround Cortex-A53 erratum 835769]"
    "-mfloat-abi=[float abi]:arg"
    "-mfpu=[fpu]:arg"
    "-mglobal-merge[enable merging of globals]"
    "-mharden-sls=[select straight-line speculation hardening scope]:arg"
    "--mhwdiv=[hwdiv]:arg"
    "-mhwdiv=[hwdiv]:arg"
    "-mhwmult=[hwmult]:arg"
    "-mignore-xcoff-visibility[do not emit the visibility attribute for asm]"
    "--migrate[run the migrator]"
    "-mimplicit-float[implicit float]"
    "-mimplicit-it=[implicit it]:arg"
    "-mincremental-linker-compatible[emit an object file which can be used with an incremental linker]"
    "-mios-simulator-version-min=[ios simulator version min]:arg"
    "-mios-version-min=[ios version min]:arg"
    "-miphoneos-version-min=[iphoneos version min]:arg"
    "-miphonesimulator-version-min=[iphonesimulator version min]:arg"
    "-mkernel[kernel]"
    "-mlinker-version=[linker version]:arg"
    "-mlittle-endian[little endian]"
    "-mllvm[additional arguments to forward to LLVM's option processing]:arg"
    "-mlong-calls[generate branches with extended addressability]"
    "-mlvi-cfi[enable only control-flow mitigations for Load Value Injection]"
    "-mlvi-hardening[enable all mitigations for Load Value Injection]"
    "-mmacos-version-min=[set Mac OS X deployment target]:arg"
    "-mmacosx-version-min=[macosx version min]:arg"
    "-mmcu=[mcu]:arg"
    "-module-dependency-dir[directory to dump module dependencies to]:arg"
    "-module-dir[odule dir]:dir"
    "-module-file-info[provide information about a particular module file]"
    "-moslib=[oslib]:arg"
    "-moutline-atomics[generate local calls to out-of-line atomic operations]"
    "-mpacked-stack[use packed stack layout]"
    "-mpad-max-prefix-size=[specify maximum number of prefixes to use for padding]:arg"
    "-mpie-copy-relocations[pie copy relocations]"
    "-mprefer-vector-width=[specifies preferred vector width]:arg"
    "-mqdsp6-compat[enable hexagon-qdsp6 backward compatibility]"
    "-mrelax-all[relax all machine instructions]"
    "-mrelax[enable linker relaxation]"
    "-mretpoline[retpoline]"
    "-mseses[enable speculative execution side effect suppression (SESES)]"
    "-msign-return-address=[select return address signing scope]:arg"
    "-msim[sim]"
    "-mspeculative-load-hardening[speculative load hardening]"
    "-mstack-alignment=[set the stack alignment]:arg"
    "-mstack-probe-size=[set the stack probe size]:size"
    "-mstack-protector-guard-offset=[use the given offset for addressing the stack-protector guard]:arg"
    "-mstack-protector-guard-reg=[use the given reg for addressing the stack-protector guard]:reg"
    "-msvr4-struct-return[return small structs in registers]"
    "-mthread-model[the thread model to use]:arg"
    "-mthumb[thumb]"
    "-mtls-size=[specify bit size of immediate TLS offsets]:arg"
    "-mtvos-simulator-version-min=[tvos simulator version min]:arg"
    "-mtvos-version-min=[tvos version min]:arg"
    "-multi_module[multi module]"
    "-multiply_defined[multiply defined]:arg"
    "-multiply_defined_unused[multiply defined unused]:arg"
    "-municode[unicode]:arg"
    "-munsafe-fp-atomics[enable unsafe floating point atomic instructions]"
    "-mv55[equivalent to -mcpu=hexagonv55]"
    "-mv5[equivalent to -mcpu=hexagonv5]"
    "-mv60[equivalent to -mcpu=hexagonv60]"
    "-mv62[equivalent to -mcpu=hexagonv62]"
    "-mv65[equivalent to -mcpu=hexagonv65]"
    "-mv66[equivalent to -mcpu=hexagonv66]"
    "-mv67[equivalent to -mcpu=hexagonv67]"
    "-mv67t[equivalent to -mcpu=hexagonv67t]"
    "-mv68[equivalent to -mcpu=hexagonv68]"
    "-mvx[vx]"
    "-mwarn-nonportable-cfstrings[warn nonportable cfstrings]"
    "-mwatchos-simulator-version-min=[watchos simulator version min]:arg"
    "-mwatchos-version-min=[watchos version min]:arg"
    "-mwatchsimulator-version-min=[watchsimulator version min]:arg"
    "-mwavefrontsize64[specify wavefront size 64 mode]"
    "-mwindows[windows]:arg"
    "-mzvector[zvector]"
    "-nobuiltininc[do not search builtin directory for include files]"
    "-nocpp[no cpp]"
    "-nocudainc[do not add include paths for CUDA/HIP and do not include the default CUDA/HIP wrapper headers]"
    "*--no-cuda-include-ptx=[do not include ptx for the following gpu architecture]:argument"
    "-nocudalib[do not link device library for CUDA/HIP device compilation]"
    "--no-cuda-noopt-device-debug[disable device-side debug info generation]"
    "--no-cuda-version-check[don't error out if the detected version of the CUDA install is too low for the requested CUDA gpu architecture]"
    "-no_dead_strip_inits_and_terms[no dead strip inits and terms]"
    "-nofixprebinding[no fixprebinding]"
    "-nogpuinc[no gpuinc]"
    "-nogpulib[no gpulib]"
    "--no-integrated-cpp[no integrated cpp]"
    "-no-integrated-cpp[no integrated cpp]"
    "-nolibc[no libc]"
    "-nomultidefs[no multidefs]"
    "--no-offload-arch=[no offload arch]:arg"
    "-no-pie[no pie]"
    "-nopie[no pie]"
    "-noprebind[no prebind]"
    "-noprofilelib[no profilelib]"
    "-no-pthread[no pthread]"
    "-noseglinkedit[no seglinkedit]"
    "--no-standard-libraries[no standard libraries]"
    "-nostdinc\+\+[disable standard #include directories for the C++ standard library]"
    "-nostdlibinc[do not search standard system directories for include files]"
    "-nostdlib\+\+[no stdlib++]"
    "--no-system-header-prefix=[no system header prefix]:prefix"
    "--no-undefined[no undefined]"
    "-objcmt-atomic-property[make migration to atomic properties]"
    "-objcmt-migrate-all[enable migration to modern ObjC]"
    "-objcmt-migrate-annotation[enable migration to property and method annotations]"
    "-objcmt-migrate-designated-init[enable migration to infer NS_DESIGNATED_INITIALIZER for initializer methods]"
    "-objcmt-migrate-instancetype[enable migration to infer instancetype for method result type]"
    "-objcmt-migrate-literals[enable migration to modern ObjC literals]"
    "-objcmt-migrate-ns-macros[enable migration to NS_ENUM/NS_OPTIONS macros]"
    "-objcmt-migrate-property-dot-syntax[enable migration of setter/getter messages to property-dot syntax]"
    "-objcmt-migrate-property[enable migration to modern ObjC property]"
    "-objcmt-migrate-protocol-conformance[enable migration to add protocol conformance on classes]"
    "-objcmt-migrate-readonly-property[enable migration to modern ObjC readonly property]"
    "-objcmt-migrate-readwrite-property[enable migration to modern ObjC readwrite property]"
    "-objcmt-migrate-subscripting[enable migration to modern ObjC subscripting]"
    "-objcmt-ns-nonatomic-iosonly[enable migration to use NS_NONATOMIC_IOSONLY macro for setting property's atomic attribute]"
    "-objcmt-returns-innerpointer-property[enable migration to annotate property with NS_RETURNS_INNER_POINTER]"
    "-objcmt-whitelist-dir-path=[objcmt whitelist dir path]:arg"
    "-objcmt-white-list-dir-path=[only modify files with a filename contained in the provided directory path]:arg"
    "-ObjC[treat source files as Objective-C]"
    "-ObjC\+\+[treat source files as Objective-C++]"
    "-object[object]"
    "--offload-arch=[offload arch]:arg"
    "--output-class-directory=[output class directory]:arg"
    "-pagezero_size[pagezero size]:arg"
    "-pg[enable mcount instrumentation]"
    {-p,--profile}"[enable function profiling for prof]"
    "-prebind_all_twolevel_modules[prebind all twolevel modules]"
    "-prebind[prebind]"
    "--precompile[only precompile the input]"
    "-preload[preload]"
    "--print-diagnostic-categories[print diagnostic categories]"
    "-print-effective-triple[print effective triple]"
    "--print-effective-triple[print the effective target triple]"
    "--print-file-name=[print the full library path of <file>]:file:_files"
    "-print-ivar-layout[enable Objective-C Ivar layout bitmap print trace]"
    "--print-libgcc-file-name[print the library path for the currently used compiler runtime library]"
    "--print-multi-directory[print multi directory]"
    "--print-multi-lib[print multi lib]"
    "--print-prog-name=[print the full program path of <name>]:name"
    "-print-resource-dir[print resource dir]"
    "--print-resource-dir[print the resource directory pathname]"
    "--print-search-dirs[print the paths used for finding libraries and programs]"
    "--print-supported-cpus[print supported cpus]"
    "-print-supported-cpus[print supported cpus]"
    "-print-targets[print targets]"
    "--print-targets[print the registered targets]"
    "-print-target-triple[print target triple]"
    "--print-target-triple[print the normalized target triple]"
    "-private_bundle[private bundle]"
    "--profile-blocks[undocumented option]"
    "-pthreads[pthreads]"
    "-pthread[support POSIX threads in generated code]"
    "--ptxas-path=[path to ptxas (used for compiling CUDA code)]:arg"
    "-Qunused-arguments[don't emit warning for unused driver arguments]"
    "-read_only_relocs[read only relocs]:arg"
    "-relocatable-pch[relocatable pch]"
    "--relocatable-pch[whether to build a relocatable precompiled header]"
    "-R[enable the specified remark]:remark"
    "--resource=[resource]:arg"
    "-rewrite-legacy-objc[rewrite Legacy Objective-C source to C++]"
    "-rewrite-objc[rewrite Objective-C source to C++]"
    "--rocm-device-lib-path=[rOCm device library path]:arg"
    "--rocm-path=[rOCm installation path]:arg"
    "-Rpass-analysis=[report transformation analysis from optimization passes]:regex"
    "-Rpass-missed=[report missed transformations by optimization passes]:arg"
    "-Rpass=[report transformations performed by optimization passes]:arg"
    "-rpath[rpath]:arg"
    "-r[product a relocatable object as output]"
    "--rtlib=[compiler runtime library to use]:arg"
    "-rtlib=[rtlib]:arg"
    "--save-stats=[save llvm statistics]:arg"
    "-sectalign[sectalign]:arg"
    "-sectcreate[sectcreate]:arg"
    "-sectobjectsymbols[sectobjectsymbols]:arg"
    "-sectorder[sectorder]:arg"
    "-seg1addr[seg1addr]:arg"
    "-segaddr[segaddr]:arg"
    "-seg_addr_table_filename[seg addr table filename]:arg"
    "-seg_addr_table[seg addr table]:arg"
    "-segcreate[segcreate]:arg"
    "-seglinkedit[seglinkedit]"
    "-segprot[segprot]:arg"
    "-segs_read_only_addr[segs read only addr]:arg"
    "-segs_read_[segs read]:arg"
    "-segs_read_write_addr[segs read write addr]:arg"
    "--serialize-diagnostics[serialize compiler diagnostics to a file]:arg"
    "-serialize-diagnostics[serialize diagnostics]:arg"
    "-shared-libasan[dynamically link the sanitizer runtime]"
    "-shared-libsan[shared libsan]"
    "--shared[shared]"
    "--signed-char[signed char]"
    "-single_module[single module]"
    "--specs=[specs]:arg"
    "-static-libgfortran[static libgfortran]"
    "-static-libsan[statically link the sanitizer runtime]"
    "-static-libstdc\+\+[static libstdc++]"
    "-static-openmp[use the static host OpenMP runtime while linking.]"
    "-static-pie[static pie]"
    "--static[static]"
    "-std-default=[std default]:arg"
    "--stdlib=[c++ standard library to use]:arg"
    "-stdlib\+\+-isystem[use directory as the C++ standard library include path]:directory:_files -/"
    "-stdlib=[stdlib]:arg"
    "-sub_library[sub library]:arg"
    "-sub_umbrella[sub umbrella]:arg"
    "-sycl-std=[SYCL language standard to compile for]:standard"
    "--system-header-prefix=[treat all #include paths starting with <prefix> as including a system header]:prefix"
    "-target[generate code for the given target]:arg"
    "--target=[target]:arg"
    "-Tbss[set starting address of BSS to <addr>]:addr"
    "-Tdata[set starting address of DATA to <addr>]:addr"
    "--traditional[traditional]"
    "-traditional[traditional]"
    "-Ttext[set starting address of TEXT to <addr>]:addr"
    "-t[undocumented option]"
    "-twolevel_namespace_hints[twolevel namespace hints]"
    "-twolevel_namespace[twolevel namespace]"
    "-umbrella[umbrella]:arg"
    "-undefined[undefined]:arg"
    "-unexported_symbols_list[unexported symbols list]:arg"
    "--unsigned-char[unsigned char]"
    "--unwindlib=[unwind library to use]:arg"
    "-unwindlib=[unwindlib]:arg"
    "--verify-debug-info[verify the binary representation of debug output]"
    "-verify-pch[load and verify that a pre-compiled header file is not stale]"
    "--warn-=-[enable the specified warning]:warning:->warning"
    "*-weak_framework[weak framework]:framework:->framework"
    "*-weak_library[weak library]:arg"
    "-weak-l[weak l]:arg"
    "-weak_reference_mismatches[weak reference mismatches]:arg"
    "-whatsloaded[whatsloaded]"
    "-whyload[whyload]"
    "-working-directory=[resolve file paths relative to the specified directory]:arg"
    "-Xanalyzer[pass <arg> to the static analyzer]:arg"
    "-Xarch_device[pass arg to CUDA/HIP device compilation]:argument"
    "-Xarch_host[pass arg to CUDA/HIP host compilation]:argument"
    "-Xclang[pass <arg> to the clang compiler]:arg"
    "-Xcuda-fatbinary[pass arg to fatbinary invocation]:argument"
    "-Xcuda-ptxas[pass arg to the ptxas assemler]:argument"
    "-Xflang[pass <arg> to the flang compiler]:arg"
    "-Xopenmp-target[pass arg to the the target offloading toolchain]:argument"
    "-y[the action to perform on the input]:arg"
    "-Z-[undocumented option]:argument"
  )
else
  args+=(
    "--dump=[dump information]:argument"
    '-flto=-[enable link-time optimization]::jobs:'
    '*--help=-[display this information]:class:->help'
  )
fi

local -a sanitizers
sanitizers=(
  address alignment bool bounds enum float-cast-overflow float-divide-by-zero
  integer-divide-by-zero memory nonnull-attribute null nullability-arg
  nullability-assign nullability-return object-size pointer-overflow return
  unsigned-integer-overflow returns-nonnull-attribute shift signed-integer-overflow
  unreachable vla-bound vptr
)

local -a languages
languages=(
  c c-header cpp-output c++ c++-header c++-cpp-output objective-c objective-c-header
  objective-c-cpp-output objective-c++ objective-c++-header objective-c++-cpp-output
  assembler assembler-with-cpp ada f77 f77-cpp-input f95 f95-cpp-input go java
  brig none
)

# warnings (from --help=warnings), note some -W options are listed by --help=common instead
warnings+=(
  '-Wabi-tag[warn if a subobject has an abi_tag attribute that the complete object type does not have]'
  '-Wabi[warn about things that will change when compiling with an ABI-compliant compiler]::'
  '-Waddress[warn about suspicious uses of memory addresses]'
  '-Waggregate-return[warn about returning structures, unions or arrays]'
  '-Waggressive-loop-optimizations[warn if a loop with constant number of iterations triggers undefined behavior]'
  '-Waliasing[warn about possible aliasing of dummy arguments]'
  '-Walign-commons[warn about alignment of COMMON blocks]'
  '-Waligned-new=[warn even if '\'new\'' uses a class member allocation function]:none|global|all: '
  '-Wall[enable most warning messages]'
  '-Walloca-larger-than=[warn on unbounded uses of alloca, and on bounded uses of alloca whose bound can be larger than <number> bytes]:bytes: '
  '-Walloca[warn on any use of alloca]'
  '-Walloc-size-larger-than=[warn for calls to allocation functions that attempt to allocate objects larger than the specified number of bytes]:bytes: '
  '-Walloc-zero[warn for calls to allocation functions that specify zero bytes]'
  '-Wampersand[warn about missing ampersand in continued character constants]'
  '-Wargument-mismatch[warn about type and rank mismatches between arguments and parameters]'
  '-Warray-bounds[warn if an array is accessed out of bounds]'
  '-Warray-bounds=[warn if an array is accessed out of bounds]:level:(1 2)'
  '-Warray-temporaries[warn about creation of array temporaries]'
  '-Wassign-intercept[warn whenever an Objective-C assignment is being intercepted by the garbage collector]'
  '-Wattributes[warn about inappropriate attribute usage]'
  '-Wbad-function-cast[warn about casting functions to incompatible types]'
  '-Wbool-compare[warn about boolean expression compared with an integer value different from true/false]'
  '-Wbool-operation[warn about certain operations on boolean expressions]'
  '-Wbuiltin-declaration-mismatch[warn when a built-in function is declared with the wrong signature]'
  '-Wbuiltin-macro-redefined[warn when a built-in preprocessor macro is undefined or redefined]'
  '-Wc++0x-compat[deprecated in favor of -Wc++11-compat]'
  '-Wc++11-compat[warn about C++ constructs whose meaning differs between ISO C++ 1998 and ISO C++ 2011]'
  '-Wc++14-compat[warn about C++ constructs whose meaning differs between ISO C++ 2011 and ISO C++ 2014]'
  '-Wc++1z-compat[warn about C++ constructs whose meaning differs between ISO C++ 2014 and (forthcoming) ISO C++ 201z(7?)]'
  '-Wc90-c99-compat[warn about features not present in ISO C90, but present in ISO C99]'
  '-Wc99-c11-compat[warn about features not present in ISO C99, but present in ISO C11]'
  '-Wcast-align[warn about pointer casts which increase alignment]'
  '-Wcast-qual[warn about casts which discard qualifiers]'
  '-Wc-binding-type[warn if the type of a variable might be not interoperable with C]'
  '-Wc++-compat[warn about C constructs that are not in the common subset of C and C++]'
  '-Wcharacter-truncation[warn about truncated character expressions]'
  '-Wchar-subscripts[warn about subscripts whose type is "char"]'
  '-Wchkp[warn about memory access errors found by Pointer Bounds Checker]'
  '-Wclobbered[warn about variables that might be changed by "longjmp" or "vfork"]'
  '-Wcomments[synonym for -Wcomment]'
  '-Wcomment[warn about possibly nested block comments, and C++ comments spanning more than one physical line]'
  '-Wcompare-reals[warn about equality comparisons involving REAL or COMPLEX expressions]'
  '-Wconditionally-supported[warn for conditionally-supported constructs]'
  '-Wconversion-extra[warn about most implicit conversions]'
  '-Wconversion-null[warn for converting NULL from/to a non-pointer type]'
  '-Wconversion[warn for implicit type conversions that may change a value]'
  '-Wcoverage-mismatch[warn in case profiles in -fprofile-use do not match]'
  '-Wcpp[warn when a #warning directive is encountered]'
  '-Wctor-dtor-privacy[warn when all constructors and destructors are private]'
  '-Wdangling-else[warn about dangling else]'
  '-Wdate-time[warn about __TIME__, __DATE__ and __TIMESTAMP__ usage]'
  '-Wdeclaration-after-statement[warn when a declaration is found after a statement]'
  '-Wdelete-incomplete[warn when deleting a pointer to incomplete type]'
  '-Wdelete-non-virtual-dtor[warn about deleting polymorphic objects with non- virtual destructors]'
  '-Wdeprecated-declarations[warn about uses of __attribute__((deprecated)) declarations]'
  '-Wdeprecated[warn if a deprecated compiler feature, class, method, or field is used]'
  '-Wdesignated-init[warn about positional initialization of structs requiring designated initializers]'
  '-Wdisabled-optimization[warn when an optimization pass is disabled]'
  '-Wdiscarded-array-qualifiers[warn if qualifiers on arrays which are pointer targets are discarded]'
  '-Wdiscarded-qualifiers[warn if type qualifiers on pointers are discarded]'
  '-Wdiv-by-zero[warn about compile-time integer division by zero]'
  '-Wdouble-promotion[warn about implicit conversions from "float" to "double"]'
  '-Wduplicated-branches[warn about duplicated branches in if-else statements]'
  '-Wduplicated-cond[warn about duplicated conditions in an if-else-if chain]'
  '-Wduplicate-decl-specifier[warn when a declaration has duplicate const, volatile, restrict or _Atomic specifier]'
  '-Weffc\+\+[warn about violations of Effective C++ style rules]'
  '-Wempty-body[warn about an empty body in an if or else statement]'
  '-Wendif-labels[warn about stray tokens after #else and #endif]'
  '-Wenum-compare[warn about comparison of different enum types]'
  # '-Werror-implicit-function-declaration[this switch is deprecated; use -Werror=implicit-fun]' # this still exists but makes completing -Werror= less convenient
  '-Wexpansion-to-defined[warn if "defined" is used outside #if]'
  '-Wextra[print extra (possibly unwanted) warnings]'
  '-Wfloat-conversion[warn for implicit type conversions that cause loss of floating point precision]'
  '-Wfloat-equal[warn if testing floating point numbers for equality]'
  '-Wformat-contains-nul[warn about format strings that contain NUL bytes]'
  '-Wformat-extra-args[warn if passing too many arguments to a function for its format string]'
  '-Wformat-nonliteral[warn about format strings that are not literals]'
  '-Wformat-overflow[warn about function calls with format strings that write past the end of the destination region]'
  '-Wformat-overflow=[warn about function calls with format strings that write past the end of the destination region]:level:(1 2)'
  '-Wformat-security[warn about possible security problems with format functions]'
  '-Wformat-signedness[warn about sign differences with format functions]'
  '-Wformat-truncation[warn about calls to snprintf and similar functions that truncate output. Same as -Wformat- truncation=1.  Same as -Wformat-truncation=]'
  '-Wformat-truncation=[warn about calls to snprintf and similar functions that truncate output]:level:(1 2)'
  '-Wformat=[warn about printf/scanf/strftime/strfmon format string anomalies]::level:(1 2)'
  '-Wformat-y2k[warn about strftime formats yielding 2-digit years]'
  '-Wformat-zero-length[warn about zero-length formats]'
  '-Wframe-address[warn when __builtin_frame_address or __builtin_return_address is used unsafely]'
  '-Wframe-larger-than=[warn if a function'\''s stack frame requires more than <number> bytes]:bytes: '
  '-Wfree-nonheap-object[warn when attempting to free a non-heap object]'
  '-Wfunction-elimination[warn about function call elimination]'
  '-Whsa[warn when a function cannot be expanded to HSAIL]'
  '-Wignored-attributes[warn whenever attributes are ignored]'
  '-Wignored-qualifiers[warn whenever type qualifiers are ignored]'
  '-Wimplicit-fallthrough=[warn when a switch case falls through]:level:(1 2 3 4 5)'
  '-Wimplicit-function-declaration[warn about implicit function declarations]'
  '-Wimplicit-interface[warn about calls with implicit interface]'
  '-Wimplicit-int[warn when a declaration does not specify a type]'
  '-Wimplicit-procedure[warn about called procedures not explicitly declared]'
  '-Wimplicit[warn about implicit declarations]'
  '-Wimport[warn about imports]'
  '-Wincompatible-pointer-types[warn when there is a conversion between pointers that have incompatible types]'
  '-Winherited-variadic-ctor[warn about C++11 inheriting constructors when the base has a variadic constructor]'
  '-Winit-self[warn about variables which are initialized to themselves]'
  '-Winline[warn when an inlined function cannot be inlined]'
  '-Wint-conversion[warn about incompatible integer to pointer and pointer to integer conversions]'
  '-Winteger-division[warn about constant integer divisions with truncated results]'
  '-Wint-in-bool-context[warn for suspicious integer expressions in boolean context]'
  '-Wintrinsic-shadow[warn if a user-procedure has the same name as an intrinsic]'
  '-Wintrinsics-std[warn on intrinsics not part of the selected standard]'
  '-Wint-to-pointer-cast[warn when there is a cast to a pointer from an integer of a different size]'
  '-Winvalid-memory-model[warn when an atomic memory model parameter is known to be outside the valid range]'
  '-Winvalid-offsetof[warn about invalid uses of the "offsetof" macro]'
  '-Winvalid-pch[warn about PCH files that are found but not used]'
  '-Wjump-misses-init[warn when a jump misses a variable initialization]'
  '-Wlarger-than=[warn if an object is larger than <number> bytes]:bytes: '
  '-Wline-truncation[warn about truncated source lines]'
  '-Wliteral-suffix[warn when a string or character literal is followed by a ud-suffix which does not begin with an underscore]'
  '-Wlogical-not-parentheses[warn when logical not is used on the left hand side operand of a comparison]'
  '-Wlogical-op[warn when a logical operator is suspiciously always evaluating to true or false]'
  '-Wlong-long[do not warn about using "long long" when -pedantic]'
  '-Wlto-type-mismatch[during link time optimization warn about mismatched types of global declarations]'
  '-Wmain[warn about suspicious declarations of "main"]'
  '-Wmaybe-uninitialized[warn about maybe uninitialized automatic variables]'
  '-Wmemset-elt-size[warn about suspicious calls to memset where the third argument contains the number of elements not multiplied by the element size]'
  '-Wmemset-transposed-args[warn about suspicious calls to memset where the third argument is constant literal zero and the second is not]'
  '-Wmisleading-indentation[warn when the indentation of the code does not reflect the block structure]'
  '-Wmissing-braces[warn about possibly missing braces around initializers]'
  '-Wmissing-declarations[warn about global functions without previous declarations]'
  '-Wmissing-field-initializers[warn about missing fields in struct initializers]'
  '-Wmissing-include-dirs[warn about user-specified include directories that do not exist]'
  '-Wmissing-parameter-type[warn about function parameters declared without a type specifier in K&R-style functions]'
  '-Wmissing-prototypes[warn about global functions without prototypes]'
  '-Wmudflap[warn about constructs not instrumented by -fmudflap]'
  '-Wmultichar[warn about use of multi-character character constants]'
  '-Wmultiple-inheritance[warn on direct multiple inheritance]'
  '-Wnamespaces[warn on namespace definition]'
  '-Wnarrowing[warn about narrowing conversions within { } that are ill-formed in C++11]'
  '-Wnested-externs[warn about "extern" declarations not at file scope]'
  '-Wnoexcept-type[warn if C++1z noexcept function type will change the mangled name of a symbol]'
  '-Wnoexcept[warn when a noexcept expression evaluates to false even though the expression can''t actually throw]'
  '-Wnonnull-compare[warn if comparing pointer parameter with nonnull attribute with NULL]'
  '-Wnonnull[warn about NULL being passed to argument slots marked as requiring non-NULL]'
  '-Wnonportable-cfstrings[warn on CFStrings containing nonportable characters]'
  '-Wnon-template-friend[warn when non-templatized friend functions are declared within a template]'
  '-Wnon-virtual-dtor[warn about non-virtual destructors]'
  '-Wnormalized=-[warn about non-normalised Unicode strings]:normalization:((id\:allow\ some\ non-nfc\ characters\ that\ are\ valid\ identifiers nfc\:only\ allow\ NFC nfkc\:only\ allow\ NFKC none\:allow\ any\ normalization)): '
  '-Wnull-dereference[warn if dereferencing a NULL pointer may lead to erroneous or undefined behavior]'
  '-Wodr[warn about some C++ One Definition Rule violations during link time optimization]'
  '-Wold-style-cast[warn if a C-style cast is used in a program]'
  '-Wold-style-declaration[warn for obsolescent usage in a declaration]'
  '-Wold-style-definition[warn if an old-style parameter definition is used]'
  '-Wopenmp-simd[warn if a simd directive is overridden by the vectorizer cost model]'
  '-Woverflow[warn about overflow in arithmetic expressions]'
  '-Woverlength-strings[warn if a string is longer than the maximum portable length specified by the standard]'
  '-Woverloaded-virtual[warn about overloaded virtual function names]'
  '-Woverride-init-side-effects[warn about overriding initializers with side effects]'
  '-Woverride-init[warn about overriding initializers without side effects]'
  '-Wpacked-bitfield-compat[warn about packed bit-fields whose offset changed in GCC 4.4]'
  '-Wpacked[warn when the packed attribute has no effect on struct layout]'
  '-Wpadded[warn when padding is required to align structure members]'
  '-Wparentheses[warn about possibly missing parentheses]'
  '-Wpedantic[issue warnings needed for strict compliance to the standard]'
  '-Wplacement-new=[warn for placement new expressions with undefined behavior]::level:(1 2)'
  '-Wpmf-conversions[warn when converting the type of pointers to member functions]'
  '-Wpointer-arith[warn about function pointer arithmetic]'
  '-Wpointer-compare[warn when a pointer is compared with a zero character constant]'
  '-Wpointer-sign[warn when a pointer differs in signedness in an assignment]'
  '-Wpointer-to-int-cast[warn when a pointer is cast to an integer of a different size]'
  '-Wpoison-system-directories[warn for -I and -L options using system directories if cross compiling]'
  '-Wpragmas[warn about misuses of pragmas]'
  '-Wproperty-assign-default[warn if a property for an Objective-C object has no assign semantics specified]'
  '-Wprotocol[warn if inherited methods are unimplemented]'
  '-Wpsabi[warn about psabi]'
  '-Wrealloc-lhs-all[warn when a left-hand-side variable is reallocated]'
  '-Wrealloc-lhs[warn when a left-hand-side array variable is reallocated]'
  '-Wreal-q-constant[warn about real-literal-constants with '\'q\'' exponent-letter]'
  '-Wredundant-decls[warn about multiple declarations of the same object]'
  '-Wregister[warn about uses of register storage specifier]'
  '-Wreorder[warn when the compiler reorders code]'
  '-Wrestrict[warn when an argument passed to a restrict- qualified parameter aliases with another argument]'
  '-Wreturn-local-addr[warn about returning a pointer/reference to a local or temporary variable]'
  '-Wreturn-type[warn whenever a function'\''s return type defaults to "int" (C), or about inconsistent return types (C++)]'
  '-Wscalar-storage-order[warn on suspicious constructs involving reverse scalar storage order]'
  '-Wselector[warn if a selector has multiple methods]'
  '-Wsequence-point[warn about possible violations of sequence point rules]'
  '-Wshadow-ivar[warn if a local declaration hides an instance variable]'
  '-Wshadow[warn when one variable shadows another.  Same as  -Wshadow=global]'
  '-Wshift-count-negative[warn if shift count is negative]'
  '-Wshift-count-overflow[warn if shift count >= width of type]'
  '-Wshift-negative-value[warn if left shifting a negative value]'
  '-Wshift-overflow[warn if left shift of a signed value overflows.  Same as -Wshift-overflow=]'
  '-Wshift-overflow=[warn if left shift of a signed value overflows]:level:(1 2)'
  '-Wsign-compare[warn about signed-unsigned comparisons]'
  '-Wsign-conversion[warn for implicit type conversions between signed and unsigned integers]'
  '-Wsign-promo[warn when overload promotes from unsigned to signed]'
  '-Wsized-deallocation[warn about missing sized deallocation functions]'
  '-Wsizeof-array-argument[warn when sizeof is applied on a parameter declared as an array]'
  '-Wsizeof-pointer-memaccess[warn about suspicious length parameters to certain string functions if the argument uses sizeof]'
  '-Wstack-protector[warn when not issuing stack smashing protection for some reason]'
  '-Wstack-usage=[warn if stack usage might be larger than specified amount]:bytes: '
  '-Wstrict-aliasing[warn about code which might break strict aliasing rules]'
  '-Wstrict-aliasing=-[warn about code which might break strict aliasing rules]:level of checking (higher is more accurate):(1 2 3)'
  '-Wstrict-null-sentinel[warn about uncasted NULL used as sentinel]'
  '-Wstrict-overflow[warn about optimizations that assume that signed overflow is undefined]'
  '-Wstrict-overflow=-[warn about optimizations that assume that signed overflow is undefined]:level of checking (higher finds more cases):(1 2 3 4 5)'
  '-Wstrict-prototypes[warn about unprototyped function declarations]'
  '-Wstrict-selector-match[warn if type signatures of candidate methods do not match exactly]'
  '-Wstringop-overflow=[under the control of Object Size type, warn about buffer overflow in string manipulation functions like memcpy and strcpy]:level:(1 2 3 4)'
  '-Wstringop-overflow[warn about buffer overflow in string manipulation functions like memcpy and strcpy.  Same as  -Wstringop-overflow=]'
  '-Wsubobject-linkage[warn if a class type has a base or a field whose type uses the anonymous namespace or depends on a type with no linkage]'
  '*-Wsuggest-attribute=-[warn about functions that might be candidates for attributes]:attribute:(pure const noreturn format)'
  '-Wsuggest-final-methods[warn about C++ virtual methods where adding final keyword would improve code quality]'
  '-Wsuggest-final-types[warn about C++ polymorphic types where adding final keyword would improve code quality]'
  '-Wsuggest-override[suggest that the override keyword be used when the declaration of a virtual function overrides another]'
  '-Wsurprising[warn about "suspicious" constructs]'
  '-Wswitch-bool[warn about switches with boolean controlling expression]'
  '-Wswitch-default[warn about enumerated switches missing a "default-" statement]'
  '-Wswitch-enum[warn about all enumerated switches missing a specific case]'
  '-Wswitch-unreachable[warn about statements between switch'\''s controlling expression and the first case]'
  '-Wswitch[warn about enumerated switches, with no default, missing a case]'
  '-Wsync-nand[warn when __sync_fetch_and_nand and __sync_nand_and_fetch built-in functions are used]'
  '-Wsynth[deprecated. This switch has no effect]'
  '-Wsystem-headers[do not suppress warnings from system headers]'
  '-Wtabs[permit nonconforming uses of the tab character]'
  '-Wtarget-lifetime[warn if the pointer in a pointer assignment might outlive its target]'
  '-Wtautological-compare[warn if a comparison always evaluates to true or false]'
  '-Wtemplates[warn on primary template declaration]'
  '-Wterminate[warn if a throw expression will always result in a call to terminate()]'
  '-W[this switch is deprecated; use -Wextra instead]'
  '-Wtraditional-conversion[warn of prototypes causing type conversions different from what would happen in the absence of prototype]'
  '-Wtraditional[warn about features not present in traditional C]'
  '-Wtrampolines[warn whenever a trampoline is generated]'
  '-Wtrigraphs[warn if trigraphs are encountered that might affect the meaning of the program]'
  '-Wtype-limits[warn if a comparison is always true or always false due to the limited range of the data type]'
  '-Wundeclared-selector[warn about @selector()s without previously declared methods]'
  '-Wundefined-do-loop[warn about an invalid DO loop]'
  '-Wundef[warn if an undefined macro is used in an #if directive]'
  '-Wunderflow[warn about underflow of numerical constant expressions]'
  '-Wuninitialized[warn about uninitialized automatic variables]'
  '-Wunknown-pragmas[warn about unrecognized pragmas]'
  '-Wunsafe-loop-optimizations[warn if the loop cannot be optimized due to nontrivial assumptions]'
  '-Wunsuffixed-float-constants[warn about unsuffixed float constants]'
  '-Wunused-but-set-parameter[warn when a function parameter is only set, otherwise unused]'
  '-Wunused-but-set-variable[warn when a variable is only set, otherwise unused]'
  '-Wunused-const-variable[warn when a const variable is unused.  Same as  -Wunused-const-variable=]'
  '-Wunused-const-variable=[warn when a const variable is unused]:level:(1 2)'
  '-Wunused-dummy-argument[warn about unused dummy arguments]'
  '-Wunused[enable all -Wunused- warnings]'
  '-Wunused-function[warn when a function is unused]'
  '-Wunused-label[warn when a label is unused]'
  '-Wunused-local-typedefs[warn when typedefs locally defined in a function are not used]'
  '-Wunused-macros[warn about macros defined in the main file that are not used]'
  '-Wunused-parameter[warn when a function parameter is unused]'
  '-Wunused-result[warn if a caller of a function, marked with attribute warn_unused_result, does not use its return value]'
  '-Wunused-value[warn when an expression value is unused]'
  '-Wunused-variable[warn when a variable is unused]'
  '-Wuseless-cast[warn about useless casts]'
  '-Wuse-without-only[warn about USE statements that have no ONLY qualifier]'
  '-Wvarargs[warn about questionable usage of the macros used to retrieve variable arguments]'
  '-Wvariadic-macros[warn about using variadic macros]'
  '-Wvector-operation-performance[warn when a vector operation is compiled outside the SIMD]'
  '-Wvirtual-inheritance[warn on direct virtual inheritance]'
  '-Wvirtual-move-assign[warn if a virtual base has a non-trivial move assignment operator]'
  '-Wvla-larger-than=[warn on unbounded uses of variable-length arrays, and on bounded uses of variable-length arrays whose bound can be larger than <number> bytes]:bytes: ' 
  '-Wvla[warn if a variable length array is used]'
  '-Wvolatile-register-var[warn when a register variable is declared volatile]'
  '-Wwrite-strings[in C++, nonzero means warn about deprecated conversion from string literals to '\''char *'\''.  In C, similar warning, except that the conversion is]'
  '-Wzero-as-null-pointer-constant[warn when a literal '\''0'\'' is used as null pointer]'
  '-Wzerotrip[warn about zero-trip DO loops]'
)

# clang specific warnings
if [[ "$service" = clang* ]]; then
  warnings+=(
    '-Wlarge-by-value-copy=[warn on large by value copy]:argument'
    '-Wunreachable-code-aggressive[controls -Wunreachable-code, -Wunreachable-code-break, -Wunreachable-code-return]'
    '-Wunreachable-code-break[warn when break will never be executed]'
    '-Wunreachable-code-loop-increment[warn when loop will be executed only once]'
    '-Wunreachable-code-return[warn when return will not be executed]'
    '-Wunreachable-code[warn on code that will not be executed]'
  )
else
  warnings+=(
    '-Wunreachable-code[does nothing. Preserved for backward compatibility]'
  )
fi

args+=(
  {'*-A-','*--assert='}'[make an assertion]:define assertion:'
  "--all-warnings[display all warnings]"
  {-ansi,--ansi}"[same as -std=c89 or -std=c++98]"
  '-aux-info[emit declaration information into <file>]:file:_files'
  {'-B-','--prefix='}'[add <prefix> to the compiler'\''s search paths]:executable prefix:_files -/'
  '-b[specify target machine to compile to]:target machine:'
  {-CC,--comments-in-macros}'[do not discard comments, including macro expansion]'
  {-C,--comments}'[do not discard comments during preprocess]'
  {-c,--compile}'[compile and assemble, but do not link]'
  {'*-D-','*--define-macro='}'[define a macro]:define macro:'
  '-d-[dump the state of the preprocessor]:dump:->dump'
  '--dependencies[generate Makefile dependencies]'
  '-dumpbase[set the file basename to be used for dumps]:file:_files'
  '-dumpdir[set the directory name to be used for dumps]:file:_files -/'
  '-dumpmachine[display the compiler'\''s target processor]'
  '-dumpspecs[display all of the built in spec strings]'
  '-dumpversion[display the version of the compiler]'
  '+e-[control how virtual function definitions are used]:virtual function definitions in classes:((0\:only\ interface 1\:generate\ code))'
  {-e,--entry}"[specify program entry point is entry]:entry"
  {-E,--preprocess}'[preprocess only; do not compile, assemble or link]'
  '-fabi-version=-[use version <n> of the C++ ABI (default: 2)]:ABI version:(1 2 3 4 5 6)'
  "-fada-spec-parent=[dump Ada specs as child units of given parent]"
  '-faggressive-loop-optimizations[aggressively optimize loops using language constraints]'
  '-falign-functions[align the start of functions]'
  '-falign-jumps[align labels which are only reached by jumping]'
  '-falign-labels[align all labels]'
  '-falign-loops[align the start of loops]'
  "-fallow-parameterless-variadic-functions[allow variadic functions without named parameter]"
  "-fasm[recognize the asm keyword]"
  '-fassociative-math[allow optimization for floating-point arithmetic which may change the result of the operation due to rounding]'
  '-fasynchronous-unwind-tables[generate unwind tables that are exact at each instruction boundary]'
  '-fauto-inc-dec[generate auto-inc/dec instructions]'
  '-fbounds-check[generate code to check bounds before indexing arrays]'
  '-fbranch-count-reg[replace add, compare, branch with branch on count register]'
  '-fbranch-probabilities[use profiling information for branch probabilities]'
  '-fbranch-target-load-optimize2[perform branch target load optimization after prologue / epilogue threading]'
  '-fbranch-target-load-optimize[perform branch target load optimization before prologue / epilogue threading]'
  '-fbtr-bb-exclusive[restrict target load migration not to re-use registers in any basic block]'
  "-fbuilding-libgcc[specify building libgcc]"
  "-fbuiltin[recognize builtin functions]"
  '-fcaller-saves[save registers around function calls]'
  '-fcall-saved--[mark <register> as being preserved across functions]:register'
  '-fcall-used--[mark <register> as being corrupted by function calls]:register'
  "-fcanonical-system-headers[where shorter use canonicalized paths to system headers]"
  '-fcheck-data-deps[compare the results of several data dependence analyzers]'
  "-fcheck-pointer-bounds[add pointer bounds checker instrumentation]"
  "-fchkp-check-incomplete-type[generate pointer bounds check for variables with incomplete type]"
  "-fchkp-check-read[generate checks for all read accesses to memory]"
  "-fchkp-check-write[generate checks for all write accesses to memory]"
  "-fchkp-first-field-has-own-bounds[forces checker to use narrowed bounds for address of the first field]"
  "-fchkp-instrument-calls[generate bounds passing for calls]"
  "-fchkp-instrument-marked-only[instrument only functions marked with bnd_instrument attribute]"
  "-fchkp-narrow-bounds[control how checker handle pointers to object fields]"
  "-fchkp-narrow-to-innermost-array[forces checker to use bounds of the innermost arrays in case of nested static array access]"
  "-fchkp-optimize[allow checker optimizations]"
  "-fchkp-store-bounds[generate bounds stores for pointer writes]"
  "-fchkp-treat-zero-dynamic-size-as-infinite[with this option zero size obtained dynamically for objects with incomplete type will be treated as infinite]"
  "-fchkp-use-fast-string-functions[allow to use *_nobnd versions of string functions]"
  "-fchkp-use-nochk-string-functions[allow to use *_nochk versions of string functions]"
  "-fchkp-use-static-bounds[use statically initialized variable for vars bounds instead of generating them each time it is required]"
  "-fchkp-use-static-const-bounds[use statically initialized variable for constant bounds]"
  "-fchkp-use-wrappers[transform instrumented builtin calls into calls to wrappers]"
  "-fchkp-zero-input-bounds-for-main[use zero bounds for all incoming arguments in main function]"
  "-fcilkplus[enable Cilk Plus]"
  '-fcode-hoisting[enable code hoisting]'
  '-fcombine-stack-adjustments[looks for opportunities to reduce stack adjustments and stack references]'
  '-fcommon[do not put uninitialized globals in the common section]'
  '-fcompare-debug=-[compile with and without e.g. -gtoggle, and compare the final-insns dump]:opts:' #TODO: complete gcc options here
  '-fcompare-debug-second[run only the second compilation of -fcompare-debug]'
  '-fcompare-elim[perform comparison elimination after register allocation has finished]'
  "-fcond-mismatch[allow the arguments of the ? operator to have different types]"
  '-fconserve-stack[do not perform optimizations increasing noticeably stack usage]'
  '-fcprop-registers[perform a register copy-propagation optimization pass]'
  '-fcrossjumping[perform cross-jumping optimization]'
  '-fcse-follow-jumps[when running CSE, follow jumps to their targets]'
  '-fcx-fortran-rules[complex multiplication and division follow Fortran rules]'
  '-fcx-limited-range[omit range reduction step when performing complex division]'
  '-fdata-sections[place data items into their own section]'
  '-fdbg-cnt=-[,<counter>-<limit>,...) Set the debug counter limit]:counter\:limit,...: ' #TODO: gcc -fdbg-cnt-list -x c /dev/null -o /dev/null -c
  '-fdbg-cnt-list[list all available debugging counters with their limits and counts]'
  '-fdce[use the RTL dead code elimination pass]'
  "-fdebug-cpp[emit debug annotations during preprocessing]"
  '-fdebug-prefix-map=-[map one directory name to another in debug information]:/old/dir=/new/dir:->dirtodir'
  '-fdebug-types-section[output .debug_types section when using DWARF v4 debuginfo]'
  '-fdefer-pop[defer popping functions args from stack until later]'
  '-fdelayed-branch[attempt to fill delay slots of branch instructions]'
  '-fdelete-dead-exceptions[delete dead instructions that may throw exceptions]'
  '-fdelete-null-pointer-checks[delete useless null pointer checks]'
  '-fdevirtualize-speculatively[perform speculative devirtualization]'
  '-fdevirtualize[try to convert virtual calls to direct ones]'
  '-fdiagnostics-color=-[colorize diagnostics]::color:(never always auto)'
  '-fdiagnostics-generate-patch[print fix-it hints to stderr in unified diff format]'
  '-fdiagnostics-parseable-fixits[print fixit hints in machine-readable form]'
  '-fdiagnostics-show-caret[show the source line with a caret indicating the column]'
  '-fdiagnostics-show-location=-[how often to emit source location at the beginning of line-wrapped diagnostics]:source location:(once every-line)'
  '-fdiagnostics-show-option[amend appropriate diagnostic messages with the command line option that controls them]'
  "-fdirectives-only[preprocess directives only]"
  "-fdollars-in-identifiers[permit $ as an identifier character]"
  '-fdse[use the RTL dead store elimination pass]'
  "-fdump-ada-spec-slim[write all declarations as Ada code for the given file only]"
  "-fdump-ada-spec[write all declarations as Ada code transitively]"
  '-fdump-final-insns=-[dump to filename the insns at the end of translation]:filename:_files'
  '-fdump-go-spec=-[write all declarations to file as Go code]:filename:_files'
  '-fdump-noaddr[suppress output of addresses in debugging dumps]'
  '-fdump-passes[dump optimization passes]'
  '-fdump-unnumbered-links[suppress output of previous and next insn numbers in debugging dumps]'
  '-fdump-unnumbered[suppress output of instruction numbers, line number notes and addresses in debugging dumps]'
  '-fdwarf2-cfi-asm[enable CFI tables via GAS assembler directives]'
  '-fearly-inlining[perform early inlining]'
  '-feliminate-dwarf2-dups[perform DWARF2 duplicate elimination]'
  '-feliminate-unused-debug-symbols[perform unused type elimination in debug info]'
  '-feliminate-unused-debug-types[perform unused type elimination in debug info]'
  '-femit-class-debug-always[do not suppress C++ class debug information]'
  "-femit-struct-debug-baseonly[aggressive reduced debug info for structs]"
  "-femit-struct-debug-detailed=[detailed reduced debug info for structs]:spec list"
  "-femit-struct-debug-reduced[conservative reduced debug info for structs]"
  '-fexceptions[enable exception handling]'
  '-fexcess-precision=-[specify handling of excess floating-point precision]:precision handling:(fast standard)'
  "-fexec-charset=[convert all strings and character constants to character set]:character set"
  '-fexpensive-optimizations[perform a number of minor, expensive optimizations]'
  "-fextended-identifiers[permit universal character names in identifiers]"
  '-ffast-math[sets -fno-math-errno, -funsafe-math-optimizations, -ffinite-math-only, -fno-rounding-math, -fno-signaling-nans and -fcx-limited-range]'
  '-ffat-lto-objects[output lto objects containing both the intermediate language and binary output]'
  '-ffinite-math-only[assume no NaNs or infinities are generated]'
  '-ffixed--[mark <register> as being unavailable to the compiler]:register'
  '-ffloat-store[don'\''t allocate floats and doubles in extended- precision registers]'
  '-fforward-propagate[perform a forward propagation pass on RTL]'
  '-ffp-contract=-[perform floating- point expression contraction (default: fast)]:style:(on off fast)'
  '-ffp-contract=[perform floating-point expression contraction]:style:(off on fast)'
  '-ffp-int-builtin-inexact[allow built-in functions ceil, floor, round, trunc to raise "inexact" exceptions]'
  "-ffreestanding[do not assume that standard C libraries and main exist]"
  '-ffunction-cse[allow function addresses to be held in registers]'
  '-ffunction-sections[place each function into its own section]'
  '-fgcse-after-reload[perform global common subexpression elimination after register allocation has finished]'
  '-fgcse-las[perform redundant load after store elimination in global common subexpression elimination]'
  '-fgcse-lm[perform enhanced load motion during global common subexpression elimination]'
  '-fgcse[perform global common subexpression elimination]'
  '-fgcse-sm[perform store motion after global common subexpression elimination]'
  "-fgnu89-inline[use traditional GNU semantics for inline functions]"
  '-fgnu-tm[enable support for GNU transactional memory]'
  '-fgraphite[enable in and out of Graphite representation]'
  '-fgraphite-identity[enable Graphite Identity transformation]'
  '-fguess-branch-probability[enable guessing of branch probabilities]'
  '-fhoist-adjacent-loads[enable hoisting adjacent loads to encourage generating conditional move instructions]'
  "-fhosted[assume normal C execution environment]"
  '-fif-conversion2[perform conversion of conditional jumps to conditional execution]'
  '-fif-conversion[perform conversion of conditional jumps to branchless equivalents]'
  '-findirect-inlining[perform indirect inlining]'
  '-finhibit-size-directive[do not generate .size directives]'
  '-finline-atomics[inline __atomic operations when a lock free instruction sequence is available]'
  '-finline[enable inlining of function declared "inline", disabling disables all inlining]'
  '-finline-functions-called-once[integrate functions only required by their single caller]'
  '-finline-functions[integrate functions not declared "inline" into their callers when profitable]'
  '-finline-limit=-[limit the size of inlined functions to <number>]:number: '
  '-finline-small-functions[integrate functions into their callers when code size is known not to grow]'
  "-finput-charset=[specify the default character set for source files]:character set"
  '-finstrument-functions-exclude-file-list=-[do not instrument functions listed in files]:comma-separated file list:->commafiles'
  '-finstrument-functions-exclude-function-list=-[do not instrument listed functions]:comma-separated list of syms: '
  '-finstrument-functions[instrument function entry and exit with profiling calls]'
  '-fipa-bit-cp[perform interprocedural bitwise constant propagation]'
  '-fipa-cp-clone[perform cloning to make Interprocedural constant propagation stronger]'
  '-fipa-cp[perform interprocedural constant propagation]'
  '-fipa-icf-functions[perform Identical Code Folding for functions]'
  '-fipa-icf[perform Identical Code Folding for functions and read-only variables]'
  '-fipa-icf-variables[perform Identical Code Folding for variables]'
  '-fipa-profile[perform interprocedural profile propagation]'
  '-fipa-pta[perform interprocedural points-to analysis]'
  '-fipa-pure-const[discover pure and const functions]'
  '-fipa-ra[use caller save register across calls if possible]'
  '-fipa-reference[discover readonly and non addressable static variables]'
  '-fipa-sra[perform interprocedural reduction of aggregates]'
  '-fipa-vrp[perform IPA Value Range Propagation]'
  '-fira-algorithm=[set the used IRA algorithm]:algorithm:(cb priority)'
  '-fira-hoist-pressure[use IRA based register pressure calculation in RTL hoist optimizations]'
  '-fira-loop-pressure[use IRA based register pressure calculation in RTL loop optimizations]'
  '-fira-region=-[set regions for IRA]:region:(all mixed one)'
  '-fira-region=[set regions for IRA]:region:(one all mixed)'
  '-fira-share-save-slots[share slots for saving different hard registers]'
  '-fira-share-spill-slots[share stack slots for spilled pseudo-registers]'
  '-fira-verbose=-[control IRA'\''s level of diagnostic messages]:verbosity: '
  '-fisolate-erroneous-paths-attribute[detect paths that trigger erroneous or undefined behavior due to a null value being used in a way forbidden by a returns_nonnull or]'
  '-fisolate-erroneous-paths-dereference[detect paths that trigger erroneous or undefined behavior due to dereferencing a null pointer.  Isolate those paths from the main]'
  '-fivopts[optimize induction variables on trees]'
  '-fjump-tables[use jump tables for sufficiently large switch statements]'
  '-fkeep-inline-functions[generate code for functions even if they are fully inlined]'
  '-fkeep-static-consts[emit static const variables even if they are not used]'
  "-flax-vector-conversions[allow implicit conversions between vectors with differing numbers of subparts and/or differing element types]"
  '-fleading-underscore[give external symbols a leading underscore]'
  '-flifetime-dse[tell DSE that the storage for a C++ object is dead when the constructor starts and when the destructor finishes]'
  '-flive-range-shrinkage[relief of register pressure through live range shrinkage]'
  '-floop-nest-optimize[enable the loop nest optimizer]'
  '-floop-parallelize-all[mark all loops as parallel]'
  '-flra-remat[do CFG-sensitive rematerialization in LRA]'
  '-flto-compression-level=-[use specified zlib compression level for IL]:compression level: '
  '-flto-odr-type-merging[merge C++ types using One Definition Rule]'
  '-flto-partition=-[partition symbols and vars at linktime based on object files they originate from]:partitioning algorithm:(1to1 balanced max one none)'
  '-flto-report[report various link-time optimization statistics]'
  '-fmath-errno[set errno after built-in math functions]'
  '-fmax-errors=-[maximum number of errors to report]:errors: '
  '-fmem-report[report on permanent memory allocation]'
  '-fmem-report-wpa[report on permanent memory allocation in WPA only]'
  '-fmerge-all-constants[attempt to merge identical constants and constant variables]'
  '-fmerge-constants[attempt to merge identical constants across compilation units]'
  '-fmerge-debug-strings[attempt to merge identical debug strings across compilation units]'
  '-fmessage-length=-[limit diagnostics to <number> characters per line.  0 suppresses line-wrapping]:length: '
  '-fmodulo-sched-allow-regmoves[perform SMS based modulo scheduling with register moves allowed]'
  '-fmodulo-sched[perform SMS based modulo scheduling before the first scheduling pass]'
  '-fmove-loop-invariants[move loop invariant computations out of loops]'
  "-fms-extensions[don't warn about uses of Microsoft extensions]"
  "-fmudflapir[this switch lacks documentation]"
  "-fmudflap[this switch lacks documentation]"
  "-fmudflapth[this switch lacks documentation]"
  '-fnon-call-exceptions[support synchronous non-call exceptions]'
  '-fno-stack-limit[do not limit the size of the stack]'
  '-fno-threadsafe-statics[do not generate thread-safe code for initializing local statics]'
  '-fnothrow-opt[treat a throw() exception specification as noexcept to improve code size]'
  '-fomit-frame-pointer[when possible do not generate stack frames]'
  "-fopenacc[enable OpenACC]"
  "-fopenmp[enable OpenMP (implies -frecursive in Fortran)]"
  "-fopenmp-simd[enable OpenMP's SIMD directives]"
  '-foptimize-sibling-calls[optimize sibling and tail recursive calls]'
  '-foptimize-strlen[enable string length optimizations on trees]'
  '-fopt-info[enable all optimization info dumps on stderr]'
  '-fopt-info-type=-[dump compiler optimization details]:filename:_files'
  '-fpack-struct[pack structure members together without holes]'
  '-fpack-struct=[set initial maximum structure member alignment]:alignment (power of 2): '
  '-fpartial-inlining[perform partial inlining]'
  '-fpcc-struct-return[return small aggregates in memory, not registers]'
  "-fpch-deps[this switch lacks documentation]"
  "-fpch-preprocess[look for and use PCH files even when preprocessing]"
  '-fpeel-loops[perform loop peeling]'
  '-fpeephole2[enable an RTL peephole pass before sched2]'
  '-fpeephole[enable machine specific peephole optimizations]'
  '-fPIC[generate position-independent code if possible (large mode)]'
  '-fpic[generate position-independent code if possible (small mode)]'
  '-fPIE[generate position-independent code for executables if possible (large mode)]'
  '-fpie[generate position-independent code for executables if possible (small mode)]'
  "-fplan9-extensions[enable Plan 9 language extensions]"
  '-fplt[use PLT for PIC calls (-fno-plt- load the address from GOT at call site)]'
  '-fplugin-arg--[specify argument <key>=<value> for plugin <name>]:-fplugin-arg-name-key=value: ' #TODO
  '-fplugin=-[specify a plugin to load]:plugin: ' # TODO: complete plugins?
  '-fpost-ipa-mem-report[report on memory allocation before interprocedural optimization]'
  '-fpredictive-commoning[run predictive commoning optimization]'
  '-fprefetch-loop-arrays[generate prefetch instructions, if available, for arrays in loops]'
  '-fpre-ipa-mem-report[report on memory allocation before interprocedural optimization]'
  "-fpreprocessed[treat the input file as already preprocessed]"
  '-fprintf-return-value[treat known sprintf return values as constants]'
  '-fprofile-arcs[insert arc-based program profiling code]'
  '-fprofile-correction[enable correction of flow inconsistent profile data input]'
  '-fprofile-dir=-[set the top-level directory for storing the profile data]:profile directory:_files -/'
  '-fprofile[enable basic program profiling code]'
  '-fprofile-generate[enable common options for generating profile info for profile feedback directed optimizations]'
  '-fprofile-report[report on consistency of profile]'
  '-fprofile-use[enable common options for performing profile feedback directed optimizations]'
  '-fprofile-values[insert code to profile values of expressions]'
  '-frandom-seed=-[use <string> as random seed]:seed: '
  '-freciprocal-math[same as -fassociative-math for expressions which include division]'
  '-frecord-gcc-switches[record gcc command line switches in the object file]'
  '-free[turn on Redundant Extensions Elimination pass]'
  '-freg-struct-return[return small aggregates in registers]'
  '-frename-registers[perform a register renaming optimization pass]'
  '-freorder-blocks-algorithm=[set the used basic block reordering algorithm]:algorithm:(simple stc)'
  '-freorder-blocks-and-partition[reorder basic blocks and partition into hot and cold sections]'
  '-freorder-blocks[reorder basic blocks to improve code placement]'
  '-freorder-functions[reorder functions to improve code placement]'
  '-frequire-return-statement[functions which return values must end with return statements]'
  '-frerun-cse-after-loop[add a common subexpression elimination pass after loop optimizations]'
  '-freschedule-modulo-scheduled-loops[enable/disable the traditional scheduling in loops that already passed modulo scheduling]'
  '-frounding-math[disable optimizations that assume default FP rounding behavior]'
  '-frtti[generate run time type descriptor information]'
  "-fsanitize=-[enable AddressSanitizer, a memory error detector]:style:($sanitizers)"
  '-fsched2-use-superblocks[if scheduling post reload, do superblock scheduling]'
  '-fsched-critical-path-heuristic[enable the critical path heuristic in the scheduler]'
  '-fsched-dep-count-heuristic[enable the dependent count heuristic in the scheduler]'
  '-fsched-group-heuristic[enable the group heuristic in the scheduler]'
  '-fsched-interblock[enable scheduling across basic blocks]'
  '-fsched-last-insn-heuristic[enable the last instruction heuristic in the scheduler]'
  '-fsched-pressure[enable register pressure sensitive insn scheduling]'
  '-fsched-rank-heuristic[enable the rank heuristic in the scheduler]'
  '-fsched-spec[allow speculative motion of non-loads]'
  '-fsched-spec-insn-heuristic[enable the speculative instruction heuristic in the scheduler]'
  '-fsched-spec-load[allow speculative motion of some loads]'
  '-fsched-spec-load-dangerous[allow speculative motion of more loads]'
  '-fsched-stalled-insns[allow premature scheduling of queued insns]'
  '-fsched-stalled-insns-dep[set dependence distance checking in premature scheduling of queued insns]'
  '-fsched-stalled-insns-dep=[set dependence distance checking in premature scheduling of queued insns]:insns:'
  '-fsched-stalled-insns-dep=-[set dependence distance checking in premature scheduling of queued insns]:instructions: '
  '-fsched-stalled-insns=[set number of queued insns that can be prematurely scheduled]:insns:'
  '-fsched-stalled-insns=-[set number of queued insns that can be prematurely scheduled]:instructions: '
  '-fschedule-fusion[perform a target dependent instruction fusion optimization pass]'
  '-fschedule-insns2[reschedule instructions after register allocation]'
  '-fschedule-insns[reschedule instructions before register allocation]'
  '-fsched-verbose=-[set the verbosity level of the scheduler]:verbosity: '
  '-fsection-anchors[access data in the same section from shared anchor points]'
  '-fselective-scheduling2[run selective scheduling after reload]'
  '-fselective-scheduling[schedule instructions using selective scheduling algorithm]'
  '-fsel-sched-pipelining-outer-loops[perform software pipelining of outer loops during selective scheduling]'
  '-fsel-sched-pipelining[perform software pipelining of inner loops during selective scheduling]'
  '-fsel-sched-reschedule-pipelined[reschedule pipelined regions without pipelining]'
  "-fshort-double[use the same size for double as for float]"
  '-fshort-enums[use the narrowest integer type possible for enumeration types]'
  '-fshort-wchar[force the underlying type for "wchar_t" to be "unsigned short"]'
  '-fshow-column[show column numbers in diagnostics, when available]'
  '-fshrink-wrap[emit function prologues only before parts of the function that need it, rather than at the top of the function]'
  '-fshrink-wrap-separate[shrink-wrap parts of the prologue and epilogue separately]'
  '-fsignaling-nans[disable optimizations observable by IEEE signaling NaNs]'
  "-fsigned-bitfields[when signed or unsigned is not given make the bitfield signed]"
  "-fsigned-char[make char signed by default]"
  '-fsigned-zeros[disable floating point optimizations that ignore the IEEE signedness of zero]'
  '-fsimd-cost-model=[specifies the vectorization cost model for code marked with a simd directive]:model:(unlimited dynamic cheap)'
  '-fsingle-precision-constant[convert floating point constants to single precision constants]'
  '-fsplit-ivs-in-unroller[split lifetimes of induction variables when loops are unrolled]'
  '-fsplit-loops[perform loop splitting]'
  '-fsplit-paths[split paths leading to loop backedges]'
  '-fsplit-stack[generate discontiguous stack frames]'
  '-fsplit-wide-types[split wide types into independent registers]'
  '-fssa-backprop[enable backward propagation of use properties at the SSA level]'
  '-fssa-phiopt[optimize conditional patterns using SSA PHI nodes]'
  '-fstack-check=-[insert stack checking code into the program.  -fstack-check=specific if to argument given]:type:(none generic specific)'
  '-fstack-limit-register=-[trap if the stack goes past <register>]:register: '
  '-fstack-limit-symbol=-[trap if the stack goes past symbol <name>]:name: '
  '-fstack-protector-all[use a stack protection method for every function]'
  '-fstack-protector-explicit[use stack protection method only for functions with the stack_protect attribute]'
  '-fstack-protector-strong[use a smart stack protection method for certain functions]'
  '-fstack-protector[use propolice as a stack protection method]'
  '-fstack-reuse=[set stack reuse level for local variables]:level:(all named_vars none)'
  '-fstack-reuse=-[set stack reuse level for local variables]:reuse-level:(all named_vars none)'
  '-fstack-usage[output stack usage information on a per-function basis]'
  '-fstdarg-opt[optimize amount of stdarg registers saved to stack at start of function]'
  '-fstore-merging[merge adjacent stores]'
  '-fstrict-aliasing[assume strict aliasing rules apply]'
  '-fstrict-enums[assume that values of enumeration type are always within the minimum range of that type]'
  '-fstrict-overflow[treat signed overflow as undefined]'
  '-fstrict-volatile-bitfields[force bitfield accesses to match their type width]'
  '-fsync-libcalls[implement __atomic operations via libcalls to legacy __sync functions]'
  '-fsyntax-only[check for syntax errors, then stop]'
  "-ftabstop=[distance between tab stops for column reporting]:number"
  '-ftest-coverage[create data files needed by "gcov"]'
  '-fthread-jumps[perform jump threading optimizations]'
  '-ftime-report[report the time taken by each compiler pass]'
  '-ftls-model=-[set the default thread-local storage code generation model]:TLS model:(global-dynamic local-dynamic initial-exec local-exec)'
  '-ftracer[perform superblock formation via tail duplication]'
  "-ftrack-macro-expansion=[track locations of tokens coming from macro expansion and display them in error messages]::argument"
  '-ftrapping-math[assume floating-point operations can trap]'
  '-ftrapv[trap for signed overflow in addition, subtraction and multiplication]'
  '-ftree-bit-ccp[enable SSA-BIT-CCP optimization on trees]'
  '-ftree-builtin-call-dce[enable conditional dead code elimination for builtin calls]'
  '-ftree-ccp[enable SSA-CCP optimization on trees]'
  '-ftree-ch[enable loop header copying on trees]'
  '-ftree-coalesce-vars[enable SSA coalescing of user variables]'
  '-ftree-copy-prop[enable copy propagation on trees]'
  '-ftree-cselim[transform condition stores into unconditional ones]'
  '-ftree-dce[enable SSA dead code elimination optimization on trees]'
  '-ftree-dominator-opts[enable dominator optimizations]'
  '-ftree-dse[enable dead store elimination]'
  '-ftree-forwprop[enable forward propagation on trees]'
  '-ftree-fre[enable Full Redundancy Elimination (FRE) on trees]'
  '-ftree-loop-distribute-patterns[enable loop distribution for patterns transformed into a library call]'
  '-ftree-loop-distribution[enable loop distribution on trees]'
  '-ftree-loop-if-convert[convert conditional jumps in innermost loops to branchless equivalents]'
  '-ftree-loop-im[enable loop invariant motion on trees]'
  '-ftree-loop-ivcanon[create canonical induction variables in loops]'
  '-ftree-loop-linear[enable loop interchange transforms.  Same as  -floop-interchange]'
  '-ftree-loop-optimize[enable loop optimizations on tree level]'
  '-ftree-loop-vectorize[enable loop vectorization on trees]'
  '-ftree-lrs[perform live range splitting during the SSA- >normal pass]'
  '-ftree-parallelize-loops=[enable automatic parallelization of loops]'
  '-ftree-parallelize-loops=-[enable automatic parallelization of loops]:threads: '
  '-ftree-partial-pre[in SSA-PRE optimization on trees, enable partial- partial redundancy elimination]'
  '-ftree-phiprop[enable hoisting loads from conditional pointers]'
  '-ftree-pre[enable SSA-PRE optimization on trees]'
  '-ftree-pta[perform function-local points-to analysis on trees]'
  '-ftree-reassoc[enable reassociation on tree level]'
  '-ftree-scev-cprop[enable copy propagation of scalar-evolution information]'
  '-ftree-sink[enable SSA code sinking on trees]'
  '-ftree-slp-vectorize[enable basic block vectorization (SLP) on trees]'
  '-ftree-slsr[perform straight-line strength reduction]'
  '-ftree-sra[perform scalar replacement of aggregates]'
  '-ftree-switch-conversion[perform conversions of switch initializations]'
  '-ftree-tail-merge[enable tail merging on trees]'
  '-ftree-ter[replace temporary expressions in the SSA->normal pass]'
  '-ftree-vectorize[enable vectorization on trees]'
  '-ftree-vrp[perform Value Range Propagation on trees]'
  '-funconstrained-commons[assume common declarations may be overridden with ones with a larger trailing array]'
  '-funroll-all-loops[perform loop unrolling for all loops]'
  '-funroll-loops[perform loop unrolling when iteration count is known]'
  '-funsafe-loop-optimizations[allow loop optimizations to assume that the loops behave in normal way]'
  '-funsafe-math-optimizations[allow math optimizations that may violate IEEE or ISO standards]'
  "-funsigned-bitfields[when signed or unsigned is not given make the bitfield unsigned]"
  "-funsigned-char[make char unsigned by default]"
  '-funswitch-loops[perform loop unswitching]'
  '-funwind-tables[just generate unwind tables for exception handling]'
  '-fuse-ld=-[use the specified linker instead of the default linker]:linker:(bfd gold)'
  '-fuse-linker-plugin[use linker plugin during link-time optimization]'
  '-fvariable-expansion-in-unroller[apply variable expansion when loops are unrolled]'
  '-fvar-tracking-assignments[perform variable tracking by annotating assignments]'
  '-fvar-tracking-assignments-toggle[toggle -fvar-tracking-assignments]'
  '-fvar-tracking[perform variable tracking]'
  '-fvar-tracking-uninit[perform variable tracking and also tag variables that are uninitialized]'
  '-fvect-cost-model=[specifies the cost model for vectorization]:model:(unlimited dynamic cheap)'
  '-fverbose-asm[add extra commentary to assembler output]'
  '-fvisibility=-[set the default symbol visibility]:visibility:(default internal hidden protected)'
  '-fvpt[use expression value profiles in optimizations]'
  '-fweb[construct webs and split unrelated uses of single variable]'
  '-fwhole-program[perform whole program optimizations]'
  "-fwide-exec-charset=[convert all wide strings and character constants to character set]:character set"
  "-fworking-directory[generate a #line directive pointing at the current working directory]"
  '-fwrapv[assume signed arithmetic overflow wraps around]'
  '-fzero-initialized-in-bss[put zero initialized data in the bss section]'
  {-g-,--debug=}'[generate debug information]::debugging information type or level:(0 1 2 3 gdb gdb0 gdb1 gdb2 gdb3 coff stabs stabs+ dwarf dwarf+ dwarf-2 dwarf-3 dwarf-4 dwarf-5 dwarf32 dwarf64 xcoff xcoff+)'
  '-gno-pubnames[don'\''t generate DWARF pubnames and pubtypes sections]'
  '-gno-record-gcc-switches[don'\''t record gcc command line switches in DWARF DW_AT_producer]'
  '-gno-split-dwarf[don'\''t generate debug information in separate .dwo files]'
  '-gno-strict-dwarf[emit DWARF additions beyond selected version]'
  '-gpubnames[generate DWARF pubnames and pubtypes sections]'
  '-grecord-gcc-switches[record gcc command line switches in DWARF DW_AT_producer]'
  '-gsplit-dwarf[generate debug information in separate .dwo files]'
  '-gstrict-dwarf[don'\''t emit DWARF additions beyond selected version]'
  '-gtoggle[toggle debug information generation]'
  '-gvms[generate debug information in VMS format]'
  '--help[display this information]'
  {-H,--trace-includes}'[print name of each header file used]'
  {'*-idirafter','*--include-directory-after='}'[add directory after include search path]:second include path directory:_files -/'
  {'*-I-','*--include-directory='}'[add directory to include search path]:header file search path:_files -/'
  {'*-imacros','*--imacros='}'[include macros from file before parsing]:macro input file:_files -g \*.h\(-.\)'
  '-imultiarch[set <dir> to be the multiarch include subdirectory]:directory:_files -/' #XXX not in manpage
  "-imultilib=[set dir to be the multilib include subdirectory]:dir:_files -/"
  "--include-barrier[restrict all prior -I flags to double-quoted inclusion and remove current directory from include path]"
  {'*-include=','*--include='}'[include file before parsing]:include file:_files -g \*.h\(-.\)'
  '-iplugindir=-[set <dir> to be the default plugin directory]:directory:_files -/'
  {'*-iprefix','*--include-prefix='}'[set the -iwithprefix prefix]:prefix:_files'
  "-iquote=[add dir to the end of the quote include path]:dir:_files -/"
  "-isysroot=[set dir to be the system root directory]:dir:_files -/"
  '*-isystem[add directory to system include search path]:second include path directory (system):_files -/'
  {'*-iwithprefixbefore','*--include-with-prefix-before='}'[set directory to include search path with prefix]:main include path directory:_files -/'
  {'*-iwithprefix','*--include-with-prefix=','*--include-with-prefix-after='}'[set directory to system include search path with prefix]:second include path directory:_files -/'
  '*-L-[add directory to library search path]:library search path:_files -/'
  "-lang-asm[set lang asm]"
  '*-l+[include library found in search path]:library:->library'
  "-MF[write dependency output to the given file]:file:_files"
  "-MJ[write a compilation database entry per input]"
  "-MQ[add a make-quoted target]:target"
  '*-M-[set flags for generating Makefile dependencies]::output dependencies:->dependencies'
  "-MT[add an unquoted target]:target"
  '-no-canonical-prefixes[do not canonicalize paths when building relative prefixes to other gcc components]'
  '-nodefaultlibs[do not use the standard system libraries when linking]'
  '-nostartfiles[do not use the standard system startup files when linking]'
  {-nostdinc,--no-standard-includes}"[do not search standard system directories or compiler builtin directories for include files]"
  '-nostdlib[do not use standard system startup files or libraries when linking]'
  {-O-,--optimize=-}'[control the optimization]::optimization level:((0 1 2 3 g\:optimize\ for\ debugging\ experience s\:optimize\ for\ space fast\:optimize\ for\ speed\ disregarding\ exact\ standards\ compliance))'
  {-o,--output=}'[write output to file]:output file:_files -g "^*.(c|h|cc|C|cxx|cpp|hpp)(-.)"'
  "--output-pch=[output pch]"
  '--param[set parameter <param> to value.  See manpage for a complete list of parameters]:name=value'
  '-pass-exit-codes[exit with highest error code from a phase]'
  {-pedantic-errors,--pedantic-errors}'[like -pedantic but issue them as errors]'
  {-pedantic,--pedantic}'[issue all mandatory diagnostics in the C standard]'
  '(-pg)-p[enable function profiling for prof]'
  '-pie[create a position independent executable]'
  {-pipe,--pipe}'[use pipes rather than intermediate files]'
  {-P,--no-line-commands}'[inhibit generation of linkemakers during preprocess]'
  '(-p)-pg[enable function profiling for gprof]'
  '-###[print commands to run this compilation]'
  '-print-file-name=-[display the full path to library <library>]:library:->library'
  '-print-libgcc-file-name[display the name of the compiler'\''s companion library]'
  "--print-missing-file-dependencies[print missing file dependencies]"
  '-print-multiarch[display the target'\''s normalized GNU triplet, used as a component in the library path]'
  '-print-multi-directory[display the root directory for versions of libgcc]'
  '-print-multi-lib[display the mapping between command line options and multiple library search directories]'
  '-print-multi-os-directory[display the relative path to OS libraries]'
  '-print-prog-name=-[display the full path to compiler component <program>]:program:'
  '-print-search-dirs[display the directories in the compiler'\''s search path]'
  '-print-sysroot[display the target libraries directory]'
  '-print-sysroot-headers-suffix[display the sysroot suffix used to find headers]'
  {-Qn,-fno-ident}"[do not emit metadata containing compiler name and version]"
  '-quiet[do not display functions compiled or elapsed time]'
  {-Qy,-fident}"[emit metadata containing compiler name and version]"
  '-rdynamic[pass the flag -export-dynamic to the ELF linker, on targets that support it]'
  "-remap[remap file names when including files]"
  {-S,--assemble}'[compile only; do not assemble or link]'
  '-save-stats=-[save code generation statistics]:location:(cwd obj)'
  '-save-temps[do not delete intermediate files]'
  '-shared[create a shared library]'
  '-shared-libgcc[force shared libgcc]'
  '*-specs=-[override built-in specs with the contents of <file>]:file:_files'
  '-s[remove all symbol table and relocation information from the executable]'
  '-static-libgcc[force static libgcc]'
  '-static[on systems that support dynamic linking, this prevents linking with the shared libraries]'
  {'-std=-','--std='}'[assume that the input sources are for specified standard]:standard:(c90 c89 iso9899\:1990 iso9899\:199409 c99 iso9899\:1999 c11 iso9899\:2011 gnu90 gnu89 gnu99 gnu11 c++98 c++03 gnu++98 gnu++03 c++11 gnu++11 c++1y gnu++1y c++14 gnu++14 c++1z gnu++1z c++17 iso9899\:2017 gnu++17 c++2a gnu++2a)'
  '-symbolic[bind references to global symbols when building a shared object]'
  '--sysroot=-[use <directory> as the root directory for headers and libraries]:directory:_files -/'
  '--target-help[display target specific command line options]'
  '-time[time the execution of each subprocess]'
  {-traditional-cpp,--traditional-cpp}"[use traditional preprocessor]"
  {-trigraphs,--trigraphs}"[process trigraph sequences]"
  '-T[specify linker script]:linker script:_files'
  "-undef[do not predefine system specific and gcc specific macros]"
  '*-u[pretend symbol to be undefined]:symbol:'
  "--user-dependencies[print user dependencies]"
  {'*-U-','*--undefine-macro='}'[undefine a macro]:undefine macro:'
  '-version[display the compiler'\''s version]'
  '--version[display version information]'
  '-V[specify compiler version]:compiler version:'
  {-v,--verbose}'[enable verbose output]'
  '*-Wa,-[pass arguments to the assembler]:assembler option:'
  '--warn--[enable the specified warning]:warning:->warning'
  '*-Werror=-[treat specified warning as error (or all if none specified)]::warning:->warning'
  '-Wfatal-errors[exit on the first error occurred]'
  '*-Wl,-[pass arguments to the linker]:linker option:'
  {-w,--no-warnings}'[suppress warnings]'
  '*-Wp,-[pass arguments to the preprocessor]:preprocessor option:'
  "--write-dependencies[write a depfile containing user and system dependencies]"
  "--write-user-dependencies[write a depfile containing user dependencies]"
  '*-Xassembler[pass argument to the assembler]:assembler option:'
  '*-Xlinker[pass argument to the linker]:linker option:'
  '*-Xpreprocessor[pass argument to the preprocessor]:preprocessor option:'
  '-x[specify the language of the following input files]:input file language:('"$languages"')'
)

# not meant for end users
#'-fdisable--pass=-[disables an optimization pass]:range1+range2: '
#'-fdisable-[disables an optimization pass]'
#'-fenable--pass=-[enables an optimization pass]:range1+range2: '
#'-fenable-[enables an optimization pass]'
#'-fdump-<type>[dump various compiler internals to a file]'

args+=($warnings)

# How to mostly autogenerate the above stuff:
# joinhelplines() { sed '$!N;s/^\(  -.*\)\n  \s*\([^-]\)/\1 \2/;P;D' }
# gcc-x86() { gcc --help=target,\^undocumented | joinhelplines | joinhelplines }
# compdef _gnu_generic gcc-x86
# printf '%s\n' ${(onq-)_args_cache_gcc_x86}
# You might want to add r:|[_-]=* to the -M option
_arguments -C -M 'L:|-{fWm}no-=-{fWm} r:|=*' \
  "$args[@]" \
  "$args2[@]" && ret=0

case "$state" in
dump)
  local -a dump_values=(
    'A[verbose assembly output]'
    'D[macro definitions and normal output]'
    'I[include directives and normal output]'
    'J[after last jump optimization]'
    'L[after loop optimization]'
    'M[only macro definitions]'
    'N[macro names]'
    'R[after second instruction scheduling pass]'
    'S[after first instruction scheduling pass]'
    'a[all dumps]'
    'c[after instruction combination]'
    'd[after delayed branch scheduling]'
    'f[after flow analysis]'
    'g[after global register allocation]'
    'j[after jump optimization]'
    'k[after conversion from registers to stack]'
    'l[after local register allocation]'
    'm[print memory usage statistics]'
    'p[annotate assembler output]'
    'r[after RTL generation]'
    's[after CSE]'
    't[after second CSE pass]'
    'x[only generate RTL]'
    'y[debugging information during parsing]'
  )
  _values -s '' 'dump information' $dump_values && ret=0
  ;;
dependencies)
  local -a dependencies=(
    "D:generate make dependencies and compile"
    "G:treat missing header files as generated"
    "M:only user header files"
    "MD:output to file"
    "P:generate phony targets for all headers"
    "V:use NMake/Jom format for the depfile"
  )
  _describe dependencies dependencies && ret=0
  ;;
library)
  # TODO: base this list on the output of clang -Wl,-v
  local -a library_path=(
    "/usr/lib"
    "/usr/local/lib"
    "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib"
  )
  # Add directories from -L options
  for ((i = 2; i < $#words; i++)); do
    if [[ "$words[i]" = -L ]]; then
      ((i++))
      library_path+=("$words[i]")
    elif [[ "$words[i]" = -L* ]]; then
      library_path+=("${words[i]##-L}")
    fi
  done
  _wanted libraries expl library \
      compadd - $library_path/lib*.(a|so*|dylib)(:t:fr:s/lib//) && ret=0
  ;;
rundir)
  compset -P '*:'
  compset -S ':*'
  _files -/ -S/ -r '\n\t\- /:' "$@" && ret=0
  ;;
help)
  _values -s , 'help' \
    optimizers warnings target params common \
    c c++ objc objc++ lto ada adascil adawhy fortran go java \
    {\^,}undocumented {\^,}joined {\^,}separate \
  && ret=0
  ;;
dirtodir)
  compset -P '*='
  _files -/ && ret=0
  ;;
commafiles)
  compset -P '*,'
  _files && ret=0
  ;;
framework)
  local -a framework_path frameworks
  local path i

  framework_path=(
    /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks
  )

  # Add directories from -F options
  for ((i = 2; i < $#words; i++)); do
    if [[ "$words[i]" = -F ]]; then
      ((i++))
      framework_path+=("$words[i]")
    elif [[ "$words[i]" = -F* ]]; then
      framework_path+=("${words[i]##-F}")
    fi
  done

  for path in $framework_path; do
    frameworks+=($path/*.framework(:t:r))
  done

  _wanted frameworks expl framework compadd -a frameworks && ret=0
  ;;
warning)
  local -a warning_names
  for warning in $warnings; do
    if [[ "$warning" = (#b)-W([^=\[]##)[^\[]#\[(*)\]* ]]; then
      warning_names+=("$match[1]:$match[2]")
    fi
  done
  _describe warning warning_names && ret=0
  ;;
arch)
  _wanted cputypes expl "CPU type" compadd -a arch && ret=0
  ;;
archgeneric)
  arch+=(generic)
  _wanted cputypes expl "CPU type" compadd -a arch && ret=0
  ;;
esac

return ret


[-- Attachment #2.3: Type: text/html, Size: 29580 bytes --]

^ permalink raw reply	[relevance 1%]

* Re: [PATCH v3 1/1] exec: run final pipeline command in a subshell in sh mode
  2021-01-04  0:22  2% ` [PATCH v3 1/1] exec: run final pipeline command in a " brian m. carlson
@ 2021-03-27 19:34  0%   ` Lawrence Velázquez
  2021-04-03 15:49  0%     ` Lawrence Velázquez
  0 siblings, 1 reply; 200+ results
From: Lawrence Velázquez @ 2021-03-27 19:34 UTC (permalink / raw)
  To: zsh-workers; +Cc: brian m. carlson

On Sun, Jan 3, 2021, at 7:22 PM, brian m. carlson wrote:
> zsh typically runs the final command in a pipeline in the main shell
> instead of a subshell.  However, POSIX specifies that all commands in a
> pipeline run in a subshell, but permits zsh's behavior as an extension.
> The default /bin/sh implementations on various Linux distros and the
> BSDs always use a subshell for all components of a pipeline.
> 
> Since zsh may be used as /bin/sh in some cases (such as macOS Catalina),
> it makes sense to have the common sh behavior when emulating sh, so do
> that by checking for being the final item of a multi-item pipeline and
> creating a subshell in that case.

ping for review

vq


^ permalink raw reply	[relevance 0%]

* Re: [PATCH] declarednull: rename DECLARED to NULL
  @ 2021-03-29  0:44  3%                   ` Oliver Kiddle
  2021-04-10 18:56  4%                     ` Bart Schaefer
  0 siblings, 1 reply; 200+ results
From: Oliver Kiddle @ 2021-03-29  0:44 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: Zsh hackers list

Bart Schaefer wrote:
> Since we resolved this down to arguing about internal names that are
> never visible to the user, IMO the primary remaining question is
> whether it's acceptable to make the user-visible behavior dependent on
> the POSIX_BUILTINS option.

It seems fairly self-contained and could have it's own option. typeset
isn't a builtin. posix compatibility options aren't really improvements
but someone might prefer this behaviour. But I don't have a strong
view - whatever you think is good.

> Perhaps the internal naming argument can be resolved by using
> PM_DEFAULTED (thus making it definitely a verb rather than "default"
> which could be interpreted as a noun).

I'm fine with that but I wouldn't especially object to DECLARED or
whatever it was before. Some other ideas:
ONLYDECLARED, DECLONLY, UNASSIGNED, INITIATED, CONCEIVED, SCOPED.

Was there anything else outstanding like (t) output perhaps?
I don't feel strongly about either of these naming issues and would be
happy for this to move forward regardless of the outcome on them.

Oliver


^ permalink raw reply	[relevance 3%]

* Re: Improvements to the gcc completion script
  @ 2021-03-31 14:53  1%         ` Jun. T
  2021-03-31 15:06  1%           ` Jun. T
  0 siblings, 1 reply; 200+ results
From: Jun. T @ 2021-03-31 14:53 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 1726 bytes --]


> 2021/03/31 21:31, Oliver Kiddle <opk@zsh.org> wrote:
> 
> On 23 Mar, "Jun. T" wrote:
>> Does anyone know a way to prevent '--' from being split in 'partial word completion'?
> 
> It is possible if you check for a -- in $PREFIX and don't add the other
> matches when it is found. That might subvert approximate completion,
> however. .... (snip)

Thanks for the analysis.
It seems 'r:|[_-][^-]=* r:|=*' works _slightly_ better, although I don't
know why. Or does this have some bad side effects?

> 2021/03/31 21:31, Oliver Kiddle <opk@zsh.org> wrote:
> 
> Was this the only outstanding issue for the contributed _gcc update?
> What's the status otherwise?

I've been trying to find a reasonable default for library_path.
We need to add /usr/lib/x86_64-linux-gnu on Ubuntu (and Debian?) and
/usr/lib64 and on Fedora/CentOS. Are there any OSs that are known to
use directories other than /usr/{,local/}lib? In the attached _gcc
I use the following for OSTYPE==linux-gnu:

      tmp=$(_call_program library-paths $words[1] -print-multiarch)
      if [[ $tmp != '' && -d /usr/lib/$tmp ]]; then
	library_path+=( /usr/lib/$tmp )
      elif [[ -d /usr/lib64 ]]; then
	library_path+=( /usr/lib64 )
      fi

> It does add
> a commented out line that assigns args2 without the file glob. That
> serves no useful purpose, was probably debug that got left in and should
> be stripped.

OP (Jacob Gelbman) wanted to use the commend-out version, but I argued that
it was not a good idea in a response to him.

Only differences of the attached _gcc from the 2nd version by OP are
the above three points (except for format changes etc.).

I will push this soon unless any problems are found.


[-- Attachment #2: _gcc --]
[-- Type: application/octet-stream, Size: 142473 bytes --]

#compdef gcc g++ cc c++ llvm-gcc llvm-g++ clang clang++ -value-,LDFLAGS,-default- -value-,CFLAGS,-default- -value-,CXXFLAGS,-default- -value-,CPPFLAGS,-default- -P gcc-* -P g++-* -P c++-*

local curcontext="$curcontext" state line ret=1 expl i
local -a args args2 warnings arch
typeset -A opt_args

if [[ "$service" = -value-* ]]; then
  compset -q
  words=( fake "$words[@]" )
  (( CURRENT++ ))
  if [[ "$service" = *LDFLAGS ]]; then
    args2=( '-R:runtime path:->rundir' )
  else
    args2=()
  fi
else
  # On some systems (macOS), cc/gcc/g++ are actually clang; treat them accordingly
  [[ $service != clang* ]] &&
  _pick_variant clang=clang unix --version &&
  service=clang-$service

  args2=( '*:input file:_files -g "*.([cCmisSoak]|cc|cpp|cxx|ii|k[ih])(-.)"' )
fi

args=()
case $MACHTYPE in

m68*)
  args=(
    -m68000 -m68020 -m68020-40 -m68030 -m68040 -m68881
    -mbitfield -mc68000 -mc68020 -mfpa -mnobitfield
    -mrtd -mshort -msoft-float
  )
  ;;
vax)
  args=(
    -mg -mgnu -munix
  )
  ;;
c[1234]*)
  args=(
    -mc1 -mc2 -mc32 -mc34 -mc38
    -margcount -mnoargcount
    -mlong32 -mlong64
    -mvolatile-cache -mvolatile-nocache
  )
  ;;
amd290?0)
  args=(
    -m29000 -m29050 -mbw -mnbw -mdw -mndw
    -mlarge -mnormal -msmall
    -mkernel-registers -mno-reuse-arg-regs
    -mno-stack-check -mno-storem-bug
    -mreuse-arg-regs -msoft-float -mstack-check
    -mstorem-bug -muser-registers
  )
  ;;
arm)
  args=(
    -mapcs -m2 -m3 -m6 -mbsd -mxopen -mno-symrename
    '-faapcs-bitfield-load[all volatile bit-field write generates at least one load]'
    '-faapcs-bitfield-width[volatile bit-field width is dictated by the field container type]'
    '-mcmse[allow use of CMSE]'
    '-mexecute-only[disallow generation of data access to code sections]'
    '-mno-movt[disallow use of movt/movw pairs]'
    '-mno-neg-immediates[disallow converting instructions with negative immediates to their negation]'
    '-mnocrc[disallow use of CRC instructions]'
    '-mrestrict-it[disallow generation of deprecated IT blocks for ARMv8]'
    '-mtp=[thread pointer access method]:arg'
    '-munaligned-access[allow memory accesses to be unaligned]'
  )
  ;;
m88k)
  args=(
    -m88000 -m88100 -m88110 -mbig-pic
    -mcheck-zero-division -mhandle-large-shift
    -midentify-revision -mno-check-zero-division
    -mno-ocs-debug-info -mno-ocs-frame-position
    -mno-optimize-arg-area -mno-serialize-volatile
    -mno-underscores -mocs-debug-info
    -mocs-frame-position -moptimize-arg-area
    -mserialize-volatile -msvr3
    -msvr4 -mtrap-large-shift -muse-div-instruction
    -mversion-03.00 -mwarn-passed-structs
    '-mshort-data--:maximum displacement:'
  )
  ;;
rs6000|powerpc*)
  arch=(rios1 rios2 rsc 501 603 604 power powerpc 403 common)
  args=(
    -mpower -mno-power -mpower2 -mno-power2
    -mpowerpc -mno-powerpc
    -mpowerpc-gpopt -mno-powerpc-gpopt
    -mpowerpc-gfxopt -mno-powerpc-gfxopt
    -mnew-mnemonics -mno-new-mnemonics
    -mfull-toc -mminimal-toc -mno-fop-in-toc -mno-sum-in-toc
    -msoft-float -mhard-float -mmultiple -mno-multiple
    -mstring -mno-string -mbit-align -mno-bit-align
    -mstrict-align -mno-strict-align -mrelocatable -mno-relocatable
    -mtoc -mno-toc -mtraceback -mno-traceback
    -mlittle -mlittle-endian -mbig -mbig-endian
    -mcall-aix -mcall-sysv -mprototype
    '-mcpu=:CPU type:->arch'
    '-maltivec[altivec]'
    '-mcmpb[cmpb]'
    '-mcrbits[crbits]'
    '-mcrypto[crypto]'
    '-mdirect-move[direct move]'
    '-mefpu2[efpu2]'
    '-mfloat128[float128]'
    '-mfprnd[fprnd]'
    '-mhtm[htm]'
    '-minvariant-function-descriptors[invariant function descriptors]'
    '-misel[isel]'
    '-mlongcall[longcall]'
    '-mmfocrf[mfocrf]'
    '-mmfcrf[mfcrf]'
    '-mmma[mma]'
    '-mpaired-vector-memops[paired vector memops]'
    '-mpcrel[pcrel]'
    '-mpopcntd[popcntd]'
    '-mpower10-vector[power10 vector]'
    '-mpower8-vector[power8 vector]'
    '-mpower9-vector[power9 vector]'
    '-mrop-protection[rop protection]'
    '-msecure-plt[secure plt]'
    '-mspe[spe]'
    '-mvsx[vsx]'
  )
  ;;
romp)
  args=(
    -mcall-lib-mul -mfp-arg-in-fpregs -mfp-arg-in-gregs
    -mfull-fp-blocks -mhc-struct-return -min-line-mul
    -mminimum-fp-blocks -mnohc-struct-return
  )
  ;;
mips*)
  arch=(r2000 r3000 r4000 r4400 r4600 r6000)
  args=(
    -membedded-pic -mgas -mgp32 -mgp64 -mhalf-pic -mhard-float -mint64 -mips1
    -mips2 -mips3 -mlong64 -mmemcpy -mmips-as -mmips-tfile -mno-abicalls
    -mno-embedded-data -mno-embedded-pic -mno-gpopt -mno-long-calls -mno-memcpy
    -mno-mips-tfile -mno-rnames -mno-stats -mrnames -msoft-float -m4650 -mmad
    -mstats -nocpp
    '-mcpu=:CPU type:->arch'
    '-mabicalls[enable SVR4-style position-independent code]'
    '-mabs=[abs]:arg'
    '-mcheck-zero-division[check zero division]'
    '-mcompact-branches=[compact branches]:arg'
    '-mdouble-float[double float]'
    '-mdsp[dsp]'
    '-mdspr2[dspr2]'
    '-membedded-data[place constants in the .rodata section instead of the .sdata section]'
    '-mextern-sdata[assume that externally defined data is in the small data]'
    '-mfp32[use 32-bit floating point registers]'
    '-mfp64[use 64-bit floating point registers]'
    '-mginv[ginv]'
    '-mgpopt[use GP relative accesses for symbols known to be in a small data section]'
    '-mindirect-jump=[change indirect jump instructions to inhibit speculation]:arg'
    '-mips16[ips16]'
    '-mldc1-sdc1[ldc1 sdc1]'
    '-mlocal-sdata[extend the -G behaviour to object local data]'
    '-mmadd4[enable the generation of 4-operand madd.s, madd.d, etc]'
    '-mmicromips[micromips]'
    '-mmsa[enable MSA ASE]'
    '-mmt[enable MT ASE]'
    '-mnan=[nan]:arg'
    '-mno-mips16[no mips16]'
    '-msingle-float[single float]'
    '-mvirt[virt]'
    '-mxgot[xgot]'
  )
  ;;
i[3456]86|x86_64)
  arch=(
    native i386 i486 i586 pentium pentium-mmx pentiumpro i686 pentium2 pentium3
    pentium3m pentium-m pentium4 pentium4m prescott nocona core2 corei7 corei7-avx
    core-avx-i core-avx2 atom k6 k6-2 k6-3 athlon athlon-tbird athlon-4 athlon-xp
    athlon-mp k8 opteron athlon64 athlon-fx k8-sse3 opteron-sse3 athlon64-sse3
    amdfam10 barcelona bdver1 bdver2 bdver3 btver1 btver2 winchip-c6 winchip2 c3
    c3-2 geode
  )
  args=(
    '-m128bit-long-double[sizeof(long double) is 16]'
    '-m16[generate 16bit i386 code]'
    '-m32[generate 32bit i386 code]'
    '-m3dnowa[support Athlon 3Dnow! built-in functions]'
    '-m3dnow[support 3DNow! built-in functions]'
    '-m64[generate 64bit x86-64 code]'
    '-m80387[use hardware fp]'
    '-m8bit-idiv[expand 32bit/64bit integer divide into 8bit unsigned integer divide with run-time check]'
    '-m96bit-long-double[sizeof(long double) is 12]'
    '-mabi=-[generate code that conforms to the given ABI]:abi:(ms sysv)'
    '-mabm[support code generation of Advanced Bit Manipulation (ABM) instructions]'
    '-maccumulate-outgoing-args[reserve space for outgoing arguments in the function prologue]'
    '-maddress-mode=-[use given address mode]:address mode:(short long)'
    '-madx[support flag-preserving add-carry instructions]'
    '-maes[support AES built-in functions and code generation]'
    '-malign-data=-[use the given data alignment]:type:(compat abi cacheline)'
    '-malign-double[align some doubles on dword boundary]'
    '-malign-functions=-[function starts are aligned to this power of 2]: **2 base for function alignment: '
    '-malign-jumps=-[jump targets are aligned to this power of 2]: **2 base for jump goal alignment: '
    '-malign-loops=-[loop code aligned to this power of 2]: **2 base for loop alignment: '
    '-malign-stringops[align destination of the string operations]'
    '-mamx-bf16[amx bf16]'
    '-mamx-int8[amx int8]'
    '-mamx-tile[amx tile]'
    '-mandroid[generate code for the Android platform]'
    '-march=-[generate instructions for CPU type]:CPU type:->archgeneric'
    '-masm=-[use given assembler dialect]:asm dialect:(att intel)'
    '-mavx256-split-unaligned-load[split 32-byte AVX unaligned load]'
    '-mavx256-split-unaligned-store[split 32-byte AVX unaligned store]'
    '-mavx2[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX and AVX2 built-in functions and code generation]'
    '-mavx5124fmaps[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2, AVX512F and AVX5124FMAPS built- in functions and code generation]'
    '-mavx5124vnniw[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2, AVX512F and AVX5124VNNIW built- in functions and code generation]'
    '-mavx512bf16[avx512bf16]'
    '-mavx512bitalg[avx512bitalg]'
    '-mavx512bw[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512BW built- in functions and code generation]'
    '-mavx512cd[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512CD built- in functions and code generation]'
    '-mavx512dq[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512DQ built- in functions and code generation]'
    '-mavx512er[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512ER built- in functions and code generation]'
    '-mavx512f[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F built-in functions and code generation]'
    '-mavx512ifma[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512IFMA built-in functions and code generation]'
    '-mavx512pf[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512PF built- in functions and code generation]'
    '-mavx512vbmi2[avx512vbmi2]'
    '-mavx512vbmi[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512VBMI built-in functions and code generation]'
    '-mavx512vl[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512VL built- in functions and code generation]'
    '-mavx512vnni[avx512vnni]'
    '-mavx512vp2intersect[avx512vp2intersect]'
    '-mavx512vpopcntdq[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2, AVX512F and AVX512VPOPCNTDQ built-in functions and code generation]'
    '-mavx[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2 and AVX built-in functions and code generation]'
    '-mavxvnni[avxvnni]'
    '-mbionic[use Bionic C library]'
    '-mbmi2[support BMI2 built-in functions and code generation]'
    '-mbmi[support BMI built-in functions and code generation]'
    '-mbranch-cost=-[branches are this expensive (1-5, arbitrary units)]:branch cost (1-5): '
    '-mcldemote[cldemote]'
    '-mcld[generate cld instruction in the function prologue]'
    '-mclflushopt[support CLFLUSHOPT instructions]'
    '-mclwb[support CLWB instruction]'
    '-mclzero[support CLZERO built-in functions and code generation]'
    '-mcmodel=-[use given x86-64 code model]:memory model:(32 small kernel medium large)'
    '-mcpu=-[set CPU type]:CPU type:->arch'
    '-mcrc32[support code generation of crc32 instruction]'
    '-mcx16[support code generation of cmpxchg16b instruction]'
    '-mdispatch-scheduler[do dispatch scheduling if processor is bdver1, bdver2, bdver3, bdver4 or znver1 and Haifa scheduling is selected]'
    '-menqcmd[enqcmd]'
    '-mf16c[support F16C built-in functions and code generation]'
    '-mfancy-math-387[generate sin, cos, sqrt for FPU]'
    '-mfentry[emit profiling counter call at function entry before prologue]'
    '-mfma4[support FMA4 built-in functions and code generation]'
    '-mfma[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX and FMA built-in functions and code generation]'
    '-mforce-drap[always use Dynamic Realigned Argument Pointer (DRAP) to realign stack]'
    '-mfpmath=-[generate floating point mathematics using given instruction set]:FPU type:(387 sse sse,387 both)'
    '-mfp-ret-in-387[return values of functions in FPU registers]'
    '-mfsgsbase[support FSGSBASE built-in functions and code generation]'
    '-mfunction-return=-[convert function return to call and return thunk]:choice:(keep thunk thunk-inline thunk-extern)'
    '-mfxsr[support FXSAVE and FXRSTOR instructions]'
    '-mgeneral-regs-only[generate code which uses only the general registers]'
    '-mgfni[gfni]'
    '-mglibc[use GNU C library]'
    '-mhard-float[use hardware fp]'
    '-mhle[support Hardware Lock Elision prefixes]'
    '-mhreset[hreset]'
    '-miamcu[generate code that conforms to Intel MCU psABI]'
    '-mieee-fp[use IEEE math for fp comparisons]'
    '-mincoming-stack-boundary=-[assume incoming stack aligned to this power of 2]:assumed size of boundary: '
    '-mindirect-branch=-[convert indirect call and jump to call and return thunks]:choice:(keep thunk thunk-inline thunk-extern)'
    '-mindirect-branch-register[force indirect call and jump via register]'
    '-minline-all-stringops[inline all known string operations]'
    '-minline-stringops-dynamically[inline memset/memcpy string operations, but perform inline version only for small blocks]'
    '-minvpcid[invpcid]'
    '-mkl[kl]'
    '-mlarge-data-threshold=-[data greater than given threshold will go into .ldata section in x86-64 medium model]:threshold: '
    '-mlong-double-128[use 128-bit long double]'
    '-mlong-double-64[use 64-bit long double]'
    '-mlong-double-80[use 80-bit long double]'
    '-mlwp[support LWP built-in functions and code generation]'
    '-mlzcnt[support LZCNT built-in function and code generation]'
    {'-mmemset-strategy=-','-mmemcpy-strategy=-'}'[specify memcpy expansion strategy when expected size is known]:strategy:'
    '-mmitigate-rop[attempt to avoid generating instruction sequences containing ret bytes]'
    '-mmmx[support MMX built-in functions]'
    '-mmovbe[support code generation of movbe instruction]'
    '-mmovdir64b[movdir64b]'
    '-mmovdiri[movdiri]'
    '-mmpx[support MPX code generation]'
    '-mms-bitfields[use native (MS) bitfield layout]'
    '-mmusl[use musl C library]'
    '-mmwaitx[support MWAITX and MONITORX built-in functions and code generation]'
    '-mno-default[clear all tune features]'
    '-mnop-mcount[generate mcount/__fentry__ calls as nops. To activate they need to be patched in]'
    '-mno-sse4[do not support SSE4.1 and SSE4.2 built-in functions and code generation]'
    '-momit-leaf-frame-pointer[omit the frame pointer in leaf functions]'
    '-mpc32[set 80387 floating-point precision to 32-bit]'
    '-mpc64[set 80387 floating-point precision to 64-bit]'
    '-mpc80[set 80387 floating-point precision to 80-bit]'
    '-mpclmul[support PCLMUL built-in functions and code generation]'
    '-mpconfig[pconfig]'
    '-mpku[support PKU built-in functions and code generation]'
    '-mpopcnt[support code generation of popcnt instruction]'
    '-mprefer-avx128[use 128-bit AVX instructions instead of 256-bit AVX instructions in the auto-vectorizer]'
    '-mpreferred-stack-boundary=-[attempt to keep stack aligned to this power of 2]:size of boundary: '
    '-mprefetchwt1[support PREFETCHWT1 built-in functions and code generation]'
    '-mprfchw[support PREFETCHW instruction]'
    '-mptwrite[ptwrite]'
    '-mpush-args[use push instructions to save outgoing arguments]'
    '-mrdpid[support RDPID built-in functions and code generation]'
    '-mrdrnd[support RDRND built-in functions and code generation]'
    '-mrdseed[support RDSEED instruction]'
    '-mrecip=-[control generation of reciprocal estimates]::instruction:(all none div divf divd rsqrt rsqrtf rsqrtd)' # TODO comma separated and can have !
    '-mrecip[generate reciprocals instead of divss and sqrtss]'
    '-mrecord-mcount[generate __mcount_loc section with all mcount or __fentry__ calls]'
    '-mred-zone[use red-zone in the x86-64 code]'
    '-mreg-alloc=[control the default allocation order of integer registers]:default register allocation order:'
    '-mregparm=-[number of registers used to pass integer arguments]:number of integer argument registers: '
    '-mretpoline-external-thunk[retpoline external thunk]'
    '-mrtd[alternate calling convention]'
    '-mrtm[support RTM built-in functions and code generation]'
    '-msahf[support code generation of sahf instruction in 64bit x86-64 code]'
    '-mserialize[serialize]'
    '-msgx[support SGX built-in functions and code generation]'
    '-msha[support SHA1 and SHA256 built-in functions and code generation]'
    '-mshstk[shstk]'
    '-mskip-rax-setup[skip setting up RAX register when passing variable arguments]'
    '-msoft-float[do not use hardware fp]'
    '-msse2avx[encode SSE instructions with VEX prefix]'
    '-msse2[support MMX, SSE and SSE2 built-in functions and code generation]'
    '-msse3[support MMX, SSE, SSE2 and SSE3 built-in functions and code generation]'
    '-msse4.1[support MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1 built-in functions and code generation]'
    '-msse4.2[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1 and SSE4.2 built-in functions and code generation]'
    '-msse4a[support MMX, SSE, SSE2, SSE3 and SSE4A built-in functions and code generation]'
    '-msse4[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1 and SSE4.2 built-in functions and code generation]'
    '-msseregparm[use SSE register passing conventions for SF and DF mode]'
    '-msse[support MMX and SSE built-in functions and code generation]'
    '-mssse3[support MMX, SSE, SSE2, SSE3 and SSSE3 built-in functions and code generation]'
    '-mstack-arg-probe[enable stack probing]'
    '-mstack-protector-guard=-[use given stack-protector guard]:guard:(global tls)'
    '-mstackrealign[realign stack in prologue]'
    '-mstringop-strategy=-[chose strategy to generate stringop using]:stringop strategy:(byte_loop libcall loop rep_4byte rep_8byte rep_byte unrolled_loop)'
    '-mstv[disable Scalar to Vector optimization pass transforming 64-bit integer computations into a vector ones]'
    '-mtbm[support TBM built-in functions and code generation]'
    '-mthreads[support thread-safe exception handling on MinGW]'
    '-mtls-dialect=-[use given thread-local storage dialect]:TLS dialect:(gnu gnu2)'
    '-mtls-direct-seg-refs[use direct references against %gs when accessing tls data]'
    '-mtsxldtrk[tsxldtrk]'
    #'-mtune-ctrl=-[fine grain control of tune features]:feature-list:' #for dev use only
    '-mtune=-[tune code for CPU type]:CPU type:->arch'
    '-muclibc[use uClibc C library]'
    '-muintr[uintr]'
    '-mvaes[vaes]'
    '-mveclibabi=-[vector library ABI to use]:vector library ABI:(acml svml)'
    '-mvect8-ret-in-mem[return 8-byte vectors in memory]'
    '-mvpclmulqdq[vpclmulqdq]'
    '-mvzeroupper[generate vzeroupper instruction before a transfer of control flow out of the function]'
    '-mwaitpkg[waitpkg]'
    '-mwbnoinvd[wbnoinvd]'
    '-mwidekl[widekl]'
    '-mx32[generate 32bit x86-64 code]'
    '-mx87[x87]'
    '-mxop[support XOP built-in functions and code generation]'
    '-mxsavec[support XSAVEC instructions]'
    '-mxsaveopt[support XSAVEOPT instruction]'
    '-mxsaves[support XSAVES and XRSTORS instructions]'
    '-mxsave[support XSAVE and XRSTOR instructions]'
  )
  ;;
hppa*)
  args=(
    -mdisable-fpregs -mdisable-indexing -mfast-indirect-calls
    -mgas -mjump-in-delay -mlong-millicode-calls -mno-disable-fpregs
    -mno-disable-indexing -mno-fast-indirect-calls -mno-gas
    -mno-jump-in-delay -mno-millicode-long-calls
    -mno-portable-runtime -mno-soft-float -msoft-float
    -mpa-risc-1-0 -mpa-risc-1-1 -mportable-runtime
    '-mschedule=:code scheduling constraints:(700 7100 7100LC)'
  )
  ;;
i960)
  args=(
    -m{ka,kb,mc,ca,cf,sa,sb}
    -masm-compat -mclean-linkage
    -mcode-align -mcomplex-addr -mleaf-procedures
    -mic-compat -mic2.0-compat -mic3.0-compat
    -mintel-asm -mno-clean-linkage -mno-code-align
    -mno-complex-addr -mno-leaf-procedures
    -mno-old-align -mno-strict-align -mno-tail-call
    -mnumerics -mold-align -msoft-float -mstrict-align
    -mtail-call
  )
  ;;
sparc)
  arch=(
    v7 cypress v8 supersparc sparclite f930 f934 hypersparc sparclite86x sparclet
    tsc701 v9 ultrasparc ultrasparc3
  )
  args=(
    -mapp-regs -mno-app-regs
    -mfpu -mhard-float
    -mno-fpu -msoft-float
    -mhard-quad-float
    -msoft-quad-float
    -mno-unaligned-doubles
    -munaligned-doubles
    -mfaster-structs -mno-faster-structs
    -mimpure-text
    '-mcpu=:CPU type:->arch'
    '-mtune=:CPU type:->arch'
    -mv8plus -mno-v8plus
    -mvis -mno-vis
    -mlittle-endian
    -m32 -m64
    '-mcmodel=:memory model:(medlow medmid medany embmedany)'
    -mstack-bias -mno-stack-bias
    -mv8
    -mcypress -mepilogue -mflat
    -mno-flat
    -mno-epilogue
    -msparclite -msupersparc
    -mmedlow -mmedany
    -mint32 -mint64 -mlong32 -mlong64
  )
  ;;
alpha*)
  args=(
    -mfp-regs -mno-fp-regs -mno-soft-float
    -msoft-float
  )
  ;;
clipper)
  args=(
    -mc300 -mc400
  )
  ;;
h8/300)
  args=(
    -mrelax -mh
  )
  ;;
aarch64)
  args=(
    '-mmark-bti-property[add .note.gnu.property with BTI to assembly files]'
    '-moutline[enable function outlining (AArch64 only)]'
    '-msve-vector-bits=[specify the size in bits of an SVE vector register]:bits'
  )
  ;;
amdgpu)
  args=(
    '-mcumode[specify CU wavefront execution mode]'
    '-mtgsplit[enable threadgroup split execution mode (AMDGPU only)]'
  )
  ;;
hexagon)
  args=(
    '-mieee-rnd-near[ieee rnd near]'
    '-mmemops[enable generation of memop instructions]'
    '-mnvj[enable generation of new-value jumps]'
    '-mnvs[enable generation of new-value stores]'
    '-mpackets[enable generation of instruction packets]'
    '-mhvx[enable Hexagon Vector eXtensions]'
    '-mhvx-length=[set Hexagon Vector Length]:arg'
    '-mhvx=[enable Hexagon Vector eXtensions]:arg'
  )
  ;;
webassembly*)
  args=(
    '-matomics[atomics]'
    '-mbulk-memory[bulk memory]'
    '-mexception-handling[exception handling]'
    '-mmultivalue[multivalue]'
    '-mmutable-globals[mutable globals]'
    '-mnontrapping-fptoint[no ntrapping fptoint]'
    '-mreference-types[reference types]'
    '-msign-ext[sign ext]'
    '-msimd128[simd128]'
    '-mtail-call[tail call]'
    '-munimplemented-simd128[unimplemented simd128]'
    '-mexec-model=[execution model]:arg'
  )
  ;;
riscv)
  args=(
    '-msave-restore[enable using library calls for save and restore]'
  )
  ;;
esac

if [[ "$service" = clang* ]]; then
  args+=(
    '-all_load[undocumented option]'
    '-allowable_client[undocumented option]:argument'
    '--analyzer-no-default-checks[analyzer does no default checks]'
    '--analyzer-output[static analyzer report output format]:format:(html plist plist-multi-file plist-html sarif sarif-html text)'
    '--analyze[run the static analyzer]'
    '-arch[arch]:argument'
    '-arch_errors_fatal[arch errors fatal]'
    '-arch_only[arch only]:argument'
    '-arcmt-migrate-emit-errors[emit ARC errors even if the migrator can fix them]'
    '-arcmt-migrate-report-output[output path for the plist report]:file:_files'
    '-a-[undocumented option]:argument'
    '--autocomplete=[autocomplete]:argument'
    '-bind_at_load[bind at load]'
    '--bootclasspath=[bootclasspath]:arg'
    '-bundle[bundle]'
    '-bundle_loader[bundle loader]:argument'
    '--CLASSPATH=[CLASSPATH]:arg'
    '--classpath=[classpath]:arg'
    '-cl-denorms-are-zero[allow denormals to be flushed to zero]'
    '-cl-fast-relaxed-math[cl fast relaxed math]'
    '-cl-finite-math-only[allow floating-point optimizations]'
    '-cl-fp32-correctly-rounded-divide-sqrt[specify that divide and sqrt are correctly rounded]'
    '-client_name[client name]:argument'
    '-cl-kernel-arg-info[generate kernel argument metadata]'
    '-cl-mad-enable[allow use of less precise MAD computations]'
    '-cl-no-signed-zeros[allow use of no signed zeros computations]'
    '-cl-no-stdinc[disables all standard includes]'
    '-cl-opt-disable[disables all optimizations]'
    '-cl-single-precision-constant[treat double float constant as single precision]'
    '-cl-std=[openCL language standard to compile for]:arg'
    '-cl-strict-aliasing[this option is added for compatibility with OpenCL 1.0]'
    '-cl-uniform-work-group-size[defines that the global work-size be uniform]'
    '-cl-unsafe-math-optimizations[allow unsafe floating-point optimizations]'
    '-compatibility_version[compatibility version]:compatibility version'
    '--config[specifies configuration file]:configuration file:_files'
    '--constant-cfstrings[use constant cfstrings]'
    '--coverage[coverage]'
    '-coverage[coverage]'
    '-cpp[cpp]'
    '--cuda-compile-host-device[compile CUDA code for both host and device]'
    '--cuda-device-only[compile CUDA code for device only]'
    '--cuda-gpu-arch=[cUDA offloading device architecture]:arg'
    '--cuda-host-only[compile CUDA code for host only]'
    '*--cuda-include-ptx=[include ptx for the following gpu architecture]:argument'
    '--cuda-noopt-device-debug[enable device-side debug info generation]'
    '--cuda-path=[cUDA installation path]:arg'
    '--cuda-path-ignore-env[ignore environment variables to detect CUDA installation]'
    '-cuid=[an id for compilation unit]:argument'
    '-current_version[current version]:current version'
    '-cxx-isystem[add directory to the C++ SYSTEM include search path]:directory:_files -/'
    '-dead_strip[dead strip]'
    '-dependency-dot[file to write dot-formatted header dependencies to]:file:_files'
    '-dependency-file[file to write dependency output to]:file:_files'
    '--dyld-prefix=[dyld prefix]:prefix'
    '--dylib_file[dyld file]:file:_files'
    '-dylinker[dylinker]'
    '-dylinker_install_name[dylinker install name]:name'
    '-dynamic[dynamic]'
    '-dynamiclib[dynamic lib]'
    '-EB[big endian]'
    '-EL[little endian]'
    '-emit-ast[emit Clang AST files for source inputs]'
    '-emit-interface-stubs[generate Interface Stub Files]'
    '-emit-llvm[use the LLVM representation for assembler and object files]'
    '-emit-merged-ifs[generate Interface Stub Files, emit merged text not binary]'
    '--emit-static-lib[enable linker job to emit a static library]'
    #'-enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang[trivial automatic variable initialization to zero is only here for benchmarks]'
    '--encoding=[encoding]:arg'
    '-exported_symbols_list[exported symbols list]:argument'
    '--extdirs=[extdirs]:arg'
    '--extra-warnings[enable extra warnings]'
    '-faccess-control[access control]'
    '*-F+[add directory to framework search path]:framework directory:_files -/'
    '-faddrsig[emit an address-significance table]'
    '-faggressive-function-elimination[aggressive function elimination]'
    '-falign-commons[align commons]'
    '-faligned-allocation[aligned allocation]'
    '-faligned-new[enable C++17 aligned allocation functions]'
    '-fall-intrinsics[all intrinsics]'
    '-fallow-editor-placeholders[treat editor placeholders as valid source code]'
    '-fallow-unsupported[allow unsupported]'
    '-falternative-parameter-statement[enable the old style PARAMETER statement]'
    '-faltivec[altivec]'
    '-fansi-escape-codes[use ANSI escape codes for diagnostics]'
    "-fapple-kext[use Apple's kernel extensions ABI]"
    '-fapple-link-rtlib[force linking the clang builtins runtime library]'
    '-fapple-pragma-pack[enable Apple GCC-compatible #pragma pack handling]'
    '-fapplication-extension[restrict code to those available for App Extensions]'
    '-fasm-blocks[asm blocks]'
    '-fassume-sane-operator-new[assume sane operator new]'
    '-fast[ast]'
    '-fastcp[astcp]'
    '-fastf[astf]'
    '-fautolink[autolink]'
    '-fautomatic[automatic]'
    '-fauto-profile-accurate[auto profile accurate]'
    '-fauto-profile=[enable sample-based profile guided optimizations]::arg'
    '-fbackslash[change the interpretation of backslashes in string literals]'
    '-fbacktrace[backtrace]'
    '-fbasic-block-sections=[generate labels for each basic block]:arg'
    '-fbinutils-version=[produced object files can use all ELF features supported by this version]:major.minor'
    '-fblas-matmul-limit=[blas matmul limit]:arg'
    '-fblocks[enable the blocks language feature]'
    '-fbootclasspath=[bootclasspath]:arg'
    '-fborland-extensions[accept non-standard constructs supported by the Borland compiler]'
    '-fbracket-depth=[bracket depth]:arg'
    '-fbuild-session-file=[use the last modification time of <file> as the build session timestamp]:file:_files'
    '-fbuild-session-timestamp=[time when the current build session started]:time since Epoch in seconds'
    '-fbuiltin-module-map[load the clang builtins module map file]'
    '-fcaret-diagnostics[show diagnostic messages using a caret]'
    '-fcf-protection=[instrument control-flow architecture protection]::arg (options\: return, branch, full, none)'
    '-fcf-runtime-abi=[cf runtime abi]:arg'
    '-fchar8_t[enable C++ builtin type char8_t]'
    '-fcheck-array-temporaries[check array temporaries]'
    '-fcheck=[check]:arg'
    '-fclang-abi-compat=[attempt to match the ABI of Clang <version>]:version'
    '-fclasspath=[classpath]:arg'
    '-fcoarray=[coarray]:arg'
    '-fcolor-diagnostics[enable colors in diagnostics]'
    '-fcomment-block-commands=[treat each comma separated argument in <arg> as a documentation comment block command]:arg'
    '-fcompile-resource=[compile resource]:arg'
    '-fcomplete-member-pointers[require member pointer base types to be complete if they would be significant under the Microsoft ABI]'
    '-fconstant-cfstrings[constant cfstrings]'
    '-fconstant-string-class=[constant string class]:arg'
    '-fconstexpr-backtrace-limit=[constexpr backtrace limit]:arg'
    '-fconstexpr-depth=[constexpr depth]:arg'
    '-fconstexpr-steps=[constexpr steps]:arg'
    '-fconvergent-functions[assume functions may be convergent]'
    '-fconvert=[convert]:arg'
    '-fcoroutines-ts[enable support for the C++ Coroutines TS]'
    '-fcoverage-compilation-dir=[the compilation directory to embed in the coverage mapping]:arg'
    '-fcoverage-mapping[generate coverage mapping to enable code coverage analysis]'
    '-fcoverage-prefix-map=[remap file source paths in coverage mapping]:arg'
    '-fcrash-diagnostics-dir=[crash diagnostics dir]:arg'
    '-fcray-pointer[cray pointer]'
    '-fcreate-profile[create profile]'
    '-fcs-profile-generate[generate instrumented code to collect context sensitive execution counts]'
    '-fcs-profile-generate=[generate instrumented code to collect context sensitive execution counts]:directory:_files -/'
    '-fc\+\+-static-destructors[c++ static destructors]'
    '-fcuda-approx-transcendentals[use approximate transcendental functions]'
    '-fcuda-flush-denormals-to-zero[flush denormal floating point values to zero in CUDA device mode]'
    '-fcuda-rdc[cuda rdc]'
    '-fcuda-short-ptr[use 32-bit pointers for accessing const/local/shared address spaces]'
    '-fcxx-exceptions[enable C++ exceptions]'
    '-fcxx-modules[cxx modules]'
    '-fdebug-compilation-dir=[the compilation directory to embed in the debug info]:arg'
    '-fdebug-default-version=[default DWARF version to use]:arg'
    '-fdebug-dump-parse-tree[dump the parse tree]'
    '-fdebug-dump-provenance[dump provenance]'
    '-fdebug-dump-symbols[dump symbols after the semantic analysis]'
    '-fdebug-info-for-profiling[emit extra debug info to make sample profile more accurate]'
    '-fdebug-macro[emit macro debug information]'
    '-fdebug-measure-parse-tree[measure the parse tree]'
    '-fdebug-pass-arguments[debug pass arguments]'
    '-fdebug-pass-structure[debug pass structure]'
    '-fdebug-pre-fir-tree[dump the pre-FIR tree]'
    '-fdebug-ranges-base-address[use DWARF base address selection entries in .debug_ranges]'
    '-fdebug-unparse[unparse and stop]'
    '-fdebug-unparse-with-symbols[unparse and stop]'
    '-fdeclspec[allow __declspec as a keyword]'
    '-fdefault-double-8[set the default double precision kind to an 8 byte wide type]'
    '-fdefault-integer-8[set the default integer kind to an 8 byte wide type]'
    '-fdefault-real-8[set the default real kind to an 8 byte wide type]'
    '-fdelayed-template-parsing[parse templated function definitions at the end of the translation unit]'
    '-fdenormal-fp-math=[denormal fp math]:arg'
    '-fdepfile-entry=[depfile entry]:arg'
    '-fdiagnostics-absolute-paths[print absolute paths in diagnostics]'
    '-fdiagnostics-fixit-info[supply fixit into with diagnostic messages]'
    '-fdiagnostics-format=[diagnostics format]:arg'
    '-fdiagnostics-hotness-threshold=[prevent optimization remarks from being output if they do not meet threshold]:value'
    '-fdiagnostics-parseable-fixits[print fixits in a machine parseable form]'
    '-fdiagnostics-print-source-range-info[print source range spans in numeric form]'
    '-fdiagnostics-show-category=[diagnostics show category]:arg'
    '-fdiagnostics-show-hotness[enable profile hotness information in diagnostic line]'
    '-fdiagnostics-show-note-include-stack[display include stacks for diagnostic notes]'
    '-fdiagnostics-show-option[enable -Woption information in diagnostic line]'
    '-fdiagnostics-show-template-tree[print a template comparison tree for differing templates]'
    '-fdigraphs[enable alternative token representations]'
    "-fdirect-access-external-data[don't use GOT indirection to reference external data symbols]"
    '-fdiscard-value-names[discard value names in LLVM IR]'
    '-fd-lines-as-code[d lines as code]'
    '-fd-lines-as-comments[d lines as comments]'
    '-fdollar-ok[dollar ok]'
    '-fdouble-square-bracket-attributes[enable double square bracket attributes]'
    '-fdump-fortran-optimized[dump fortran optimized]'
    '-fdump-fortran-original[dump fortran original]'
    '-fdump-parse-tree[dump parse tree]'
    '-fdwarf-directory-asm[DWARF directory asm]'
    '-fdwarf-exceptions[use DWARF style exceptions]'
    '-felide-constructors[elide constructors]'
    '-felide-type[elide types when printing diagnostics]'
    '-fembed-bitcode=[embed LLVM bitcode (option: off, all, bitcode, marker)]:option'
    '-fembed-bitcode[equivalent to -fembed-bitcode=all]'
    '-fembed-bitcode-marker[equivalent to -fembed-bitcode=marker]'
    '-femit-all-decls[emit all declarations]'
    '-femulated-tls[use emutls functions to access thread_local variables]'
    '-fenable-matrix[enable matrix data type and related builtin functions]'
    '-fencoding=[encoding]:arg'
    '-ferror-limit=[error limit]:arg'
    '-fescaping-block-tail-calls[escaping block tail calls]'
    '-fexperimental-isel[experimental isel]'
    '-fexperimental-new-constant-interpreter[enable the experimental new constant interpreter]'
    '-fexperimental-relative-c\+\+-abi-vtables[use the experimental C++ class ABI for classes with vtables]'
    '-fexperimental-strict-floating-point[enables experimental strict floating point in LLVM]'
    '-fextdirs=[extdirs]:arg'
    '-fexternal-blas[external blas]'
    '-ff2c[f2c]'
    '-ffile-compilation-dir=[the compilation directory to embed in the debug info]:arg'
    '-ffile-prefix-map=[remap file source paths in debug info and predefined preprocessor macros]:arg'
    '-ffine-grained-bitfield-accesses[use separate accesses for consecutive bitfield runs with legal widths and alignments]'
    '-ffinite-loops[assume all loops are finite]'
    '-ffixed-form[process source files in fixed form]'
    '-ffixed-line-length=[set column after which characters are ignored]:arg'
    '-ffixed-point[enable fixed point types]'
    '-fforce-dwarf-frame[always emit a debug frame section]'
    '-fforce-emit-vtables[emits more virtual tables to improve devirtualization]'
    '-fforce-enable-int128[enable support for int128_t type]'
    '-ffor-scope[for scope]'
    '-ffpe-trap=[fpe trap]:arg'
    '-ffp-exception-behavior=[specifies the exception behavior of floating-point operations]:arg'
    '-ffp-model=[controls the semantics of floating-point calculations]:arg'
    '-ffree-form[process source files in free form]'
    '-ffree-line-length-[free line length]:arg'
    '-ffrontend-optimize[frontend optimize]'
    '-fglobal-isel[enables the global instruction selector]'
    '-fgnuc-version=[sets various macros to claim compatibility with the given GCC version]:version'
    '-fgnu-inline-asm[gnu inline asm]'
    '-fgnu-keywords[allow GNU-extension keywords regardless of language standard]'
    '-fgnu-runtime[generate output compatible with the standard GNU Objective-C runtime]'
    '-fgpu-allow-device-init[allow device side init function in HIP]'
    '-fgpu-defer-diag[defer host/device related diagnostic messages for CUDA/HIP]'
    '-fgpu-rdc[generate relocatable device code, also known as separate compilation mode]'
    '-fgpu-sanitize[enable sanitizer for AMDGPU target]'
    '-fheinous-gnu-extensions[heinous GNU extensions]'
    '-fhip-new-launch-api,[-fno-hip-new-launch-api Use new kernel launching API for HIP]'
    '-fhonor-infinites[honor infinites]'
    '-fhonor-infinities[honor infinities]'
    '-fhonor-nans[honor nans]'
    '-fignore-exceptions[enable support for ignoring exception handling constructs]'
    '-filelist[ilelist]:arg'
    '-fimplicit-module-maps[implicit module maps]'
    '-fimplicit-modules[implicit modules]'
    '-fimplicit-none[no implicit typing allowed unless overridden by IMPLICIT statements]'
    '-findirect-virtual-calls[indirect virtual calls]'
    '-finit-character=[init character]:arg'
    '-finit-integer=[init integer]:arg'
    '-finit-local-zero[init local zero]'
    '-finit-logical=[init logical]:arg'
    '-finit-real=[init real]:arg'
    '-finline-hint-functions[inline functions which are (explicitly or implicitly) marked inline]'
    '-finstrument-function-entry-bare[instrument function entry only]'
    '-finstrument-functions-after-inlining[insert the calls after inlining]'
    '-finteger-4-integer-8[integer 4 integer 8]'
    '-fintegrated-as[enable the integrated assembler]'
    '-fintegrated-cc1[run cc1 in-process]'
    '-fintrinsic-modules-path[intrinsic modules path]'
    '-flarge-sizes[use INTEGER(KIND=8) for the result type in size-related intrinsics]'
    '-flat_namespace[flat namespace]'
    '-flegacy-pass-manager[use the legacy pass manager in LLVM]'
    '-flimited-precision=[limited precision]:arg'
    '-flogical-abbreviations[enable logical abbreviations]'
    '-flto=-[generate output files suitable for link time optimization]::style:(full thin)'
    '-flto-jobs=[controls the backend parallelism]:arg'
    '-fmacro-backtrace-limit=[macro backtrace limit]:limit'
    '-fmacro-prefix-map=[remap file source paths in predefined preprocessor macros]:arg'
    '-fmax-array-constructor=[max array constructor]:arg'
    '-fmax-identifier-length[max identifier length]'
    '-fmax-stack-var-size=[max stack var size]:arg'
    '-fmax-subrecord-length=[max subrecord length]:arg'
    '-fmax-tokens=[max total number of preprocessed tokens for -Wmax-tokens]:number'
    '-fmax-type-align=[specify the maximum alignment to enforce on pointers lacking an explicit alignment]:arg'
    '-fmemory-profile=[enable heap memory profiling and dump results into <directory>]::directory:_files -/'
    '-fmodule-file-deps[module file deps]'
    '-fmodule-file=[specify the mapping of module name to precompiled module file]:file:_files'
    '-fmodule-implementation-of[module implementation of]:name'
    '-fmodule-map-file=[load this module map file]:file:_files'
    '-fmodule-maps[implicitly search the file system for module map files.]'
    '-fmodule-name=[specify the name of the module to build]:name'
    '-fmodule-private[module private]'
    '-fmodules-cache-path=[specify the module cache path]:directory:_files -/'
    '-fmodules-decluse[require declaration of modules used within a module]'
    '-fmodules-disable-diagnostic-validation[disable validation of the diagnostic options when loading the module]'
    '-fmodules[enable the modules language feature]'
    '-fmodules-ignore-macro=[ignore the definition of the given macro when building and loading modules]:macro'
    '-fmodules-prune-after=[specify the interval after which a module file will be considered unused]:seconds'
    '-fmodules-prune-interval=[specify the interval between attempts to prune the module cache]:seconds'
    '-fmodules-search-all[search even non-imported modules to resolve references]'
    '-fmodules-strict-decluse[requires all headers to be in modules]'
    '-fmodules-ts[enable support for the C++ Modules TS]'
    '-fmodules-user-build-path[specify the module user build path]:directory:_files -/'
    '-fmodules-validate-input-files-content[validate PCM input files based on content if mtime differs]'
    "-fmodules-validate-once-per-build-session[don't verify input files for the modules]"
    '-fmodules-validate-system-headers[validate the system headers that a module depends on when loading the module]'
    '-fms-compatibility[enable full Microsoft Visual C++ compatibility]'
    '-fms-compatibility-version=[microsoft compiler version number]:arg'
    '-fmsc-version=[microsoft compiler version number to report]:arg'
    '-fms-memptr-rep=[ms memptr rep]:arg'
    '-fms-volatile[ms volatile]'
    '-fnested-functions[nested functions]'
    '-fnew-alignment=[specifies the largest alignment guaranteed]:align'
    '-fnext-runtime[next runtime]'
    '-fno-builtin-[disable implicit builtin knowledge of a specific function]:arg'
    '-fno-crash-diagnostics[disable auto-generation of preprocessed source files and a script for reproduction during a clang crash]'
    '-fno-limit-debug-info[no limit debug info]'
    '-fno-max-type-align[no max type align]'
    '-fno_modules-validate-input-files-content[no modules validate input files content]'
    '-fno_pch-validate-input-files-content[no pch validate input files content]'
    '-fno-strict-modules-decluse[no strict modules decluse]'
    '-fno-temp-file[directly create compilation output files]'
    '-fno-working-directory[no working directory]'
    '-fnoxray-link-deps[no xray link deps]'
    '-fobjc-abi-version=-[set Objective-C ABI version]:version'
    '-fobjc-arc-exceptions[use EH-safe code when synthesizing retains and releases in -fobjc-arc]'
    '-fobjc-arc[synthesize retain and release calls for Objective-C pointers]'
    '-fobjc-convert-messages-to-runtime-calls[convert messages to runtime calls]'
    '-fobjc-encode-cxx-class-template-spec[fully encode C++ class template specialization]'
    '-fobjc-exceptions[enable Objective-C exceptions]'
    '-fobjc-infer-related-result-type[infer related result type]'
    '-fobjc-legacy-dispatch[use legacy dispatch]'
    '-fobjc-link-runtime[set link runtime]'
    '-fobjc-nonfragile-abi[set nonfragile abi]'
    '-fobjc-nonfragile-abi-version=-[set nonfragile abi version]:version'
    '-fobjc-runtime=-[specify the target Objective-C runtime kind and version]:runtime'
    '-fobjc-sender-dependent-dispatch[set sender dependent dispatch]'
    '-fobjc-weak[enable ARC-style weak references in Objective-C]'
    '-fopenmp-targets=[specify comma-separated list of triples OpenMP offloading targets to be supported]:targets'
    '-fopenmp-version=[openmp version]:version'
    '-foperator-arrow-depth=[operator arrow depth]:arg'
    '-foperator-names[treat C++ operator name keywords as synonyms for operators]'
    '-foptimization-record-file=[specify the output name of the file containing the optimization remarks]:file:_files'
    '-foptimization-record-passes=[only include passes which match a specified regex]:regex'
    '-force_cpusubtype_ALL[force cpusubtype all]'
    '-force_flat_namespace[force flat namespace]'
    '--force-link=[force link]:arg'
    '-force_load[force load]:argument'
    '-forder-file-instrumentation[generate instrumented code to collect order file]'
    '-foutput-class-dir=[output class dir]:arg'
    '-fpack-derived[pack derived]'
    '-fparse-all-comments[parse all comments]'
    '-fpascal-strings[recognize and construct Pascal-style string literals]'
    '-fpass-plugin=[load pass plugin from a dynamic shared object file]:dsopath'
    '-fpatchable-function-entry=[generate NOPs around function entry]:N,M'
    '-fpch-codegen[generate code for uses of this PCH]'
    '-fpch-debuginfo[generate debug info for types in an object file built from this PCH]'
    '-fpch-instantiate-templates[instantiate templates already while building a PCH]'
    '-fpch-validate-input-files-content[validate PCH input files based on content]'
    '-fprebuilt-implicit-modules[look up implicit modules]'
    '-fprebuilt-module-path=[specify the prebuilt module path]:directory:_files -/'
    '-fpreserve-as-comments[preserve as comments]'
    '-fproc-stat-report=[save subprocess statistics to the given file]:arg'
    '-fprofile-exclude-files=[exclude files from profile]:arg'
    '-fprofile-filter-files=[filter files for profile]:arg'
    '-fprofile-instr-generate=[generate instrumented profile into file]::file:_files'
    '-fprofile-instr-use=[use instrumentation data for profile-guided optimization]::arg'
    '-fprofile-list=[filename defining the list of items to instrument]:file:_files'
    '-fprofile-remapping-file=[use the remappings described in file in profile]:file:_files'
    '-fprofile-sample-accurate[specifies that the sample profile is accurate]'
    '-fprofile-sample-use=[profile sample use]::arg'
    '-fprofile-update=[set update method of profile counters]:method'
    '-fprotect-parens[protect parens]'
    '-fpseudo-probe-for-profiling[emit pseudo probes for sample profiling]'
    '*-framework[include framework found in search path]:framework:->framework'
    '-frange-check[range check]'
    '-freal-4-real-10[real 4 real 10]'
    '-freal-4-real-16[real 4 real 16]'
    '-freal-4-real-8[real 4 real 8]'
    '-freal-8-real-10[real 8 real 10]'
    '-freal-8-real-16[real 8 real 16]'
    '-freal-8-real-4[real 8 real 4]'
    '-frealloc-lhs[realloc lhs]'
    '-frecord-command-line[record command line]'
    '-frecord-marker=[record marker]:arg'
    '-frecursive[recursive]'
    '-fregister-global-dtors-with-atexit[use atexit to register global destructors]'
    '-frelaxed-template-template-args[enable C++17 relaxed template template argument matching]'
    '-frepack-arrays[repack arrays]'
    '-freroll-loops[turn on loop reroller]'
    '-fretain-comments-from-system-headers[retain comments from system headers]'
    '-frewrite-imports[rewrite imports]'
    '-frewrite-includes[rewrite includes]'
    '-frewrite-map-file=[rewrite map file]:arg'
    '-fropi[generate read-only position independent code (ARM only)]'
    '-frtlib-add-rpath[add -rpath with architecture-specific resource directory to the linker flags]'
    '-frtti-data[rtti data]'
    '-frwpi[generate read-write position independent code (ARM only)]'
    '-fsanitize-address-destructor-kind=[set destructor type used in ASan instrumentation]:kind'
    '-fsanitize-address-field-padding=[level of field padding for AddressSanitizer]:arg'
    '-fsanitize-address-globals-dead-stripping[enable linker dead stripping of globals in AddressSanitizer]'
    '-fsanitize-address-poison-custom-array-cookie[enable poisoning array cookies when using custom operator new in AddressSanitizer]'
    '-fsanitize-address-use-after-scope[enable use-after-scope detection in AddressSanitizer]'
    '-fsanitize-address-use-odr-indicator[enable ODR indicator globals]'
    '-fsanitize-blacklist=[path to blacklist file for sanitizers]:arg'
    '-fsanitize-cfi-canonical-jump-tables[make the jump table addresses canonical in the symbol table]'
    '-fsanitize-cfi-cross-dso[enable control flow integrity (CFI) checks for cross-DSO calls]'
    '-fsanitize-cfi-icall-generalize-pointers[generalize pointers in CFI indirect call type signature checks]'
    '-fsanitize-coverage-allowlist=[sanitize coverage allowlist]:arg'
    '-fsanitize-coverage-blacklist=[disable sanitizer coverage instrumentation]:arg'
    '-fsanitize-coverage-blocklist=[sanitize coverage blocklist]:arg'
    '-fsanitize-coverage=[specify the type of coverage instrumentation for Sanitizers]:arg'
    '-fsanitize-coverage-whitelist=[restrict sanitizer coverage instrumentation]:arg'
    '-fsanitize-hwaddress-abi=[select the HWAddressSanitizer ABI to target]:arg'
    '-fsanitize-link-c\+\+-runtime[sanitize link c++ runtime]'
    '-fsanitize-link-runtime[sanitize link runtime]'
    '-fsanitize-memory-track-origins=[enable origins tracking in MemorySanitizer]::arg'
    '-fsanitize-memory-use-after-dtor[enable use-after-destroy detection in MemorySanitizer]'
    '-fsanitize-minimal-runtime[sanitize minimal runtime]'
    '-fsanitize-recover=[enable recovery for specified sanitizers]::arg'
    '-fsanitize-stats[enable sanitizer statistics gathering]'
    '-fsanitize-system-blacklist[path to system blacklist file for sanitizers]:file:_files'
    '-fsanitize-thread-atomics[enable atomic operations instrumentation in ThreadSanitizer (default)]'
    '-fsanitize-thread-func-entry-exit[enable function entry/exit instrumentation in ThreadSanitizer]'
    '-fsanitize-thread-memory-access[enable memory access instrumentation in ThreadSanitizer]'
    '-fsanitize-trap=[enable trapping for specified sanitizers]::arg'
    '-fsanitize-undefined-strip-path-components=[strip a given number of path components when emitting check metadata]:number'
    '-fsanitize-undefined-trap-on-error[equivalent to -fsanitize-trap=undefined]'
    '-fsave-optimization-record=[generate an optimization record file in a specific format]::format'
    '-fsecond-underscore[second underscore]'
    '-fseh-exceptions[use SEH style exceptions]'
    '-fsemantic-interposition[semantic interposition]'
    '-fshow-column[show the column]'
    '-fshow-overloads=[which overload candidates to show when overload resolution fails]:arg'
    '-fshow-source-location[show source location]'
    '-fsignaling-math[signaling math]'
    '-fsign-zero[sign zero]'
    '-fsized-deallocation[enable C++14 sized global deallocation functions]'
    '-fsjlj-exceptions[use SjLj style exceptions]'
    '-fslp-vectorize[enable the superword-level parallelism vectorization passes]'
    '-fspell-checking-limit=[spell checking limit]:arg'
    '-fspell-checking[spell checking]'
    '-fsplit-dwarf-inlining[provide minimal debug info in the object]'
    '-fsplit-lto-unit[enables splitting of the LTO unit]'
    '-fsplit-machine-functions[enable late function splitting using profile information]'
    '-fstack-arrays[stack arrays]'
    '-fstack-clash-protection[enable stack clash protection]'
    '-fstack-size-section[emit section containing metadata on function stack sizes]'
    '-fstandalone-debug[emit full debug info for all types used by the program]'
    '-fstrict-float-cast-overflow[assume that overflowing float-to-int casts are undefined]'
    '-fstrict-return[strict return]'
    '-fstrict-vtable-pointers[enable optimizations based on the strict vtables]'
    '-fstruct-path-tbaa[struct path tbaa]'
    '-fsycl[enable SYCL kernels compilation for device]'
    '-fsymbol-partition=[symbol partition]:arg'
    '-fsystem-module[build this module as a system module. only used with -emit-module]'
    '-ftemplate-backtrace-limit=[template backtrace limit]:arg'
    '-ftemplate-depth--[template depth]:arg'
    '-ftemplate-depth=[template depth]:arg'
    '-fterminated-vtables[terminated vtables]'
    '-fthin-link-bitcode=[write minimized bitcode to <file>]:file:_files'
    '-fthinlto-index=[perform ThinLTO importing using provided index]:arg'
    '-fthreadsafe-statics[threadsafe statics]'
    '-ftime-trace-granularity=[minimum time granularity traced by time profiler]:microseconds'
    '-ftime-trace[turn on time profiler]'
    '-ftrap-function=[issue call to specified function rather than a trap instruction]:function name'
    '-ftrapv-handler=[specify the function to be called on overflow]:function name'
    '-ftrigraphs[process trigraph sequences]'
    '-ftrivial-auto-var-init=[initialize trivial automatic stack variables]:arg'
    '-ftrivial-auto-var-init-stop-after=[stop initializing trivial automatic stack variables after the specified number of instances]:arg'
    '-funderscoring[underscoring]'
    '-funique-basic-block-section-names[use unique names for basic block sections]'
    '-funique-internal-linkage-names[uniqueify Internal Linkage Symbol Names]'
    '-funique-section-names[unique section names]'
    '-funit-at-a-time[unit at a time]'
    '-fuse-cuid=[method to generate ids for compilation units for single source offloading languages CUDA and HIP]:argument'
    '-fuse-cxa-atexit[use cxa atexit]'
    '-fuse-init-array[use init array]'
    '-fuse-line-directives[use #line in preprocessed output]'
    '-fvalidate-ast-input-files-content[compute and store the hash of input files used to build an AST]'
    '-fveclib=[use the given vector functions library]:arg'
    '-fvectorize[enable the loop vectorization passes]'
    '-fvirtual-function-elimination[enables dead virtual function elimination optimization]'
    '-fvisibility-dllexport=[the visibility for dllexport defintions]:arg'
    '-fvisibility-externs-dllimport=[the visibility for dllimport external declarations]:arg'
    '-fvisibility-externs-nodllstorageclass=[the visibility for external declarations without an explicit DLL dllstorageclass]:arg'
    '-fvisibility-from-dllstorageclass[set the visiblity of symbols in the generated code from their DLL storage class]'
    '-fvisibility-global-new-delete-hidden[give global C++ operator new and delete declarations hidden visibility]'
    '-fvisibility-inlines-hidden[give inline C++ member functions hidden visibility by default]'
    '-fvisibility-inlines-hidden-static-local-var[visibility inlines hidden static local var]'
    '-fvisibility-ms-compat[give global types and functions a specific visibility]'
    '-fvisibility-nodllstorageclass=[the visibility for defintiions without an explicit DLL export class]:arg'
    '-fwasm-exceptions[use WebAssembly style exceptions]'
    '-fwhole-file[whole file]'
    '-fwhole-program-vtables[enables whole-program vtable optimization]'
    '-fwritable-strings[store string literals as writable data]'
    '-fxl-pragma-pack[enable IBM XL #pragma pack handling]'
    '-fxor-operator[enable .XOR. as a synonym of .NEQV.]'
    '-fxray-always-emit-customevents[always emit xray customevent calls]'
    '-fxray-always-emit-typedevents[always emit xray typedevents calls]'
    '-fxray-always-instrument=[file defining xray always instrument]:file:_files'
    '-fxray-attr-list=[file defining the list of xray attributes]:file:_files'
    '-fxray-function-groups=[only instrument 1 of N groups]:arg'
    '-fxray-function-index[xray function index]'
    "-fxray-ignore-loops[don't instrument functions with loops unless they also meet the minimum function size]"
    '-fxray-instruction-threshold=[sets the minimum function size to instrument with XRay]:arg'
    '-fxray-instrumentation-bundle=[select which XRay instrumentation points to emit]:arg'
    '-fxray-instrument[generate XRay instrumentation sleds on function entry and exit]'
    '-fxray-link-deps[tells clang to add the link dependencies for XRay]'
    '-fxray-modes=[list of modes to link in by default into XRay instrumented binaries]:arg'
    '-fxray-never-instrument=[file defining the whitelist for Xray attributes]:file:_files'
    '-fxray-selected-function-group=[select which group of functions to instrument]:arg'
    '-fzvector[enable System z vector language extension]'
    {-gcc-toolchain=,--gcc-toolchain=}'[use the gcc toolchain at the given directory]:directory:_files -/'
    '-gcodeview[generate CodeView debug information]'
    {-gcodeview-ghash,-gno-codeview-ghash}'[emit type record hashes is a .debug section]'
    '-gcolumn-info[column info]'
    '-gdwarf-aranges[DWARF aranges]'
    '-gembed-source[embed source text in DWARF debug sections]'
    '-gfull[emit debugging information for all symbols and types]'
    {-G-,-G=-,-msmall-data-limit=,-msmall-data-threshold}'[put objects of at most size bytes into small data section]:size'
    '-ggnu-pubnames[gnu pubnames]'
    '-ginline-line-tables[inline line tables]'
    '-gline-directives-only[emit debug line info directives only]'
    '-gline-tables-only[line tables only]'
    '-glldb[lldb]'
    '-gmlt[emit debug line number tables only]'
    '-gmodules[generate debug info with external references]'
    '-gno-column-info[no column info]'
    '-gno-embed-source[no embed source]'
    '-gno-gnu-pubnames[no gnu pubnames]'
    '-gno-inline-line-tables[no inline line tables]'
    '-gno-record-command-line[no record command line]'
    '--gpu-instrument-lib=[instrument device library for HIP]:argument'
    '--gpu-max-threads-per-block=[default max threads per block for kernel launch bounds for HIP]'
    '-grecord-command-line[record command line]'
    '-gsce[sce]'
    '-gused[emit debugging information for symbols that are used]'
    '-gz=[DWARF debug sections compression type]::arg'
    '-headerpad_max_install_names[headerpad max install names]:argument'
    '-help[display this information]'
    '--help-hidden[display help for hidden options]'
    '--hip-device-lib=[hIP device library]:arg'
    '--hip-device-lib-path=[hip device lib path]:arg'
    '--hip-link[link clang-offload-bundler bundles for HIP]'
    '--hip-version=[HIP version in the format of major.minor.patch]'
    '-ibuiltininc[enable builtin #include directories even when -nostdinc is used before or after -ibuiltininc]'
    '-iframework[add directory to SYSTEM framework search path]:directory:_files -/'
    '-iframeworkwithsysroot[add directory to SYSTEM framework search path, absolute paths are relative to -isysroot]:directory:_files -/'
    '-image_base[image base]:argument'
    '-include-pch[include precompiled header file]:file:_files'
    '-index-header-map[make the next included directory (-I or -F) an indexer header map]'
    '-init[init]:arg'
    '-install_name[install name]:arg'
    '-integrated-as[integrated as]'
    '-interface-stub-version=[interface stub version]:arg'
    '-isystem-after[add directory to end of the SYSTEM include search path]:directory:_files -/'
    '-ivfsoverlay[overlay the virtual filesystem described by file over the real file system]:arg'
    '-iwithsysroot[add directory to SYSTEM include search path]:directory:_files -/'
    '-J[this option specifies where to put .mod files for compiled modules]:arg'
    '-keep_private_externs[keep private externs]'
    '*-lazy_framework[lazy framework]:framework:->framework'
    '*-lazy_library[lazy library]:arg'
    '--ld-path=[ld path]:arg'
    '--libomptarget-amdgcn-bc-path=[path to libomptarget-amdgcn bitcode library]:arg'
    '--libomptarget-nvptx-bc-path=[path to libomptarget-nvptx bitcode library]:arg'
    '--library-directory=[add directory to library search path]:directory:_files -/'
    '-maix-struct-return[return all structs in memory]'
    "-malign-branch-boundary=[specify the boundary's size to align branches]:size"
    '-malign-branch=[specify types of branches to align]:arg'
    '-mappletvos-version-min=[appletvos version min]:arg'
    '-mappletvsimulator-version-min=[appletvsimulator version min]:arg'
    '-mbackchain[link stack frames through backchain on System Z]'
    '-mbig-endian[big endian]'
    '-mbranches-within-32B-boundaries[align selected branches within 32-byte boundary]'
    '-mbranch-protection=[enforce targets of indirect branches and function returns]:arg'
    '-mcode-object-v3[legacy option to specify code object ABI V3]'
    '-mcode-object-version=[specify code object ABI version]:version'
    '-mconsole[console]:arg'
    '-mcrc[allow use of CRC instructions]'
    '-mdefault-build-attributes[default build attributes]:arg'
    '-mdll[dll]:arg'
    '-mdouble=[force double to be 32 bits or 64 bits]:arg'
    '-mdynamic-no-pic[dynamic no pic]:arg'
    '-meabi[set EABI type]:arg'
    '-menable-experimental-extensions[enable use of experimental RISC-V extensions]'
    '-menable-unsafe-fp-math[allow unsafe floating-point math optimizations which may decrease precision]'
    '-mfix-cortex-a53-835769[workaround Cortex-A53 erratum 835769]'
    '-mfloat-abi=[float abi]:arg'
    '-mfpu=[fpu]:arg'
    '-mglobal-merge[enable merging of globals]'
    '-mharden-sls=[select straight-line speculation hardening scope]:arg'
    '--mhwdiv=[hwdiv]:arg'
    '-mhwdiv=[hwdiv]:arg'
    '-mhwmult=[hwmult]:arg'
    '-mignore-xcoff-visibility[do not emit the visibility attribute for asm]'
    '--migrate[run the migrator]'
    '-mimplicit-float[implicit float]'
    '-mimplicit-it=[implicit it]:arg'
    '-mincremental-linker-compatible[emit an object file which can be used with an incremental linker]'
    '-mios-simulator-version-min=[ios simulator version min]:arg'
    '-mios-version-min=[ios version min]:arg'
    '-miphoneos-version-min=[iphoneos version min]:arg'
    '-miphonesimulator-version-min=[iphonesimulator version min]:arg'
    '-mkernel[kernel]'
    '-mlinker-version=[linker version]:arg'
    '-mlittle-endian[little endian]'
    "-mllvm[additional arguments to forward to LLVM's option processing]:arg"
    '-mlong-calls[generate branches with extended addressability]'
    '-mlvi-cfi[enable only control-flow mitigations for Load Value Injection]'
    '-mlvi-hardening[enable all mitigations for Load Value Injection]'
    '-mmacos-version-min=[set Mac OS X deployment target]:arg'
    '-mmacosx-version-min=[macosx version min]:arg'
    '-mmcu=[mcu]:arg'
    '-module-dependency-dir[directory to dump module dependencies to]:arg'
    '-module-dir[odule dir]:dir'
    '-module-file-info[provide information about a particular module file]'
    '-moslib=[oslib]:arg'
    '-moutline-atomics[generate local calls to out-of-line atomic operations]'
    '-mpacked-stack[use packed stack layout]'
    '-mpad-max-prefix-size=[specify maximum number of prefixes to use for padding]:arg'
    '-mpie-copy-relocations[pie copy relocations]'
    '-mprefer-vector-width=[specifies preferred vector width]:arg'
    '-mqdsp6-compat[enable hexagon-qdsp6 backward compatibility]'
    '-mrelax-all[relax all machine instructions]'
    '-mrelax[enable linker relaxation]'
    '-mretpoline[retpoline]'
    '-mseses[enable speculative execution side effect suppression (SESES)]'
    '-msign-return-address=[select return address signing scope]:arg'
    '-msim[sim]'
    '-mspeculative-load-hardening[speculative load hardening]'
    '-mstack-alignment=[set the stack alignment]:arg'
    '-mstack-probe-size=[set the stack probe size]:size'
    '-mstack-protector-guard-offset=[use the given offset for addressing the stack-protector guard]:arg'
    '-mstack-protector-guard-reg=[use the given reg for addressing the stack-protector guard]:reg'
    '-msvr4-struct-return[return small structs in registers]'
    '-mthread-model[the thread model to use]:arg'
    '-mthumb[thumb]'
    '-mtls-size=[specify bit size of immediate TLS offsets]:arg'
    '-mtvos-simulator-version-min=[tvos simulator version min]:arg'
    '-mtvos-version-min=[tvos version min]:arg'
    '-multi_module[multi module]'
    '-multiply_defined[multiply defined]:arg'
    '-multiply_defined_unused[multiply defined unused]:arg'
    '-municode[unicode]:arg'
    '-munsafe-fp-atomics[enable unsafe floating point atomic instructions]'
    '-mv55[equivalent to -mcpu=hexagonv55]'
    '-mv5[equivalent to -mcpu=hexagonv5]'
    '-mv60[equivalent to -mcpu=hexagonv60]'
    '-mv62[equivalent to -mcpu=hexagonv62]'
    '-mv65[equivalent to -mcpu=hexagonv65]'
    '-mv66[equivalent to -mcpu=hexagonv66]'
    '-mv67[equivalent to -mcpu=hexagonv67]'
    '-mv67t[equivalent to -mcpu=hexagonv67t]'
    '-mv68[equivalent to -mcpu=hexagonv68]'
    '-mvx[vx]'
    '-mwarn-nonportable-cfstrings[warn nonportable cfstrings]'
    '-mwatchos-simulator-version-min=[watchos simulator version min]:arg'
    '-mwatchos-version-min=[watchos version min]:arg'
    '-mwatchsimulator-version-min=[watchsimulator version min]:arg'
    '-mwavefrontsize64[specify wavefront size 64 mode]'
    '-mwindows[windows]:arg'
    '-mzvector[zvector]'
    '-nobuiltininc[do not search builtin directory for include files]'
    '-nocpp[no cpp]'
    '-nocudainc[do not add include paths for CUDA/HIP and do not include the default CUDA/HIP wrapper headers]'
    '*--no-cuda-include-ptx=[do not include ptx for the following gpu architecture]:argument'
    '-nocudalib[do not link device library for CUDA/HIP device compilation]'
    '--no-cuda-noopt-device-debug[disable device-side debug info generation]'
    "--no-cuda-version-check[don't error out if the detected version of the CUDA install is too low for the requested CUDA gpu architecture]"
    '-no_dead_strip_inits_and_terms[no dead strip inits and terms]'
    '-nofixprebinding[no fixprebinding]'
    '-nogpuinc[no gpuinc]'
    '-nogpulib[no gpulib]'
    '--no-integrated-cpp[no integrated cpp]'
    '-no-integrated-cpp[no integrated cpp]'
    '-nolibc[no libc]'
    '-nomultidefs[no multidefs]'
    '--no-offload-arch=[no offload arch]:arg'
    '-no-pie[no pie]'
    '-nopie[no pie]'
    '-noprebind[no prebind]'
    '-noprofilelib[no profilelib]'
    '-no-pthread[no pthread]'
    '-noseglinkedit[no seglinkedit]'
    '--no-standard-libraries[no standard libraries]'
    '-nostdinc\+\+[disable standard #include directories for the C++ standard library]'
    '-nostdlibinc[do not search standard system directories for include files]'
    '-nostdlib\+\+[no stdlib++]'
    '--no-system-header-prefix=[no system header prefix]:prefix'
    '--no-undefined[no undefined]'
    '-objcmt-atomic-property[make migration to atomic properties]'
    '-objcmt-migrate-all[enable migration to modern ObjC]'
    '-objcmt-migrate-annotation[enable migration to property and method annotations]'
    '-objcmt-migrate-designated-init[enable migration to infer NS_DESIGNATED_INITIALIZER for initializer methods]'
    '-objcmt-migrate-instancetype[enable migration to infer instancetype for method result type]'
    '-objcmt-migrate-literals[enable migration to modern ObjC literals]'
    '-objcmt-migrate-ns-macros[enable migration to NS_ENUM/NS_OPTIONS macros]'
    '-objcmt-migrate-property-dot-syntax[enable migration of setter/getter messages to property-dot syntax]'
    '-objcmt-migrate-property[enable migration to modern ObjC property]'
    '-objcmt-migrate-protocol-conformance[enable migration to add protocol conformance on classes]'
    '-objcmt-migrate-readonly-property[enable migration to modern ObjC readonly property]'
    '-objcmt-migrate-readwrite-property[enable migration to modern ObjC readwrite property]'
    '-objcmt-migrate-subscripting[enable migration to modern ObjC subscripting]'
    "-objcmt-ns-nonatomic-iosonly[enable migration to use NS_NONATOMIC_IOSONLY macro for setting property's atomic attribute]"
    '-objcmt-returns-innerpointer-property[enable migration to annotate property with NS_RETURNS_INNER_POINTER]'
    '-objcmt-whitelist-dir-path=[objcmt whitelist dir path]:arg'
    '-objcmt-white-list-dir-path=[only modify files with a filename contained in the provided directory path]:arg'
    '-ObjC[treat source files as Objective-C]'
    '-ObjC\+\+[treat source files as Objective-C++]'
    '-object[object]'
    '--offload-arch=[offload arch]:arg'
    '--output-class-directory=[output class directory]:arg'
    '-pagezero_size[pagezero size]:arg'
    '-pg[enable mcount instrumentation]'
    {-p,--profile}'[enable function profiling for prof]'
    '-prebind_all_twolevel_modules[prebind all twolevel modules]'
    '-prebind[prebind]'
    '--precompile[only precompile the input]'
    '-preload[preload]'
    '--print-diagnostic-categories[print diagnostic categories]'
    '-print-effective-triple[print effective triple]'
    '--print-effective-triple[print the effective target triple]'
    '--print-file-name=[print the full library path of <file>]:file:_files'
    '-print-ivar-layout[enable Objective-C Ivar layout bitmap print trace]'
    '--print-libgcc-file-name[print the library path for the currently used compiler runtime library]'
    '--print-multi-directory[print multi directory]'
    '--print-multi-lib[print multi lib]'
    '--print-prog-name=[print the full program path of <name>]:name'
    '-print-resource-dir[print resource dir]'
    '--print-resource-dir[print the resource directory pathname]'
    '--print-search-dirs[print the paths used for finding libraries and programs]'
    '--print-supported-cpus[print supported cpus]'
    '-print-supported-cpus[print supported cpus]'
    '-print-targets[print targets]'
    '--print-targets[print the registered targets]'
    '-print-target-triple[print target triple]'
    '--print-target-triple[print the normalized target triple]'
    '-private_bundle[private bundle]'
    '--profile-blocks[undocumented option]'
    '-pthreads[pthreads]'
    '-pthread[support POSIX threads in generated code]'
    '--ptxas-path=[path to ptxas (used for compiling CUDA code)]:arg'
    "-Qunused-arguments[don't emit warning for unused driver arguments]"
    '-read_only_relocs[read only relocs]:arg'
    '-relocatable-pch[relocatable pch]'
    '--relocatable-pch[whether to build a relocatable precompiled header]'
    '-R[enable the specified remark]:remark'
    '--resource=[resource]:arg'
    '-rewrite-legacy-objc[rewrite Legacy Objective-C source to C++]'
    '-rewrite-objc[rewrite Objective-C source to C++]'
    '--rocm-device-lib-path=[rOCm device library path]:arg'
    '--rocm-path=[rOCm installation path]:arg'
    '-Rpass-analysis=[report transformation analysis from optimization passes]:regex'
    '-Rpass-missed=[report missed transformations by optimization passes]:arg'
    '-Rpass=[report transformations performed by optimization passes]:arg'
    '-rpath[rpath]:arg'
    '-r[product a relocatable object as output]'
    '--rtlib=[compiler runtime library to use]:arg'
    '-rtlib=[rtlib]:arg'
    '--save-stats=[save llvm statistics]:arg'
    '-sectalign[sectalign]:arg'
    '-sectcreate[sectcreate]:arg'
    '-sectobjectsymbols[sectobjectsymbols]:arg'
    '-sectorder[sectorder]:arg'
    '-seg1addr[seg1addr]:arg'
    '-segaddr[segaddr]:arg'
    '-seg_addr_table_filename[seg addr table filename]:arg'
    '-seg_addr_table[seg addr table]:arg'
    '-segcreate[segcreate]:arg'
    '-seglinkedit[seglinkedit]'
    '-segprot[segprot]:arg'
    '-segs_read_only_addr[segs read only addr]:arg'
    '-segs_read_[segs read]:arg'
    '-segs_read_write_addr[segs read write addr]:arg'
    '--serialize-diagnostics[serialize compiler diagnostics to a file]:arg'
    '-serialize-diagnostics[serialize diagnostics]:arg'
    '-shared-libasan[dynamically link the sanitizer runtime]'
    '-shared-libsan[shared libsan]'
    '--shared[shared]'
    '--signed-char[signed char]'
    '-single_module[single module]'
    '--specs=[specs]:arg'
    '-static-libgfortran[static libgfortran]'
    '-static-libsan[statically link the sanitizer runtime]'
    '-static-libstdc\+\+[static libstdc++]'
    '-static-openmp[use the static host OpenMP runtime while linking.]'
    '-static-pie[static pie]'
    '--static[static]'
    '-std-default=[std default]:arg'
    '--stdlib=[c++ standard library to use]:arg'
    '-stdlib\+\+-isystem[use directory as the C++ standard library include path]:directory:_files -/'
    '-stdlib=[stdlib]:arg'
    '-sub_library[sub library]:arg'
    '-sub_umbrella[sub umbrella]:arg'
    '-sycl-std=[SYCL language standard to compile for]:standard'
    '--system-header-prefix=[treat all #include paths starting with <prefix> as including a system header]:prefix'
    '-target[generate code for the given target]:arg'
    '--target=[target]:arg'
    '-Tbss[set starting address of BSS to <addr>]:addr'
    '-Tdata[set starting address of DATA to <addr>]:addr'
    '--traditional[traditional]'
    '-traditional[traditional]'
    '-Ttext[set starting address of TEXT to <addr>]:addr'
    '-t[undocumented option]'
    '-twolevel_namespace_hints[twolevel namespace hints]'
    '-twolevel_namespace[twolevel namespace]'
    '-umbrella[umbrella]:arg'
    '-undefined[undefined]:arg'
    '-unexported_symbols_list[unexported symbols list]:arg'
    '--unsigned-char[unsigned char]'
    '--unwindlib=[unwind library to use]:arg'
    '-unwindlib=[unwindlib]:arg'
    '--verify-debug-info[verify the binary representation of debug output]'
    '-verify-pch[load and verify that a pre-compiled header file is not stale]'
    '--warn-=-[enable the specified warning]:warning:->warning'
    '*-weak_framework[weak framework]:framework:->framework'
    '*-weak_library[weak library]:arg'
    '-weak-l[weak l]:arg'
    '-weak_reference_mismatches[weak reference mismatches]:arg'
    '-whatsloaded[whatsloaded]'
    '-whyload[whyload]'
    '-working-directory=[resolve file paths relative to the specified directory]:arg'
    '-Xanalyzer[pass <arg> to the static analyzer]:arg'
    '-Xarch_device[pass arg to CUDA/HIP device compilation]:argument'
    '-Xarch_host[pass arg to CUDA/HIP host compilation]:argument'
    '-Xclang[pass <arg> to the clang compiler]:arg'
    '-Xcuda-fatbinary[pass arg to fatbinary invocation]:argument'
    '-Xcuda-ptxas[pass arg to the ptxas assemler]:argument'
    '-Xflang[pass <arg> to the flang compiler]:arg'
    '-Xopenmp-target[pass arg to the the target offloading toolchain]:argument'
    '-y[the action to perform on the input]:arg'
    '-Z-[undocumented option]:argument'
  )
else
  args+=(
    '--dump=[dump information]:argument'
    '-flto=-[enable link-time optimization]::jobs:'
    '*--help=-[display this information]:class:->help'
  )
fi

local -a sanitizers
sanitizers=(
  address alignment bool bounds enum float-cast-overflow float-divide-by-zero
  integer-divide-by-zero memory nonnull-attribute null nullability-arg
  nullability-assign nullability-return object-size pointer-overflow return
  unsigned-integer-overflow returns-nonnull-attribute shift signed-integer-overflow
  unreachable vla-bound vptr
)

local -a languages
languages=(
  c c-header cpp-output c++ c++-header c++-cpp-output objective-c objective-c-header
  objective-c-cpp-output objective-c++ objective-c++-header objective-c++-cpp-output
  assembler assembler-with-cpp ada f77 f77-cpp-input f95 f95-cpp-input go java
  brig none
)

# warnings (from --help=warnings), note some -W options are listed by --help=common instead
warnings+=(
  '-Wabi-tag[warn if a subobject has an abi_tag attribute that the complete object type does not have]'
  '-Wabi[warn about things that will change when compiling with an ABI-compliant compiler]::'
  '-Waddress[warn about suspicious uses of memory addresses]'
  '-Waggregate-return[warn about returning structures, unions or arrays]'
  '-Waggressive-loop-optimizations[warn if a loop with constant number of iterations triggers undefined behavior]'
  '-Waliasing[warn about possible aliasing of dummy arguments]'
  '-Walign-commons[warn about alignment of COMMON blocks]'
  '-Waligned-new=[warn even if '\'new\'' uses a class member allocation function]:none|global|all: '
  '-Wall[enable most warning messages]'
  '-Walloca-larger-than=[warn on unbounded uses of alloca, and on bounded uses of alloca whose bound can be larger than <number> bytes]:bytes: '
  '-Walloca[warn on any use of alloca]'
  '-Walloc-size-larger-than=[warn for calls to allocation functions that attempt to allocate objects larger than the specified number of bytes]:bytes: '
  '-Walloc-zero[warn for calls to allocation functions that specify zero bytes]'
  '-Wampersand[warn about missing ampersand in continued character constants]'
  '-Wargument-mismatch[warn about type and rank mismatches between arguments and parameters]'
  '-Warray-bounds[warn if an array is accessed out of bounds]'
  '-Warray-bounds=[warn if an array is accessed out of bounds]:level:(1 2)'
  '-Warray-temporaries[warn about creation of array temporaries]'
  '-Wassign-intercept[warn whenever an Objective-C assignment is being intercepted by the garbage collector]'
  '-Wattributes[warn about inappropriate attribute usage]'
  '-Wbad-function-cast[warn about casting functions to incompatible types]'
  '-Wbool-compare[warn about boolean expression compared with an integer value different from true/false]'
  '-Wbool-operation[warn about certain operations on boolean expressions]'
  '-Wbuiltin-declaration-mismatch[warn when a built-in function is declared with the wrong signature]'
  '-Wbuiltin-macro-redefined[warn when a built-in preprocessor macro is undefined or redefined]'
  '-Wc++0x-compat[deprecated in favor of -Wc++11-compat]'
  '-Wc++11-compat[warn about C++ constructs whose meaning differs between ISO C++ 1998 and ISO C++ 2011]'
  '-Wc++14-compat[warn about C++ constructs whose meaning differs between ISO C++ 2011 and ISO C++ 2014]'
  '-Wc++1z-compat[warn about C++ constructs whose meaning differs between ISO C++ 2014 and (forthcoming) ISO C++ 201z(7?)]'
  '-Wc90-c99-compat[warn about features not present in ISO C90, but present in ISO C99]'
  '-Wc99-c11-compat[warn about features not present in ISO C99, but present in ISO C11]'
  '-Wcast-align[warn about pointer casts which increase alignment]'
  '-Wcast-qual[warn about casts which discard qualifiers]'
  '-Wc-binding-type[warn if the type of a variable might be not interoperable with C]'
  '-Wc++-compat[warn about C constructs that are not in the common subset of C and C++]'
  '-Wcharacter-truncation[warn about truncated character expressions]'
  '-Wchar-subscripts[warn about subscripts whose type is "char"]'
  '-Wchkp[warn about memory access errors found by Pointer Bounds Checker]'
  '-Wclobbered[warn about variables that might be changed by "longjmp" or "vfork"]'
  '-Wcomments[synonym for -Wcomment]'
  '-Wcomment[warn about possibly nested block comments, and C++ comments spanning more than one physical line]'
  '-Wcompare-reals[warn about equality comparisons involving REAL or COMPLEX expressions]'
  '-Wconditionally-supported[warn for conditionally-supported constructs]'
  '-Wconversion-extra[warn about most implicit conversions]'
  '-Wconversion-null[warn for converting NULL from/to a non-pointer type]'
  '-Wconversion[warn for implicit type conversions that may change a value]'
  '-Wcoverage-mismatch[warn in case profiles in -fprofile-use do not match]'
  '-Wcpp[warn when a #warning directive is encountered]'
  '-Wctor-dtor-privacy[warn when all constructors and destructors are private]'
  '-Wdangling-else[warn about dangling else]'
  '-Wdate-time[warn about __TIME__, __DATE__ and __TIMESTAMP__ usage]'
  '-Wdeclaration-after-statement[warn when a declaration is found after a statement]'
  '-Wdelete-incomplete[warn when deleting a pointer to incomplete type]'
  '-Wdelete-non-virtual-dtor[warn about deleting polymorphic objects with non- virtual destructors]'
  '-Wdeprecated-declarations[warn about uses of __attribute__((deprecated)) declarations]'
  '-Wdeprecated[warn if a deprecated compiler feature, class, method, or field is used]'
  '-Wdesignated-init[warn about positional initialization of structs requiring designated initializers]'
  '-Wdisabled-optimization[warn when an optimization pass is disabled]'
  '-Wdiscarded-array-qualifiers[warn if qualifiers on arrays which are pointer targets are discarded]'
  '-Wdiscarded-qualifiers[warn if type qualifiers on pointers are discarded]'
  '-Wdiv-by-zero[warn about compile-time integer division by zero]'
  '-Wdouble-promotion[warn about implicit conversions from "float" to "double"]'
  '-Wduplicated-branches[warn about duplicated branches in if-else statements]'
  '-Wduplicated-cond[warn about duplicated conditions in an if-else-if chain]'
  '-Wduplicate-decl-specifier[warn when a declaration has duplicate const, volatile, restrict or _Atomic specifier]'
  '-Weffc\+\+[warn about violations of Effective C++ style rules]'
  '-Wempty-body[warn about an empty body in an if or else statement]'
  '-Wendif-labels[warn about stray tokens after #else and #endif]'
  '-Wenum-compare[warn about comparison of different enum types]'
  # '-Werror-implicit-function-declaration[this switch is deprecated; use -Werror=implicit-fun]' # this still exists but makes completing -Werror= less convenient
  '-Wexpansion-to-defined[warn if "defined" is used outside #if]'
  '-Wextra[print extra (possibly unwanted) warnings]'
  '-Wfloat-conversion[warn for implicit type conversions that cause loss of floating point precision]'
  '-Wfloat-equal[warn if testing floating point numbers for equality]'
  '-Wformat-contains-nul[warn about format strings that contain NUL bytes]'
  '-Wformat-extra-args[warn if passing too many arguments to a function for its format string]'
  '-Wformat-nonliteral[warn about format strings that are not literals]'
  '-Wformat-overflow[warn about function calls with format strings that write past the end of the destination region]'
  '-Wformat-overflow=[warn about function calls with format strings that write past the end of the destination region]:level:(1 2)'
  '-Wformat-security[warn about possible security problems with format functions]'
  '-Wformat-signedness[warn about sign differences with format functions]'
  '-Wformat-truncation[warn about calls to snprintf and similar functions that truncate output. Same as -Wformat- truncation=1.  Same as -Wformat-truncation=]'
  '-Wformat-truncation=[warn about calls to snprintf and similar functions that truncate output]:level:(1 2)'
  '-Wformat=[warn about printf/scanf/strftime/strfmon format string anomalies]::level:(1 2)'
  '-Wformat-y2k[warn about strftime formats yielding 2-digit years]'
  '-Wformat-zero-length[warn about zero-length formats]'
  '-Wframe-address[warn when __builtin_frame_address or __builtin_return_address is used unsafely]'
  '-Wframe-larger-than=[warn if a function'\''s stack frame requires more than <number> bytes]:bytes: '
  '-Wfree-nonheap-object[warn when attempting to free a non-heap object]'
  '-Wfunction-elimination[warn about function call elimination]'
  '-Whsa[warn when a function cannot be expanded to HSAIL]'
  '-Wignored-attributes[warn whenever attributes are ignored]'
  '-Wignored-qualifiers[warn whenever type qualifiers are ignored]'
  '-Wimplicit-fallthrough=[warn when a switch case falls through]:level:(1 2 3 4 5)'
  '-Wimplicit-function-declaration[warn about implicit function declarations]'
  '-Wimplicit-interface[warn about calls with implicit interface]'
  '-Wimplicit-int[warn when a declaration does not specify a type]'
  '-Wimplicit-procedure[warn about called procedures not explicitly declared]'
  '-Wimplicit[warn about implicit declarations]'
  '-Wimport[warn about imports]'
  '-Wincompatible-pointer-types[warn when there is a conversion between pointers that have incompatible types]'
  '-Winherited-variadic-ctor[warn about C++11 inheriting constructors when the base has a variadic constructor]'
  '-Winit-self[warn about variables which are initialized to themselves]'
  '-Winline[warn when an inlined function cannot be inlined]'
  '-Wint-conversion[warn about incompatible integer to pointer and pointer to integer conversions]'
  '-Winteger-division[warn about constant integer divisions with truncated results]'
  '-Wint-in-bool-context[warn for suspicious integer expressions in boolean context]'
  '-Wintrinsic-shadow[warn if a user-procedure has the same name as an intrinsic]'
  '-Wintrinsics-std[warn on intrinsics not part of the selected standard]'
  '-Wint-to-pointer-cast[warn when there is a cast to a pointer from an integer of a different size]'
  '-Winvalid-memory-model[warn when an atomic memory model parameter is known to be outside the valid range]'
  '-Winvalid-offsetof[warn about invalid uses of the "offsetof" macro]'
  '-Winvalid-pch[warn about PCH files that are found but not used]'
  '-Wjump-misses-init[warn when a jump misses a variable initialization]'
  '-Wlarger-than=[warn if an object is larger than <number> bytes]:bytes: '
  '-Wline-truncation[warn about truncated source lines]'
  '-Wliteral-suffix[warn when a string or character literal is followed by a ud-suffix which does not begin with an underscore]'
  '-Wlogical-not-parentheses[warn when logical not is used on the left hand side operand of a comparison]'
  '-Wlogical-op[warn when a logical operator is suspiciously always evaluating to true or false]'
  '-Wlong-long[do not warn about using "long long" when -pedantic]'
  '-Wlto-type-mismatch[during link time optimization warn about mismatched types of global declarations]'
  '-Wmain[warn about suspicious declarations of "main"]'
  '-Wmaybe-uninitialized[warn about maybe uninitialized automatic variables]'
  '-Wmemset-elt-size[warn about suspicious calls to memset where the third argument contains the number of elements not multiplied by the element size]'
  '-Wmemset-transposed-args[warn about suspicious calls to memset where the third argument is constant literal zero and the second is not]'
  '-Wmisleading-indentation[warn when the indentation of the code does not reflect the block structure]'
  '-Wmissing-braces[warn about possibly missing braces around initializers]'
  '-Wmissing-declarations[warn about global functions without previous declarations]'
  '-Wmissing-field-initializers[warn about missing fields in struct initializers]'
  '-Wmissing-include-dirs[warn about user-specified include directories that do not exist]'
  '-Wmissing-parameter-type[warn about function parameters declared without a type specifier in K&R-style functions]'
  '-Wmissing-prototypes[warn about global functions without prototypes]'
  '-Wmudflap[warn about constructs not instrumented by -fmudflap]'
  '-Wmultichar[warn about use of multi-character character constants]'
  '-Wmultiple-inheritance[warn on direct multiple inheritance]'
  '-Wnamespaces[warn on namespace definition]'
  '-Wnarrowing[warn about narrowing conversions within { } that are ill-formed in C++11]'
  '-Wnested-externs[warn about "extern" declarations not at file scope]'
  '-Wnoexcept-type[warn if C++1z noexcept function type will change the mangled name of a symbol]'
  '-Wnoexcept[warn when a noexcept expression evaluates to false even though the expression can''t actually throw]'
  '-Wnonnull-compare[warn if comparing pointer parameter with nonnull attribute with NULL]'
  '-Wnonnull[warn about NULL being passed to argument slots marked as requiring non-NULL]'
  '-Wnonportable-cfstrings[warn on CFStrings containing nonportable characters]'
  '-Wnon-template-friend[warn when non-templatized friend functions are declared within a template]'
  '-Wnon-virtual-dtor[warn about non-virtual destructors]'
  '-Wnormalized=-[warn about non-normalised Unicode strings]:normalization:((id\:allow\ some\ non-nfc\ characters\ that\ are\ valid\ identifiers nfc\:only\ allow\ NFC nfkc\:only\ allow\ NFKC none\:allow\ any\ normalization)): '
  '-Wnull-dereference[warn if dereferencing a NULL pointer may lead to erroneous or undefined behavior]'
  '-Wodr[warn about some C++ One Definition Rule violations during link time optimization]'
  '-Wold-style-cast[warn if a C-style cast is used in a program]'
  '-Wold-style-declaration[warn for obsolescent usage in a declaration]'
  '-Wold-style-definition[warn if an old-style parameter definition is used]'
  '-Wopenmp-simd[warn if a simd directive is overridden by the vectorizer cost model]'
  '-Woverflow[warn about overflow in arithmetic expressions]'
  '-Woverlength-strings[warn if a string is longer than the maximum portable length specified by the standard]'
  '-Woverloaded-virtual[warn about overloaded virtual function names]'
  '-Woverride-init-side-effects[warn about overriding initializers with side effects]'
  '-Woverride-init[warn about overriding initializers without side effects]'
  '-Wpacked-bitfield-compat[warn about packed bit-fields whose offset changed in GCC 4.4]'
  '-Wpacked[warn when the packed attribute has no effect on struct layout]'
  '-Wpadded[warn when padding is required to align structure members]'
  '-Wparentheses[warn about possibly missing parentheses]'
  '-Wpedantic[issue warnings needed for strict compliance to the standard]'
  '-Wplacement-new=[warn for placement new expressions with undefined behavior]::level:(1 2)'
  '-Wpmf-conversions[warn when converting the type of pointers to member functions]'
  '-Wpointer-arith[warn about function pointer arithmetic]'
  '-Wpointer-compare[warn when a pointer is compared with a zero character constant]'
  '-Wpointer-sign[warn when a pointer differs in signedness in an assignment]'
  '-Wpointer-to-int-cast[warn when a pointer is cast to an integer of a different size]'
  '-Wpoison-system-directories[warn for -I and -L options using system directories if cross compiling]'
  '-Wpragmas[warn about misuses of pragmas]'
  '-Wproperty-assign-default[warn if a property for an Objective-C object has no assign semantics specified]'
  '-Wprotocol[warn if inherited methods are unimplemented]'
  '-Wpsabi[warn about psabi]'
  '-Wrealloc-lhs-all[warn when a left-hand-side variable is reallocated]'
  '-Wrealloc-lhs[warn when a left-hand-side array variable is reallocated]'
  '-Wreal-q-constant[warn about real-literal-constants with '\'q\'' exponent-letter]'
  '-Wredundant-decls[warn about multiple declarations of the same object]'
  '-Wregister[warn about uses of register storage specifier]'
  '-Wreorder[warn when the compiler reorders code]'
  '-Wrestrict[warn when an argument passed to a restrict- qualified parameter aliases with another argument]'
  '-Wreturn-local-addr[warn about returning a pointer/reference to a local or temporary variable]'
  '-Wreturn-type[warn whenever a function'\''s return type defaults to "int" (C), or about inconsistent return types (C++)]'
  '-Wscalar-storage-order[warn on suspicious constructs involving reverse scalar storage order]'
  '-Wselector[warn if a selector has multiple methods]'
  '-Wsequence-point[warn about possible violations of sequence point rules]'
  '-Wshadow-ivar[warn if a local declaration hides an instance variable]'
  '-Wshadow[warn when one variable shadows another.  Same as  -Wshadow=global]'
  '-Wshift-count-negative[warn if shift count is negative]'
  '-Wshift-count-overflow[warn if shift count >= width of type]'
  '-Wshift-negative-value[warn if left shifting a negative value]'
  '-Wshift-overflow[warn if left shift of a signed value overflows.  Same as -Wshift-overflow=]'
  '-Wshift-overflow=[warn if left shift of a signed value overflows]:level:(1 2)'
  '-Wsign-compare[warn about signed-unsigned comparisons]'
  '-Wsign-conversion[warn for implicit type conversions between signed and unsigned integers]'
  '-Wsign-promo[warn when overload promotes from unsigned to signed]'
  '-Wsized-deallocation[warn about missing sized deallocation functions]'
  '-Wsizeof-array-argument[warn when sizeof is applied on a parameter declared as an array]'
  '-Wsizeof-pointer-memaccess[warn about suspicious length parameters to certain string functions if the argument uses sizeof]'
  '-Wstack-protector[warn when not issuing stack smashing protection for some reason]'
  '-Wstack-usage=[warn if stack usage might be larger than specified amount]:bytes: '
  '-Wstrict-aliasing[warn about code which might break strict aliasing rules]'
  '-Wstrict-aliasing=-[warn about code which might break strict aliasing rules]:level of checking (higher is more accurate):(1 2 3)'
  '-Wstrict-null-sentinel[warn about uncasted NULL used as sentinel]'
  '-Wstrict-overflow[warn about optimizations that assume that signed overflow is undefined]'
  '-Wstrict-overflow=-[warn about optimizations that assume that signed overflow is undefined]:level of checking (higher finds more cases):(1 2 3 4 5)'
  '-Wstrict-prototypes[warn about unprototyped function declarations]'
  '-Wstrict-selector-match[warn if type signatures of candidate methods do not match exactly]'
  '-Wstringop-overflow=[under the control of Object Size type, warn about buffer overflow in string manipulation functions like memcpy and strcpy]:level:(1 2 3 4)'
  '-Wstringop-overflow[warn about buffer overflow in string manipulation functions like memcpy and strcpy.  Same as  -Wstringop-overflow=]'
  '-Wsubobject-linkage[warn if a class type has a base or a field whose type uses the anonymous namespace or depends on a type with no linkage]'
  '*-Wsuggest-attribute=-[warn about functions that might be candidates for attributes]:attribute:(pure const noreturn format)'
  '-Wsuggest-final-methods[warn about C++ virtual methods where adding final keyword would improve code quality]'
  '-Wsuggest-final-types[warn about C++ polymorphic types where adding final keyword would improve code quality]'
  '-Wsuggest-override[suggest that the override keyword be used when the declaration of a virtual function overrides another]'
  '-Wsurprising[warn about "suspicious" constructs]'
  '-Wswitch-bool[warn about switches with boolean controlling expression]'
  '-Wswitch-default[warn about enumerated switches missing a "default-" statement]'
  '-Wswitch-enum[warn about all enumerated switches missing a specific case]'
  '-Wswitch-unreachable[warn about statements between switch'\''s controlling expression and the first case]'
  '-Wswitch[warn about enumerated switches, with no default, missing a case]'
  '-Wsync-nand[warn when __sync_fetch_and_nand and __sync_nand_and_fetch built-in functions are used]'
  '-Wsynth[deprecated. This switch has no effect]'
  '-Wsystem-headers[do not suppress warnings from system headers]'
  '-Wtabs[permit nonconforming uses of the tab character]'
  '-Wtarget-lifetime[warn if the pointer in a pointer assignment might outlive its target]'
  '-Wtautological-compare[warn if a comparison always evaluates to true or false]'
  '-Wtemplates[warn on primary template declaration]'
  '-Wterminate[warn if a throw expression will always result in a call to terminate()]'
  '-W[this switch is deprecated; use -Wextra instead]'
  '-Wtraditional-conversion[warn of prototypes causing type conversions different from what would happen in the absence of prototype]'
  '-Wtraditional[warn about features not present in traditional C]'
  '-Wtrampolines[warn whenever a trampoline is generated]'
  '-Wtrigraphs[warn if trigraphs are encountered that might affect the meaning of the program]'
  '-Wtype-limits[warn if a comparison is always true or always false due to the limited range of the data type]'
  '-Wundeclared-selector[warn about @selector()s without previously declared methods]'
  '-Wundefined-do-loop[warn about an invalid DO loop]'
  '-Wundef[warn if an undefined macro is used in an #if directive]'
  '-Wunderflow[warn about underflow of numerical constant expressions]'
  '-Wuninitialized[warn about uninitialized automatic variables]'
  '-Wunknown-pragmas[warn about unrecognized pragmas]'
  '-Wunsafe-loop-optimizations[warn if the loop cannot be optimized due to nontrivial assumptions]'
  '-Wunsuffixed-float-constants[warn about unsuffixed float constants]'
  '-Wunused-but-set-parameter[warn when a function parameter is only set, otherwise unused]'
  '-Wunused-but-set-variable[warn when a variable is only set, otherwise unused]'
  '-Wunused-const-variable[warn when a const variable is unused.  Same as  -Wunused-const-variable=]'
  '-Wunused-const-variable=[warn when a const variable is unused]:level:(1 2)'
  '-Wunused-dummy-argument[warn about unused dummy arguments]'
  '-Wunused[enable all -Wunused- warnings]'
  '-Wunused-function[warn when a function is unused]'
  '-Wunused-label[warn when a label is unused]'
  '-Wunused-local-typedefs[warn when typedefs locally defined in a function are not used]'
  '-Wunused-macros[warn about macros defined in the main file that are not used]'
  '-Wunused-parameter[warn when a function parameter is unused]'
  '-Wunused-result[warn if a caller of a function, marked with attribute warn_unused_result, does not use its return value]'
  '-Wunused-value[warn when an expression value is unused]'
  '-Wunused-variable[warn when a variable is unused]'
  '-Wuseless-cast[warn about useless casts]'
  '-Wuse-without-only[warn about USE statements that have no ONLY qualifier]'
  '-Wvarargs[warn about questionable usage of the macros used to retrieve variable arguments]'
  '-Wvariadic-macros[warn about using variadic macros]'
  '-Wvector-operation-performance[warn when a vector operation is compiled outside the SIMD]'
  '-Wvirtual-inheritance[warn on direct virtual inheritance]'
  '-Wvirtual-move-assign[warn if a virtual base has a non-trivial move assignment operator]'
  '-Wvla-larger-than=[warn on unbounded uses of variable-length arrays, and on bounded uses of variable-length arrays whose bound can be larger than <number> bytes]:bytes: ' 
  '-Wvla[warn if a variable length array is used]'
  '-Wvolatile-register-var[warn when a register variable is declared volatile]'
  '-Wwrite-strings[in C++, nonzero means warn about deprecated conversion from string literals to '\''char *'\''.  In C, similar warning, except that the conversion is]'
  '-Wzero-as-null-pointer-constant[warn when a literal '\''0'\'' is used as null pointer]'
  '-Wzerotrip[warn about zero-trip DO loops]'
)

# clang specific warnings
if [[ "$service" = clang* ]]; then
  warnings+=(
    '-Wlarge-by-value-copy=[warn on large by value copy]:argument'
    '-Wunreachable-code-aggressive[controls -Wunreachable-code, -Wunreachable-code-break, -Wunreachable-code-return]'
    '-Wunreachable-code-break[warn when break will never be executed]'
    '-Wunreachable-code-loop-increment[warn when loop will be executed only once]'
    '-Wunreachable-code-return[warn when return will not be executed]'
    '-Wunreachable-code[warn on code that will not be executed]'
  )
else
  warnings+=(
    '-Wunreachable-code[does nothing. Preserved for backward compatibility]'
  )
fi

args+=(
  {'*-A-','*--assert='}'[make an assertion]:define assertion:'
  '--all-warnings[display all warnings]'
  {-ansi,--ansi}'[same as -std=c89 or -std=c++98]'
  '-aux-info[emit declaration information into <file>]:file:_files'
  {'-B-','--prefix='}'[add <prefix> to the compiler'\''s search paths]:executable prefix:_files -/'
  '-b[specify target machine to compile to]:target machine:'
  {-CC,--comments-in-macros}'[do not discard comments, including macro expansion]'
  {-C,--comments}'[do not discard comments during preprocess]'
  {-c,--compile}'[compile and assemble, but do not link]'
  {'*-D-','*--define-macro='}'[define a macro]:define macro:'
  '-d-[dump the state of the preprocessor]:dump:->dump'
  '--dependencies[generate Makefile dependencies]'
  '-dumpbase[set the file basename to be used for dumps]:file:_files'
  '-dumpdir[set the directory name to be used for dumps]:file:_files -/'
  '-dumpmachine[display the compiler'\''s target processor]'
  '-dumpspecs[display all of the built in spec strings]'
  '-dumpversion[display the version of the compiler]'
  '+e-[control how virtual function definitions are used]:virtual function definitions in classes:((0\:only\ interface 1\:generate\ code))'
  {-e,--entry}'[specify program entry point is entry]:entry'
  {-E,--preprocess}'[preprocess only; do not compile, assemble or link]'
  '-fabi-version=-[use version <n> of the C++ ABI (default: 2)]:ABI version:(1 2 3 4 5 6)'
  '-fada-spec-parent=[dump Ada specs as child units of given parent]'
  '-faggressive-loop-optimizations[aggressively optimize loops using language constraints]'
  '-falign-functions[align the start of functions]'
  '-falign-jumps[align labels which are only reached by jumping]'
  '-falign-labels[align all labels]'
  '-falign-loops[align the start of loops]'
  '-fallow-parameterless-variadic-functions[allow variadic functions without named parameter]'
  '-fasm[recognize the asm keyword]'
  '-fassociative-math[allow optimization for floating-point arithmetic which may change the result of the operation due to rounding]'
  '-fasynchronous-unwind-tables[generate unwind tables that are exact at each instruction boundary]'
  '-fauto-inc-dec[generate auto-inc/dec instructions]'
  '-fbounds-check[generate code to check bounds before indexing arrays]'
  '-fbranch-count-reg[replace add, compare, branch with branch on count register]'
  '-fbranch-probabilities[use profiling information for branch probabilities]'
  '-fbranch-target-load-optimize2[perform branch target load optimization after prologue / epilogue threading]'
  '-fbranch-target-load-optimize[perform branch target load optimization before prologue / epilogue threading]'
  '-fbtr-bb-exclusive[restrict target load migration not to re-use registers in any basic block]'
  '-fbuilding-libgcc[specify building libgcc]'
  '-fbuiltin[recognize builtin functions]'
  '-fcaller-saves[save registers around function calls]'
  '-fcall-saved--[mark <register> as being preserved across functions]:register'
  '-fcall-used--[mark <register> as being corrupted by function calls]:register'
  '-fcanonical-system-headers[where shorter use canonicalized paths to system headers]'
  '-fcheck-data-deps[compare the results of several data dependence analyzers]'
  '-fcheck-pointer-bounds[add pointer bounds checker instrumentation]'
  '-fchkp-check-incomplete-type[generate pointer bounds check for variables with incomplete type]'
  '-fchkp-check-read[generate checks for all read accesses to memory]'
  '-fchkp-check-write[generate checks for all write accesses to memory]'
  '-fchkp-first-field-has-own-bounds[forces checker to use narrowed bounds for address of the first field]'
  '-fchkp-instrument-calls[generate bounds passing for calls]'
  '-fchkp-instrument-marked-only[instrument only functions marked with bnd_instrument attribute]'
  '-fchkp-narrow-bounds[control how checker handle pointers to object fields]'
  '-fchkp-narrow-to-innermost-array[forces checker to use bounds of the innermost arrays in case of nested static array access]'
  '-fchkp-optimize[allow checker optimizations]'
  '-fchkp-store-bounds[generate bounds stores for pointer writes]'
  '-fchkp-treat-zero-dynamic-size-as-infinite[with this option zero size obtained dynamically for objects with incomplete type will be treated as infinite]'
  '-fchkp-use-fast-string-functions[allow to use *_nobnd versions of string functions]'
  '-fchkp-use-nochk-string-functions[allow to use *_nochk versions of string functions]'
  '-fchkp-use-static-bounds[use statically initialized variable for vars bounds instead of generating them each time it is required]'
  '-fchkp-use-static-const-bounds[use statically initialized variable for constant bounds]'
  '-fchkp-use-wrappers[transform instrumented builtin calls into calls to wrappers]'
  '-fchkp-zero-input-bounds-for-main[use zero bounds for all incoming arguments in main function]'
  '-fcilkplus[enable Cilk Plus]'
  '-fcode-hoisting[enable code hoisting]'
  '-fcombine-stack-adjustments[looks for opportunities to reduce stack adjustments and stack references]'
  '-fcommon[do not put uninitialized globals in the common section]'
  '-fcompare-debug=-[compile with and without e.g. -gtoggle, and compare the final-insns dump]:opts:' # TODO: complete gcc options here
  '-fcompare-debug-second[run only the second compilation of -fcompare-debug]'
  '-fcompare-elim[perform comparison elimination after register allocation has finished]'
  '-fcond-mismatch[allow the arguments of the ? operator to have different types]'
  '-fconserve-stack[do not perform optimizations increasing noticeably stack usage]'
  '-fcprop-registers[perform a register copy-propagation optimization pass]'
  '-fcrossjumping[perform cross-jumping optimization]'
  '-fcse-follow-jumps[when running CSE, follow jumps to their targets]'
  '-fcx-fortran-rules[complex multiplication and division follow Fortran rules]'
  '-fcx-limited-range[omit range reduction step when performing complex division]'
  '-fdata-sections[place data items into their own section]'
  '-fdbg-cnt=-[,<counter>-<limit>,...) Set the debug counter limit]:counter\:limit,...: ' # TODO: gcc -fdbg-cnt-list -x c /dev/null -o /dev/null -c
  '-fdbg-cnt-list[list all available debugging counters with their limits and counts]'
  '-fdce[use the RTL dead code elimination pass]'
  '-fdebug-cpp[emit debug annotations during preprocessing]'
  '-fdebug-prefix-map=-[map one directory name to another in debug information]:/old/dir=/new/dir:->dirtodir'
  '-fdebug-types-section[output .debug_types section when using DWARF v4 debuginfo]'
  '-fdefer-pop[defer popping functions args from stack until later]'
  '-fdelayed-branch[attempt to fill delay slots of branch instructions]'
  '-fdelete-dead-exceptions[delete dead instructions that may throw exceptions]'
  '-fdelete-null-pointer-checks[delete useless null pointer checks]'
  '-fdevirtualize-speculatively[perform speculative devirtualization]'
  '-fdevirtualize[try to convert virtual calls to direct ones]'
  '-fdiagnostics-color=-[colorize diagnostics]::color:(never always auto)'
  '-fdiagnostics-generate-patch[print fix-it hints to stderr in unified diff format]'
  '-fdiagnostics-parseable-fixits[print fixit hints in machine-readable form]'
  '-fdiagnostics-show-caret[show the source line with a caret indicating the column]'
  '-fdiagnostics-show-location=-[how often to emit source location at the beginning of line-wrapped diagnostics]:source location:(once every-line)'
  '-fdiagnostics-show-option[amend appropriate diagnostic messages with the command line option that controls them]'
  '-fdirectives-only[preprocess directives only]'
  '-fdollars-in-identifiers[permit $ as an identifier character]'
  '-fdse[use the RTL dead store elimination pass]'
  '-fdump-ada-spec-slim[write all declarations as Ada code for the given file only]'
  '-fdump-ada-spec[write all declarations as Ada code transitively]'
  '-fdump-final-insns=-[dump to filename the insns at the end of translation]:filename:_files'
  '-fdump-go-spec=-[write all declarations to file as Go code]:filename:_files'
  '-fdump-noaddr[suppress output of addresses in debugging dumps]'
  '-fdump-passes[dump optimization passes]'
  '-fdump-unnumbered-links[suppress output of previous and next insn numbers in debugging dumps]'
  '-fdump-unnumbered[suppress output of instruction numbers, line number notes and addresses in debugging dumps]'
  '-fdwarf2-cfi-asm[enable CFI tables via GAS assembler directives]'
  '-fearly-inlining[perform early inlining]'
  '-feliminate-dwarf2-dups[perform DWARF2 duplicate elimination]'
  '-feliminate-unused-debug-symbols[perform unused type elimination in debug info]'
  '-feliminate-unused-debug-types[perform unused type elimination in debug info]'
  '-femit-class-debug-always[do not suppress C++ class debug information]'
  '-femit-struct-debug-baseonly[aggressive reduced debug info for structs]'
  '-femit-struct-debug-detailed=[detailed reduced debug info for structs]:spec list'
  '-femit-struct-debug-reduced[conservative reduced debug info for structs]'
  '-fexceptions[enable exception handling]'
  '-fexcess-precision=-[specify handling of excess floating-point precision]:precision handling:(fast standard)'
  '-fexec-charset=[convert all strings and character constants to character set]:character set'
  '-fexpensive-optimizations[perform a number of minor, expensive optimizations]'
  '-fextended-identifiers[permit universal character names in identifiers]'
  '-ffast-math[sets -fno-math-errno, -funsafe-math-optimizations, -ffinite-math-only, -fno-rounding-math, -fno-signaling-nans and -fcx-limited-range]'
  '-ffat-lto-objects[output lto objects containing both the intermediate language and binary output]'
  '-ffinite-math-only[assume no NaNs or infinities are generated]'
  '-ffixed--[mark <register> as being unavailable to the compiler]:register'
  '-ffloat-store[don'\''t allocate floats and doubles in extended- precision registers]'
  '-fforward-propagate[perform a forward propagation pass on RTL]'
  '-ffp-contract=-[perform floating- point expression contraction (default: fast)]:style:(on off fast)'
  '-ffp-contract=[perform floating-point expression contraction]:style:(off on fast)'
  '-ffp-int-builtin-inexact[allow built-in functions ceil, floor, round, trunc to raise "inexact" exceptions]'
  '-ffreestanding[do not assume that standard C libraries and main exist]'
  '-ffunction-cse[allow function addresses to be held in registers]'
  '-ffunction-sections[place each function into its own section]'
  '-fgcse-after-reload[perform global common subexpression elimination after register allocation has finished]'
  '-fgcse-las[perform redundant load after store elimination in global common subexpression elimination]'
  '-fgcse-lm[perform enhanced load motion during global common subexpression elimination]'
  '-fgcse[perform global common subexpression elimination]'
  '-fgcse-sm[perform store motion after global common subexpression elimination]'
  '-fgnu89-inline[use traditional GNU semantics for inline functions]'
  '-fgnu-tm[enable support for GNU transactional memory]'
  '-fgraphite[enable in and out of Graphite representation]'
  '-fgraphite-identity[enable Graphite Identity transformation]'
  '-fguess-branch-probability[enable guessing of branch probabilities]'
  '-fhoist-adjacent-loads[enable hoisting adjacent loads to encourage generating conditional move instructions]'
  '-fhosted[assume normal C execution environment]'
  '-fif-conversion2[perform conversion of conditional jumps to conditional execution]'
  '-fif-conversion[perform conversion of conditional jumps to branchless equivalents]'
  '-findirect-inlining[perform indirect inlining]'
  '-finhibit-size-directive[do not generate .size directives]'
  '-finline-atomics[inline __atomic operations when a lock free instruction sequence is available]'
  '-finline[enable inlining of function declared "inline", disabling disables all inlining]'
  '-finline-functions-called-once[integrate functions only required by their single caller]'
  '-finline-functions[integrate functions not declared "inline" into their callers when profitable]'
  '-finline-limit=-[limit the size of inlined functions to <number>]:number: '
  '-finline-small-functions[integrate functions into their callers when code size is known not to grow]'
  '-finput-charset=[specify the default character set for source files]:character set'
  '-finstrument-functions-exclude-file-list=-[do not instrument functions listed in files]:comma-separated file list:->commafiles'
  '-finstrument-functions-exclude-function-list=-[do not instrument listed functions]:comma-separated list of syms: '
  '-finstrument-functions[instrument function entry and exit with profiling calls]'
  '-fipa-bit-cp[perform interprocedural bitwise constant propagation]'
  '-fipa-cp-clone[perform cloning to make Interprocedural constant propagation stronger]'
  '-fipa-cp[perform interprocedural constant propagation]'
  '-fipa-icf-functions[perform Identical Code Folding for functions]'
  '-fipa-icf[perform Identical Code Folding for functions and read-only variables]'
  '-fipa-icf-variables[perform Identical Code Folding for variables]'
  '-fipa-profile[perform interprocedural profile propagation]'
  '-fipa-pta[perform interprocedural points-to analysis]'
  '-fipa-pure-const[discover pure and const functions]'
  '-fipa-ra[use caller save register across calls if possible]'
  '-fipa-reference[discover readonly and non addressable static variables]'
  '-fipa-sra[perform interprocedural reduction of aggregates]'
  '-fipa-vrp[perform IPA Value Range Propagation]'
  '-fira-algorithm=[set the used IRA algorithm]:algorithm:(cb priority)'
  '-fira-hoist-pressure[use IRA based register pressure calculation in RTL hoist optimizations]'
  '-fira-loop-pressure[use IRA based register pressure calculation in RTL loop optimizations]'
  '-fira-region=-[set regions for IRA]:region:(all mixed one)'
  '-fira-region=[set regions for IRA]:region:(one all mixed)'
  '-fira-share-save-slots[share slots for saving different hard registers]'
  '-fira-share-spill-slots[share stack slots for spilled pseudo-registers]'
  '-fira-verbose=-[control IRA'\''s level of diagnostic messages]:verbosity: '
  '-fisolate-erroneous-paths-attribute[detect paths that trigger erroneous or undefined behavior due to a null value being used in a way forbidden by a returns_nonnull or]'
  '-fisolate-erroneous-paths-dereference[detect paths that trigger erroneous or undefined behavior due to dereferencing a null pointer.  Isolate those paths from the main]'
  '-fivopts[optimize induction variables on trees]'
  '-fjump-tables[use jump tables for sufficiently large switch statements]'
  '-fkeep-inline-functions[generate code for functions even if they are fully inlined]'
  '-fkeep-static-consts[emit static const variables even if they are not used]'
  '-flax-vector-conversions[allow implicit conversions between vectors with differing numbers of subparts and/or differing element types]'
  '-fleading-underscore[give external symbols a leading underscore]'
  '-flifetime-dse[tell DSE that the storage for a C++ object is dead when the constructor starts and when the destructor finishes]'
  '-flive-range-shrinkage[relief of register pressure through live range shrinkage]'
  '-floop-nest-optimize[enable the loop nest optimizer]'
  '-floop-parallelize-all[mark all loops as parallel]'
  '-flra-remat[do CFG-sensitive rematerialization in LRA]'
  '-flto-compression-level=-[use specified zlib compression level for IL]:compression level: '
  '-flto-odr-type-merging[merge C++ types using One Definition Rule]'
  '-flto-partition=-[partition symbols and vars at linktime based on object files they originate from]:partitioning algorithm:(1to1 balanced max one none)'
  '-flto-report[report various link-time optimization statistics]'
  '-fmath-errno[set errno after built-in math functions]'
  '-fmax-errors=-[maximum number of errors to report]:errors: '
  '-fmem-report[report on permanent memory allocation]'
  '-fmem-report-wpa[report on permanent memory allocation in WPA only]'
  '-fmerge-all-constants[attempt to merge identical constants and constant variables]'
  '-fmerge-constants[attempt to merge identical constants across compilation units]'
  '-fmerge-debug-strings[attempt to merge identical debug strings across compilation units]'
  '-fmessage-length=-[limit diagnostics to <number> characters per line.  0 suppresses line-wrapping]:length: '
  '-fmodulo-sched-allow-regmoves[perform SMS based modulo scheduling with register moves allowed]'
  '-fmodulo-sched[perform SMS based modulo scheduling before the first scheduling pass]'
  '-fmove-loop-invariants[move loop invariant computations out of loops]'
  "-fms-extensions[don't warn about uses of Microsoft extensions]"
  '-fmudflapir[this switch lacks documentation]'
  '-fmudflap[this switch lacks documentation]'
  '-fmudflapth[this switch lacks documentation]'
  '-fnon-call-exceptions[support synchronous non-call exceptions]'
  '-fno-stack-limit[do not limit the size of the stack]'
  '-fno-threadsafe-statics[do not generate thread-safe code for initializing local statics]'
  '-fnothrow-opt[treat a throw() exception specification as noexcept to improve code size]'
  '-fomit-frame-pointer[when possible do not generate stack frames]'
  '-fopenacc[enable OpenACC]'
  '-fopenmp[enable OpenMP (implies -frecursive in Fortran)]'
  "-fopenmp-simd[enable OpenMP's SIMD directives]"
  '-foptimize-sibling-calls[optimize sibling and tail recursive calls]'
  '-foptimize-strlen[enable string length optimizations on trees]'
  '-fopt-info[enable all optimization info dumps on stderr]'
  '-fopt-info-type=-[dump compiler optimization details]:filename:_files'
  '-fpack-struct[pack structure members together without holes]'
  '-fpack-struct=[set initial maximum structure member alignment]:alignment (power of 2): '
  '-fpartial-inlining[perform partial inlining]'
  '-fpcc-struct-return[return small aggregates in memory, not registers]'
  '-fpch-deps[this switch lacks documentation]'
  '-fpch-preprocess[look for and use PCH files even when preprocessing]'
  '-fpeel-loops[perform loop peeling]'
  '-fpeephole2[enable an RTL peephole pass before sched2]'
  '-fpeephole[enable machine specific peephole optimizations]'
  '-fPIC[generate position-independent code if possible (large mode)]'
  '-fpic[generate position-independent code if possible (small mode)]'
  '-fPIE[generate position-independent code for executables if possible (large mode)]'
  '-fpie[generate position-independent code for executables if possible (small mode)]'
  '-fplan9-extensions[enable Plan 9 language extensions]'
  '-fplt[use PLT for PIC calls (-fno-plt- load the address from GOT at call site)]'
  '-fplugin-arg--[specify argument <key>=<value> for plugin <name>]:-fplugin-arg-name-key=value: ' #TODO
  '-fplugin=-[specify a plugin to load]:plugin: ' # TODO: complete plugins?
  '-fpost-ipa-mem-report[report on memory allocation before interprocedural optimization]'
  '-fpredictive-commoning[run predictive commoning optimization]'
  '-fprefetch-loop-arrays[generate prefetch instructions, if available, for arrays in loops]'
  '-fpre-ipa-mem-report[report on memory allocation before interprocedural optimization]'
  '-fpreprocessed[treat the input file as already preprocessed]'
  '-fprintf-return-value[treat known sprintf return values as constants]'
  '-fprofile-arcs[insert arc-based program profiling code]'
  '-fprofile-correction[enable correction of flow inconsistent profile data input]'
  '-fprofile-dir=-[set the top-level directory for storing the profile data]:profile directory:_files -/'
  '-fprofile[enable basic program profiling code]'
  '-fprofile-generate[enable common options for generating profile info for profile feedback directed optimizations]'
  '-fprofile-report[report on consistency of profile]'
  '-fprofile-use[enable common options for performing profile feedback directed optimizations]'
  '-fprofile-values[insert code to profile values of expressions]'
  '-frandom-seed=-[use <string> as random seed]:seed: '
  '-freciprocal-math[same as -fassociative-math for expressions which include division]'
  '-frecord-gcc-switches[record gcc command line switches in the object file]'
  '-free[turn on Redundant Extensions Elimination pass]'
  '-freg-struct-return[return small aggregates in registers]'
  '-frename-registers[perform a register renaming optimization pass]'
  '-freorder-blocks-algorithm=[set the used basic block reordering algorithm]:algorithm:(simple stc)'
  '-freorder-blocks-and-partition[reorder basic blocks and partition into hot and cold sections]'
  '-freorder-blocks[reorder basic blocks to improve code placement]'
  '-freorder-functions[reorder functions to improve code placement]'
  '-frequire-return-statement[functions which return values must end with return statements]'
  '-frerun-cse-after-loop[add a common subexpression elimination pass after loop optimizations]'
  '-freschedule-modulo-scheduled-loops[enable/disable the traditional scheduling in loops that already passed modulo scheduling]'
  '-frounding-math[disable optimizations that assume default FP rounding behavior]'
  '-frtti[generate run time type descriptor information]'
  "-fsanitize=-[enable AddressSanitizer, a memory error detector]:style:($sanitizers)"
  '-fsched2-use-superblocks[if scheduling post reload, do superblock scheduling]'
  '-fsched-critical-path-heuristic[enable the critical path heuristic in the scheduler]'
  '-fsched-dep-count-heuristic[enable the dependent count heuristic in the scheduler]'
  '-fsched-group-heuristic[enable the group heuristic in the scheduler]'
  '-fsched-interblock[enable scheduling across basic blocks]'
  '-fsched-last-insn-heuristic[enable the last instruction heuristic in the scheduler]'
  '-fsched-pressure[enable register pressure sensitive insn scheduling]'
  '-fsched-rank-heuristic[enable the rank heuristic in the scheduler]'
  '-fsched-spec[allow speculative motion of non-loads]'
  '-fsched-spec-insn-heuristic[enable the speculative instruction heuristic in the scheduler]'
  '-fsched-spec-load[allow speculative motion of some loads]'
  '-fsched-spec-load-dangerous[allow speculative motion of more loads]'
  '-fsched-stalled-insns[allow premature scheduling of queued insns]'
  '-fsched-stalled-insns-dep[set dependence distance checking in premature scheduling of queued insns]'
  '-fsched-stalled-insns-dep=[set dependence distance checking in premature scheduling of queued insns]:insns:'
  '-fsched-stalled-insns-dep=-[set dependence distance checking in premature scheduling of queued insns]:instructions: '
  '-fsched-stalled-insns=[set number of queued insns that can be prematurely scheduled]:insns:'
  '-fsched-stalled-insns=-[set number of queued insns that can be prematurely scheduled]:instructions: '
  '-fschedule-fusion[perform a target dependent instruction fusion optimization pass]'
  '-fschedule-insns2[reschedule instructions after register allocation]'
  '-fschedule-insns[reschedule instructions before register allocation]'
  '-fsched-verbose=-[set the verbosity level of the scheduler]:verbosity: '
  '-fsection-anchors[access data in the same section from shared anchor points]'
  '-fselective-scheduling2[run selective scheduling after reload]'
  '-fselective-scheduling[schedule instructions using selective scheduling algorithm]'
  '-fsel-sched-pipelining-outer-loops[perform software pipelining of outer loops during selective scheduling]'
  '-fsel-sched-pipelining[perform software pipelining of inner loops during selective scheduling]'
  '-fsel-sched-reschedule-pipelined[reschedule pipelined regions without pipelining]'
  '-fshort-double[use the same size for double as for float]'
  '-fshort-enums[use the narrowest integer type possible for enumeration types]'
  '-fshort-wchar[force the underlying type for "wchar_t" to be "unsigned short"]'
  '-fshow-column[show column numbers in diagnostics, when available]'
  '-fshrink-wrap[emit function prologues only before parts of the function that need it, rather than at the top of the function]'
  '-fshrink-wrap-separate[shrink-wrap parts of the prologue and epilogue separately]'
  '-fsignaling-nans[disable optimizations observable by IEEE signaling NaNs]'
  '-fsigned-bitfields[when signed or unsigned is not given make the bitfield signed]'
  '-fsigned-char[make char signed by default]'
  '-fsigned-zeros[disable floating point optimizations that ignore the IEEE signedness of zero]'
  '-fsimd-cost-model=[specifies the vectorization cost model for code marked with a simd directive]:model:(unlimited dynamic cheap)'
  '-fsingle-precision-constant[convert floating point constants to single precision constants]'
  '-fsplit-ivs-in-unroller[split lifetimes of induction variables when loops are unrolled]'
  '-fsplit-loops[perform loop splitting]'
  '-fsplit-paths[split paths leading to loop backedges]'
  '-fsplit-stack[generate discontiguous stack frames]'
  '-fsplit-wide-types[split wide types into independent registers]'
  '-fssa-backprop[enable backward propagation of use properties at the SSA level]'
  '-fssa-phiopt[optimize conditional patterns using SSA PHI nodes]'
  '-fstack-check=-[insert stack checking code into the program.  -fstack-check=specific if to argument given]:type:(none generic specific)'
  '-fstack-limit-register=-[trap if the stack goes past <register>]:register: '
  '-fstack-limit-symbol=-[trap if the stack goes past symbol <name>]:name: '
  '-fstack-protector-all[use a stack protection method for every function]'
  '-fstack-protector-explicit[use stack protection method only for functions with the stack_protect attribute]'
  '-fstack-protector-strong[use a smart stack protection method for certain functions]'
  '-fstack-protector[use propolice as a stack protection method]'
  '-fstack-reuse=[set stack reuse level for local variables]:level:(all named_vars none)'
  '-fstack-reuse=-[set stack reuse level for local variables]:reuse-level:(all named_vars none)'
  '-fstack-usage[output stack usage information on a per-function basis]'
  '-fstdarg-opt[optimize amount of stdarg registers saved to stack at start of function]'
  '-fstore-merging[merge adjacent stores]'
  '-fstrict-aliasing[assume strict aliasing rules apply]'
  '-fstrict-enums[assume that values of enumeration type are always within the minimum range of that type]'
  '-fstrict-overflow[treat signed overflow as undefined]'
  '-fstrict-volatile-bitfields[force bitfield accesses to match their type width]'
  '-fsync-libcalls[implement __atomic operations via libcalls to legacy __sync functions]'
  '-fsyntax-only[check for syntax errors, then stop]'
  '-ftabstop=[distance between tab stops for column reporting]:number'
  '-ftest-coverage[create data files needed by "gcov"]'
  '-fthread-jumps[perform jump threading optimizations]'
  '-ftime-report[report the time taken by each compiler pass]'
  '-ftls-model=-[set the default thread-local storage code generation model]:TLS model:(global-dynamic local-dynamic initial-exec local-exec)'
  '-ftracer[perform superblock formation via tail duplication]'
  '-ftrack-macro-expansion=[track locations of tokens coming from macro expansion and display them in error messages]::argument'
  '-ftrapping-math[assume floating-point operations can trap]'
  '-ftrapv[trap for signed overflow in addition, subtraction and multiplication]'
  '-ftree-bit-ccp[enable SSA-BIT-CCP optimization on trees]'
  '-ftree-builtin-call-dce[enable conditional dead code elimination for builtin calls]'
  '-ftree-ccp[enable SSA-CCP optimization on trees]'
  '-ftree-ch[enable loop header copying on trees]'
  '-ftree-coalesce-vars[enable SSA coalescing of user variables]'
  '-ftree-copy-prop[enable copy propagation on trees]'
  '-ftree-cselim[transform condition stores into unconditional ones]'
  '-ftree-dce[enable SSA dead code elimination optimization on trees]'
  '-ftree-dominator-opts[enable dominator optimizations]'
  '-ftree-dse[enable dead store elimination]'
  '-ftree-forwprop[enable forward propagation on trees]'
  '-ftree-fre[enable Full Redundancy Elimination (FRE) on trees]'
  '-ftree-loop-distribute-patterns[enable loop distribution for patterns transformed into a library call]'
  '-ftree-loop-distribution[enable loop distribution on trees]'
  '-ftree-loop-if-convert[convert conditional jumps in innermost loops to branchless equivalents]'
  '-ftree-loop-im[enable loop invariant motion on trees]'
  '-ftree-loop-ivcanon[create canonical induction variables in loops]'
  '-ftree-loop-linear[enable loop interchange transforms.  Same as  -floop-interchange]'
  '-ftree-loop-optimize[enable loop optimizations on tree level]'
  '-ftree-loop-vectorize[enable loop vectorization on trees]'
  '-ftree-lrs[perform live range splitting during the SSA- >normal pass]'
  '-ftree-parallelize-loops=[enable automatic parallelization of loops]'
  '-ftree-parallelize-loops=-[enable automatic parallelization of loops]:threads: '
  '-ftree-partial-pre[in SSA-PRE optimization on trees, enable partial- partial redundancy elimination]'
  '-ftree-phiprop[enable hoisting loads from conditional pointers]'
  '-ftree-pre[enable SSA-PRE optimization on trees]'
  '-ftree-pta[perform function-local points-to analysis on trees]'
  '-ftree-reassoc[enable reassociation on tree level]'
  '-ftree-scev-cprop[enable copy propagation of scalar-evolution information]'
  '-ftree-sink[enable SSA code sinking on trees]'
  '-ftree-slp-vectorize[enable basic block vectorization (SLP) on trees]'
  '-ftree-slsr[perform straight-line strength reduction]'
  '-ftree-sra[perform scalar replacement of aggregates]'
  '-ftree-switch-conversion[perform conversions of switch initializations]'
  '-ftree-tail-merge[enable tail merging on trees]'
  '-ftree-ter[replace temporary expressions in the SSA->normal pass]'
  '-ftree-vectorize[enable vectorization on trees]'
  '-ftree-vrp[perform Value Range Propagation on trees]'
  '-funconstrained-commons[assume common declarations may be overridden with ones with a larger trailing array]'
  '-funroll-all-loops[perform loop unrolling for all loops]'
  '-funroll-loops[perform loop unrolling when iteration count is known]'
  '-funsafe-loop-optimizations[allow loop optimizations to assume that the loops behave in normal way]'
  '-funsafe-math-optimizations[allow math optimizations that may violate IEEE or ISO standards]'
  '-funsigned-bitfields[when signed or unsigned is not given make the bitfield unsigned]'
  '-funsigned-char[make char unsigned by default]'
  '-funswitch-loops[perform loop unswitching]'
  '-funwind-tables[just generate unwind tables for exception handling]'
  '-fuse-ld=-[use the specified linker instead of the default linker]:linker:(bfd gold)'
  '-fuse-linker-plugin[use linker plugin during link-time optimization]'
  '-fvariable-expansion-in-unroller[apply variable expansion when loops are unrolled]'
  '-fvar-tracking-assignments[perform variable tracking by annotating assignments]'
  '-fvar-tracking-assignments-toggle[toggle -fvar-tracking-assignments]'
  '-fvar-tracking[perform variable tracking]'
  '-fvar-tracking-uninit[perform variable tracking and also tag variables that are uninitialized]'
  '-fvect-cost-model=[specifies the cost model for vectorization]:model:(unlimited dynamic cheap)'
  '-fverbose-asm[add extra commentary to assembler output]'
  '-fvisibility=-[set the default symbol visibility]:visibility:(default internal hidden protected)'
  '-fvpt[use expression value profiles in optimizations]'
  '-fweb[construct webs and split unrelated uses of single variable]'
  '-fwhole-program[perform whole program optimizations]'
  '-fwide-exec-charset=[convert all wide strings and character constants to character set]:character set'
  '-fworking-directory[generate a #line directive pointing at the current working directory]'
  '-fwrapv[assume signed arithmetic overflow wraps around]'
  '-fzero-initialized-in-bss[put zero initialized data in the bss section]'
  {-g-,--debug=}'[generate debug information]::debugging information type or level:(0 1 2 3 gdb gdb0 gdb1 gdb2 gdb3 coff stabs stabs+ dwarf dwarf+ dwarf-2 dwarf-3 dwarf-4 dwarf-5 dwarf32 dwarf64 xcoff xcoff+)'
  '-gno-pubnames[don'\''t generate DWARF pubnames and pubtypes sections]'
  '-gno-record-gcc-switches[don'\''t record gcc command line switches in DWARF DW_AT_producer]'
  '-gno-split-dwarf[don'\''t generate debug information in separate .dwo files]'
  '-gno-strict-dwarf[emit DWARF additions beyond selected version]'
  '-gpubnames[generate DWARF pubnames and pubtypes sections]'
  '-grecord-gcc-switches[record gcc command line switches in DWARF DW_AT_producer]'
  '-gsplit-dwarf[generate debug information in separate .dwo files]'
  '-gstrict-dwarf[don'\''t emit DWARF additions beyond selected version]'
  '-gtoggle[toggle debug information generation]'
  '-gvms[generate debug information in VMS format]'
  '--help[display this information]'
  {-H,--trace-includes}'[print name of each header file used]'
  {'*-idirafter','*--include-directory-after='}'[add directory after include search path]:second include path directory:_files -/'
  {'*-I-','*--include-directory='}'[add directory to include search path]:header file search path:_files -/'
  {'*-imacros','*--imacros='}'[include macros from file before parsing]:macro input file:_files -g \*.h\(-.\)'
  '-imultiarch[set <dir> to be the multiarch include subdirectory]:directory:_files -/' #XXX not in manpage
  '-imultilib=[set dir to be the multilib include subdirectory]:dir:_files -/'
  '--include-barrier[restrict all prior -I flags to double-quoted inclusion and remove current directory from include path]'
  {'*-include=','*--include='}'[include file before parsing]:include file:_files -g \*.h\(-.\)'
  '-iplugindir=-[set <dir> to be the default plugin directory]:directory:_files -/'
  {'*-iprefix','*--include-prefix='}'[set the -iwithprefix prefix]:prefix:_files'
  '-iquote=[add dir to the end of the quote include path]:dir:_files -/'
  '-isysroot=[set dir to be the system root directory]:dir:_files -/'
  '*-isystem[add directory to system include search path]:second include path directory (system):_files -/'
  {'*-iwithprefixbefore','*--include-with-prefix-before='}'[set directory to include search path with prefix]:main include path directory:_files -/'
  {'*-iwithprefix','*--include-with-prefix=','*--include-with-prefix-after='}'[set directory to system include search path with prefix]:second include path directory:_files -/'
  '*-L-[add directory to library search path]:library search path:_files -/'
  '-lang-asm[set lang asm]'
  '*-l+[include library found in search path]:library:->library'
  '-MF[write dependency output to the given file]:file:_files'
  '-MJ[write a compilation database entry per input]'
  '-MQ[add a make-quoted target]:target'
  '*-M-[set flags for generating Makefile dependencies]::output dependencies:->dependencies'
  '-MT[add an unquoted target]:target'
  '-no-canonical-prefixes[do not canonicalize paths when building relative prefixes to other gcc components]'
  '-nodefaultlibs[do not use the standard system libraries when linking]'
  '-nostartfiles[do not use the standard system startup files when linking]'
  {-nostdinc,--no-standard-includes}'[do not search standard system directories or compiler builtin directories for include files]'
  '-nostdlib[do not use standard system startup files or libraries when linking]'
  {-O-,--optimize=-}'[control the optimization]::optimization level:((0 1 2 3 g\:optimize\ for\ debugging\ experience s\:optimize\ for\ space fast\:optimize\ for\ speed\ disregarding\ exact\ standards\ compliance))'
  {-o,--output=}'[write output to file]:output file:_files -g "^*.(c|h|cc|C|cxx|cpp|hpp)(-.)"'
  '--output-pch=[output pch]'
  '--param[set parameter <param> to value.  See manpage for a complete list of parameters]:name=value'
  '-pass-exit-codes[exit with highest error code from a phase]'
  {-pedantic-errors,--pedantic-errors}'[like -pedantic but issue them as errors]'
  {-pedantic,--pedantic}'[issue all mandatory diagnostics in the C standard]'
  '(-pg)-p[enable function profiling for prof]'
  '-pie[create a position independent executable]'
  {-pipe,--pipe}'[use pipes rather than intermediate files]'
  {-P,--no-line-commands}'[inhibit generation of linkemakers during preprocess]'
  '(-p)-pg[enable function profiling for gprof]'
  '-###[print commands to run this compilation]'
  '-print-file-name=-[display the full path to library <library>]:library:->library'
  '-print-libgcc-file-name[display the name of the compiler'\''s companion library]'
  '--print-missing-file-dependencies[print missing file dependencies]'
  '-print-multiarch[display the target'\''s normalized GNU triplet, used as a component in the library path]'
  '-print-multi-directory[display the root directory for versions of libgcc]'
  '-print-multi-lib[display the mapping between command line options and multiple library search directories]'
  '-print-multi-os-directory[display the relative path to OS libraries]'
  '-print-prog-name=-[display the full path to compiler component <program>]:program:'
  '-print-search-dirs[display the directories in the compiler'\''s search path]'
  '-print-sysroot[display the target libraries directory]'
  '-print-sysroot-headers-suffix[display the sysroot suffix used to find headers]'
  {-Qn,-fno-ident}'[do not emit metadata containing compiler name and version]'
  '-quiet[do not display functions compiled or elapsed time]'
  {-Qy,-fident}'[emit metadata containing compiler name and version]'
  '-rdynamic[pass the flag -export-dynamic to the ELF linker, on targets that support it]'
  '-remap[remap file names when including files]'
  {-S,--assemble}'[compile only; do not assemble or link]'
  '-save-stats=-[save code generation statistics]:location:(cwd obj)'
  '-save-temps[do not delete intermediate files]'
  '-shared[create a shared library]'
  '-shared-libgcc[force shared libgcc]'
  '*-specs=-[override built-in specs with the contents of <file>]:file:_files'
  '-s[remove all symbol table and relocation information from the executable]'
  '-static-libgcc[force static libgcc]'
  '-static[on systems that support dynamic linking, this prevents linking with the shared libraries]'
  {'-std=-','--std='}'[assume that the input sources are for specified standard]:standard:(c90 c89 iso9899\:1990 iso9899\:199409 c99 iso9899\:1999 c11 iso9899\:2011 gnu90 gnu89 gnu99 gnu11 c++98 c++03 gnu++98 gnu++03 c++11 gnu++11 c++1y gnu++1y c++14 gnu++14 c++1z gnu++1z c++17 iso9899\:2017 gnu++17 c++2a gnu++2a)'
  '-symbolic[bind references to global symbols when building a shared object]'
  '--sysroot=-[use <directory> as the root directory for headers and libraries]:directory:_files -/'
  '--target-help[display target specific command line options]'
  '-time[time the execution of each subprocess]'
  {-traditional-cpp,--traditional-cpp}'[use traditional preprocessor]'
  {-trigraphs,--trigraphs}'[process trigraph sequences]'
  '-T[specify linker script]:linker script:_files'
  '-undef[do not predefine system specific and gcc specific macros]'
  '*-u[pretend symbol to be undefined]:symbol:'
  '--user-dependencies[print user dependencies]'
  {'*-U-','*--undefine-macro='}'[undefine a macro]:undefine macro:'
  '-version[display the compiler'\''s version]'
  '--version[display version information]'
  '-V[specify compiler version]:compiler version:'
  {-v,--verbose}'[enable verbose output]'
  '*-Wa,-[pass arguments to the assembler]:assembler option:'
  '--warn--[enable the specified warning]:warning:->warning'
  '*-Werror=-[treat specified warning as error (or all if none specified)]::warning:->warning'
  '-Wfatal-errors[exit on the first error occurred]'
  '*-Wl,-[pass arguments to the linker]:linker option:'
  {-w,--no-warnings}'[suppress warnings]'
  '*-Wp,-[pass arguments to the preprocessor]:preprocessor option:'
  '--write-dependencies[write a depfile containing user and system dependencies]'
  '--write-user-dependencies[write a depfile containing user dependencies]'
  '*-Xassembler[pass argument to the assembler]:assembler option:'
  '*-Xlinker[pass argument to the linker]:linker option:'
  '*-Xpreprocessor[pass argument to the preprocessor]:preprocessor option:'
  '-x[specify the language of the following input files]:input file language:('"$languages"')'
)

# not meant for end users
#'-fdisable--pass=-[disables an optimization pass]:range1+range2: '
#'-fdisable-[disables an optimization pass]'
#'-fenable--pass=-[enables an optimization pass]:range1+range2: '
#'-fenable-[enables an optimization pass]'
#'-fdump-<type>[dump various compiler internals to a file]'

args+=($warnings)

# How to mostly autogenerate the above stuff:
# joinhelplines() { sed '$!N;s/^\(  -.*\)\n  \s*\([^-]\)/\1 \2/;P;D' }
# gcc-x86() { gcc --help=target,\^undocumented | joinhelplines | joinhelplines }
# compdef _gnu_generic gcc-x86
# printf '%s\n' ${(onq-)_args_cache_gcc_x86}

# TODO: -fno-<TAB> and -mno-<TAB> match lots of non-existent options.
#_arguments -C -M 'L:|-{fWm}no-=-{fWm} r:|[_-][^-]=* r:|=*'
_arguments -C -M 'L:|-{fWm}no-=-{fWm} r:[^-]|[_-]=* r:|=*' \
  "$args[@]" \
  "$args2[@]" && ret=0

case "$state" in
dump)
  local -a dump_values=(
    'A[verbose assembly output]'
    'D[macro definitions and normal output]'
    'I[include directives and normal output]'
    'J[after last jump optimization]'
    'L[after loop optimization]'
    'M[only macro definitions]'
    'N[macro names]'
    'R[after second instruction scheduling pass]'
    'S[after first instruction scheduling pass]'
    'a[all dumps]'
    'c[after instruction combination]'
    'd[after delayed branch scheduling]'
    'f[after flow analysis]'
    'g[after global register allocation]'
    'j[after jump optimization]'
    'k[after conversion from registers to stack]'
    'l[after local register allocation]'
    'm[print memory usage statistics]'
    'p[annotate assembler output]'
    'r[after RTL generation]'
    's[after CSE]'
    't[after second CSE pass]'
    'x[only generate RTL]'
    'y[debugging information during parsing]'
  )
  _values -s '' 'dump information' $dump_values && ret=0
  ;;
dependencies)
  local -a dependencies=(
    'D:generate make dependencies and compile'
    'G:treat missing header files as generated'
    'M:only user header files'
    'MD:output to file'
    'P:generate phony targets for all headers'
    'V:use NMake/Jom format for the depfile'
  )
  _describe dependencies dependencies && ret=0
  ;;
library)
  # TODO: improve defaults for library_path (e.g., use output of clang -Wl,-v)
  local -a library_path=( /usr/lib /usr/local/lib )
  case $OSTYPE in
    (darwin*)
      library_path+=( $(xcrun --show-sdk-path)/usr/lib )
      ;;
    (linux-gnu)
      local tmp
      tmp=$(_call_program library-paths $words[1] -print-multiarch)
      if [[ $tmp != '' && -d /usr/lib/$tmp ]]; then
	library_path+=( /usr/lib/$tmp )
      elif [[ -d /usr/lib64 ]]; then
	library_path+=( /usr/lib64 )
      fi
      ;;
  esac
  # Add directories from -L options
  for ((i = 2; i < $#words; i++)); do
    if [[ "$words[i]" = -L ]]; then
      library_path+=("$words[++i]")
    elif [[ "$words[i]" = -L* ]]; then
      library_path+=("${words[i]##-L}")
    fi
  done
  _wanted libraries expl library \
      compadd - $library_path/lib*.(a|so*|dylib)(:t:fr:s/lib//) && ret=0
  ;;
rundir)
  compset -P '*:'
  compset -S ':*'
  _files -/ -S/ -r '\n\t\- /:' "$@" && ret=0
  ;;
help)
  _values -s , 'help' \
    optimizers warnings target params common \
    c c++ objc objc++ lto ada adascil adawhy fortran go java \
    {\^,}undocumented {\^,}joined {\^,}separate \
  && ret=0
  ;;
dirtodir)
  compset -P '*='
  _files -/ && ret=0
  ;;
commafiles)
  compset -P '*,'
  _files && ret=0
  ;;
framework)
  local -a framework_path=()
  case $OSTYPE in
    darwin*)
      framework_path=( $(xcrun --show-sdk-path)/System/Library/Frameworks ) ;;
  esac
  # Add directories from -F options
  for ((i = 2; i < $#words; i++)); do
    if [[ "$words[i]" = -F ]]; then
      framework_path+=("$words[++i]")
    elif [[ "$words[i]" = -F* ]]; then
      framework_path+=("${words[i]##-F}")
    fi
  done
  _wanted frameworks expl framework \
      compadd -- $framework_path/*.framework(:t:r) && ret=0
  ;;
warning)
  local -a warning_names
  for warning in $warnings; do
    if [[ "$warning" = (#b)-W([^=\[]##)[^\[]#\[(*)\]* ]]; then
      warning_names+=("$match[1]:$match[2]")
    fi
  done
  _describe warning warning_names && ret=0
  ;;
arch)
  _wanted cputypes expl "CPU type" compadd -a arch && ret=0
  ;;
archgeneric)
  arch+=(generic)
  _wanted cputypes expl "CPU type" compadd -a arch && ret=0
  ;;
esac

return ret

^ permalink raw reply	[relevance 1%]

* Re: Improvements to the gcc completion script
  2021-03-31 14:53  1%         ` Jun. T
@ 2021-03-31 15:06  1%           ` Jun. T
  0 siblings, 0 replies; 200+ results
From: Jun. T @ 2021-03-31 15:06 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 234 bytes --]

Oops, sorry. Please throw away the one attached to the previous post.

> 2021/03/31 23:53、Jun. T <takimoto-j@kba.biglobe.ne.jp>のメール:
> 
> It seems 'r:|[_-][^-]=* r:|=*' works _slightly_ better

No. It doesn't work.


[-- Attachment #2: _gcc --]
[-- Type: application/octet-stream, Size: 142409 bytes --]

#compdef gcc g++ cc c++ llvm-gcc llvm-g++ clang clang++ -value-,LDFLAGS,-default- -value-,CFLAGS,-default- -value-,CXXFLAGS,-default- -value-,CPPFLAGS,-default- -P gcc-* -P g++-* -P c++-*

local curcontext="$curcontext" state line ret=1 expl i
local -a args args2 warnings arch
typeset -A opt_args

if [[ "$service" = -value-* ]]; then
  compset -q
  words=( fake "$words[@]" )
  (( CURRENT++ ))
  if [[ "$service" = *LDFLAGS ]]; then
    args2=( '-R:runtime path:->rundir' )
  else
    args2=()
  fi
else
  # On some systems (macOS), cc/gcc/g++ are actually clang; treat them accordingly
  [[ $service != clang* ]] &&
  _pick_variant clang=clang unix --version &&
  service=clang-$service

  args2=( '*:input file:_files -g "*.([cCmisSoak]|cc|cpp|cxx|ii|k[ih])(-.)"' )
fi

args=()
case $MACHTYPE in

m68*)
  args=(
    -m68000 -m68020 -m68020-40 -m68030 -m68040 -m68881
    -mbitfield -mc68000 -mc68020 -mfpa -mnobitfield
    -mrtd -mshort -msoft-float
  )
  ;;
vax)
  args=(
    -mg -mgnu -munix
  )
  ;;
c[1234]*)
  args=(
    -mc1 -mc2 -mc32 -mc34 -mc38
    -margcount -mnoargcount
    -mlong32 -mlong64
    -mvolatile-cache -mvolatile-nocache
  )
  ;;
amd290?0)
  args=(
    -m29000 -m29050 -mbw -mnbw -mdw -mndw
    -mlarge -mnormal -msmall
    -mkernel-registers -mno-reuse-arg-regs
    -mno-stack-check -mno-storem-bug
    -mreuse-arg-regs -msoft-float -mstack-check
    -mstorem-bug -muser-registers
  )
  ;;
arm)
  args=(
    -mapcs -m2 -m3 -m6 -mbsd -mxopen -mno-symrename
    '-faapcs-bitfield-load[all volatile bit-field write generates at least one load]'
    '-faapcs-bitfield-width[volatile bit-field width is dictated by the field container type]'
    '-mcmse[allow use of CMSE]'
    '-mexecute-only[disallow generation of data access to code sections]'
    '-mno-movt[disallow use of movt/movw pairs]'
    '-mno-neg-immediates[disallow converting instructions with negative immediates to their negation]'
    '-mnocrc[disallow use of CRC instructions]'
    '-mrestrict-it[disallow generation of deprecated IT blocks for ARMv8]'
    '-mtp=[thread pointer access method]:arg'
    '-munaligned-access[allow memory accesses to be unaligned]'
  )
  ;;
m88k)
  args=(
    -m88000 -m88100 -m88110 -mbig-pic
    -mcheck-zero-division -mhandle-large-shift
    -midentify-revision -mno-check-zero-division
    -mno-ocs-debug-info -mno-ocs-frame-position
    -mno-optimize-arg-area -mno-serialize-volatile
    -mno-underscores -mocs-debug-info
    -mocs-frame-position -moptimize-arg-area
    -mserialize-volatile -msvr3
    -msvr4 -mtrap-large-shift -muse-div-instruction
    -mversion-03.00 -mwarn-passed-structs
    '-mshort-data--:maximum displacement:'
  )
  ;;
rs6000|powerpc*)
  arch=(rios1 rios2 rsc 501 603 604 power powerpc 403 common)
  args=(
    -mpower -mno-power -mpower2 -mno-power2
    -mpowerpc -mno-powerpc
    -mpowerpc-gpopt -mno-powerpc-gpopt
    -mpowerpc-gfxopt -mno-powerpc-gfxopt
    -mnew-mnemonics -mno-new-mnemonics
    -mfull-toc -mminimal-toc -mno-fop-in-toc -mno-sum-in-toc
    -msoft-float -mhard-float -mmultiple -mno-multiple
    -mstring -mno-string -mbit-align -mno-bit-align
    -mstrict-align -mno-strict-align -mrelocatable -mno-relocatable
    -mtoc -mno-toc -mtraceback -mno-traceback
    -mlittle -mlittle-endian -mbig -mbig-endian
    -mcall-aix -mcall-sysv -mprototype
    '-mcpu=:CPU type:->arch'
    '-maltivec[altivec]'
    '-mcmpb[cmpb]'
    '-mcrbits[crbits]'
    '-mcrypto[crypto]'
    '-mdirect-move[direct move]'
    '-mefpu2[efpu2]'
    '-mfloat128[float128]'
    '-mfprnd[fprnd]'
    '-mhtm[htm]'
    '-minvariant-function-descriptors[invariant function descriptors]'
    '-misel[isel]'
    '-mlongcall[longcall]'
    '-mmfocrf[mfocrf]'
    '-mmfcrf[mfcrf]'
    '-mmma[mma]'
    '-mpaired-vector-memops[paired vector memops]'
    '-mpcrel[pcrel]'
    '-mpopcntd[popcntd]'
    '-mpower10-vector[power10 vector]'
    '-mpower8-vector[power8 vector]'
    '-mpower9-vector[power9 vector]'
    '-mrop-protection[rop protection]'
    '-msecure-plt[secure plt]'
    '-mspe[spe]'
    '-mvsx[vsx]'
  )
  ;;
romp)
  args=(
    -mcall-lib-mul -mfp-arg-in-fpregs -mfp-arg-in-gregs
    -mfull-fp-blocks -mhc-struct-return -min-line-mul
    -mminimum-fp-blocks -mnohc-struct-return
  )
  ;;
mips*)
  arch=(r2000 r3000 r4000 r4400 r4600 r6000)
  args=(
    -membedded-pic -mgas -mgp32 -mgp64 -mhalf-pic -mhard-float -mint64 -mips1
    -mips2 -mips3 -mlong64 -mmemcpy -mmips-as -mmips-tfile -mno-abicalls
    -mno-embedded-data -mno-embedded-pic -mno-gpopt -mno-long-calls -mno-memcpy
    -mno-mips-tfile -mno-rnames -mno-stats -mrnames -msoft-float -m4650 -mmad
    -mstats -nocpp
    '-mcpu=:CPU type:->arch'
    '-mabicalls[enable SVR4-style position-independent code]'
    '-mabs=[abs]:arg'
    '-mcheck-zero-division[check zero division]'
    '-mcompact-branches=[compact branches]:arg'
    '-mdouble-float[double float]'
    '-mdsp[dsp]'
    '-mdspr2[dspr2]'
    '-membedded-data[place constants in the .rodata section instead of the .sdata section]'
    '-mextern-sdata[assume that externally defined data is in the small data]'
    '-mfp32[use 32-bit floating point registers]'
    '-mfp64[use 64-bit floating point registers]'
    '-mginv[ginv]'
    '-mgpopt[use GP relative accesses for symbols known to be in a small data section]'
    '-mindirect-jump=[change indirect jump instructions to inhibit speculation]:arg'
    '-mips16[ips16]'
    '-mldc1-sdc1[ldc1 sdc1]'
    '-mlocal-sdata[extend the -G behaviour to object local data]'
    '-mmadd4[enable the generation of 4-operand madd.s, madd.d, etc]'
    '-mmicromips[micromips]'
    '-mmsa[enable MSA ASE]'
    '-mmt[enable MT ASE]'
    '-mnan=[nan]:arg'
    '-mno-mips16[no mips16]'
    '-msingle-float[single float]'
    '-mvirt[virt]'
    '-mxgot[xgot]'
  )
  ;;
i[3456]86|x86_64)
  arch=(
    native i386 i486 i586 pentium pentium-mmx pentiumpro i686 pentium2 pentium3
    pentium3m pentium-m pentium4 pentium4m prescott nocona core2 corei7 corei7-avx
    core-avx-i core-avx2 atom k6 k6-2 k6-3 athlon athlon-tbird athlon-4 athlon-xp
    athlon-mp k8 opteron athlon64 athlon-fx k8-sse3 opteron-sse3 athlon64-sse3
    amdfam10 barcelona bdver1 bdver2 bdver3 btver1 btver2 winchip-c6 winchip2 c3
    c3-2 geode
  )
  args=(
    '-m128bit-long-double[sizeof(long double) is 16]'
    '-m16[generate 16bit i386 code]'
    '-m32[generate 32bit i386 code]'
    '-m3dnowa[support Athlon 3Dnow! built-in functions]'
    '-m3dnow[support 3DNow! built-in functions]'
    '-m64[generate 64bit x86-64 code]'
    '-m80387[use hardware fp]'
    '-m8bit-idiv[expand 32bit/64bit integer divide into 8bit unsigned integer divide with run-time check]'
    '-m96bit-long-double[sizeof(long double) is 12]'
    '-mabi=-[generate code that conforms to the given ABI]:abi:(ms sysv)'
    '-mabm[support code generation of Advanced Bit Manipulation (ABM) instructions]'
    '-maccumulate-outgoing-args[reserve space for outgoing arguments in the function prologue]'
    '-maddress-mode=-[use given address mode]:address mode:(short long)'
    '-madx[support flag-preserving add-carry instructions]'
    '-maes[support AES built-in functions and code generation]'
    '-malign-data=-[use the given data alignment]:type:(compat abi cacheline)'
    '-malign-double[align some doubles on dword boundary]'
    '-malign-functions=-[function starts are aligned to this power of 2]: **2 base for function alignment: '
    '-malign-jumps=-[jump targets are aligned to this power of 2]: **2 base for jump goal alignment: '
    '-malign-loops=-[loop code aligned to this power of 2]: **2 base for loop alignment: '
    '-malign-stringops[align destination of the string operations]'
    '-mamx-bf16[amx bf16]'
    '-mamx-int8[amx int8]'
    '-mamx-tile[amx tile]'
    '-mandroid[generate code for the Android platform]'
    '-march=-[generate instructions for CPU type]:CPU type:->archgeneric'
    '-masm=-[use given assembler dialect]:asm dialect:(att intel)'
    '-mavx256-split-unaligned-load[split 32-byte AVX unaligned load]'
    '-mavx256-split-unaligned-store[split 32-byte AVX unaligned store]'
    '-mavx2[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX and AVX2 built-in functions and code generation]'
    '-mavx5124fmaps[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2, AVX512F and AVX5124FMAPS built- in functions and code generation]'
    '-mavx5124vnniw[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2, AVX512F and AVX5124VNNIW built- in functions and code generation]'
    '-mavx512bf16[avx512bf16]'
    '-mavx512bitalg[avx512bitalg]'
    '-mavx512bw[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512BW built- in functions and code generation]'
    '-mavx512cd[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512CD built- in functions and code generation]'
    '-mavx512dq[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512DQ built- in functions and code generation]'
    '-mavx512er[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512ER built- in functions and code generation]'
    '-mavx512f[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F built-in functions and code generation]'
    '-mavx512ifma[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512IFMA built-in functions and code generation]'
    '-mavx512pf[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512PF built- in functions and code generation]'
    '-mavx512vbmi2[avx512vbmi2]'
    '-mavx512vbmi[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512VBMI built-in functions and code generation]'
    '-mavx512vl[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512VL built- in functions and code generation]'
    '-mavx512vnni[avx512vnni]'
    '-mavx512vp2intersect[avx512vp2intersect]'
    '-mavx512vpopcntdq[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2, AVX512F and AVX512VPOPCNTDQ built-in functions and code generation]'
    '-mavx[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2 and AVX built-in functions and code generation]'
    '-mavxvnni[avxvnni]'
    '-mbionic[use Bionic C library]'
    '-mbmi2[support BMI2 built-in functions and code generation]'
    '-mbmi[support BMI built-in functions and code generation]'
    '-mbranch-cost=-[branches are this expensive (1-5, arbitrary units)]:branch cost (1-5): '
    '-mcldemote[cldemote]'
    '-mcld[generate cld instruction in the function prologue]'
    '-mclflushopt[support CLFLUSHOPT instructions]'
    '-mclwb[support CLWB instruction]'
    '-mclzero[support CLZERO built-in functions and code generation]'
    '-mcmodel=-[use given x86-64 code model]:memory model:(32 small kernel medium large)'
    '-mcpu=-[set CPU type]:CPU type:->arch'
    '-mcrc32[support code generation of crc32 instruction]'
    '-mcx16[support code generation of cmpxchg16b instruction]'
    '-mdispatch-scheduler[do dispatch scheduling if processor is bdver1, bdver2, bdver3, bdver4 or znver1 and Haifa scheduling is selected]'
    '-menqcmd[enqcmd]'
    '-mf16c[support F16C built-in functions and code generation]'
    '-mfancy-math-387[generate sin, cos, sqrt for FPU]'
    '-mfentry[emit profiling counter call at function entry before prologue]'
    '-mfma4[support FMA4 built-in functions and code generation]'
    '-mfma[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX and FMA built-in functions and code generation]'
    '-mforce-drap[always use Dynamic Realigned Argument Pointer (DRAP) to realign stack]'
    '-mfpmath=-[generate floating point mathematics using given instruction set]:FPU type:(387 sse sse,387 both)'
    '-mfp-ret-in-387[return values of functions in FPU registers]'
    '-mfsgsbase[support FSGSBASE built-in functions and code generation]'
    '-mfunction-return=-[convert function return to call and return thunk]:choice:(keep thunk thunk-inline thunk-extern)'
    '-mfxsr[support FXSAVE and FXRSTOR instructions]'
    '-mgeneral-regs-only[generate code which uses only the general registers]'
    '-mgfni[gfni]'
    '-mglibc[use GNU C library]'
    '-mhard-float[use hardware fp]'
    '-mhle[support Hardware Lock Elision prefixes]'
    '-mhreset[hreset]'
    '-miamcu[generate code that conforms to Intel MCU psABI]'
    '-mieee-fp[use IEEE math for fp comparisons]'
    '-mincoming-stack-boundary=-[assume incoming stack aligned to this power of 2]:assumed size of boundary: '
    '-mindirect-branch=-[convert indirect call and jump to call and return thunks]:choice:(keep thunk thunk-inline thunk-extern)'
    '-mindirect-branch-register[force indirect call and jump via register]'
    '-minline-all-stringops[inline all known string operations]'
    '-minline-stringops-dynamically[inline memset/memcpy string operations, but perform inline version only for small blocks]'
    '-minvpcid[invpcid]'
    '-mkl[kl]'
    '-mlarge-data-threshold=-[data greater than given threshold will go into .ldata section in x86-64 medium model]:threshold: '
    '-mlong-double-128[use 128-bit long double]'
    '-mlong-double-64[use 64-bit long double]'
    '-mlong-double-80[use 80-bit long double]'
    '-mlwp[support LWP built-in functions and code generation]'
    '-mlzcnt[support LZCNT built-in function and code generation]'
    {'-mmemset-strategy=-','-mmemcpy-strategy=-'}'[specify memcpy expansion strategy when expected size is known]:strategy:'
    '-mmitigate-rop[attempt to avoid generating instruction sequences containing ret bytes]'
    '-mmmx[support MMX built-in functions]'
    '-mmovbe[support code generation of movbe instruction]'
    '-mmovdir64b[movdir64b]'
    '-mmovdiri[movdiri]'
    '-mmpx[support MPX code generation]'
    '-mms-bitfields[use native (MS) bitfield layout]'
    '-mmusl[use musl C library]'
    '-mmwaitx[support MWAITX and MONITORX built-in functions and code generation]'
    '-mno-default[clear all tune features]'
    '-mnop-mcount[generate mcount/__fentry__ calls as nops. To activate they need to be patched in]'
    '-mno-sse4[do not support SSE4.1 and SSE4.2 built-in functions and code generation]'
    '-momit-leaf-frame-pointer[omit the frame pointer in leaf functions]'
    '-mpc32[set 80387 floating-point precision to 32-bit]'
    '-mpc64[set 80387 floating-point precision to 64-bit]'
    '-mpc80[set 80387 floating-point precision to 80-bit]'
    '-mpclmul[support PCLMUL built-in functions and code generation]'
    '-mpconfig[pconfig]'
    '-mpku[support PKU built-in functions and code generation]'
    '-mpopcnt[support code generation of popcnt instruction]'
    '-mprefer-avx128[use 128-bit AVX instructions instead of 256-bit AVX instructions in the auto-vectorizer]'
    '-mpreferred-stack-boundary=-[attempt to keep stack aligned to this power of 2]:size of boundary: '
    '-mprefetchwt1[support PREFETCHWT1 built-in functions and code generation]'
    '-mprfchw[support PREFETCHW instruction]'
    '-mptwrite[ptwrite]'
    '-mpush-args[use push instructions to save outgoing arguments]'
    '-mrdpid[support RDPID built-in functions and code generation]'
    '-mrdrnd[support RDRND built-in functions and code generation]'
    '-mrdseed[support RDSEED instruction]'
    '-mrecip=-[control generation of reciprocal estimates]::instruction:(all none div divf divd rsqrt rsqrtf rsqrtd)' # TODO comma separated and can have !
    '-mrecip[generate reciprocals instead of divss and sqrtss]'
    '-mrecord-mcount[generate __mcount_loc section with all mcount or __fentry__ calls]'
    '-mred-zone[use red-zone in the x86-64 code]'
    '-mreg-alloc=[control the default allocation order of integer registers]:default register allocation order:'
    '-mregparm=-[number of registers used to pass integer arguments]:number of integer argument registers: '
    '-mretpoline-external-thunk[retpoline external thunk]'
    '-mrtd[alternate calling convention]'
    '-mrtm[support RTM built-in functions and code generation]'
    '-msahf[support code generation of sahf instruction in 64bit x86-64 code]'
    '-mserialize[serialize]'
    '-msgx[support SGX built-in functions and code generation]'
    '-msha[support SHA1 and SHA256 built-in functions and code generation]'
    '-mshstk[shstk]'
    '-mskip-rax-setup[skip setting up RAX register when passing variable arguments]'
    '-msoft-float[do not use hardware fp]'
    '-msse2avx[encode SSE instructions with VEX prefix]'
    '-msse2[support MMX, SSE and SSE2 built-in functions and code generation]'
    '-msse3[support MMX, SSE, SSE2 and SSE3 built-in functions and code generation]'
    '-msse4.1[support MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1 built-in functions and code generation]'
    '-msse4.2[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1 and SSE4.2 built-in functions and code generation]'
    '-msse4a[support MMX, SSE, SSE2, SSE3 and SSE4A built-in functions and code generation]'
    '-msse4[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1 and SSE4.2 built-in functions and code generation]'
    '-msseregparm[use SSE register passing conventions for SF and DF mode]'
    '-msse[support MMX and SSE built-in functions and code generation]'
    '-mssse3[support MMX, SSE, SSE2, SSE3 and SSSE3 built-in functions and code generation]'
    '-mstack-arg-probe[enable stack probing]'
    '-mstack-protector-guard=-[use given stack-protector guard]:guard:(global tls)'
    '-mstackrealign[realign stack in prologue]'
    '-mstringop-strategy=-[chose strategy to generate stringop using]:stringop strategy:(byte_loop libcall loop rep_4byte rep_8byte rep_byte unrolled_loop)'
    '-mstv[disable Scalar to Vector optimization pass transforming 64-bit integer computations into a vector ones]'
    '-mtbm[support TBM built-in functions and code generation]'
    '-mthreads[support thread-safe exception handling on MinGW]'
    '-mtls-dialect=-[use given thread-local storage dialect]:TLS dialect:(gnu gnu2)'
    '-mtls-direct-seg-refs[use direct references against %gs when accessing tls data]'
    '-mtsxldtrk[tsxldtrk]'
    #'-mtune-ctrl=-[fine grain control of tune features]:feature-list:' #for dev use only
    '-mtune=-[tune code for CPU type]:CPU type:->arch'
    '-muclibc[use uClibc C library]'
    '-muintr[uintr]'
    '-mvaes[vaes]'
    '-mveclibabi=-[vector library ABI to use]:vector library ABI:(acml svml)'
    '-mvect8-ret-in-mem[return 8-byte vectors in memory]'
    '-mvpclmulqdq[vpclmulqdq]'
    '-mvzeroupper[generate vzeroupper instruction before a transfer of control flow out of the function]'
    '-mwaitpkg[waitpkg]'
    '-mwbnoinvd[wbnoinvd]'
    '-mwidekl[widekl]'
    '-mx32[generate 32bit x86-64 code]'
    '-mx87[x87]'
    '-mxop[support XOP built-in functions and code generation]'
    '-mxsavec[support XSAVEC instructions]'
    '-mxsaveopt[support XSAVEOPT instruction]'
    '-mxsaves[support XSAVES and XRSTORS instructions]'
    '-mxsave[support XSAVE and XRSTOR instructions]'
  )
  ;;
hppa*)
  args=(
    -mdisable-fpregs -mdisable-indexing -mfast-indirect-calls
    -mgas -mjump-in-delay -mlong-millicode-calls -mno-disable-fpregs
    -mno-disable-indexing -mno-fast-indirect-calls -mno-gas
    -mno-jump-in-delay -mno-millicode-long-calls
    -mno-portable-runtime -mno-soft-float -msoft-float
    -mpa-risc-1-0 -mpa-risc-1-1 -mportable-runtime
    '-mschedule=:code scheduling constraints:(700 7100 7100LC)'
  )
  ;;
i960)
  args=(
    -m{ka,kb,mc,ca,cf,sa,sb}
    -masm-compat -mclean-linkage
    -mcode-align -mcomplex-addr -mleaf-procedures
    -mic-compat -mic2.0-compat -mic3.0-compat
    -mintel-asm -mno-clean-linkage -mno-code-align
    -mno-complex-addr -mno-leaf-procedures
    -mno-old-align -mno-strict-align -mno-tail-call
    -mnumerics -mold-align -msoft-float -mstrict-align
    -mtail-call
  )
  ;;
sparc)
  arch=(
    v7 cypress v8 supersparc sparclite f930 f934 hypersparc sparclite86x sparclet
    tsc701 v9 ultrasparc ultrasparc3
  )
  args=(
    -mapp-regs -mno-app-regs
    -mfpu -mhard-float
    -mno-fpu -msoft-float
    -mhard-quad-float
    -msoft-quad-float
    -mno-unaligned-doubles
    -munaligned-doubles
    -mfaster-structs -mno-faster-structs
    -mimpure-text
    '-mcpu=:CPU type:->arch'
    '-mtune=:CPU type:->arch'
    -mv8plus -mno-v8plus
    -mvis -mno-vis
    -mlittle-endian
    -m32 -m64
    '-mcmodel=:memory model:(medlow medmid medany embmedany)'
    -mstack-bias -mno-stack-bias
    -mv8
    -mcypress -mepilogue -mflat
    -mno-flat
    -mno-epilogue
    -msparclite -msupersparc
    -mmedlow -mmedany
    -mint32 -mint64 -mlong32 -mlong64
  )
  ;;
alpha*)
  args=(
    -mfp-regs -mno-fp-regs -mno-soft-float
    -msoft-float
  )
  ;;
clipper)
  args=(
    -mc300 -mc400
  )
  ;;
h8/300)
  args=(
    -mrelax -mh
  )
  ;;
aarch64)
  args=(
    '-mmark-bti-property[add .note.gnu.property with BTI to assembly files]'
    '-moutline[enable function outlining (AArch64 only)]'
    '-msve-vector-bits=[specify the size in bits of an SVE vector register]:bits'
  )
  ;;
amdgpu)
  args=(
    '-mcumode[specify CU wavefront execution mode]'
    '-mtgsplit[enable threadgroup split execution mode (AMDGPU only)]'
  )
  ;;
hexagon)
  args=(
    '-mieee-rnd-near[ieee rnd near]'
    '-mmemops[enable generation of memop instructions]'
    '-mnvj[enable generation of new-value jumps]'
    '-mnvs[enable generation of new-value stores]'
    '-mpackets[enable generation of instruction packets]'
    '-mhvx[enable Hexagon Vector eXtensions]'
    '-mhvx-length=[set Hexagon Vector Length]:arg'
    '-mhvx=[enable Hexagon Vector eXtensions]:arg'
  )
  ;;
webassembly*)
  args=(
    '-matomics[atomics]'
    '-mbulk-memory[bulk memory]'
    '-mexception-handling[exception handling]'
    '-mmultivalue[multivalue]'
    '-mmutable-globals[mutable globals]'
    '-mnontrapping-fptoint[no ntrapping fptoint]'
    '-mreference-types[reference types]'
    '-msign-ext[sign ext]'
    '-msimd128[simd128]'
    '-mtail-call[tail call]'
    '-munimplemented-simd128[unimplemented simd128]'
    '-mexec-model=[execution model]:arg'
  )
  ;;
riscv)
  args=(
    '-msave-restore[enable using library calls for save and restore]'
  )
  ;;
esac

if [[ "$service" = clang* ]]; then
  args+=(
    '-all_load[undocumented option]'
    '-allowable_client[undocumented option]:argument'
    '--analyzer-no-default-checks[analyzer does no default checks]'
    '--analyzer-output[static analyzer report output format]:format:(html plist plist-multi-file plist-html sarif sarif-html text)'
    '--analyze[run the static analyzer]'
    '-arch[arch]:argument'
    '-arch_errors_fatal[arch errors fatal]'
    '-arch_only[arch only]:argument'
    '-arcmt-migrate-emit-errors[emit ARC errors even if the migrator can fix them]'
    '-arcmt-migrate-report-output[output path for the plist report]:file:_files'
    '-a-[undocumented option]:argument'
    '--autocomplete=[autocomplete]:argument'
    '-bind_at_load[bind at load]'
    '--bootclasspath=[bootclasspath]:arg'
    '-bundle[bundle]'
    '-bundle_loader[bundle loader]:argument'
    '--CLASSPATH=[CLASSPATH]:arg'
    '--classpath=[classpath]:arg'
    '-cl-denorms-are-zero[allow denormals to be flushed to zero]'
    '-cl-fast-relaxed-math[cl fast relaxed math]'
    '-cl-finite-math-only[allow floating-point optimizations]'
    '-cl-fp32-correctly-rounded-divide-sqrt[specify that divide and sqrt are correctly rounded]'
    '-client_name[client name]:argument'
    '-cl-kernel-arg-info[generate kernel argument metadata]'
    '-cl-mad-enable[allow use of less precise MAD computations]'
    '-cl-no-signed-zeros[allow use of no signed zeros computations]'
    '-cl-no-stdinc[disables all standard includes]'
    '-cl-opt-disable[disables all optimizations]'
    '-cl-single-precision-constant[treat double float constant as single precision]'
    '-cl-std=[openCL language standard to compile for]:arg'
    '-cl-strict-aliasing[this option is added for compatibility with OpenCL 1.0]'
    '-cl-uniform-work-group-size[defines that the global work-size be uniform]'
    '-cl-unsafe-math-optimizations[allow unsafe floating-point optimizations]'
    '-compatibility_version[compatibility version]:compatibility version'
    '--config[specifies configuration file]:configuration file:_files'
    '--constant-cfstrings[use constant cfstrings]'
    '--coverage[coverage]'
    '-coverage[coverage]'
    '-cpp[cpp]'
    '--cuda-compile-host-device[compile CUDA code for both host and device]'
    '--cuda-device-only[compile CUDA code for device only]'
    '--cuda-gpu-arch=[cUDA offloading device architecture]:arg'
    '--cuda-host-only[compile CUDA code for host only]'
    '*--cuda-include-ptx=[include ptx for the following gpu architecture]:argument'
    '--cuda-noopt-device-debug[enable device-side debug info generation]'
    '--cuda-path=[cUDA installation path]:arg'
    '--cuda-path-ignore-env[ignore environment variables to detect CUDA installation]'
    '-cuid=[an id for compilation unit]:argument'
    '-current_version[current version]:current version'
    '-cxx-isystem[add directory to the C++ SYSTEM include search path]:directory:_files -/'
    '-dead_strip[dead strip]'
    '-dependency-dot[file to write dot-formatted header dependencies to]:file:_files'
    '-dependency-file[file to write dependency output to]:file:_files'
    '--dyld-prefix=[dyld prefix]:prefix'
    '--dylib_file[dyld file]:file:_files'
    '-dylinker[dylinker]'
    '-dylinker_install_name[dylinker install name]:name'
    '-dynamic[dynamic]'
    '-dynamiclib[dynamic lib]'
    '-EB[big endian]'
    '-EL[little endian]'
    '-emit-ast[emit Clang AST files for source inputs]'
    '-emit-interface-stubs[generate Interface Stub Files]'
    '-emit-llvm[use the LLVM representation for assembler and object files]'
    '-emit-merged-ifs[generate Interface Stub Files, emit merged text not binary]'
    '--emit-static-lib[enable linker job to emit a static library]'
    #'-enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang[trivial automatic variable initialization to zero is only here for benchmarks]'
    '--encoding=[encoding]:arg'
    '-exported_symbols_list[exported symbols list]:argument'
    '--extdirs=[extdirs]:arg'
    '--extra-warnings[enable extra warnings]'
    '-faccess-control[access control]'
    '*-F+[add directory to framework search path]:framework directory:_files -/'
    '-faddrsig[emit an address-significance table]'
    '-faggressive-function-elimination[aggressive function elimination]'
    '-falign-commons[align commons]'
    '-faligned-allocation[aligned allocation]'
    '-faligned-new[enable C++17 aligned allocation functions]'
    '-fall-intrinsics[all intrinsics]'
    '-fallow-editor-placeholders[treat editor placeholders as valid source code]'
    '-fallow-unsupported[allow unsupported]'
    '-falternative-parameter-statement[enable the old style PARAMETER statement]'
    '-faltivec[altivec]'
    '-fansi-escape-codes[use ANSI escape codes for diagnostics]'
    "-fapple-kext[use Apple's kernel extensions ABI]"
    '-fapple-link-rtlib[force linking the clang builtins runtime library]'
    '-fapple-pragma-pack[enable Apple GCC-compatible #pragma pack handling]'
    '-fapplication-extension[restrict code to those available for App Extensions]'
    '-fasm-blocks[asm blocks]'
    '-fassume-sane-operator-new[assume sane operator new]'
    '-fast[ast]'
    '-fastcp[astcp]'
    '-fastf[astf]'
    '-fautolink[autolink]'
    '-fautomatic[automatic]'
    '-fauto-profile-accurate[auto profile accurate]'
    '-fauto-profile=[enable sample-based profile guided optimizations]::arg'
    '-fbackslash[change the interpretation of backslashes in string literals]'
    '-fbacktrace[backtrace]'
    '-fbasic-block-sections=[generate labels for each basic block]:arg'
    '-fbinutils-version=[produced object files can use all ELF features supported by this version]:major.minor'
    '-fblas-matmul-limit=[blas matmul limit]:arg'
    '-fblocks[enable the blocks language feature]'
    '-fbootclasspath=[bootclasspath]:arg'
    '-fborland-extensions[accept non-standard constructs supported by the Borland compiler]'
    '-fbracket-depth=[bracket depth]:arg'
    '-fbuild-session-file=[use the last modification time of <file> as the build session timestamp]:file:_files'
    '-fbuild-session-timestamp=[time when the current build session started]:time since Epoch in seconds'
    '-fbuiltin-module-map[load the clang builtins module map file]'
    '-fcaret-diagnostics[show diagnostic messages using a caret]'
    '-fcf-protection=[instrument control-flow architecture protection]::arg (options\: return, branch, full, none)'
    '-fcf-runtime-abi=[cf runtime abi]:arg'
    '-fchar8_t[enable C++ builtin type char8_t]'
    '-fcheck-array-temporaries[check array temporaries]'
    '-fcheck=[check]:arg'
    '-fclang-abi-compat=[attempt to match the ABI of Clang <version>]:version'
    '-fclasspath=[classpath]:arg'
    '-fcoarray=[coarray]:arg'
    '-fcolor-diagnostics[enable colors in diagnostics]'
    '-fcomment-block-commands=[treat each comma separated argument in <arg> as a documentation comment block command]:arg'
    '-fcompile-resource=[compile resource]:arg'
    '-fcomplete-member-pointers[require member pointer base types to be complete if they would be significant under the Microsoft ABI]'
    '-fconstant-cfstrings[constant cfstrings]'
    '-fconstant-string-class=[constant string class]:arg'
    '-fconstexpr-backtrace-limit=[constexpr backtrace limit]:arg'
    '-fconstexpr-depth=[constexpr depth]:arg'
    '-fconstexpr-steps=[constexpr steps]:arg'
    '-fconvergent-functions[assume functions may be convergent]'
    '-fconvert=[convert]:arg'
    '-fcoroutines-ts[enable support for the C++ Coroutines TS]'
    '-fcoverage-compilation-dir=[the compilation directory to embed in the coverage mapping]:arg'
    '-fcoverage-mapping[generate coverage mapping to enable code coverage analysis]'
    '-fcoverage-prefix-map=[remap file source paths in coverage mapping]:arg'
    '-fcrash-diagnostics-dir=[crash diagnostics dir]:arg'
    '-fcray-pointer[cray pointer]'
    '-fcreate-profile[create profile]'
    '-fcs-profile-generate[generate instrumented code to collect context sensitive execution counts]'
    '-fcs-profile-generate=[generate instrumented code to collect context sensitive execution counts]:directory:_files -/'
    '-fc\+\+-static-destructors[c++ static destructors]'
    '-fcuda-approx-transcendentals[use approximate transcendental functions]'
    '-fcuda-flush-denormals-to-zero[flush denormal floating point values to zero in CUDA device mode]'
    '-fcuda-rdc[cuda rdc]'
    '-fcuda-short-ptr[use 32-bit pointers for accessing const/local/shared address spaces]'
    '-fcxx-exceptions[enable C++ exceptions]'
    '-fcxx-modules[cxx modules]'
    '-fdebug-compilation-dir=[the compilation directory to embed in the debug info]:arg'
    '-fdebug-default-version=[default DWARF version to use]:arg'
    '-fdebug-dump-parse-tree[dump the parse tree]'
    '-fdebug-dump-provenance[dump provenance]'
    '-fdebug-dump-symbols[dump symbols after the semantic analysis]'
    '-fdebug-info-for-profiling[emit extra debug info to make sample profile more accurate]'
    '-fdebug-macro[emit macro debug information]'
    '-fdebug-measure-parse-tree[measure the parse tree]'
    '-fdebug-pass-arguments[debug pass arguments]'
    '-fdebug-pass-structure[debug pass structure]'
    '-fdebug-pre-fir-tree[dump the pre-FIR tree]'
    '-fdebug-ranges-base-address[use DWARF base address selection entries in .debug_ranges]'
    '-fdebug-unparse[unparse and stop]'
    '-fdebug-unparse-with-symbols[unparse and stop]'
    '-fdeclspec[allow __declspec as a keyword]'
    '-fdefault-double-8[set the default double precision kind to an 8 byte wide type]'
    '-fdefault-integer-8[set the default integer kind to an 8 byte wide type]'
    '-fdefault-real-8[set the default real kind to an 8 byte wide type]'
    '-fdelayed-template-parsing[parse templated function definitions at the end of the translation unit]'
    '-fdenormal-fp-math=[denormal fp math]:arg'
    '-fdepfile-entry=[depfile entry]:arg'
    '-fdiagnostics-absolute-paths[print absolute paths in diagnostics]'
    '-fdiagnostics-fixit-info[supply fixit into with diagnostic messages]'
    '-fdiagnostics-format=[diagnostics format]:arg'
    '-fdiagnostics-hotness-threshold=[prevent optimization remarks from being output if they do not meet threshold]:value'
    '-fdiagnostics-parseable-fixits[print fixits in a machine parseable form]'
    '-fdiagnostics-print-source-range-info[print source range spans in numeric form]'
    '-fdiagnostics-show-category=[diagnostics show category]:arg'
    '-fdiagnostics-show-hotness[enable profile hotness information in diagnostic line]'
    '-fdiagnostics-show-note-include-stack[display include stacks for diagnostic notes]'
    '-fdiagnostics-show-option[enable -Woption information in diagnostic line]'
    '-fdiagnostics-show-template-tree[print a template comparison tree for differing templates]'
    '-fdigraphs[enable alternative token representations]'
    "-fdirect-access-external-data[don't use GOT indirection to reference external data symbols]"
    '-fdiscard-value-names[discard value names in LLVM IR]'
    '-fd-lines-as-code[d lines as code]'
    '-fd-lines-as-comments[d lines as comments]'
    '-fdollar-ok[dollar ok]'
    '-fdouble-square-bracket-attributes[enable double square bracket attributes]'
    '-fdump-fortran-optimized[dump fortran optimized]'
    '-fdump-fortran-original[dump fortran original]'
    '-fdump-parse-tree[dump parse tree]'
    '-fdwarf-directory-asm[DWARF directory asm]'
    '-fdwarf-exceptions[use DWARF style exceptions]'
    '-felide-constructors[elide constructors]'
    '-felide-type[elide types when printing diagnostics]'
    '-fembed-bitcode=[embed LLVM bitcode (option: off, all, bitcode, marker)]:option'
    '-fembed-bitcode[equivalent to -fembed-bitcode=all]'
    '-fembed-bitcode-marker[equivalent to -fembed-bitcode=marker]'
    '-femit-all-decls[emit all declarations]'
    '-femulated-tls[use emutls functions to access thread_local variables]'
    '-fenable-matrix[enable matrix data type and related builtin functions]'
    '-fencoding=[encoding]:arg'
    '-ferror-limit=[error limit]:arg'
    '-fescaping-block-tail-calls[escaping block tail calls]'
    '-fexperimental-isel[experimental isel]'
    '-fexperimental-new-constant-interpreter[enable the experimental new constant interpreter]'
    '-fexperimental-relative-c\+\+-abi-vtables[use the experimental C++ class ABI for classes with vtables]'
    '-fexperimental-strict-floating-point[enables experimental strict floating point in LLVM]'
    '-fextdirs=[extdirs]:arg'
    '-fexternal-blas[external blas]'
    '-ff2c[f2c]'
    '-ffile-compilation-dir=[the compilation directory to embed in the debug info]:arg'
    '-ffile-prefix-map=[remap file source paths in debug info and predefined preprocessor macros]:arg'
    '-ffine-grained-bitfield-accesses[use separate accesses for consecutive bitfield runs with legal widths and alignments]'
    '-ffinite-loops[assume all loops are finite]'
    '-ffixed-form[process source files in fixed form]'
    '-ffixed-line-length=[set column after which characters are ignored]:arg'
    '-ffixed-point[enable fixed point types]'
    '-fforce-dwarf-frame[always emit a debug frame section]'
    '-fforce-emit-vtables[emits more virtual tables to improve devirtualization]'
    '-fforce-enable-int128[enable support for int128_t type]'
    '-ffor-scope[for scope]'
    '-ffpe-trap=[fpe trap]:arg'
    '-ffp-exception-behavior=[specifies the exception behavior of floating-point operations]:arg'
    '-ffp-model=[controls the semantics of floating-point calculations]:arg'
    '-ffree-form[process source files in free form]'
    '-ffree-line-length-[free line length]:arg'
    '-ffrontend-optimize[frontend optimize]'
    '-fglobal-isel[enables the global instruction selector]'
    '-fgnuc-version=[sets various macros to claim compatibility with the given GCC version]:version'
    '-fgnu-inline-asm[gnu inline asm]'
    '-fgnu-keywords[allow GNU-extension keywords regardless of language standard]'
    '-fgnu-runtime[generate output compatible with the standard GNU Objective-C runtime]'
    '-fgpu-allow-device-init[allow device side init function in HIP]'
    '-fgpu-defer-diag[defer host/device related diagnostic messages for CUDA/HIP]'
    '-fgpu-rdc[generate relocatable device code, also known as separate compilation mode]'
    '-fgpu-sanitize[enable sanitizer for AMDGPU target]'
    '-fheinous-gnu-extensions[heinous GNU extensions]'
    '-fhip-new-launch-api,[-fno-hip-new-launch-api Use new kernel launching API for HIP]'
    '-fhonor-infinites[honor infinites]'
    '-fhonor-infinities[honor infinities]'
    '-fhonor-nans[honor nans]'
    '-fignore-exceptions[enable support for ignoring exception handling constructs]'
    '-filelist[ilelist]:arg'
    '-fimplicit-module-maps[implicit module maps]'
    '-fimplicit-modules[implicit modules]'
    '-fimplicit-none[no implicit typing allowed unless overridden by IMPLICIT statements]'
    '-findirect-virtual-calls[indirect virtual calls]'
    '-finit-character=[init character]:arg'
    '-finit-integer=[init integer]:arg'
    '-finit-local-zero[init local zero]'
    '-finit-logical=[init logical]:arg'
    '-finit-real=[init real]:arg'
    '-finline-hint-functions[inline functions which are (explicitly or implicitly) marked inline]'
    '-finstrument-function-entry-bare[instrument function entry only]'
    '-finstrument-functions-after-inlining[insert the calls after inlining]'
    '-finteger-4-integer-8[integer 4 integer 8]'
    '-fintegrated-as[enable the integrated assembler]'
    '-fintegrated-cc1[run cc1 in-process]'
    '-fintrinsic-modules-path[intrinsic modules path]'
    '-flarge-sizes[use INTEGER(KIND=8) for the result type in size-related intrinsics]'
    '-flat_namespace[flat namespace]'
    '-flegacy-pass-manager[use the legacy pass manager in LLVM]'
    '-flimited-precision=[limited precision]:arg'
    '-flogical-abbreviations[enable logical abbreviations]'
    '-flto=-[generate output files suitable for link time optimization]::style:(full thin)'
    '-flto-jobs=[controls the backend parallelism]:arg'
    '-fmacro-backtrace-limit=[macro backtrace limit]:limit'
    '-fmacro-prefix-map=[remap file source paths in predefined preprocessor macros]:arg'
    '-fmax-array-constructor=[max array constructor]:arg'
    '-fmax-identifier-length[max identifier length]'
    '-fmax-stack-var-size=[max stack var size]:arg'
    '-fmax-subrecord-length=[max subrecord length]:arg'
    '-fmax-tokens=[max total number of preprocessed tokens for -Wmax-tokens]:number'
    '-fmax-type-align=[specify the maximum alignment to enforce on pointers lacking an explicit alignment]:arg'
    '-fmemory-profile=[enable heap memory profiling and dump results into <directory>]::directory:_files -/'
    '-fmodule-file-deps[module file deps]'
    '-fmodule-file=[specify the mapping of module name to precompiled module file]:file:_files'
    '-fmodule-implementation-of[module implementation of]:name'
    '-fmodule-map-file=[load this module map file]:file:_files'
    '-fmodule-maps[implicitly search the file system for module map files.]'
    '-fmodule-name=[specify the name of the module to build]:name'
    '-fmodule-private[module private]'
    '-fmodules-cache-path=[specify the module cache path]:directory:_files -/'
    '-fmodules-decluse[require declaration of modules used within a module]'
    '-fmodules-disable-diagnostic-validation[disable validation of the diagnostic options when loading the module]'
    '-fmodules[enable the modules language feature]'
    '-fmodules-ignore-macro=[ignore the definition of the given macro when building and loading modules]:macro'
    '-fmodules-prune-after=[specify the interval after which a module file will be considered unused]:seconds'
    '-fmodules-prune-interval=[specify the interval between attempts to prune the module cache]:seconds'
    '-fmodules-search-all[search even non-imported modules to resolve references]'
    '-fmodules-strict-decluse[requires all headers to be in modules]'
    '-fmodules-ts[enable support for the C++ Modules TS]'
    '-fmodules-user-build-path[specify the module user build path]:directory:_files -/'
    '-fmodules-validate-input-files-content[validate PCM input files based on content if mtime differs]'
    "-fmodules-validate-once-per-build-session[don't verify input files for the modules]"
    '-fmodules-validate-system-headers[validate the system headers that a module depends on when loading the module]'
    '-fms-compatibility[enable full Microsoft Visual C++ compatibility]'
    '-fms-compatibility-version=[microsoft compiler version number]:arg'
    '-fmsc-version=[microsoft compiler version number to report]:arg'
    '-fms-memptr-rep=[ms memptr rep]:arg'
    '-fms-volatile[ms volatile]'
    '-fnested-functions[nested functions]'
    '-fnew-alignment=[specifies the largest alignment guaranteed]:align'
    '-fnext-runtime[next runtime]'
    '-fno-builtin-[disable implicit builtin knowledge of a specific function]:arg'
    '-fno-crash-diagnostics[disable auto-generation of preprocessed source files and a script for reproduction during a clang crash]'
    '-fno-limit-debug-info[no limit debug info]'
    '-fno-max-type-align[no max type align]'
    '-fno_modules-validate-input-files-content[no modules validate input files content]'
    '-fno_pch-validate-input-files-content[no pch validate input files content]'
    '-fno-strict-modules-decluse[no strict modules decluse]'
    '-fno-temp-file[directly create compilation output files]'
    '-fno-working-directory[no working directory]'
    '-fnoxray-link-deps[no xray link deps]'
    '-fobjc-abi-version=-[set Objective-C ABI version]:version'
    '-fobjc-arc-exceptions[use EH-safe code when synthesizing retains and releases in -fobjc-arc]'
    '-fobjc-arc[synthesize retain and release calls for Objective-C pointers]'
    '-fobjc-convert-messages-to-runtime-calls[convert messages to runtime calls]'
    '-fobjc-encode-cxx-class-template-spec[fully encode C++ class template specialization]'
    '-fobjc-exceptions[enable Objective-C exceptions]'
    '-fobjc-infer-related-result-type[infer related result type]'
    '-fobjc-legacy-dispatch[use legacy dispatch]'
    '-fobjc-link-runtime[set link runtime]'
    '-fobjc-nonfragile-abi[set nonfragile abi]'
    '-fobjc-nonfragile-abi-version=-[set nonfragile abi version]:version'
    '-fobjc-runtime=-[specify the target Objective-C runtime kind and version]:runtime'
    '-fobjc-sender-dependent-dispatch[set sender dependent dispatch]'
    '-fobjc-weak[enable ARC-style weak references in Objective-C]'
    '-fopenmp-targets=[specify comma-separated list of triples OpenMP offloading targets to be supported]:targets'
    '-fopenmp-version=[openmp version]:version'
    '-foperator-arrow-depth=[operator arrow depth]:arg'
    '-foperator-names[treat C++ operator name keywords as synonyms for operators]'
    '-foptimization-record-file=[specify the output name of the file containing the optimization remarks]:file:_files'
    '-foptimization-record-passes=[only include passes which match a specified regex]:regex'
    '-force_cpusubtype_ALL[force cpusubtype all]'
    '-force_flat_namespace[force flat namespace]'
    '--force-link=[force link]:arg'
    '-force_load[force load]:argument'
    '-forder-file-instrumentation[generate instrumented code to collect order file]'
    '-foutput-class-dir=[output class dir]:arg'
    '-fpack-derived[pack derived]'
    '-fparse-all-comments[parse all comments]'
    '-fpascal-strings[recognize and construct Pascal-style string literals]'
    '-fpass-plugin=[load pass plugin from a dynamic shared object file]:dsopath'
    '-fpatchable-function-entry=[generate NOPs around function entry]:N,M'
    '-fpch-codegen[generate code for uses of this PCH]'
    '-fpch-debuginfo[generate debug info for types in an object file built from this PCH]'
    '-fpch-instantiate-templates[instantiate templates already while building a PCH]'
    '-fpch-validate-input-files-content[validate PCH input files based on content]'
    '-fprebuilt-implicit-modules[look up implicit modules]'
    '-fprebuilt-module-path=[specify the prebuilt module path]:directory:_files -/'
    '-fpreserve-as-comments[preserve as comments]'
    '-fproc-stat-report=[save subprocess statistics to the given file]:arg'
    '-fprofile-exclude-files=[exclude files from profile]:arg'
    '-fprofile-filter-files=[filter files for profile]:arg'
    '-fprofile-instr-generate=[generate instrumented profile into file]::file:_files'
    '-fprofile-instr-use=[use instrumentation data for profile-guided optimization]::arg'
    '-fprofile-list=[filename defining the list of items to instrument]:file:_files'
    '-fprofile-remapping-file=[use the remappings described in file in profile]:file:_files'
    '-fprofile-sample-accurate[specifies that the sample profile is accurate]'
    '-fprofile-sample-use=[profile sample use]::arg'
    '-fprofile-update=[set update method of profile counters]:method'
    '-fprotect-parens[protect parens]'
    '-fpseudo-probe-for-profiling[emit pseudo probes for sample profiling]'
    '*-framework[include framework found in search path]:framework:->framework'
    '-frange-check[range check]'
    '-freal-4-real-10[real 4 real 10]'
    '-freal-4-real-16[real 4 real 16]'
    '-freal-4-real-8[real 4 real 8]'
    '-freal-8-real-10[real 8 real 10]'
    '-freal-8-real-16[real 8 real 16]'
    '-freal-8-real-4[real 8 real 4]'
    '-frealloc-lhs[realloc lhs]'
    '-frecord-command-line[record command line]'
    '-frecord-marker=[record marker]:arg'
    '-frecursive[recursive]'
    '-fregister-global-dtors-with-atexit[use atexit to register global destructors]'
    '-frelaxed-template-template-args[enable C++17 relaxed template template argument matching]'
    '-frepack-arrays[repack arrays]'
    '-freroll-loops[turn on loop reroller]'
    '-fretain-comments-from-system-headers[retain comments from system headers]'
    '-frewrite-imports[rewrite imports]'
    '-frewrite-includes[rewrite includes]'
    '-frewrite-map-file=[rewrite map file]:arg'
    '-fropi[generate read-only position independent code (ARM only)]'
    '-frtlib-add-rpath[add -rpath with architecture-specific resource directory to the linker flags]'
    '-frtti-data[rtti data]'
    '-frwpi[generate read-write position independent code (ARM only)]'
    '-fsanitize-address-destructor-kind=[set destructor type used in ASan instrumentation]:kind'
    '-fsanitize-address-field-padding=[level of field padding for AddressSanitizer]:arg'
    '-fsanitize-address-globals-dead-stripping[enable linker dead stripping of globals in AddressSanitizer]'
    '-fsanitize-address-poison-custom-array-cookie[enable poisoning array cookies when using custom operator new in AddressSanitizer]'
    '-fsanitize-address-use-after-scope[enable use-after-scope detection in AddressSanitizer]'
    '-fsanitize-address-use-odr-indicator[enable ODR indicator globals]'
    '-fsanitize-blacklist=[path to blacklist file for sanitizers]:arg'
    '-fsanitize-cfi-canonical-jump-tables[make the jump table addresses canonical in the symbol table]'
    '-fsanitize-cfi-cross-dso[enable control flow integrity (CFI) checks for cross-DSO calls]'
    '-fsanitize-cfi-icall-generalize-pointers[generalize pointers in CFI indirect call type signature checks]'
    '-fsanitize-coverage-allowlist=[sanitize coverage allowlist]:arg'
    '-fsanitize-coverage-blacklist=[disable sanitizer coverage instrumentation]:arg'
    '-fsanitize-coverage-blocklist=[sanitize coverage blocklist]:arg'
    '-fsanitize-coverage=[specify the type of coverage instrumentation for Sanitizers]:arg'
    '-fsanitize-coverage-whitelist=[restrict sanitizer coverage instrumentation]:arg'
    '-fsanitize-hwaddress-abi=[select the HWAddressSanitizer ABI to target]:arg'
    '-fsanitize-link-c\+\+-runtime[sanitize link c++ runtime]'
    '-fsanitize-link-runtime[sanitize link runtime]'
    '-fsanitize-memory-track-origins=[enable origins tracking in MemorySanitizer]::arg'
    '-fsanitize-memory-use-after-dtor[enable use-after-destroy detection in MemorySanitizer]'
    '-fsanitize-minimal-runtime[sanitize minimal runtime]'
    '-fsanitize-recover=[enable recovery for specified sanitizers]::arg'
    '-fsanitize-stats[enable sanitizer statistics gathering]'
    '-fsanitize-system-blacklist[path to system blacklist file for sanitizers]:file:_files'
    '-fsanitize-thread-atomics[enable atomic operations instrumentation in ThreadSanitizer (default)]'
    '-fsanitize-thread-func-entry-exit[enable function entry/exit instrumentation in ThreadSanitizer]'
    '-fsanitize-thread-memory-access[enable memory access instrumentation in ThreadSanitizer]'
    '-fsanitize-trap=[enable trapping for specified sanitizers]::arg'
    '-fsanitize-undefined-strip-path-components=[strip a given number of path components when emitting check metadata]:number'
    '-fsanitize-undefined-trap-on-error[equivalent to -fsanitize-trap=undefined]'
    '-fsave-optimization-record=[generate an optimization record file in a specific format]::format'
    '-fsecond-underscore[second underscore]'
    '-fseh-exceptions[use SEH style exceptions]'
    '-fsemantic-interposition[semantic interposition]'
    '-fshow-column[show the column]'
    '-fshow-overloads=[which overload candidates to show when overload resolution fails]:arg'
    '-fshow-source-location[show source location]'
    '-fsignaling-math[signaling math]'
    '-fsign-zero[sign zero]'
    '-fsized-deallocation[enable C++14 sized global deallocation functions]'
    '-fsjlj-exceptions[use SjLj style exceptions]'
    '-fslp-vectorize[enable the superword-level parallelism vectorization passes]'
    '-fspell-checking-limit=[spell checking limit]:arg'
    '-fspell-checking[spell checking]'
    '-fsplit-dwarf-inlining[provide minimal debug info in the object]'
    '-fsplit-lto-unit[enables splitting of the LTO unit]'
    '-fsplit-machine-functions[enable late function splitting using profile information]'
    '-fstack-arrays[stack arrays]'
    '-fstack-clash-protection[enable stack clash protection]'
    '-fstack-size-section[emit section containing metadata on function stack sizes]'
    '-fstandalone-debug[emit full debug info for all types used by the program]'
    '-fstrict-float-cast-overflow[assume that overflowing float-to-int casts are undefined]'
    '-fstrict-return[strict return]'
    '-fstrict-vtable-pointers[enable optimizations based on the strict vtables]'
    '-fstruct-path-tbaa[struct path tbaa]'
    '-fsycl[enable SYCL kernels compilation for device]'
    '-fsymbol-partition=[symbol partition]:arg'
    '-fsystem-module[build this module as a system module. only used with -emit-module]'
    '-ftemplate-backtrace-limit=[template backtrace limit]:arg'
    '-ftemplate-depth--[template depth]:arg'
    '-ftemplate-depth=[template depth]:arg'
    '-fterminated-vtables[terminated vtables]'
    '-fthin-link-bitcode=[write minimized bitcode to <file>]:file:_files'
    '-fthinlto-index=[perform ThinLTO importing using provided index]:arg'
    '-fthreadsafe-statics[threadsafe statics]'
    '-ftime-trace-granularity=[minimum time granularity traced by time profiler]:microseconds'
    '-ftime-trace[turn on time profiler]'
    '-ftrap-function=[issue call to specified function rather than a trap instruction]:function name'
    '-ftrapv-handler=[specify the function to be called on overflow]:function name'
    '-ftrigraphs[process trigraph sequences]'
    '-ftrivial-auto-var-init=[initialize trivial automatic stack variables]:arg'
    '-ftrivial-auto-var-init-stop-after=[stop initializing trivial automatic stack variables after the specified number of instances]:arg'
    '-funderscoring[underscoring]'
    '-funique-basic-block-section-names[use unique names for basic block sections]'
    '-funique-internal-linkage-names[uniqueify Internal Linkage Symbol Names]'
    '-funique-section-names[unique section names]'
    '-funit-at-a-time[unit at a time]'
    '-fuse-cuid=[method to generate ids for compilation units for single source offloading languages CUDA and HIP]:argument'
    '-fuse-cxa-atexit[use cxa atexit]'
    '-fuse-init-array[use init array]'
    '-fuse-line-directives[use #line in preprocessed output]'
    '-fvalidate-ast-input-files-content[compute and store the hash of input files used to build an AST]'
    '-fveclib=[use the given vector functions library]:arg'
    '-fvectorize[enable the loop vectorization passes]'
    '-fvirtual-function-elimination[enables dead virtual function elimination optimization]'
    '-fvisibility-dllexport=[the visibility for dllexport defintions]:arg'
    '-fvisibility-externs-dllimport=[the visibility for dllimport external declarations]:arg'
    '-fvisibility-externs-nodllstorageclass=[the visibility for external declarations without an explicit DLL dllstorageclass]:arg'
    '-fvisibility-from-dllstorageclass[set the visiblity of symbols in the generated code from their DLL storage class]'
    '-fvisibility-global-new-delete-hidden[give global C++ operator new and delete declarations hidden visibility]'
    '-fvisibility-inlines-hidden[give inline C++ member functions hidden visibility by default]'
    '-fvisibility-inlines-hidden-static-local-var[visibility inlines hidden static local var]'
    '-fvisibility-ms-compat[give global types and functions a specific visibility]'
    '-fvisibility-nodllstorageclass=[the visibility for defintiions without an explicit DLL export class]:arg'
    '-fwasm-exceptions[use WebAssembly style exceptions]'
    '-fwhole-file[whole file]'
    '-fwhole-program-vtables[enables whole-program vtable optimization]'
    '-fwritable-strings[store string literals as writable data]'
    '-fxl-pragma-pack[enable IBM XL #pragma pack handling]'
    '-fxor-operator[enable .XOR. as a synonym of .NEQV.]'
    '-fxray-always-emit-customevents[always emit xray customevent calls]'
    '-fxray-always-emit-typedevents[always emit xray typedevents calls]'
    '-fxray-always-instrument=[file defining xray always instrument]:file:_files'
    '-fxray-attr-list=[file defining the list of xray attributes]:file:_files'
    '-fxray-function-groups=[only instrument 1 of N groups]:arg'
    '-fxray-function-index[xray function index]'
    "-fxray-ignore-loops[don't instrument functions with loops unless they also meet the minimum function size]"
    '-fxray-instruction-threshold=[sets the minimum function size to instrument with XRay]:arg'
    '-fxray-instrumentation-bundle=[select which XRay instrumentation points to emit]:arg'
    '-fxray-instrument[generate XRay instrumentation sleds on function entry and exit]'
    '-fxray-link-deps[tells clang to add the link dependencies for XRay]'
    '-fxray-modes=[list of modes to link in by default into XRay instrumented binaries]:arg'
    '-fxray-never-instrument=[file defining the whitelist for Xray attributes]:file:_files'
    '-fxray-selected-function-group=[select which group of functions to instrument]:arg'
    '-fzvector[enable System z vector language extension]'
    {-gcc-toolchain=,--gcc-toolchain=}'[use the gcc toolchain at the given directory]:directory:_files -/'
    '-gcodeview[generate CodeView debug information]'
    {-gcodeview-ghash,-gno-codeview-ghash}'[emit type record hashes is a .debug section]'
    '-gcolumn-info[column info]'
    '-gdwarf-aranges[DWARF aranges]'
    '-gembed-source[embed source text in DWARF debug sections]'
    '-gfull[emit debugging information for all symbols and types]'
    {-G-,-G=-,-msmall-data-limit=,-msmall-data-threshold}'[put objects of at most size bytes into small data section]:size'
    '-ggnu-pubnames[gnu pubnames]'
    '-ginline-line-tables[inline line tables]'
    '-gline-directives-only[emit debug line info directives only]'
    '-gline-tables-only[line tables only]'
    '-glldb[lldb]'
    '-gmlt[emit debug line number tables only]'
    '-gmodules[generate debug info with external references]'
    '-gno-column-info[no column info]'
    '-gno-embed-source[no embed source]'
    '-gno-gnu-pubnames[no gnu pubnames]'
    '-gno-inline-line-tables[no inline line tables]'
    '-gno-record-command-line[no record command line]'
    '--gpu-instrument-lib=[instrument device library for HIP]:argument'
    '--gpu-max-threads-per-block=[default max threads per block for kernel launch bounds for HIP]'
    '-grecord-command-line[record command line]'
    '-gsce[sce]'
    '-gused[emit debugging information for symbols that are used]'
    '-gz=[DWARF debug sections compression type]::arg'
    '-headerpad_max_install_names[headerpad max install names]:argument'
    '-help[display this information]'
    '--help-hidden[display help for hidden options]'
    '--hip-device-lib=[hIP device library]:arg'
    '--hip-device-lib-path=[hip device lib path]:arg'
    '--hip-link[link clang-offload-bundler bundles for HIP]'
    '--hip-version=[HIP version in the format of major.minor.patch]'
    '-ibuiltininc[enable builtin #include directories even when -nostdinc is used before or after -ibuiltininc]'
    '-iframework[add directory to SYSTEM framework search path]:directory:_files -/'
    '-iframeworkwithsysroot[add directory to SYSTEM framework search path, absolute paths are relative to -isysroot]:directory:_files -/'
    '-image_base[image base]:argument'
    '-include-pch[include precompiled header file]:file:_files'
    '-index-header-map[make the next included directory (-I or -F) an indexer header map]'
    '-init[init]:arg'
    '-install_name[install name]:arg'
    '-integrated-as[integrated as]'
    '-interface-stub-version=[interface stub version]:arg'
    '-isystem-after[add directory to end of the SYSTEM include search path]:directory:_files -/'
    '-ivfsoverlay[overlay the virtual filesystem described by file over the real file system]:arg'
    '-iwithsysroot[add directory to SYSTEM include search path]:directory:_files -/'
    '-J[this option specifies where to put .mod files for compiled modules]:arg'
    '-keep_private_externs[keep private externs]'
    '*-lazy_framework[lazy framework]:framework:->framework'
    '*-lazy_library[lazy library]:arg'
    '--ld-path=[ld path]:arg'
    '--libomptarget-amdgcn-bc-path=[path to libomptarget-amdgcn bitcode library]:arg'
    '--libomptarget-nvptx-bc-path=[path to libomptarget-nvptx bitcode library]:arg'
    '--library-directory=[add directory to library search path]:directory:_files -/'
    '-maix-struct-return[return all structs in memory]'
    "-malign-branch-boundary=[specify the boundary's size to align branches]:size"
    '-malign-branch=[specify types of branches to align]:arg'
    '-mappletvos-version-min=[appletvos version min]:arg'
    '-mappletvsimulator-version-min=[appletvsimulator version min]:arg'
    '-mbackchain[link stack frames through backchain on System Z]'
    '-mbig-endian[big endian]'
    '-mbranches-within-32B-boundaries[align selected branches within 32-byte boundary]'
    '-mbranch-protection=[enforce targets of indirect branches and function returns]:arg'
    '-mcode-object-v3[legacy option to specify code object ABI V3]'
    '-mcode-object-version=[specify code object ABI version]:version'
    '-mconsole[console]:arg'
    '-mcrc[allow use of CRC instructions]'
    '-mdefault-build-attributes[default build attributes]:arg'
    '-mdll[dll]:arg'
    '-mdouble=[force double to be 32 bits or 64 bits]:arg'
    '-mdynamic-no-pic[dynamic no pic]:arg'
    '-meabi[set EABI type]:arg'
    '-menable-experimental-extensions[enable use of experimental RISC-V extensions]'
    '-menable-unsafe-fp-math[allow unsafe floating-point math optimizations which may decrease precision]'
    '-mfix-cortex-a53-835769[workaround Cortex-A53 erratum 835769]'
    '-mfloat-abi=[float abi]:arg'
    '-mfpu=[fpu]:arg'
    '-mglobal-merge[enable merging of globals]'
    '-mharden-sls=[select straight-line speculation hardening scope]:arg'
    '--mhwdiv=[hwdiv]:arg'
    '-mhwdiv=[hwdiv]:arg'
    '-mhwmult=[hwmult]:arg'
    '-mignore-xcoff-visibility[do not emit the visibility attribute for asm]'
    '--migrate[run the migrator]'
    '-mimplicit-float[implicit float]'
    '-mimplicit-it=[implicit it]:arg'
    '-mincremental-linker-compatible[emit an object file which can be used with an incremental linker]'
    '-mios-simulator-version-min=[ios simulator version min]:arg'
    '-mios-version-min=[ios version min]:arg'
    '-miphoneos-version-min=[iphoneos version min]:arg'
    '-miphonesimulator-version-min=[iphonesimulator version min]:arg'
    '-mkernel[kernel]'
    '-mlinker-version=[linker version]:arg'
    '-mlittle-endian[little endian]'
    "-mllvm[additional arguments to forward to LLVM's option processing]:arg"
    '-mlong-calls[generate branches with extended addressability]'
    '-mlvi-cfi[enable only control-flow mitigations for Load Value Injection]'
    '-mlvi-hardening[enable all mitigations for Load Value Injection]'
    '-mmacos-version-min=[set Mac OS X deployment target]:arg'
    '-mmacosx-version-min=[macosx version min]:arg'
    '-mmcu=[mcu]:arg'
    '-module-dependency-dir[directory to dump module dependencies to]:arg'
    '-module-dir[odule dir]:dir'
    '-module-file-info[provide information about a particular module file]'
    '-moslib=[oslib]:arg'
    '-moutline-atomics[generate local calls to out-of-line atomic operations]'
    '-mpacked-stack[use packed stack layout]'
    '-mpad-max-prefix-size=[specify maximum number of prefixes to use for padding]:arg'
    '-mpie-copy-relocations[pie copy relocations]'
    '-mprefer-vector-width=[specifies preferred vector width]:arg'
    '-mqdsp6-compat[enable hexagon-qdsp6 backward compatibility]'
    '-mrelax-all[relax all machine instructions]'
    '-mrelax[enable linker relaxation]'
    '-mretpoline[retpoline]'
    '-mseses[enable speculative execution side effect suppression (SESES)]'
    '-msign-return-address=[select return address signing scope]:arg'
    '-msim[sim]'
    '-mspeculative-load-hardening[speculative load hardening]'
    '-mstack-alignment=[set the stack alignment]:arg'
    '-mstack-probe-size=[set the stack probe size]:size'
    '-mstack-protector-guard-offset=[use the given offset for addressing the stack-protector guard]:arg'
    '-mstack-protector-guard-reg=[use the given reg for addressing the stack-protector guard]:reg'
    '-msvr4-struct-return[return small structs in registers]'
    '-mthread-model[the thread model to use]:arg'
    '-mthumb[thumb]'
    '-mtls-size=[specify bit size of immediate TLS offsets]:arg'
    '-mtvos-simulator-version-min=[tvos simulator version min]:arg'
    '-mtvos-version-min=[tvos version min]:arg'
    '-multi_module[multi module]'
    '-multiply_defined[multiply defined]:arg'
    '-multiply_defined_unused[multiply defined unused]:arg'
    '-municode[unicode]:arg'
    '-munsafe-fp-atomics[enable unsafe floating point atomic instructions]'
    '-mv55[equivalent to -mcpu=hexagonv55]'
    '-mv5[equivalent to -mcpu=hexagonv5]'
    '-mv60[equivalent to -mcpu=hexagonv60]'
    '-mv62[equivalent to -mcpu=hexagonv62]'
    '-mv65[equivalent to -mcpu=hexagonv65]'
    '-mv66[equivalent to -mcpu=hexagonv66]'
    '-mv67[equivalent to -mcpu=hexagonv67]'
    '-mv67t[equivalent to -mcpu=hexagonv67t]'
    '-mv68[equivalent to -mcpu=hexagonv68]'
    '-mvx[vx]'
    '-mwarn-nonportable-cfstrings[warn nonportable cfstrings]'
    '-mwatchos-simulator-version-min=[watchos simulator version min]:arg'
    '-mwatchos-version-min=[watchos version min]:arg'
    '-mwatchsimulator-version-min=[watchsimulator version min]:arg'
    '-mwavefrontsize64[specify wavefront size 64 mode]'
    '-mwindows[windows]:arg'
    '-mzvector[zvector]'
    '-nobuiltininc[do not search builtin directory for include files]'
    '-nocpp[no cpp]'
    '-nocudainc[do not add include paths for CUDA/HIP and do not include the default CUDA/HIP wrapper headers]'
    '*--no-cuda-include-ptx=[do not include ptx for the following gpu architecture]:argument'
    '-nocudalib[do not link device library for CUDA/HIP device compilation]'
    '--no-cuda-noopt-device-debug[disable device-side debug info generation]'
    "--no-cuda-version-check[don't error out if the detected version of the CUDA install is too low for the requested CUDA gpu architecture]"
    '-no_dead_strip_inits_and_terms[no dead strip inits and terms]'
    '-nofixprebinding[no fixprebinding]'
    '-nogpuinc[no gpuinc]'
    '-nogpulib[no gpulib]'
    '--no-integrated-cpp[no integrated cpp]'
    '-no-integrated-cpp[no integrated cpp]'
    '-nolibc[no libc]'
    '-nomultidefs[no multidefs]'
    '--no-offload-arch=[no offload arch]:arg'
    '-no-pie[no pie]'
    '-nopie[no pie]'
    '-noprebind[no prebind]'
    '-noprofilelib[no profilelib]'
    '-no-pthread[no pthread]'
    '-noseglinkedit[no seglinkedit]'
    '--no-standard-libraries[no standard libraries]'
    '-nostdinc\+\+[disable standard #include directories for the C++ standard library]'
    '-nostdlibinc[do not search standard system directories for include files]'
    '-nostdlib\+\+[no stdlib++]'
    '--no-system-header-prefix=[no system header prefix]:prefix'
    '--no-undefined[no undefined]'
    '-objcmt-atomic-property[make migration to atomic properties]'
    '-objcmt-migrate-all[enable migration to modern ObjC]'
    '-objcmt-migrate-annotation[enable migration to property and method annotations]'
    '-objcmt-migrate-designated-init[enable migration to infer NS_DESIGNATED_INITIALIZER for initializer methods]'
    '-objcmt-migrate-instancetype[enable migration to infer instancetype for method result type]'
    '-objcmt-migrate-literals[enable migration to modern ObjC literals]'
    '-objcmt-migrate-ns-macros[enable migration to NS_ENUM/NS_OPTIONS macros]'
    '-objcmt-migrate-property-dot-syntax[enable migration of setter/getter messages to property-dot syntax]'
    '-objcmt-migrate-property[enable migration to modern ObjC property]'
    '-objcmt-migrate-protocol-conformance[enable migration to add protocol conformance on classes]'
    '-objcmt-migrate-readonly-property[enable migration to modern ObjC readonly property]'
    '-objcmt-migrate-readwrite-property[enable migration to modern ObjC readwrite property]'
    '-objcmt-migrate-subscripting[enable migration to modern ObjC subscripting]'
    "-objcmt-ns-nonatomic-iosonly[enable migration to use NS_NONATOMIC_IOSONLY macro for setting property's atomic attribute]"
    '-objcmt-returns-innerpointer-property[enable migration to annotate property with NS_RETURNS_INNER_POINTER]'
    '-objcmt-whitelist-dir-path=[objcmt whitelist dir path]:arg'
    '-objcmt-white-list-dir-path=[only modify files with a filename contained in the provided directory path]:arg'
    '-ObjC[treat source files as Objective-C]'
    '-ObjC\+\+[treat source files as Objective-C++]'
    '-object[object]'
    '--offload-arch=[offload arch]:arg'
    '--output-class-directory=[output class directory]:arg'
    '-pagezero_size[pagezero size]:arg'
    '-pg[enable mcount instrumentation]'
    {-p,--profile}'[enable function profiling for prof]'
    '-prebind_all_twolevel_modules[prebind all twolevel modules]'
    '-prebind[prebind]'
    '--precompile[only precompile the input]'
    '-preload[preload]'
    '--print-diagnostic-categories[print diagnostic categories]'
    '-print-effective-triple[print effective triple]'
    '--print-effective-triple[print the effective target triple]'
    '--print-file-name=[print the full library path of <file>]:file:_files'
    '-print-ivar-layout[enable Objective-C Ivar layout bitmap print trace]'
    '--print-libgcc-file-name[print the library path for the currently used compiler runtime library]'
    '--print-multi-directory[print multi directory]'
    '--print-multi-lib[print multi lib]'
    '--print-prog-name=[print the full program path of <name>]:name'
    '-print-resource-dir[print resource dir]'
    '--print-resource-dir[print the resource directory pathname]'
    '--print-search-dirs[print the paths used for finding libraries and programs]'
    '--print-supported-cpus[print supported cpus]'
    '-print-supported-cpus[print supported cpus]'
    '-print-targets[print targets]'
    '--print-targets[print the registered targets]'
    '-print-target-triple[print target triple]'
    '--print-target-triple[print the normalized target triple]'
    '-private_bundle[private bundle]'
    '--profile-blocks[undocumented option]'
    '-pthreads[pthreads]'
    '-pthread[support POSIX threads in generated code]'
    '--ptxas-path=[path to ptxas (used for compiling CUDA code)]:arg'
    "-Qunused-arguments[don't emit warning for unused driver arguments]"
    '-read_only_relocs[read only relocs]:arg'
    '-relocatable-pch[relocatable pch]'
    '--relocatable-pch[whether to build a relocatable precompiled header]'
    '-R[enable the specified remark]:remark'
    '--resource=[resource]:arg'
    '-rewrite-legacy-objc[rewrite Legacy Objective-C source to C++]'
    '-rewrite-objc[rewrite Objective-C source to C++]'
    '--rocm-device-lib-path=[rOCm device library path]:arg'
    '--rocm-path=[rOCm installation path]:arg'
    '-Rpass-analysis=[report transformation analysis from optimization passes]:regex'
    '-Rpass-missed=[report missed transformations by optimization passes]:arg'
    '-Rpass=[report transformations performed by optimization passes]:arg'
    '-rpath[rpath]:arg'
    '-r[product a relocatable object as output]'
    '--rtlib=[compiler runtime library to use]:arg'
    '-rtlib=[rtlib]:arg'
    '--save-stats=[save llvm statistics]:arg'
    '-sectalign[sectalign]:arg'
    '-sectcreate[sectcreate]:arg'
    '-sectobjectsymbols[sectobjectsymbols]:arg'
    '-sectorder[sectorder]:arg'
    '-seg1addr[seg1addr]:arg'
    '-segaddr[segaddr]:arg'
    '-seg_addr_table_filename[seg addr table filename]:arg'
    '-seg_addr_table[seg addr table]:arg'
    '-segcreate[segcreate]:arg'
    '-seglinkedit[seglinkedit]'
    '-segprot[segprot]:arg'
    '-segs_read_only_addr[segs read only addr]:arg'
    '-segs_read_[segs read]:arg'
    '-segs_read_write_addr[segs read write addr]:arg'
    '--serialize-diagnostics[serialize compiler diagnostics to a file]:arg'
    '-serialize-diagnostics[serialize diagnostics]:arg'
    '-shared-libasan[dynamically link the sanitizer runtime]'
    '-shared-libsan[shared libsan]'
    '--shared[shared]'
    '--signed-char[signed char]'
    '-single_module[single module]'
    '--specs=[specs]:arg'
    '-static-libgfortran[static libgfortran]'
    '-static-libsan[statically link the sanitizer runtime]'
    '-static-libstdc\+\+[static libstdc++]'
    '-static-openmp[use the static host OpenMP runtime while linking.]'
    '-static-pie[static pie]'
    '--static[static]'
    '-std-default=[std default]:arg'
    '--stdlib=[c++ standard library to use]:arg'
    '-stdlib\+\+-isystem[use directory as the C++ standard library include path]:directory:_files -/'
    '-stdlib=[stdlib]:arg'
    '-sub_library[sub library]:arg'
    '-sub_umbrella[sub umbrella]:arg'
    '-sycl-std=[SYCL language standard to compile for]:standard'
    '--system-header-prefix=[treat all #include paths starting with <prefix> as including a system header]:prefix'
    '-target[generate code for the given target]:arg'
    '--target=[target]:arg'
    '-Tbss[set starting address of BSS to <addr>]:addr'
    '-Tdata[set starting address of DATA to <addr>]:addr'
    '--traditional[traditional]'
    '-traditional[traditional]'
    '-Ttext[set starting address of TEXT to <addr>]:addr'
    '-t[undocumented option]'
    '-twolevel_namespace_hints[twolevel namespace hints]'
    '-twolevel_namespace[twolevel namespace]'
    '-umbrella[umbrella]:arg'
    '-undefined[undefined]:arg'
    '-unexported_symbols_list[unexported symbols list]:arg'
    '--unsigned-char[unsigned char]'
    '--unwindlib=[unwind library to use]:arg'
    '-unwindlib=[unwindlib]:arg'
    '--verify-debug-info[verify the binary representation of debug output]'
    '-verify-pch[load and verify that a pre-compiled header file is not stale]'
    '--warn-=-[enable the specified warning]:warning:->warning'
    '*-weak_framework[weak framework]:framework:->framework'
    '*-weak_library[weak library]:arg'
    '-weak-l[weak l]:arg'
    '-weak_reference_mismatches[weak reference mismatches]:arg'
    '-whatsloaded[whatsloaded]'
    '-whyload[whyload]'
    '-working-directory=[resolve file paths relative to the specified directory]:arg'
    '-Xanalyzer[pass <arg> to the static analyzer]:arg'
    '-Xarch_device[pass arg to CUDA/HIP device compilation]:argument'
    '-Xarch_host[pass arg to CUDA/HIP host compilation]:argument'
    '-Xclang[pass <arg> to the clang compiler]:arg'
    '-Xcuda-fatbinary[pass arg to fatbinary invocation]:argument'
    '-Xcuda-ptxas[pass arg to the ptxas assemler]:argument'
    '-Xflang[pass <arg> to the flang compiler]:arg'
    '-Xopenmp-target[pass arg to the the target offloading toolchain]:argument'
    '-y[the action to perform on the input]:arg'
    '-Z-[undocumented option]:argument'
  )
else
  args+=(
    '--dump=[dump information]:argument'
    '-flto=-[enable link-time optimization]::jobs:'
    '*--help=-[display this information]:class:->help'
  )
fi

local -a sanitizers
sanitizers=(
  address alignment bool bounds enum float-cast-overflow float-divide-by-zero
  integer-divide-by-zero memory nonnull-attribute null nullability-arg
  nullability-assign nullability-return object-size pointer-overflow return
  unsigned-integer-overflow returns-nonnull-attribute shift signed-integer-overflow
  unreachable vla-bound vptr
)

local -a languages
languages=(
  c c-header cpp-output c++ c++-header c++-cpp-output objective-c objective-c-header
  objective-c-cpp-output objective-c++ objective-c++-header objective-c++-cpp-output
  assembler assembler-with-cpp ada f77 f77-cpp-input f95 f95-cpp-input go java
  brig none
)

# warnings (from --help=warnings), note some -W options are listed by --help=common instead
warnings+=(
  '-Wabi-tag[warn if a subobject has an abi_tag attribute that the complete object type does not have]'
  '-Wabi[warn about things that will change when compiling with an ABI-compliant compiler]::'
  '-Waddress[warn about suspicious uses of memory addresses]'
  '-Waggregate-return[warn about returning structures, unions or arrays]'
  '-Waggressive-loop-optimizations[warn if a loop with constant number of iterations triggers undefined behavior]'
  '-Waliasing[warn about possible aliasing of dummy arguments]'
  '-Walign-commons[warn about alignment of COMMON blocks]'
  '-Waligned-new=[warn even if '\'new\'' uses a class member allocation function]:none|global|all: '
  '-Wall[enable most warning messages]'
  '-Walloca-larger-than=[warn on unbounded uses of alloca, and on bounded uses of alloca whose bound can be larger than <number> bytes]:bytes: '
  '-Walloca[warn on any use of alloca]'
  '-Walloc-size-larger-than=[warn for calls to allocation functions that attempt to allocate objects larger than the specified number of bytes]:bytes: '
  '-Walloc-zero[warn for calls to allocation functions that specify zero bytes]'
  '-Wampersand[warn about missing ampersand in continued character constants]'
  '-Wargument-mismatch[warn about type and rank mismatches between arguments and parameters]'
  '-Warray-bounds[warn if an array is accessed out of bounds]'
  '-Warray-bounds=[warn if an array is accessed out of bounds]:level:(1 2)'
  '-Warray-temporaries[warn about creation of array temporaries]'
  '-Wassign-intercept[warn whenever an Objective-C assignment is being intercepted by the garbage collector]'
  '-Wattributes[warn about inappropriate attribute usage]'
  '-Wbad-function-cast[warn about casting functions to incompatible types]'
  '-Wbool-compare[warn about boolean expression compared with an integer value different from true/false]'
  '-Wbool-operation[warn about certain operations on boolean expressions]'
  '-Wbuiltin-declaration-mismatch[warn when a built-in function is declared with the wrong signature]'
  '-Wbuiltin-macro-redefined[warn when a built-in preprocessor macro is undefined or redefined]'
  '-Wc++0x-compat[deprecated in favor of -Wc++11-compat]'
  '-Wc++11-compat[warn about C++ constructs whose meaning differs between ISO C++ 1998 and ISO C++ 2011]'
  '-Wc++14-compat[warn about C++ constructs whose meaning differs between ISO C++ 2011 and ISO C++ 2014]'
  '-Wc++1z-compat[warn about C++ constructs whose meaning differs between ISO C++ 2014 and (forthcoming) ISO C++ 201z(7?)]'
  '-Wc90-c99-compat[warn about features not present in ISO C90, but present in ISO C99]'
  '-Wc99-c11-compat[warn about features not present in ISO C99, but present in ISO C11]'
  '-Wcast-align[warn about pointer casts which increase alignment]'
  '-Wcast-qual[warn about casts which discard qualifiers]'
  '-Wc-binding-type[warn if the type of a variable might be not interoperable with C]'
  '-Wc++-compat[warn about C constructs that are not in the common subset of C and C++]'
  '-Wcharacter-truncation[warn about truncated character expressions]'
  '-Wchar-subscripts[warn about subscripts whose type is "char"]'
  '-Wchkp[warn about memory access errors found by Pointer Bounds Checker]'
  '-Wclobbered[warn about variables that might be changed by "longjmp" or "vfork"]'
  '-Wcomments[synonym for -Wcomment]'
  '-Wcomment[warn about possibly nested block comments, and C++ comments spanning more than one physical line]'
  '-Wcompare-reals[warn about equality comparisons involving REAL or COMPLEX expressions]'
  '-Wconditionally-supported[warn for conditionally-supported constructs]'
  '-Wconversion-extra[warn about most implicit conversions]'
  '-Wconversion-null[warn for converting NULL from/to a non-pointer type]'
  '-Wconversion[warn for implicit type conversions that may change a value]'
  '-Wcoverage-mismatch[warn in case profiles in -fprofile-use do not match]'
  '-Wcpp[warn when a #warning directive is encountered]'
  '-Wctor-dtor-privacy[warn when all constructors and destructors are private]'
  '-Wdangling-else[warn about dangling else]'
  '-Wdate-time[warn about __TIME__, __DATE__ and __TIMESTAMP__ usage]'
  '-Wdeclaration-after-statement[warn when a declaration is found after a statement]'
  '-Wdelete-incomplete[warn when deleting a pointer to incomplete type]'
  '-Wdelete-non-virtual-dtor[warn about deleting polymorphic objects with non- virtual destructors]'
  '-Wdeprecated-declarations[warn about uses of __attribute__((deprecated)) declarations]'
  '-Wdeprecated[warn if a deprecated compiler feature, class, method, or field is used]'
  '-Wdesignated-init[warn about positional initialization of structs requiring designated initializers]'
  '-Wdisabled-optimization[warn when an optimization pass is disabled]'
  '-Wdiscarded-array-qualifiers[warn if qualifiers on arrays which are pointer targets are discarded]'
  '-Wdiscarded-qualifiers[warn if type qualifiers on pointers are discarded]'
  '-Wdiv-by-zero[warn about compile-time integer division by zero]'
  '-Wdouble-promotion[warn about implicit conversions from "float" to "double"]'
  '-Wduplicated-branches[warn about duplicated branches in if-else statements]'
  '-Wduplicated-cond[warn about duplicated conditions in an if-else-if chain]'
  '-Wduplicate-decl-specifier[warn when a declaration has duplicate const, volatile, restrict or _Atomic specifier]'
  '-Weffc\+\+[warn about violations of Effective C++ style rules]'
  '-Wempty-body[warn about an empty body in an if or else statement]'
  '-Wendif-labels[warn about stray tokens after #else and #endif]'
  '-Wenum-compare[warn about comparison of different enum types]'
  # '-Werror-implicit-function-declaration[this switch is deprecated; use -Werror=implicit-fun]' # this still exists but makes completing -Werror= less convenient
  '-Wexpansion-to-defined[warn if "defined" is used outside #if]'
  '-Wextra[print extra (possibly unwanted) warnings]'
  '-Wfloat-conversion[warn for implicit type conversions that cause loss of floating point precision]'
  '-Wfloat-equal[warn if testing floating point numbers for equality]'
  '-Wformat-contains-nul[warn about format strings that contain NUL bytes]'
  '-Wformat-extra-args[warn if passing too many arguments to a function for its format string]'
  '-Wformat-nonliteral[warn about format strings that are not literals]'
  '-Wformat-overflow[warn about function calls with format strings that write past the end of the destination region]'
  '-Wformat-overflow=[warn about function calls with format strings that write past the end of the destination region]:level:(1 2)'
  '-Wformat-security[warn about possible security problems with format functions]'
  '-Wformat-signedness[warn about sign differences with format functions]'
  '-Wformat-truncation[warn about calls to snprintf and similar functions that truncate output. Same as -Wformat- truncation=1.  Same as -Wformat-truncation=]'
  '-Wformat-truncation=[warn about calls to snprintf and similar functions that truncate output]:level:(1 2)'
  '-Wformat=[warn about printf/scanf/strftime/strfmon format string anomalies]::level:(1 2)'
  '-Wformat-y2k[warn about strftime formats yielding 2-digit years]'
  '-Wformat-zero-length[warn about zero-length formats]'
  '-Wframe-address[warn when __builtin_frame_address or __builtin_return_address is used unsafely]'
  '-Wframe-larger-than=[warn if a function'\''s stack frame requires more than <number> bytes]:bytes: '
  '-Wfree-nonheap-object[warn when attempting to free a non-heap object]'
  '-Wfunction-elimination[warn about function call elimination]'
  '-Whsa[warn when a function cannot be expanded to HSAIL]'
  '-Wignored-attributes[warn whenever attributes are ignored]'
  '-Wignored-qualifiers[warn whenever type qualifiers are ignored]'
  '-Wimplicit-fallthrough=[warn when a switch case falls through]:level:(1 2 3 4 5)'
  '-Wimplicit-function-declaration[warn about implicit function declarations]'
  '-Wimplicit-interface[warn about calls with implicit interface]'
  '-Wimplicit-int[warn when a declaration does not specify a type]'
  '-Wimplicit-procedure[warn about called procedures not explicitly declared]'
  '-Wimplicit[warn about implicit declarations]'
  '-Wimport[warn about imports]'
  '-Wincompatible-pointer-types[warn when there is a conversion between pointers that have incompatible types]'
  '-Winherited-variadic-ctor[warn about C++11 inheriting constructors when the base has a variadic constructor]'
  '-Winit-self[warn about variables which are initialized to themselves]'
  '-Winline[warn when an inlined function cannot be inlined]'
  '-Wint-conversion[warn about incompatible integer to pointer and pointer to integer conversions]'
  '-Winteger-division[warn about constant integer divisions with truncated results]'
  '-Wint-in-bool-context[warn for suspicious integer expressions in boolean context]'
  '-Wintrinsic-shadow[warn if a user-procedure has the same name as an intrinsic]'
  '-Wintrinsics-std[warn on intrinsics not part of the selected standard]'
  '-Wint-to-pointer-cast[warn when there is a cast to a pointer from an integer of a different size]'
  '-Winvalid-memory-model[warn when an atomic memory model parameter is known to be outside the valid range]'
  '-Winvalid-offsetof[warn about invalid uses of the "offsetof" macro]'
  '-Winvalid-pch[warn about PCH files that are found but not used]'
  '-Wjump-misses-init[warn when a jump misses a variable initialization]'
  '-Wlarger-than=[warn if an object is larger than <number> bytes]:bytes: '
  '-Wline-truncation[warn about truncated source lines]'
  '-Wliteral-suffix[warn when a string or character literal is followed by a ud-suffix which does not begin with an underscore]'
  '-Wlogical-not-parentheses[warn when logical not is used on the left hand side operand of a comparison]'
  '-Wlogical-op[warn when a logical operator is suspiciously always evaluating to true or false]'
  '-Wlong-long[do not warn about using "long long" when -pedantic]'
  '-Wlto-type-mismatch[during link time optimization warn about mismatched types of global declarations]'
  '-Wmain[warn about suspicious declarations of "main"]'
  '-Wmaybe-uninitialized[warn about maybe uninitialized automatic variables]'
  '-Wmemset-elt-size[warn about suspicious calls to memset where the third argument contains the number of elements not multiplied by the element size]'
  '-Wmemset-transposed-args[warn about suspicious calls to memset where the third argument is constant literal zero and the second is not]'
  '-Wmisleading-indentation[warn when the indentation of the code does not reflect the block structure]'
  '-Wmissing-braces[warn about possibly missing braces around initializers]'
  '-Wmissing-declarations[warn about global functions without previous declarations]'
  '-Wmissing-field-initializers[warn about missing fields in struct initializers]'
  '-Wmissing-include-dirs[warn about user-specified include directories that do not exist]'
  '-Wmissing-parameter-type[warn about function parameters declared without a type specifier in K&R-style functions]'
  '-Wmissing-prototypes[warn about global functions without prototypes]'
  '-Wmudflap[warn about constructs not instrumented by -fmudflap]'
  '-Wmultichar[warn about use of multi-character character constants]'
  '-Wmultiple-inheritance[warn on direct multiple inheritance]'
  '-Wnamespaces[warn on namespace definition]'
  '-Wnarrowing[warn about narrowing conversions within { } that are ill-formed in C++11]'
  '-Wnested-externs[warn about "extern" declarations not at file scope]'
  '-Wnoexcept-type[warn if C++1z noexcept function type will change the mangled name of a symbol]'
  '-Wnoexcept[warn when a noexcept expression evaluates to false even though the expression can''t actually throw]'
  '-Wnonnull-compare[warn if comparing pointer parameter with nonnull attribute with NULL]'
  '-Wnonnull[warn about NULL being passed to argument slots marked as requiring non-NULL]'
  '-Wnonportable-cfstrings[warn on CFStrings containing nonportable characters]'
  '-Wnon-template-friend[warn when non-templatized friend functions are declared within a template]'
  '-Wnon-virtual-dtor[warn about non-virtual destructors]'
  '-Wnormalized=-[warn about non-normalised Unicode strings]:normalization:((id\:allow\ some\ non-nfc\ characters\ that\ are\ valid\ identifiers nfc\:only\ allow\ NFC nfkc\:only\ allow\ NFKC none\:allow\ any\ normalization)): '
  '-Wnull-dereference[warn if dereferencing a NULL pointer may lead to erroneous or undefined behavior]'
  '-Wodr[warn about some C++ One Definition Rule violations during link time optimization]'
  '-Wold-style-cast[warn if a C-style cast is used in a program]'
  '-Wold-style-declaration[warn for obsolescent usage in a declaration]'
  '-Wold-style-definition[warn if an old-style parameter definition is used]'
  '-Wopenmp-simd[warn if a simd directive is overridden by the vectorizer cost model]'
  '-Woverflow[warn about overflow in arithmetic expressions]'
  '-Woverlength-strings[warn if a string is longer than the maximum portable length specified by the standard]'
  '-Woverloaded-virtual[warn about overloaded virtual function names]'
  '-Woverride-init-side-effects[warn about overriding initializers with side effects]'
  '-Woverride-init[warn about overriding initializers without side effects]'
  '-Wpacked-bitfield-compat[warn about packed bit-fields whose offset changed in GCC 4.4]'
  '-Wpacked[warn when the packed attribute has no effect on struct layout]'
  '-Wpadded[warn when padding is required to align structure members]'
  '-Wparentheses[warn about possibly missing parentheses]'
  '-Wpedantic[issue warnings needed for strict compliance to the standard]'
  '-Wplacement-new=[warn for placement new expressions with undefined behavior]::level:(1 2)'
  '-Wpmf-conversions[warn when converting the type of pointers to member functions]'
  '-Wpointer-arith[warn about function pointer arithmetic]'
  '-Wpointer-compare[warn when a pointer is compared with a zero character constant]'
  '-Wpointer-sign[warn when a pointer differs in signedness in an assignment]'
  '-Wpointer-to-int-cast[warn when a pointer is cast to an integer of a different size]'
  '-Wpoison-system-directories[warn for -I and -L options using system directories if cross compiling]'
  '-Wpragmas[warn about misuses of pragmas]'
  '-Wproperty-assign-default[warn if a property for an Objective-C object has no assign semantics specified]'
  '-Wprotocol[warn if inherited methods are unimplemented]'
  '-Wpsabi[warn about psabi]'
  '-Wrealloc-lhs-all[warn when a left-hand-side variable is reallocated]'
  '-Wrealloc-lhs[warn when a left-hand-side array variable is reallocated]'
  '-Wreal-q-constant[warn about real-literal-constants with '\'q\'' exponent-letter]'
  '-Wredundant-decls[warn about multiple declarations of the same object]'
  '-Wregister[warn about uses of register storage specifier]'
  '-Wreorder[warn when the compiler reorders code]'
  '-Wrestrict[warn when an argument passed to a restrict- qualified parameter aliases with another argument]'
  '-Wreturn-local-addr[warn about returning a pointer/reference to a local or temporary variable]'
  '-Wreturn-type[warn whenever a function'\''s return type defaults to "int" (C), or about inconsistent return types (C++)]'
  '-Wscalar-storage-order[warn on suspicious constructs involving reverse scalar storage order]'
  '-Wselector[warn if a selector has multiple methods]'
  '-Wsequence-point[warn about possible violations of sequence point rules]'
  '-Wshadow-ivar[warn if a local declaration hides an instance variable]'
  '-Wshadow[warn when one variable shadows another.  Same as  -Wshadow=global]'
  '-Wshift-count-negative[warn if shift count is negative]'
  '-Wshift-count-overflow[warn if shift count >= width of type]'
  '-Wshift-negative-value[warn if left shifting a negative value]'
  '-Wshift-overflow[warn if left shift of a signed value overflows.  Same as -Wshift-overflow=]'
  '-Wshift-overflow=[warn if left shift of a signed value overflows]:level:(1 2)'
  '-Wsign-compare[warn about signed-unsigned comparisons]'
  '-Wsign-conversion[warn for implicit type conversions between signed and unsigned integers]'
  '-Wsign-promo[warn when overload promotes from unsigned to signed]'
  '-Wsized-deallocation[warn about missing sized deallocation functions]'
  '-Wsizeof-array-argument[warn when sizeof is applied on a parameter declared as an array]'
  '-Wsizeof-pointer-memaccess[warn about suspicious length parameters to certain string functions if the argument uses sizeof]'
  '-Wstack-protector[warn when not issuing stack smashing protection for some reason]'
  '-Wstack-usage=[warn if stack usage might be larger than specified amount]:bytes: '
  '-Wstrict-aliasing[warn about code which might break strict aliasing rules]'
  '-Wstrict-aliasing=-[warn about code which might break strict aliasing rules]:level of checking (higher is more accurate):(1 2 3)'
  '-Wstrict-null-sentinel[warn about uncasted NULL used as sentinel]'
  '-Wstrict-overflow[warn about optimizations that assume that signed overflow is undefined]'
  '-Wstrict-overflow=-[warn about optimizations that assume that signed overflow is undefined]:level of checking (higher finds more cases):(1 2 3 4 5)'
  '-Wstrict-prototypes[warn about unprototyped function declarations]'
  '-Wstrict-selector-match[warn if type signatures of candidate methods do not match exactly]'
  '-Wstringop-overflow=[under the control of Object Size type, warn about buffer overflow in string manipulation functions like memcpy and strcpy]:level:(1 2 3 4)'
  '-Wstringop-overflow[warn about buffer overflow in string manipulation functions like memcpy and strcpy.  Same as  -Wstringop-overflow=]'
  '-Wsubobject-linkage[warn if a class type has a base or a field whose type uses the anonymous namespace or depends on a type with no linkage]'
  '*-Wsuggest-attribute=-[warn about functions that might be candidates for attributes]:attribute:(pure const noreturn format)'
  '-Wsuggest-final-methods[warn about C++ virtual methods where adding final keyword would improve code quality]'
  '-Wsuggest-final-types[warn about C++ polymorphic types where adding final keyword would improve code quality]'
  '-Wsuggest-override[suggest that the override keyword be used when the declaration of a virtual function overrides another]'
  '-Wsurprising[warn about "suspicious" constructs]'
  '-Wswitch-bool[warn about switches with boolean controlling expression]'
  '-Wswitch-default[warn about enumerated switches missing a "default-" statement]'
  '-Wswitch-enum[warn about all enumerated switches missing a specific case]'
  '-Wswitch-unreachable[warn about statements between switch'\''s controlling expression and the first case]'
  '-Wswitch[warn about enumerated switches, with no default, missing a case]'
  '-Wsync-nand[warn when __sync_fetch_and_nand and __sync_nand_and_fetch built-in functions are used]'
  '-Wsynth[deprecated. This switch has no effect]'
  '-Wsystem-headers[do not suppress warnings from system headers]'
  '-Wtabs[permit nonconforming uses of the tab character]'
  '-Wtarget-lifetime[warn if the pointer in a pointer assignment might outlive its target]'
  '-Wtautological-compare[warn if a comparison always evaluates to true or false]'
  '-Wtemplates[warn on primary template declaration]'
  '-Wterminate[warn if a throw expression will always result in a call to terminate()]'
  '-W[this switch is deprecated; use -Wextra instead]'
  '-Wtraditional-conversion[warn of prototypes causing type conversions different from what would happen in the absence of prototype]'
  '-Wtraditional[warn about features not present in traditional C]'
  '-Wtrampolines[warn whenever a trampoline is generated]'
  '-Wtrigraphs[warn if trigraphs are encountered that might affect the meaning of the program]'
  '-Wtype-limits[warn if a comparison is always true or always false due to the limited range of the data type]'
  '-Wundeclared-selector[warn about @selector()s without previously declared methods]'
  '-Wundefined-do-loop[warn about an invalid DO loop]'
  '-Wundef[warn if an undefined macro is used in an #if directive]'
  '-Wunderflow[warn about underflow of numerical constant expressions]'
  '-Wuninitialized[warn about uninitialized automatic variables]'
  '-Wunknown-pragmas[warn about unrecognized pragmas]'
  '-Wunsafe-loop-optimizations[warn if the loop cannot be optimized due to nontrivial assumptions]'
  '-Wunsuffixed-float-constants[warn about unsuffixed float constants]'
  '-Wunused-but-set-parameter[warn when a function parameter is only set, otherwise unused]'
  '-Wunused-but-set-variable[warn when a variable is only set, otherwise unused]'
  '-Wunused-const-variable[warn when a const variable is unused.  Same as  -Wunused-const-variable=]'
  '-Wunused-const-variable=[warn when a const variable is unused]:level:(1 2)'
  '-Wunused-dummy-argument[warn about unused dummy arguments]'
  '-Wunused[enable all -Wunused- warnings]'
  '-Wunused-function[warn when a function is unused]'
  '-Wunused-label[warn when a label is unused]'
  '-Wunused-local-typedefs[warn when typedefs locally defined in a function are not used]'
  '-Wunused-macros[warn about macros defined in the main file that are not used]'
  '-Wunused-parameter[warn when a function parameter is unused]'
  '-Wunused-result[warn if a caller of a function, marked with attribute warn_unused_result, does not use its return value]'
  '-Wunused-value[warn when an expression value is unused]'
  '-Wunused-variable[warn when a variable is unused]'
  '-Wuseless-cast[warn about useless casts]'
  '-Wuse-without-only[warn about USE statements that have no ONLY qualifier]'
  '-Wvarargs[warn about questionable usage of the macros used to retrieve variable arguments]'
  '-Wvariadic-macros[warn about using variadic macros]'
  '-Wvector-operation-performance[warn when a vector operation is compiled outside the SIMD]'
  '-Wvirtual-inheritance[warn on direct virtual inheritance]'
  '-Wvirtual-move-assign[warn if a virtual base has a non-trivial move assignment operator]'
  '-Wvla-larger-than=[warn on unbounded uses of variable-length arrays, and on bounded uses of variable-length arrays whose bound can be larger than <number> bytes]:bytes: ' 
  '-Wvla[warn if a variable length array is used]'
  '-Wvolatile-register-var[warn when a register variable is declared volatile]'
  '-Wwrite-strings[in C++, nonzero means warn about deprecated conversion from string literals to '\''char *'\''.  In C, similar warning, except that the conversion is]'
  '-Wzero-as-null-pointer-constant[warn when a literal '\''0'\'' is used as null pointer]'
  '-Wzerotrip[warn about zero-trip DO loops]'
)

# clang specific warnings
if [[ "$service" = clang* ]]; then
  warnings+=(
    '-Wlarge-by-value-copy=[warn on large by value copy]:argument'
    '-Wunreachable-code-aggressive[controls -Wunreachable-code, -Wunreachable-code-break, -Wunreachable-code-return]'
    '-Wunreachable-code-break[warn when break will never be executed]'
    '-Wunreachable-code-loop-increment[warn when loop will be executed only once]'
    '-Wunreachable-code-return[warn when return will not be executed]'
    '-Wunreachable-code[warn on code that will not be executed]'
  )
else
  warnings+=(
    '-Wunreachable-code[does nothing. Preserved for backward compatibility]'
  )
fi

args+=(
  {'*-A-','*--assert='}'[make an assertion]:define assertion:'
  '--all-warnings[display all warnings]'
  {-ansi,--ansi}'[same as -std=c89 or -std=c++98]'
  '-aux-info[emit declaration information into <file>]:file:_files'
  {'-B-','--prefix='}'[add <prefix> to the compiler'\''s search paths]:executable prefix:_files -/'
  '-b[specify target machine to compile to]:target machine:'
  {-CC,--comments-in-macros}'[do not discard comments, including macro expansion]'
  {-C,--comments}'[do not discard comments during preprocess]'
  {-c,--compile}'[compile and assemble, but do not link]'
  {'*-D-','*--define-macro='}'[define a macro]:define macro:'
  '-d-[dump the state of the preprocessor]:dump:->dump'
  '--dependencies[generate Makefile dependencies]'
  '-dumpbase[set the file basename to be used for dumps]:file:_files'
  '-dumpdir[set the directory name to be used for dumps]:file:_files -/'
  '-dumpmachine[display the compiler'\''s target processor]'
  '-dumpspecs[display all of the built in spec strings]'
  '-dumpversion[display the version of the compiler]'
  '+e-[control how virtual function definitions are used]:virtual function definitions in classes:((0\:only\ interface 1\:generate\ code))'
  {-e,--entry}'[specify program entry point is entry]:entry'
  {-E,--preprocess}'[preprocess only; do not compile, assemble or link]'
  '-fabi-version=-[use version <n> of the C++ ABI (default: 2)]:ABI version:(1 2 3 4 5 6)'
  '-fada-spec-parent=[dump Ada specs as child units of given parent]'
  '-faggressive-loop-optimizations[aggressively optimize loops using language constraints]'
  '-falign-functions[align the start of functions]'
  '-falign-jumps[align labels which are only reached by jumping]'
  '-falign-labels[align all labels]'
  '-falign-loops[align the start of loops]'
  '-fallow-parameterless-variadic-functions[allow variadic functions without named parameter]'
  '-fasm[recognize the asm keyword]'
  '-fassociative-math[allow optimization for floating-point arithmetic which may change the result of the operation due to rounding]'
  '-fasynchronous-unwind-tables[generate unwind tables that are exact at each instruction boundary]'
  '-fauto-inc-dec[generate auto-inc/dec instructions]'
  '-fbounds-check[generate code to check bounds before indexing arrays]'
  '-fbranch-count-reg[replace add, compare, branch with branch on count register]'
  '-fbranch-probabilities[use profiling information for branch probabilities]'
  '-fbranch-target-load-optimize2[perform branch target load optimization after prologue / epilogue threading]'
  '-fbranch-target-load-optimize[perform branch target load optimization before prologue / epilogue threading]'
  '-fbtr-bb-exclusive[restrict target load migration not to re-use registers in any basic block]'
  '-fbuilding-libgcc[specify building libgcc]'
  '-fbuiltin[recognize builtin functions]'
  '-fcaller-saves[save registers around function calls]'
  '-fcall-saved--[mark <register> as being preserved across functions]:register'
  '-fcall-used--[mark <register> as being corrupted by function calls]:register'
  '-fcanonical-system-headers[where shorter use canonicalized paths to system headers]'
  '-fcheck-data-deps[compare the results of several data dependence analyzers]'
  '-fcheck-pointer-bounds[add pointer bounds checker instrumentation]'
  '-fchkp-check-incomplete-type[generate pointer bounds check for variables with incomplete type]'
  '-fchkp-check-read[generate checks for all read accesses to memory]'
  '-fchkp-check-write[generate checks for all write accesses to memory]'
  '-fchkp-first-field-has-own-bounds[forces checker to use narrowed bounds for address of the first field]'
  '-fchkp-instrument-calls[generate bounds passing for calls]'
  '-fchkp-instrument-marked-only[instrument only functions marked with bnd_instrument attribute]'
  '-fchkp-narrow-bounds[control how checker handle pointers to object fields]'
  '-fchkp-narrow-to-innermost-array[forces checker to use bounds of the innermost arrays in case of nested static array access]'
  '-fchkp-optimize[allow checker optimizations]'
  '-fchkp-store-bounds[generate bounds stores for pointer writes]'
  '-fchkp-treat-zero-dynamic-size-as-infinite[with this option zero size obtained dynamically for objects with incomplete type will be treated as infinite]'
  '-fchkp-use-fast-string-functions[allow to use *_nobnd versions of string functions]'
  '-fchkp-use-nochk-string-functions[allow to use *_nochk versions of string functions]'
  '-fchkp-use-static-bounds[use statically initialized variable for vars bounds instead of generating them each time it is required]'
  '-fchkp-use-static-const-bounds[use statically initialized variable for constant bounds]'
  '-fchkp-use-wrappers[transform instrumented builtin calls into calls to wrappers]'
  '-fchkp-zero-input-bounds-for-main[use zero bounds for all incoming arguments in main function]'
  '-fcilkplus[enable Cilk Plus]'
  '-fcode-hoisting[enable code hoisting]'
  '-fcombine-stack-adjustments[looks for opportunities to reduce stack adjustments and stack references]'
  '-fcommon[do not put uninitialized globals in the common section]'
  '-fcompare-debug=-[compile with and without e.g. -gtoggle, and compare the final-insns dump]:opts:' # TODO: complete gcc options here
  '-fcompare-debug-second[run only the second compilation of -fcompare-debug]'
  '-fcompare-elim[perform comparison elimination after register allocation has finished]'
  '-fcond-mismatch[allow the arguments of the ? operator to have different types]'
  '-fconserve-stack[do not perform optimizations increasing noticeably stack usage]'
  '-fcprop-registers[perform a register copy-propagation optimization pass]'
  '-fcrossjumping[perform cross-jumping optimization]'
  '-fcse-follow-jumps[when running CSE, follow jumps to their targets]'
  '-fcx-fortran-rules[complex multiplication and division follow Fortran rules]'
  '-fcx-limited-range[omit range reduction step when performing complex division]'
  '-fdata-sections[place data items into their own section]'
  '-fdbg-cnt=-[,<counter>-<limit>,...) Set the debug counter limit]:counter\:limit,...: ' # TODO: gcc -fdbg-cnt-list -x c /dev/null -o /dev/null -c
  '-fdbg-cnt-list[list all available debugging counters with their limits and counts]'
  '-fdce[use the RTL dead code elimination pass]'
  '-fdebug-cpp[emit debug annotations during preprocessing]'
  '-fdebug-prefix-map=-[map one directory name to another in debug information]:/old/dir=/new/dir:->dirtodir'
  '-fdebug-types-section[output .debug_types section when using DWARF v4 debuginfo]'
  '-fdefer-pop[defer popping functions args from stack until later]'
  '-fdelayed-branch[attempt to fill delay slots of branch instructions]'
  '-fdelete-dead-exceptions[delete dead instructions that may throw exceptions]'
  '-fdelete-null-pointer-checks[delete useless null pointer checks]'
  '-fdevirtualize-speculatively[perform speculative devirtualization]'
  '-fdevirtualize[try to convert virtual calls to direct ones]'
  '-fdiagnostics-color=-[colorize diagnostics]::color:(never always auto)'
  '-fdiagnostics-generate-patch[print fix-it hints to stderr in unified diff format]'
  '-fdiagnostics-parseable-fixits[print fixit hints in machine-readable form]'
  '-fdiagnostics-show-caret[show the source line with a caret indicating the column]'
  '-fdiagnostics-show-location=-[how often to emit source location at the beginning of line-wrapped diagnostics]:source location:(once every-line)'
  '-fdiagnostics-show-option[amend appropriate diagnostic messages with the command line option that controls them]'
  '-fdirectives-only[preprocess directives only]'
  '-fdollars-in-identifiers[permit $ as an identifier character]'
  '-fdse[use the RTL dead store elimination pass]'
  '-fdump-ada-spec-slim[write all declarations as Ada code for the given file only]'
  '-fdump-ada-spec[write all declarations as Ada code transitively]'
  '-fdump-final-insns=-[dump to filename the insns at the end of translation]:filename:_files'
  '-fdump-go-spec=-[write all declarations to file as Go code]:filename:_files'
  '-fdump-noaddr[suppress output of addresses in debugging dumps]'
  '-fdump-passes[dump optimization passes]'
  '-fdump-unnumbered-links[suppress output of previous and next insn numbers in debugging dumps]'
  '-fdump-unnumbered[suppress output of instruction numbers, line number notes and addresses in debugging dumps]'
  '-fdwarf2-cfi-asm[enable CFI tables via GAS assembler directives]'
  '-fearly-inlining[perform early inlining]'
  '-feliminate-dwarf2-dups[perform DWARF2 duplicate elimination]'
  '-feliminate-unused-debug-symbols[perform unused type elimination in debug info]'
  '-feliminate-unused-debug-types[perform unused type elimination in debug info]'
  '-femit-class-debug-always[do not suppress C++ class debug information]'
  '-femit-struct-debug-baseonly[aggressive reduced debug info for structs]'
  '-femit-struct-debug-detailed=[detailed reduced debug info for structs]:spec list'
  '-femit-struct-debug-reduced[conservative reduced debug info for structs]'
  '-fexceptions[enable exception handling]'
  '-fexcess-precision=-[specify handling of excess floating-point precision]:precision handling:(fast standard)'
  '-fexec-charset=[convert all strings and character constants to character set]:character set'
  '-fexpensive-optimizations[perform a number of minor, expensive optimizations]'
  '-fextended-identifiers[permit universal character names in identifiers]'
  '-ffast-math[sets -fno-math-errno, -funsafe-math-optimizations, -ffinite-math-only, -fno-rounding-math, -fno-signaling-nans and -fcx-limited-range]'
  '-ffat-lto-objects[output lto objects containing both the intermediate language and binary output]'
  '-ffinite-math-only[assume no NaNs or infinities are generated]'
  '-ffixed--[mark <register> as being unavailable to the compiler]:register'
  '-ffloat-store[don'\''t allocate floats and doubles in extended- precision registers]'
  '-fforward-propagate[perform a forward propagation pass on RTL]'
  '-ffp-contract=-[perform floating- point expression contraction (default: fast)]:style:(on off fast)'
  '-ffp-contract=[perform floating-point expression contraction]:style:(off on fast)'
  '-ffp-int-builtin-inexact[allow built-in functions ceil, floor, round, trunc to raise "inexact" exceptions]'
  '-ffreestanding[do not assume that standard C libraries and main exist]'
  '-ffunction-cse[allow function addresses to be held in registers]'
  '-ffunction-sections[place each function into its own section]'
  '-fgcse-after-reload[perform global common subexpression elimination after register allocation has finished]'
  '-fgcse-las[perform redundant load after store elimination in global common subexpression elimination]'
  '-fgcse-lm[perform enhanced load motion during global common subexpression elimination]'
  '-fgcse[perform global common subexpression elimination]'
  '-fgcse-sm[perform store motion after global common subexpression elimination]'
  '-fgnu89-inline[use traditional GNU semantics for inline functions]'
  '-fgnu-tm[enable support for GNU transactional memory]'
  '-fgraphite[enable in and out of Graphite representation]'
  '-fgraphite-identity[enable Graphite Identity transformation]'
  '-fguess-branch-probability[enable guessing of branch probabilities]'
  '-fhoist-adjacent-loads[enable hoisting adjacent loads to encourage generating conditional move instructions]'
  '-fhosted[assume normal C execution environment]'
  '-fif-conversion2[perform conversion of conditional jumps to conditional execution]'
  '-fif-conversion[perform conversion of conditional jumps to branchless equivalents]'
  '-findirect-inlining[perform indirect inlining]'
  '-finhibit-size-directive[do not generate .size directives]'
  '-finline-atomics[inline __atomic operations when a lock free instruction sequence is available]'
  '-finline[enable inlining of function declared "inline", disabling disables all inlining]'
  '-finline-functions-called-once[integrate functions only required by their single caller]'
  '-finline-functions[integrate functions not declared "inline" into their callers when profitable]'
  '-finline-limit=-[limit the size of inlined functions to <number>]:number: '
  '-finline-small-functions[integrate functions into their callers when code size is known not to grow]'
  '-finput-charset=[specify the default character set for source files]:character set'
  '-finstrument-functions-exclude-file-list=-[do not instrument functions listed in files]:comma-separated file list:->commafiles'
  '-finstrument-functions-exclude-function-list=-[do not instrument listed functions]:comma-separated list of syms: '
  '-finstrument-functions[instrument function entry and exit with profiling calls]'
  '-fipa-bit-cp[perform interprocedural bitwise constant propagation]'
  '-fipa-cp-clone[perform cloning to make Interprocedural constant propagation stronger]'
  '-fipa-cp[perform interprocedural constant propagation]'
  '-fipa-icf-functions[perform Identical Code Folding for functions]'
  '-fipa-icf[perform Identical Code Folding for functions and read-only variables]'
  '-fipa-icf-variables[perform Identical Code Folding for variables]'
  '-fipa-profile[perform interprocedural profile propagation]'
  '-fipa-pta[perform interprocedural points-to analysis]'
  '-fipa-pure-const[discover pure and const functions]'
  '-fipa-ra[use caller save register across calls if possible]'
  '-fipa-reference[discover readonly and non addressable static variables]'
  '-fipa-sra[perform interprocedural reduction of aggregates]'
  '-fipa-vrp[perform IPA Value Range Propagation]'
  '-fira-algorithm=[set the used IRA algorithm]:algorithm:(cb priority)'
  '-fira-hoist-pressure[use IRA based register pressure calculation in RTL hoist optimizations]'
  '-fira-loop-pressure[use IRA based register pressure calculation in RTL loop optimizations]'
  '-fira-region=-[set regions for IRA]:region:(all mixed one)'
  '-fira-region=[set regions for IRA]:region:(one all mixed)'
  '-fira-share-save-slots[share slots for saving different hard registers]'
  '-fira-share-spill-slots[share stack slots for spilled pseudo-registers]'
  '-fira-verbose=-[control IRA'\''s level of diagnostic messages]:verbosity: '
  '-fisolate-erroneous-paths-attribute[detect paths that trigger erroneous or undefined behavior due to a null value being used in a way forbidden by a returns_nonnull or]'
  '-fisolate-erroneous-paths-dereference[detect paths that trigger erroneous or undefined behavior due to dereferencing a null pointer.  Isolate those paths from the main]'
  '-fivopts[optimize induction variables on trees]'
  '-fjump-tables[use jump tables for sufficiently large switch statements]'
  '-fkeep-inline-functions[generate code for functions even if they are fully inlined]'
  '-fkeep-static-consts[emit static const variables even if they are not used]'
  '-flax-vector-conversions[allow implicit conversions between vectors with differing numbers of subparts and/or differing element types]'
  '-fleading-underscore[give external symbols a leading underscore]'
  '-flifetime-dse[tell DSE that the storage for a C++ object is dead when the constructor starts and when the destructor finishes]'
  '-flive-range-shrinkage[relief of register pressure through live range shrinkage]'
  '-floop-nest-optimize[enable the loop nest optimizer]'
  '-floop-parallelize-all[mark all loops as parallel]'
  '-flra-remat[do CFG-sensitive rematerialization in LRA]'
  '-flto-compression-level=-[use specified zlib compression level for IL]:compression level: '
  '-flto-odr-type-merging[merge C++ types using One Definition Rule]'
  '-flto-partition=-[partition symbols and vars at linktime based on object files they originate from]:partitioning algorithm:(1to1 balanced max one none)'
  '-flto-report[report various link-time optimization statistics]'
  '-fmath-errno[set errno after built-in math functions]'
  '-fmax-errors=-[maximum number of errors to report]:errors: '
  '-fmem-report[report on permanent memory allocation]'
  '-fmem-report-wpa[report on permanent memory allocation in WPA only]'
  '-fmerge-all-constants[attempt to merge identical constants and constant variables]'
  '-fmerge-constants[attempt to merge identical constants across compilation units]'
  '-fmerge-debug-strings[attempt to merge identical debug strings across compilation units]'
  '-fmessage-length=-[limit diagnostics to <number> characters per line.  0 suppresses line-wrapping]:length: '
  '-fmodulo-sched-allow-regmoves[perform SMS based modulo scheduling with register moves allowed]'
  '-fmodulo-sched[perform SMS based modulo scheduling before the first scheduling pass]'
  '-fmove-loop-invariants[move loop invariant computations out of loops]'
  "-fms-extensions[don't warn about uses of Microsoft extensions]"
  '-fmudflapir[this switch lacks documentation]'
  '-fmudflap[this switch lacks documentation]'
  '-fmudflapth[this switch lacks documentation]'
  '-fnon-call-exceptions[support synchronous non-call exceptions]'
  '-fno-stack-limit[do not limit the size of the stack]'
  '-fno-threadsafe-statics[do not generate thread-safe code for initializing local statics]'
  '-fnothrow-opt[treat a throw() exception specification as noexcept to improve code size]'
  '-fomit-frame-pointer[when possible do not generate stack frames]'
  '-fopenacc[enable OpenACC]'
  '-fopenmp[enable OpenMP (implies -frecursive in Fortran)]'
  "-fopenmp-simd[enable OpenMP's SIMD directives]"
  '-foptimize-sibling-calls[optimize sibling and tail recursive calls]'
  '-foptimize-strlen[enable string length optimizations on trees]'
  '-fopt-info[enable all optimization info dumps on stderr]'
  '-fopt-info-type=-[dump compiler optimization details]:filename:_files'
  '-fpack-struct[pack structure members together without holes]'
  '-fpack-struct=[set initial maximum structure member alignment]:alignment (power of 2): '
  '-fpartial-inlining[perform partial inlining]'
  '-fpcc-struct-return[return small aggregates in memory, not registers]'
  '-fpch-deps[this switch lacks documentation]'
  '-fpch-preprocess[look for and use PCH files even when preprocessing]'
  '-fpeel-loops[perform loop peeling]'
  '-fpeephole2[enable an RTL peephole pass before sched2]'
  '-fpeephole[enable machine specific peephole optimizations]'
  '-fPIC[generate position-independent code if possible (large mode)]'
  '-fpic[generate position-independent code if possible (small mode)]'
  '-fPIE[generate position-independent code for executables if possible (large mode)]'
  '-fpie[generate position-independent code for executables if possible (small mode)]'
  '-fplan9-extensions[enable Plan 9 language extensions]'
  '-fplt[use PLT for PIC calls (-fno-plt- load the address from GOT at call site)]'
  '-fplugin-arg--[specify argument <key>=<value> for plugin <name>]:-fplugin-arg-name-key=value: ' #TODO
  '-fplugin=-[specify a plugin to load]:plugin: ' # TODO: complete plugins?
  '-fpost-ipa-mem-report[report on memory allocation before interprocedural optimization]'
  '-fpredictive-commoning[run predictive commoning optimization]'
  '-fprefetch-loop-arrays[generate prefetch instructions, if available, for arrays in loops]'
  '-fpre-ipa-mem-report[report on memory allocation before interprocedural optimization]'
  '-fpreprocessed[treat the input file as already preprocessed]'
  '-fprintf-return-value[treat known sprintf return values as constants]'
  '-fprofile-arcs[insert arc-based program profiling code]'
  '-fprofile-correction[enable correction of flow inconsistent profile data input]'
  '-fprofile-dir=-[set the top-level directory for storing the profile data]:profile directory:_files -/'
  '-fprofile[enable basic program profiling code]'
  '-fprofile-generate[enable common options for generating profile info for profile feedback directed optimizations]'
  '-fprofile-report[report on consistency of profile]'
  '-fprofile-use[enable common options for performing profile feedback directed optimizations]'
  '-fprofile-values[insert code to profile values of expressions]'
  '-frandom-seed=-[use <string> as random seed]:seed: '
  '-freciprocal-math[same as -fassociative-math for expressions which include division]'
  '-frecord-gcc-switches[record gcc command line switches in the object file]'
  '-free[turn on Redundant Extensions Elimination pass]'
  '-freg-struct-return[return small aggregates in registers]'
  '-frename-registers[perform a register renaming optimization pass]'
  '-freorder-blocks-algorithm=[set the used basic block reordering algorithm]:algorithm:(simple stc)'
  '-freorder-blocks-and-partition[reorder basic blocks and partition into hot and cold sections]'
  '-freorder-blocks[reorder basic blocks to improve code placement]'
  '-freorder-functions[reorder functions to improve code placement]'
  '-frequire-return-statement[functions which return values must end with return statements]'
  '-frerun-cse-after-loop[add a common subexpression elimination pass after loop optimizations]'
  '-freschedule-modulo-scheduled-loops[enable/disable the traditional scheduling in loops that already passed modulo scheduling]'
  '-frounding-math[disable optimizations that assume default FP rounding behavior]'
  '-frtti[generate run time type descriptor information]'
  "-fsanitize=-[enable AddressSanitizer, a memory error detector]:style:($sanitizers)"
  '-fsched2-use-superblocks[if scheduling post reload, do superblock scheduling]'
  '-fsched-critical-path-heuristic[enable the critical path heuristic in the scheduler]'
  '-fsched-dep-count-heuristic[enable the dependent count heuristic in the scheduler]'
  '-fsched-group-heuristic[enable the group heuristic in the scheduler]'
  '-fsched-interblock[enable scheduling across basic blocks]'
  '-fsched-last-insn-heuristic[enable the last instruction heuristic in the scheduler]'
  '-fsched-pressure[enable register pressure sensitive insn scheduling]'
  '-fsched-rank-heuristic[enable the rank heuristic in the scheduler]'
  '-fsched-spec[allow speculative motion of non-loads]'
  '-fsched-spec-insn-heuristic[enable the speculative instruction heuristic in the scheduler]'
  '-fsched-spec-load[allow speculative motion of some loads]'
  '-fsched-spec-load-dangerous[allow speculative motion of more loads]'
  '-fsched-stalled-insns[allow premature scheduling of queued insns]'
  '-fsched-stalled-insns-dep[set dependence distance checking in premature scheduling of queued insns]'
  '-fsched-stalled-insns-dep=[set dependence distance checking in premature scheduling of queued insns]:insns:'
  '-fsched-stalled-insns-dep=-[set dependence distance checking in premature scheduling of queued insns]:instructions: '
  '-fsched-stalled-insns=[set number of queued insns that can be prematurely scheduled]:insns:'
  '-fsched-stalled-insns=-[set number of queued insns that can be prematurely scheduled]:instructions: '
  '-fschedule-fusion[perform a target dependent instruction fusion optimization pass]'
  '-fschedule-insns2[reschedule instructions after register allocation]'
  '-fschedule-insns[reschedule instructions before register allocation]'
  '-fsched-verbose=-[set the verbosity level of the scheduler]:verbosity: '
  '-fsection-anchors[access data in the same section from shared anchor points]'
  '-fselective-scheduling2[run selective scheduling after reload]'
  '-fselective-scheduling[schedule instructions using selective scheduling algorithm]'
  '-fsel-sched-pipelining-outer-loops[perform software pipelining of outer loops during selective scheduling]'
  '-fsel-sched-pipelining[perform software pipelining of inner loops during selective scheduling]'
  '-fsel-sched-reschedule-pipelined[reschedule pipelined regions without pipelining]'
  '-fshort-double[use the same size for double as for float]'
  '-fshort-enums[use the narrowest integer type possible for enumeration types]'
  '-fshort-wchar[force the underlying type for "wchar_t" to be "unsigned short"]'
  '-fshow-column[show column numbers in diagnostics, when available]'
  '-fshrink-wrap[emit function prologues only before parts of the function that need it, rather than at the top of the function]'
  '-fshrink-wrap-separate[shrink-wrap parts of the prologue and epilogue separately]'
  '-fsignaling-nans[disable optimizations observable by IEEE signaling NaNs]'
  '-fsigned-bitfields[when signed or unsigned is not given make the bitfield signed]'
  '-fsigned-char[make char signed by default]'
  '-fsigned-zeros[disable floating point optimizations that ignore the IEEE signedness of zero]'
  '-fsimd-cost-model=[specifies the vectorization cost model for code marked with a simd directive]:model:(unlimited dynamic cheap)'
  '-fsingle-precision-constant[convert floating point constants to single precision constants]'
  '-fsplit-ivs-in-unroller[split lifetimes of induction variables when loops are unrolled]'
  '-fsplit-loops[perform loop splitting]'
  '-fsplit-paths[split paths leading to loop backedges]'
  '-fsplit-stack[generate discontiguous stack frames]'
  '-fsplit-wide-types[split wide types into independent registers]'
  '-fssa-backprop[enable backward propagation of use properties at the SSA level]'
  '-fssa-phiopt[optimize conditional patterns using SSA PHI nodes]'
  '-fstack-check=-[insert stack checking code into the program.  -fstack-check=specific if to argument given]:type:(none generic specific)'
  '-fstack-limit-register=-[trap if the stack goes past <register>]:register: '
  '-fstack-limit-symbol=-[trap if the stack goes past symbol <name>]:name: '
  '-fstack-protector-all[use a stack protection method for every function]'
  '-fstack-protector-explicit[use stack protection method only for functions with the stack_protect attribute]'
  '-fstack-protector-strong[use a smart stack protection method for certain functions]'
  '-fstack-protector[use propolice as a stack protection method]'
  '-fstack-reuse=[set stack reuse level for local variables]:level:(all named_vars none)'
  '-fstack-reuse=-[set stack reuse level for local variables]:reuse-level:(all named_vars none)'
  '-fstack-usage[output stack usage information on a per-function basis]'
  '-fstdarg-opt[optimize amount of stdarg registers saved to stack at start of function]'
  '-fstore-merging[merge adjacent stores]'
  '-fstrict-aliasing[assume strict aliasing rules apply]'
  '-fstrict-enums[assume that values of enumeration type are always within the minimum range of that type]'
  '-fstrict-overflow[treat signed overflow as undefined]'
  '-fstrict-volatile-bitfields[force bitfield accesses to match their type width]'
  '-fsync-libcalls[implement __atomic operations via libcalls to legacy __sync functions]'
  '-fsyntax-only[check for syntax errors, then stop]'
  '-ftabstop=[distance between tab stops for column reporting]:number'
  '-ftest-coverage[create data files needed by "gcov"]'
  '-fthread-jumps[perform jump threading optimizations]'
  '-ftime-report[report the time taken by each compiler pass]'
  '-ftls-model=-[set the default thread-local storage code generation model]:TLS model:(global-dynamic local-dynamic initial-exec local-exec)'
  '-ftracer[perform superblock formation via tail duplication]'
  '-ftrack-macro-expansion=[track locations of tokens coming from macro expansion and display them in error messages]::argument'
  '-ftrapping-math[assume floating-point operations can trap]'
  '-ftrapv[trap for signed overflow in addition, subtraction and multiplication]'
  '-ftree-bit-ccp[enable SSA-BIT-CCP optimization on trees]'
  '-ftree-builtin-call-dce[enable conditional dead code elimination for builtin calls]'
  '-ftree-ccp[enable SSA-CCP optimization on trees]'
  '-ftree-ch[enable loop header copying on trees]'
  '-ftree-coalesce-vars[enable SSA coalescing of user variables]'
  '-ftree-copy-prop[enable copy propagation on trees]'
  '-ftree-cselim[transform condition stores into unconditional ones]'
  '-ftree-dce[enable SSA dead code elimination optimization on trees]'
  '-ftree-dominator-opts[enable dominator optimizations]'
  '-ftree-dse[enable dead store elimination]'
  '-ftree-forwprop[enable forward propagation on trees]'
  '-ftree-fre[enable Full Redundancy Elimination (FRE) on trees]'
  '-ftree-loop-distribute-patterns[enable loop distribution for patterns transformed into a library call]'
  '-ftree-loop-distribution[enable loop distribution on trees]'
  '-ftree-loop-if-convert[convert conditional jumps in innermost loops to branchless equivalents]'
  '-ftree-loop-im[enable loop invariant motion on trees]'
  '-ftree-loop-ivcanon[create canonical induction variables in loops]'
  '-ftree-loop-linear[enable loop interchange transforms.  Same as  -floop-interchange]'
  '-ftree-loop-optimize[enable loop optimizations on tree level]'
  '-ftree-loop-vectorize[enable loop vectorization on trees]'
  '-ftree-lrs[perform live range splitting during the SSA- >normal pass]'
  '-ftree-parallelize-loops=[enable automatic parallelization of loops]'
  '-ftree-parallelize-loops=-[enable automatic parallelization of loops]:threads: '
  '-ftree-partial-pre[in SSA-PRE optimization on trees, enable partial- partial redundancy elimination]'
  '-ftree-phiprop[enable hoisting loads from conditional pointers]'
  '-ftree-pre[enable SSA-PRE optimization on trees]'
  '-ftree-pta[perform function-local points-to analysis on trees]'
  '-ftree-reassoc[enable reassociation on tree level]'
  '-ftree-scev-cprop[enable copy propagation of scalar-evolution information]'
  '-ftree-sink[enable SSA code sinking on trees]'
  '-ftree-slp-vectorize[enable basic block vectorization (SLP) on trees]'
  '-ftree-slsr[perform straight-line strength reduction]'
  '-ftree-sra[perform scalar replacement of aggregates]'
  '-ftree-switch-conversion[perform conversions of switch initializations]'
  '-ftree-tail-merge[enable tail merging on trees]'
  '-ftree-ter[replace temporary expressions in the SSA->normal pass]'
  '-ftree-vectorize[enable vectorization on trees]'
  '-ftree-vrp[perform Value Range Propagation on trees]'
  '-funconstrained-commons[assume common declarations may be overridden with ones with a larger trailing array]'
  '-funroll-all-loops[perform loop unrolling for all loops]'
  '-funroll-loops[perform loop unrolling when iteration count is known]'
  '-funsafe-loop-optimizations[allow loop optimizations to assume that the loops behave in normal way]'
  '-funsafe-math-optimizations[allow math optimizations that may violate IEEE or ISO standards]'
  '-funsigned-bitfields[when signed or unsigned is not given make the bitfield unsigned]'
  '-funsigned-char[make char unsigned by default]'
  '-funswitch-loops[perform loop unswitching]'
  '-funwind-tables[just generate unwind tables for exception handling]'
  '-fuse-ld=-[use the specified linker instead of the default linker]:linker:(bfd gold)'
  '-fuse-linker-plugin[use linker plugin during link-time optimization]'
  '-fvariable-expansion-in-unroller[apply variable expansion when loops are unrolled]'
  '-fvar-tracking-assignments[perform variable tracking by annotating assignments]'
  '-fvar-tracking-assignments-toggle[toggle -fvar-tracking-assignments]'
  '-fvar-tracking[perform variable tracking]'
  '-fvar-tracking-uninit[perform variable tracking and also tag variables that are uninitialized]'
  '-fvect-cost-model=[specifies the cost model for vectorization]:model:(unlimited dynamic cheap)'
  '-fverbose-asm[add extra commentary to assembler output]'
  '-fvisibility=-[set the default symbol visibility]:visibility:(default internal hidden protected)'
  '-fvpt[use expression value profiles in optimizations]'
  '-fweb[construct webs and split unrelated uses of single variable]'
  '-fwhole-program[perform whole program optimizations]'
  '-fwide-exec-charset=[convert all wide strings and character constants to character set]:character set'
  '-fworking-directory[generate a #line directive pointing at the current working directory]'
  '-fwrapv[assume signed arithmetic overflow wraps around]'
  '-fzero-initialized-in-bss[put zero initialized data in the bss section]'
  {-g-,--debug=}'[generate debug information]::debugging information type or level:(0 1 2 3 gdb gdb0 gdb1 gdb2 gdb3 coff stabs stabs+ dwarf dwarf+ dwarf-2 dwarf-3 dwarf-4 dwarf-5 dwarf32 dwarf64 xcoff xcoff+)'
  '-gno-pubnames[don'\''t generate DWARF pubnames and pubtypes sections]'
  '-gno-record-gcc-switches[don'\''t record gcc command line switches in DWARF DW_AT_producer]'
  '-gno-split-dwarf[don'\''t generate debug information in separate .dwo files]'
  '-gno-strict-dwarf[emit DWARF additions beyond selected version]'
  '-gpubnames[generate DWARF pubnames and pubtypes sections]'
  '-grecord-gcc-switches[record gcc command line switches in DWARF DW_AT_producer]'
  '-gsplit-dwarf[generate debug information in separate .dwo files]'
  '-gstrict-dwarf[don'\''t emit DWARF additions beyond selected version]'
  '-gtoggle[toggle debug information generation]'
  '-gvms[generate debug information in VMS format]'
  '--help[display this information]'
  {-H,--trace-includes}'[print name of each header file used]'
  {'*-idirafter','*--include-directory-after='}'[add directory after include search path]:second include path directory:_files -/'
  {'*-I-','*--include-directory='}'[add directory to include search path]:header file search path:_files -/'
  {'*-imacros','*--imacros='}'[include macros from file before parsing]:macro input file:_files -g \*.h\(-.\)'
  '-imultiarch[set <dir> to be the multiarch include subdirectory]:directory:_files -/' #XXX not in manpage
  '-imultilib=[set dir to be the multilib include subdirectory]:dir:_files -/'
  '--include-barrier[restrict all prior -I flags to double-quoted inclusion and remove current directory from include path]'
  {'*-include=','*--include='}'[include file before parsing]:include file:_files -g \*.h\(-.\)'
  '-iplugindir=-[set <dir> to be the default plugin directory]:directory:_files -/'
  {'*-iprefix','*--include-prefix='}'[set the -iwithprefix prefix]:prefix:_files'
  '-iquote=[add dir to the end of the quote include path]:dir:_files -/'
  '-isysroot=[set dir to be the system root directory]:dir:_files -/'
  '*-isystem[add directory to system include search path]:second include path directory (system):_files -/'
  {'*-iwithprefixbefore','*--include-with-prefix-before='}'[set directory to include search path with prefix]:main include path directory:_files -/'
  {'*-iwithprefix','*--include-with-prefix=','*--include-with-prefix-after='}'[set directory to system include search path with prefix]:second include path directory:_files -/'
  '*-L-[add directory to library search path]:library search path:_files -/'
  '-lang-asm[set lang asm]'
  '*-l+[include library found in search path]:library:->library'
  '-MF[write dependency output to the given file]:file:_files'
  '-MJ[write a compilation database entry per input]'
  '-MQ[add a make-quoted target]:target'
  '*-M-[set flags for generating Makefile dependencies]::output dependencies:->dependencies'
  '-MT[add an unquoted target]:target'
  '-no-canonical-prefixes[do not canonicalize paths when building relative prefixes to other gcc components]'
  '-nodefaultlibs[do not use the standard system libraries when linking]'
  '-nostartfiles[do not use the standard system startup files when linking]'
  {-nostdinc,--no-standard-includes}'[do not search standard system directories or compiler builtin directories for include files]'
  '-nostdlib[do not use standard system startup files or libraries when linking]'
  {-O-,--optimize=-}'[control the optimization]::optimization level:((0 1 2 3 g\:optimize\ for\ debugging\ experience s\:optimize\ for\ space fast\:optimize\ for\ speed\ disregarding\ exact\ standards\ compliance))'
  {-o,--output=}'[write output to file]:output file:_files -g "^*.(c|h|cc|C|cxx|cpp|hpp)(-.)"'
  '--output-pch=[output pch]'
  '--param[set parameter <param> to value.  See manpage for a complete list of parameters]:name=value'
  '-pass-exit-codes[exit with highest error code from a phase]'
  {-pedantic-errors,--pedantic-errors}'[like -pedantic but issue them as errors]'
  {-pedantic,--pedantic}'[issue all mandatory diagnostics in the C standard]'
  '(-pg)-p[enable function profiling for prof]'
  '-pie[create a position independent executable]'
  {-pipe,--pipe}'[use pipes rather than intermediate files]'
  {-P,--no-line-commands}'[inhibit generation of linkemakers during preprocess]'
  '(-p)-pg[enable function profiling for gprof]'
  '-###[print commands to run this compilation]'
  '-print-file-name=-[display the full path to library <library>]:library:->library'
  '-print-libgcc-file-name[display the name of the compiler'\''s companion library]'
  '--print-missing-file-dependencies[print missing file dependencies]'
  '-print-multiarch[display the target'\''s normalized GNU triplet, used as a component in the library path]'
  '-print-multi-directory[display the root directory for versions of libgcc]'
  '-print-multi-lib[display the mapping between command line options and multiple library search directories]'
  '-print-multi-os-directory[display the relative path to OS libraries]'
  '-print-prog-name=-[display the full path to compiler component <program>]:program:'
  '-print-search-dirs[display the directories in the compiler'\''s search path]'
  '-print-sysroot[display the target libraries directory]'
  '-print-sysroot-headers-suffix[display the sysroot suffix used to find headers]'
  {-Qn,-fno-ident}'[do not emit metadata containing compiler name and version]'
  '-quiet[do not display functions compiled or elapsed time]'
  {-Qy,-fident}'[emit metadata containing compiler name and version]'
  '-rdynamic[pass the flag -export-dynamic to the ELF linker, on targets that support it]'
  '-remap[remap file names when including files]'
  {-S,--assemble}'[compile only; do not assemble or link]'
  '-save-stats=-[save code generation statistics]:location:(cwd obj)'
  '-save-temps[do not delete intermediate files]'
  '-shared[create a shared library]'
  '-shared-libgcc[force shared libgcc]'
  '*-specs=-[override built-in specs with the contents of <file>]:file:_files'
  '-s[remove all symbol table and relocation information from the executable]'
  '-static-libgcc[force static libgcc]'
  '-static[on systems that support dynamic linking, this prevents linking with the shared libraries]'
  {'-std=-','--std='}'[assume that the input sources are for specified standard]:standard:(c90 c89 iso9899\:1990 iso9899\:199409 c99 iso9899\:1999 c11 iso9899\:2011 gnu90 gnu89 gnu99 gnu11 c++98 c++03 gnu++98 gnu++03 c++11 gnu++11 c++1y gnu++1y c++14 gnu++14 c++1z gnu++1z c++17 iso9899\:2017 gnu++17 c++2a gnu++2a)'
  '-symbolic[bind references to global symbols when building a shared object]'
  '--sysroot=-[use <directory> as the root directory for headers and libraries]:directory:_files -/'
  '--target-help[display target specific command line options]'
  '-time[time the execution of each subprocess]'
  {-traditional-cpp,--traditional-cpp}'[use traditional preprocessor]'
  {-trigraphs,--trigraphs}'[process trigraph sequences]'
  '-T[specify linker script]:linker script:_files'
  '-undef[do not predefine system specific and gcc specific macros]'
  '*-u[pretend symbol to be undefined]:symbol:'
  '--user-dependencies[print user dependencies]'
  {'*-U-','*--undefine-macro='}'[undefine a macro]:undefine macro:'
  '-version[display the compiler'\''s version]'
  '--version[display version information]'
  '-V[specify compiler version]:compiler version:'
  {-v,--verbose}'[enable verbose output]'
  '*-Wa,-[pass arguments to the assembler]:assembler option:'
  '--warn--[enable the specified warning]:warning:->warning'
  '*-Werror=-[treat specified warning as error (or all if none specified)]::warning:->warning'
  '-Wfatal-errors[exit on the first error occurred]'
  '*-Wl,-[pass arguments to the linker]:linker option:'
  {-w,--no-warnings}'[suppress warnings]'
  '*-Wp,-[pass arguments to the preprocessor]:preprocessor option:'
  '--write-dependencies[write a depfile containing user and system dependencies]'
  '--write-user-dependencies[write a depfile containing user dependencies]'
  '*-Xassembler[pass argument to the assembler]:assembler option:'
  '*-Xlinker[pass argument to the linker]:linker option:'
  '*-Xpreprocessor[pass argument to the preprocessor]:preprocessor option:'
  '-x[specify the language of the following input files]:input file language:('"$languages"')'
)

# not meant for end users
#'-fdisable--pass=-[disables an optimization pass]:range1+range2: '
#'-fdisable-[disables an optimization pass]'
#'-fenable--pass=-[enables an optimization pass]:range1+range2: '
#'-fenable-[enables an optimization pass]'
#'-fdump-<type>[dump various compiler internals to a file]'

args+=($warnings)

# How to mostly autogenerate the above stuff:
# joinhelplines() { sed '$!N;s/^\(  -.*\)\n  \s*\([^-]\)/\1 \2/;P;D' }
# gcc-x86() { gcc --help=target,\^undocumented | joinhelplines | joinhelplines }
# compdef _gnu_generic gcc-x86
# printf '%s\n' ${(onq-)_args_cache_gcc_x86}

# TODO: -fno-<TAB> and -mno-<TAB> match lots of non-existent options.
_arguments -C -M 'L:|-{fWm}no-=-{fWm} r:|[_-]=* r:|=*' \
  "$args[@]" \
  "$args2[@]" && ret=0

case "$state" in
dump)
  local -a dump_values=(
    'A[verbose assembly output]'
    'D[macro definitions and normal output]'
    'I[include directives and normal output]'
    'J[after last jump optimization]'
    'L[after loop optimization]'
    'M[only macro definitions]'
    'N[macro names]'
    'R[after second instruction scheduling pass]'
    'S[after first instruction scheduling pass]'
    'a[all dumps]'
    'c[after instruction combination]'
    'd[after delayed branch scheduling]'
    'f[after flow analysis]'
    'g[after global register allocation]'
    'j[after jump optimization]'
    'k[after conversion from registers to stack]'
    'l[after local register allocation]'
    'm[print memory usage statistics]'
    'p[annotate assembler output]'
    'r[after RTL generation]'
    's[after CSE]'
    't[after second CSE pass]'
    'x[only generate RTL]'
    'y[debugging information during parsing]'
  )
  _values -s '' 'dump information' $dump_values && ret=0
  ;;
dependencies)
  local -a dependencies=(
    'D:generate make dependencies and compile'
    'G:treat missing header files as generated'
    'M:only user header files'
    'MD:output to file'
    'P:generate phony targets for all headers'
    'V:use NMake/Jom format for the depfile'
  )
  _describe dependencies dependencies && ret=0
  ;;
library)
  # TODO: improve defaults for library_path (e.g., use output of clang -Wl,-v)
  local -a library_path=( /usr/lib /usr/local/lib )
  case $OSTYPE in
    (darwin*)
      library_path+=( $(xcrun --show-sdk-path)/usr/lib )
      ;;
    (linux-gnu)
      local tmp
      tmp=$(_call_program library-paths $words[1] -print-multiarch)
      if [[ $tmp != '' && -d /usr/lib/$tmp ]]; then
	library_path+=( /usr/lib/$tmp )
      elif [[ -d /usr/lib64 ]]; then
	library_path+=( /usr/lib64 )
      fi
      ;;
  esac
  # Add directories from -L options
  for ((i = 2; i < $#words; i++)); do
    if [[ "$words[i]" = -L ]]; then
      library_path+=("$words[++i]")
    elif [[ "$words[i]" = -L* ]]; then
      library_path+=("${words[i]##-L}")
    fi
  done
  _wanted libraries expl library \
      compadd - $library_path/lib*.(a|so*|dylib)(:t:fr:s/lib//) && ret=0
  ;;
rundir)
  compset -P '*:'
  compset -S ':*'
  _files -/ -S/ -r '\n\t\- /:' "$@" && ret=0
  ;;
help)
  _values -s , 'help' \
    optimizers warnings target params common \
    c c++ objc objc++ lto ada adascil adawhy fortran go java \
    {\^,}undocumented {\^,}joined {\^,}separate \
  && ret=0
  ;;
dirtodir)
  compset -P '*='
  _files -/ && ret=0
  ;;
commafiles)
  compset -P '*,'
  _files && ret=0
  ;;
framework)
  local -a framework_path=()
  case $OSTYPE in
    darwin*)
      framework_path=( $(xcrun --show-sdk-path)/System/Library/Frameworks ) ;;
  esac
  # Add directories from -F options
  for ((i = 2; i < $#words; i++)); do
    if [[ "$words[i]" = -F ]]; then
      framework_path+=("$words[++i]")
    elif [[ "$words[i]" = -F* ]]; then
      framework_path+=("${words[i]##-F}")
    fi
  done
  _wanted frameworks expl framework \
      compadd -- $framework_path/*.framework(:t:r) && ret=0
  ;;
warning)
  local -a warning_names
  for warning in $warnings; do
    if [[ "$warning" = (#b)-W([^=\[]##)[^\[]#\[(*)\]* ]]; then
      warning_names+=("$match[1]:$match[2]")
    fi
  done
  _describe warning warning_names && ret=0
  ;;
arch)
  _wanted cputypes expl "CPU type" compadd -a arch && ret=0
  ;;
archgeneric)
  arch+=(generic)
  _wanted cputypes expl "CPU type" compadd -a arch && ret=0
  ;;
esac

return ret

^ permalink raw reply	[relevance 1%]

* Re: [PATCH v3 1/1] exec: run final pipeline command in a subshell in sh mode
  2021-03-27 19:34  0%   ` Lawrence Velázquez
@ 2021-04-03 15:49  0%     ` Lawrence Velázquez
  2021-04-10 20:05  0%       ` Lawrence Velázquez
  0 siblings, 1 reply; 200+ results
From: Lawrence Velázquez @ 2021-04-03 15:49 UTC (permalink / raw)
  To: zsh-workers

On Sat, Mar 27, 2021, at 3:34 PM, Lawrence Velázquez wrote:
> On Sun, Jan 3, 2021, at 7:22 PM, brian m. carlson wrote:
> > zsh typically runs the final command in a pipeline in the main shell
> > instead of a subshell.  However, POSIX specifies that all commands in a
> > pipeline run in a subshell, but permits zsh's behavior as an extension.
> > The default /bin/sh implementations on various Linux distros and the
> > BSDs always use a subshell for all components of a pipeline.
> > 
> > Since zsh may be used as /bin/sh in some cases (such as macOS Catalina),
> > it makes sense to have the common sh behavior when emulating sh, so do
> > that by checking for being the final item of a multi-item pipeline and
> > creating a subshell in that case.
> 
> ping for review

Ping: 2.0 You Can (Not) Review

vq


^ permalink raw reply	[relevance 0%]

* Re: [PATCH] declarednull: rename DECLARED to NULL
  2021-03-29  0:44  3%                   ` Oliver Kiddle
@ 2021-04-10 18:56  4%                     ` Bart Schaefer
  2021-04-10 21:58  3%                       ` Oliver Kiddle
  0 siblings, 1 reply; 200+ results
From: Bart Schaefer @ 2021-04-10 18:56 UTC (permalink / raw)
  To: Oliver Kiddle; +Cc: Zsh hackers list

On Sun, Mar 28, 2021 at 5:44 PM Oliver Kiddle <opk@zsh.org> wrote:
>
> Bart Schaefer wrote:
> > IMO the primary remaining question is
> > whether it's acceptable to make the user-visible behavior dependent on
> > the POSIX_BUILTINS option.
>
> It seems fairly self-contained and could have it's own option. typeset
> isn't a builtin. posix compatibility options aren't really improvements
> but someone might prefer this behaviour.

(I'm reading that as "typeset isn't a POSIX builtin").  There has at
least been discussion about standardizing "local" on austin-group, and
given that "local" is an alias for typeset, this (or related) behavior
might become a POSIX compatibility thing in the future.

I'm also somewhat concerned that choosing a descriptive name for a new
option is going to spawn another argument.  TYPESET_DOES_NOT_SET ?

As mentioned long ago, it could also be an emulation-mode thing,
although that makes it a lot more difficult to access at a scripting
level.

> Was there anything else outstanding like (t) output perhaps?

I believe I have dealt properly with ${(t)var}.  I'll add something to
the doc about ${emptystr[(i)]}, because that's a weird case even
without this patch.


^ permalink raw reply	[relevance 4%]

* Re: [PATCH v3 1/1] exec: run final pipeline command in a subshell in sh mode
  2021-04-03 15:49  0%     ` Lawrence Velázquez
@ 2021-04-10 20:05  0%       ` Lawrence Velázquez
  0 siblings, 0 replies; 200+ results
From: Lawrence Velázquez @ 2021-04-10 20:05 UTC (permalink / raw)
  To: zsh-workers

On Sat, Apr 3, 2021, at 11:49 AM, Lawrence Velázquez wrote:
> On Sat, Mar 27, 2021, at 3:34 PM, Lawrence Velázquez wrote:
> > On Sun, Jan 3, 2021, at 7:22 PM, brian m. carlson wrote:
> > > zsh typically runs the final command in a pipeline in the main shell
> > > instead of a subshell.  However, POSIX specifies that all commands in a
> > > pipeline run in a subshell, but permits zsh's behavior as an extension.
> > > The default /bin/sh implementations on various Linux distros and the
> > > BSDs always use a subshell for all components of a pipeline.
> > > 
> > > Since zsh may be used as /bin/sh in some cases (such as macOS Catalina),
> > > it makes sense to have the common sh behavior when emulating sh, so do
> > > that by checking for being the final item of a multi-item pipeline and
> > > creating a subshell in that case.
> > 
> > ping for review
> 
> Ping: 2.0 You Can (Not) Review

The Ping for Review Part III

vq


^ permalink raw reply	[relevance 0%]

* Re: [PATCH] declarednull: rename DECLARED to NULL
  2021-04-10 18:56  4%                     ` Bart Schaefer
@ 2021-04-10 21:58  3%                       ` Oliver Kiddle
  0 siblings, 0 replies; 200+ results
From: Oliver Kiddle @ 2021-04-10 21:58 UTC (permalink / raw)
  To: Zsh hackers list

Bart Schaefer wrote:
> On Sun, Mar 28, 2021 at 5:44 PM Oliver Kiddle <opk@zsh.org> wrote:
> > It seems fairly self-contained and could have it's own option. typeset
> > isn't a builtin. posix compatibility options aren't really improvements
> > but someone might prefer this behaviour.
>
> (I'm reading that as "typeset isn't a POSIX builtin").  There has at

I meant it more in the sense of "typeset is a reserved word". I know
that's only true to a limited extent and a future POSIX standardisation
of local would likely only cover functionality that works as a builtin.
I don't really have a strong opinion but would like to see the work
finished off and pushed.

> I'm also somewhat concerned that choosing a descriptive name for a new
> option is going to spawn another argument.  TYPESET_DOES_NOT_SET ?

I can understand that, its never easy to name these things.

> As mentioned long ago, it could also be an emulation-mode thing,
> although that makes it a lot more difficult to access at a scripting
> level.

I'd be fine with that too if you prefer. If you think you might want to
change how it is controlled later, an internal macro would make that
easier. But I'm, not sure backward compatibility concerns would ever
allow that anyway.

Oliver


^ permalink raw reply	[relevance 3%]

* [PATCH] Document imperfections in POSIX/sh compatibility
@ 2021-04-10 23:31 11% dana
  2021-04-10 23:50  5% ` Bart Schaefer
  2021-04-13 16:01  5% ` Daniel Shahaf
  0 siblings, 2 replies; 200+ results
From: dana @ 2021-04-10 23:31 UTC (permalink / raw)
  To: Zsh hackers list

Lawrence bumping 47794 reminded me of this. Someone on IRC was trying to use
zsh as sh and they were very annoyed to learn that the sh emulation has
imperfections that aren't really documented anywhere. I said i would add a
mention. Let me know if this is editorialising it too much

dana


diff --git a/Doc/Zsh/compat.yo b/Doc/Zsh/compat.yo
index f1be15fee..a09187918 100644
--- a/Doc/Zsh/compat.yo
+++ b/Doc/Zsh/compat.yo
@@ -74,3 +74,8 @@ tt(PROMPT_SUBST)
 and
 tt(SINGLE_LINE_ZLE)
 options are set if zsh is invoked as tt(ksh).
+
+Please note that zsh's emulation of other shells, as well as the degree
+of its POSIX compliance, is provided on a `best effort' basis.  Full
+compatibility is not guaranteed, and is not necessarily a goal of the
+project.



^ permalink raw reply	[relevance 11%]

* Re: [PATCH] Document imperfections in POSIX/sh compatibility
  2021-04-10 23:31 11% [PATCH] Document imperfections in POSIX/sh compatibility dana
@ 2021-04-10 23:50  5% ` Bart Schaefer
  2021-04-11  0:19 10%   ` dana
  2021-04-13 16:01  5% ` Daniel Shahaf
  1 sibling, 1 reply; 200+ results
From: Bart Schaefer @ 2021-04-10 23:50 UTC (permalink / raw)
  To: dana; +Cc: Zsh hackers list

On Sat, Apr 10, 2021 at 4:32 PM dana <dana@dana.is> wrote:
>
> Someone on IRC was trying to use
> zsh as sh and they were very annoyed to learn that the sh emulation has
> imperfections

Any particular ones?  You're right about

> not necessarily a goal

but I'm curious.


^ permalink raw reply	[relevance 5%]

* Re: [PATCH] Document imperfections in POSIX/sh compatibility
  2021-04-10 23:50  5% ` Bart Schaefer
@ 2021-04-11  0:19 10%   ` dana
  2021-04-11 16:54  5%     ` Bart Schaefer
  0 siblings, 1 reply; 200+ results
From: dana @ 2021-04-11  0:19 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: Zsh hackers list

On 10 Apr 2021, at 18:50, Bart Schaefer <schaefer@brasslantern.com> wrote:
> Any particular ones?

I had someone pull the logs. It looks like the person was just warned by
someone else that the sh mode's accuracy is 'iffy' and that zsh doesn't have
POSIX compliance as an actual project goal. There was no specific
functionality mentioned

Since you asked, off the top of my head, zsh's getopts isn't POSIX-compliant
due to its handling of '+'-prefixed options. I think i had a patch somewhere
to make that respect POSIX_BUILTINS

dana



^ permalink raw reply	[relevance 10%]

* Re: [PATCH] Document imperfections in POSIX/sh compatibility
  2021-04-11  0:19 10%   ` dana
@ 2021-04-11 16:54  5%     ` Bart Schaefer
  2021-04-11 17:57 12%       ` sh emulation POSIX non-conformances (Was: [PATCH] Document imperfections in POSIX/sh compatibility) Stephane Chazelas
  2021-04-11 23:04  9%       ` [PATCH] Document imperfections in POSIX/sh compatibility dana
  0 siblings, 2 replies; 200+ results
From: Bart Schaefer @ 2021-04-11 16:54 UTC (permalink / raw)
  To: dana; +Cc: Zsh hackers list

On Sat, Apr 10, 2021 at 5:19 PM dana <dana@dana.is> wrote:
>
> Since you asked, off the top of my head, zsh's getopts isn't POSIX-compliant
> due to its handling of '+'-prefixed options. I think i had a patch somewhere
> to make that respect POSIX_BUILTINS

You're talking about the thread from workers/42248, which itself
mentions a thread from workers/35317.  Did none of those patches get
applied?


^ permalink raw reply	[relevance 5%]

* sh emulation POSIX non-conformances (Was: [PATCH] Document imperfections in POSIX/sh compatibility)
  2021-04-11 16:54  5%     ` Bart Schaefer
@ 2021-04-11 17:57 12%       ` Stephane Chazelas
  2021-04-11 18:13 10%         ` Bart Schaefer
                           ` (4 more replies)
  2021-04-11 23:04  9%       ` [PATCH] Document imperfections in POSIX/sh compatibility dana
  1 sibling, 5 replies; 200+ results
From: Stephane Chazelas @ 2021-04-11 17:57 UTC (permalink / raw)
  To: Zsh hackers list

Some non-POSIX conformances I can think of ATM:

* "echo -" does not output -\n

  last (or one of the last) time it was brought up, I pointed
  out that anyway few shells were POSIX compliant in that regard
  in that for instance POSIX requires "echo -e" to output
  "-e\n".

  I've since asked POSIX allow echo -e, echo -E (and
  combinations of those and -n), and zsh's echo -. They've
  rejected the latter part. See
  https://www.austingroupbugs.net/view.php?id=1222

  So I think it would make sense now to stop accepting "-" as
  option delimiter in sh emulation.

* a few of zsh's reserved words are still available in POSIX
  mode.

  $ zsh --emulate sh -c 'foreach() { true; }'
  zsh:1: parse error near `()'
  $ zsh --emulate sh -c 'end() { true; }'
  zsh:1: parse error near `end'

* IFS treated as separator and not delimiter:

  $ a='a:b:' zsh --emulate sh -c 'IFS=:; printf "<%s>\n" $a'
  <a>
  <b>
  <>

  (POSIX requires <a> and <b> only). Many shells used to behave
  like zsh, but switched for POSIX compliance even though the
  zsh behaviour is more useful for instance to break down
  variables like $PATH (like /bin:/usr/bin: which should be
  split into "/bin", "/usr/bin" and "").

* whitespace characters other than SPC/TAB/NL not treated as IFS
  whitespace.

  $ a=$'\ra\r\rb' zsh --emulate sh -c $'IFS=\r; printf "<%s>\n" $a'
  <>
  <a>
  <>
  <b>

  POSIX requires only <a> and <b> above as isspace('\r') is
  true so \r should receive the same treatment as space, \t, \n.
  Few shells do it. bash has only started recently doing it and
  only for single byte characters (so is not POSIX either).

-- 
Stephane


^ permalink raw reply	[relevance 12%]

* Re: sh emulation POSIX non-conformances (Was: [PATCH] Document imperfections in POSIX/sh compatibility)
  2021-04-11 17:57 12%       ` sh emulation POSIX non-conformances (Was: [PATCH] Document imperfections in POSIX/sh compatibility) Stephane Chazelas
@ 2021-04-11 18:13 10%         ` Bart Schaefer
  2021-04-11 19:18 10%         ` sh emulation POSIX non-conformances (no word splitting upon arithmetic expansion) Stephane Chazelas
                           ` (3 subsequent siblings)
  4 siblings, 0 replies; 200+ results
From: Bart Schaefer @ 2021-04-11 18:13 UTC (permalink / raw)
  To: Zsh hackers list

On Sun, Apr 11, 2021 at 10:58 AM Stephane Chazelas
<stephane@chazelas.org> wrote:
>
> Some non-POSIX conformances I can think of ATM:

Thanks for this list ... but POSIX conformance and /bin/sh
"replaceability" are not necessarily the same thing.

If I have time, I'll add failure tests for these to E03posix.ztst
(when that finally gets merged from declarednull).


^ permalink raw reply	[relevance 10%]

* Re: sh emulation POSIX non-conformances (no word splitting upon arithmetic expansion)
  2021-04-11 17:57 12%       ` sh emulation POSIX non-conformances (Was: [PATCH] Document imperfections in POSIX/sh compatibility) Stephane Chazelas
  2021-04-11 18:13 10%         ` Bart Schaefer
@ 2021-04-11 19:18 10%         ` Stephane Chazelas
  2021-04-22 15:03  5%           ` Vincent Lefevre
  2021-04-11 19:31  9%         ` sh emulation POSIX non-conformances ("inf"/"Inf" in arithmetic expressions) Stephane Chazelas
                           ` (2 subsequent siblings)
  4 siblings, 1 reply; 200+ results
From: Stephane Chazelas @ 2021-04-11 19:18 UTC (permalink / raw)
  To: Zsh hackers list

2021-04-11 18:57:26 +0100, Stephane Chazelas:
> Some non-POSIX conformances I can think of ATM:
[...]

Another one:

$ zsh --emulate sh -c 'IFS=2; printf "<%s>\n" $((11*11))'
<121>

While POSIX (beleive it or not) requires:

<1>
<1>

Again, that's one of the cases where many shells (most ash-based ones,
pdksh, yash at least) behaved like zsh but switched for POSIX
compliance (even though that hardly makes sense).

-- 
Stephane


^ permalink raw reply	[relevance 10%]

* Re: sh emulation POSIX non-conformances ("inf"/"Inf" in arithmetic expressions)
  2021-04-11 17:57 12%       ` sh emulation POSIX non-conformances (Was: [PATCH] Document imperfections in POSIX/sh compatibility) Stephane Chazelas
  2021-04-11 18:13 10%         ` Bart Schaefer
  2021-04-11 19:18 10%         ` sh emulation POSIX non-conformances (no word splitting upon arithmetic expansion) Stephane Chazelas
@ 2021-04-11 19:31  9%         ` Stephane Chazelas
  2021-04-12 20:41 10%           ` Bart Schaefer
  2021-04-11 19:33  5%         ` sh emulation POSIX non-conformances (some of zsh's special variables) Stephane Chazelas
  2021-04-11 19:42 10%         ` sh emulation POSIX non-conformances (printf %10s and bytes vs character) Stephane Chazelas
  4 siblings, 1 reply; 200+ results
From: Stephane Chazelas @ 2021-04-11 19:31 UTC (permalink / raw)
  To: Zsh hackers list

2021-04-11 18:57:26 +0100, Stephane Chazelas:
> Some non-POSIX conformances I can think of ATM:
[...]

Also:

$ zsh --emulate sh -c 'inf=42; echo $((inf))'
Inf

(POSIX requires 42 there).


^ permalink raw reply	[relevance 9%]

* Re: sh emulation POSIX non-conformances (some of zsh's special variables)
  2021-04-11 17:57 12%       ` sh emulation POSIX non-conformances (Was: [PATCH] Document imperfections in POSIX/sh compatibility) Stephane Chazelas
                           ` (2 preceding siblings ...)
  2021-04-11 19:31  9%         ` sh emulation POSIX non-conformances ("inf"/"Inf" in arithmetic expressions) Stephane Chazelas
@ 2021-04-11 19:33  5%         ` Stephane Chazelas
  2021-04-11 19:42 10%         ` sh emulation POSIX non-conformances (printf %10s and bytes vs character) Stephane Chazelas
  4 siblings, 0 replies; 200+ results
From: Stephane Chazelas @ 2021-04-11 19:33 UTC (permalink / raw)
  To: Zsh hackers list

2021-04-11 18:57:26 +0100, Stephane Chazelas:
> Some non-POSIX conformances I can think of ATM:
[...]

$ zsh --emulate sh -c 'EUID=10; echo "$EUID"'
zsh:1: failed to change effective user ID: operation not permitted

But then again, many shells have similar problems with their own
special variables.

-- 
Stephane


^ permalink raw reply	[relevance 5%]

* Re: sh emulation POSIX non-conformances (printf %10s and bytes vs character)
  2021-04-11 17:57 12%       ` sh emulation POSIX non-conformances (Was: [PATCH] Document imperfections in POSIX/sh compatibility) Stephane Chazelas
                           ` (3 preceding siblings ...)
  2021-04-11 19:33  5%         ` sh emulation POSIX non-conformances (some of zsh's special variables) Stephane Chazelas
@ 2021-04-11 19:42 10%         ` Stephane Chazelas
  2021-04-13 15:57  5%           ` Daniel Shahaf
  2021-04-22 13:59  5%           ` Vincent Lefevre
  4 siblings, 2 replies; 200+ results
From: Stephane Chazelas @ 2021-04-11 19:42 UTC (permalink / raw)
  To: Zsh hackers list

2021-04-11 18:57:26 +0100, Stephane Chazelas:
> Some non-POSIX conformances I can think of ATM:
[...]

Another POSIX bug fixed by zsh (but which makes it non-compliant):

With multibyte characters:

$ printf '|%10s|\n' Stéphane Chazelas
|  Stéphane|
|  Chazelas|

POSIX requires:

| Stéphane|
|  Chazelas|

(with a UTF-8 é encoded one 2 bytes), that is, the width to be
a number of bytes not characters.

ksh93 has printf %20Ls where width is based on the display width
of characters.

$ zsh -c "printf '|%10Ls|\n' Ste$'\u0301'phane Chazelas"
| Stéphane|
|  Chazelas|
$ ksh -c "printf '|%10Ls|\n' Ste$'\u0301'phane Chazelas"
|  Stéphane|
|  Chazelas|

(that one is not specified by POSIX)


-- 
Stephane


^ permalink raw reply	[relevance 10%]

* Re: [PATCH] Document imperfections in POSIX/sh compatibility
  2021-04-11 16:54  5%     ` Bart Schaefer
  2021-04-11 17:57 12%       ` sh emulation POSIX non-conformances (Was: [PATCH] Document imperfections in POSIX/sh compatibility) Stephane Chazelas
@ 2021-04-11 23:04  9%       ` dana
  1 sibling, 0 replies; 200+ results
From: dana @ 2021-04-11 23:04 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: Zsh hackers list

On 11 Apr 2021, at 11:54, Bart Schaefer <schaefer@brasslantern.com> wrote:
> You're talking about the thread from workers/42248, which itself
> mentions a thread from workers/35317.  Did none of those patches get
> applied?

No, this is a separate problem. POSIX says getopts shall end option processing
when it encounters either an error or a non-optarg consisting of '--' or not
beginning with '-'. zsh's getopts has no way of disabling '+'-prefixed option
handling, so it isn't conformant with that.

Regarding the other thing, Peter's patch from 35318 was applied, but mine was
not. I guess Peter wanted me to change the behaviour only with POSIX_BUILTINS
set. I'll look at it again later

dana



^ permalink raw reply	[relevance 9%]

* Re: sh emulation POSIX non-conformances ("inf"/"Inf" in arithmetic expressions)
  2021-04-11 19:31  9%         ` sh emulation POSIX non-conformances ("inf"/"Inf" in arithmetic expressions) Stephane Chazelas
@ 2021-04-12 20:41 10%           ` Bart Schaefer
  2021-04-13  7:17  9%             ` Stephane Chazelas
  0 siblings, 1 reply; 200+ results
From: Bart Schaefer @ 2021-04-12 20:41 UTC (permalink / raw)
  To: Zsh hackers list

On Sun, Apr 11, 2021 at 12:32 PM Stephane Chazelas
<stephane@chazelas.org> wrote:
>
> $ zsh --emulate sh -c 'inf=42; echo $((inf))'
> Inf
>
> (POSIX requires 42 there).

Is that because "Inf" is case-sensitive, or because POSIX requires
evaluating the variable?  E.g. what does

sh -c 'Inf=42; echo $((Inf))'

yield in POSIX?  What about

sh -c 'unset Inf; echo $((Inf))'
sh -c 'unset inf; echo $((inf))'

??  I don't have a POSIX shell to test with, it seems.  Ksh "Version A
2020.0.0" responds the same as zsh, and bash "5.0.17(1)-release"
doesn't seem to have Inf at all (and gives a syntax error on
floating-point arithmetic?).


^ permalink raw reply	[relevance 10%]

* Re: sh emulation POSIX non-conformances ("inf"/"Inf" in arithmetic expressions)
  2021-04-12 20:41 10%           ` Bart Schaefer
@ 2021-04-13  7:17  9%             ` Stephane Chazelas
  2021-04-22 15:31  5%               ` Vincent Lefevre
  0 siblings, 1 reply; 200+ results
From: Stephane Chazelas @ 2021-04-13  7:17 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: Zsh hackers list

2021-04-12 13:41:58 -0700, Bart Schaefer:
> On Sun, Apr 11, 2021 at 12:32 PM Stephane Chazelas
> <stephane@chazelas.org> wrote:
> >
> > $ zsh --emulate sh -c 'inf=42; echo $((inf))'
> > Inf
> >
> > (POSIX requires 42 there).
> 
> Is that because "Inf" is case-sensitive, or because POSIX requires
> evaluating the variable?  E.g. what does

That was because "inf" in an arithmetic expression, where inf is
the name of a variable whose contents is an integer constant
(decimal, octal or hex) is meant to represent the corresponding
integer number (and an empty or unset variable is meant to yield
0)..

https://pubs.opengroup.org/onlinepubs/9699919799.2018edition/basedefs/V1_chap08.html#tag_08
warns about some of the special variables used by some shells
(such as RANDOM and SECONDS), but in those cases, $((RANDOM))
still expands to the value of the variable.

Here, a user must make sure they don't use "inf" (or
INF/InF/Inf, nan/NAN...) as the name of a variable if they want
to use it in an arithmetic expression. Same family of issues as
those linked to zsh special parameters or keywords/builtins. 

Since the POSIX shell language doesn't support floating point
arithmetics, zsh could disable it in POSIX mode, but it may not
be worth the bother. Since floating point arithmetics is
supported by a few shells (ksh93, yash, zsh), maybe a better
approach would be for text to be added to the POSIX standard to
warn against using those as variable names.

I think it would be worth documenting that nan and inf are
recognised in arithmetic expressions (and warn against using
variables with the same name). Maybe something like:

diff --git a/Doc/Zsh/arith.yo b/Doc/Zsh/arith.yo
index bc3e35ad5..44c35edab 100644
--- a/Doc/Zsh/arith.yo
+++ b/Doc/Zsh/arith.yo
@@ -120,6 +120,11 @@ taken for a parameter name.  All numeric parts (before and after the
 decimal point and in the exponent) may contain underscores after the
 leading digit for visual guidance; these are ignored in computation.
 
+tt(Inf)) and tt(NaN) and all their variation of case (tt(inf), tt(NAN), etc.)
+are also recognised as meaning "infinity" and "not-a-number" floating point
+constants respectively. One should avoid using variables with such names when
+they are to be used in arithmetic expressions.
+
 cindex(arithmetic operators)
 cindex(operators, arithmetic)
 An arithmetic expression uses nearly the same syntax and

> 
> sh -c 'Inf=42; echo $((Inf))'
> 
> yield in POSIX?  What about

42

> sh -c 'unset Inf; echo $((Inf))'

0

> sh -c 'unset inf; echo $((inf))'

0

> ??  I don't have a POSIX shell to test with, it seems.  Ksh "Version A
> 2020.0.0" responds the same as zsh, and bash "5.0.17(1)-release"
> doesn't seem to have Inf at all (and gives a syntax error on
> floating-point arithmetic?).

There's not really such a thing as a POSIX shell. There's a
standard specification of the POSIX sh *language*, and a number
of shell implementations that try to provide a compliant
interpreter for that language.

That language specification was initially based on a subset of
ksh88's, but with some deviations.

The only Unix shells that I know that have been /certified/ as
compliant are some ksh88 derivatives (like on Solaris, AIX,
HPUX) and some versions of bash (in posix mode and with xpg_echo
enabled, like on macos, Inspur K/UX).

They both have non-conformances, especially ksh88-based ones
(which have much more serious ones than the one I've listed in
this thread). I'd say zsh's sh emulation is probably more
compliant than those ksh88-based ones.

The Opengroup does have a certification test suite, but I don't
think it's publicly available.

Note that ksh2020 development has been abandoned. It was based
on a beta version of ksh93 released when AT&T Research was shut
down, but eventually deemed too buggy to fix. There is still
some community effort to maintain a ksh93u+ based shell.

Having said that, ksh93/ksh2020 is one of the few Bourne-like
shells that support floating point arithmetic expressions (and
the first one that did). $((inf)) expands to "inf" for me with
those (which would also make it non-compliant).

yash (the other shell with floating point arithmetic expressions
and which was written to the POSIX specification) doesn't support
nan/inf in arithmetic expressions unless you do

  inf=inf nan=nan (and Inf=inf, NaN=nan... if you want to use
  those)

and disables floating point arithmetics when in posix mode (yash
-o posix). All three handle the locale decimal radix character
differently, which makes me think there's little hope floating
point arithmetics ever makes it to the POSIX spec.

-- 
Stephane


^ permalink raw reply	[relevance 9%]

* Re: sh emulation POSIX non-conformances (printf %10s and bytes vs character)
  2021-04-11 19:42 10%         ` sh emulation POSIX non-conformances (printf %10s and bytes vs character) Stephane Chazelas
@ 2021-04-13 15:57  5%           ` Daniel Shahaf
  2021-04-13 18:03  5%             ` Stephane Chazelas
  2021-04-22 13:59  5%           ` Vincent Lefevre
  1 sibling, 1 reply; 200+ results
From: Daniel Shahaf @ 2021-04-13 15:57 UTC (permalink / raw)
  To: Zsh hackers list

Stephane Chazelas wrote on Sun, Apr 11, 2021 at 20:42:05 +0100:
> Another POSIX bug fixed by zsh (but which makes it non-compliant):
> 
> With multibyte characters:
> 
> $ printf '|%10s|\n' Stéphane Chazelas
> |  Stéphane|
> |  Chazelas|
> 
> POSIX requires:
> 
> | Stéphane|
> |  Chazelas|
> 
> (with a UTF-8 é encoded one 2 bytes

Note that e-with-acute has two encodings in Unicode:

é, one codepoint, two UTF-8 bytes
é, two codepoints, three UTF-8 bytes

https://en.wikipedia.org/wiki/Unicode_equivalence#Normal_forms


^ permalink raw reply	[relevance 5%]

* Re: [PATCH] Document imperfections in POSIX/sh compatibility
  2021-04-10 23:31 11% [PATCH] Document imperfections in POSIX/sh compatibility dana
  2021-04-10 23:50  5% ` Bart Schaefer
@ 2021-04-13 16:01  5% ` Daniel Shahaf
  2021-04-13 16:12  9%   ` Peter Stephenson
  2021-04-13 20:28 10%   ` Oliver Kiddle
  1 sibling, 2 replies; 200+ results
From: Daniel Shahaf @ 2021-04-13 16:01 UTC (permalink / raw)
  To: dana; +Cc: Zsh hackers list

dana wrote on Sat, Apr 10, 2021 at 18:31:31 -0500:
> Lawrence bumping 47794 reminded me of this. Someone on IRC was trying to use
> zsh as sh and they were very annoyed to learn that the sh emulation has
> imperfections that aren't really documented anywhere. I said i would add a
> mention. Let me know if this is editorialising it too much
> 
> dana
> 
> 
> diff --git a/Doc/Zsh/compat.yo b/Doc/Zsh/compat.yo
> index f1be15fee..a09187918 100644
> --- a/Doc/Zsh/compat.yo
> +++ b/Doc/Zsh/compat.yo
> @@ -74,3 +74,8 @@ tt(PROMPT_SUBST)
>  and
>  tt(SINGLE_LINE_ZLE)
>  options are set if zsh is invoked as tt(ksh).
> +
> +Please note that zsh's emulation of other shells, as well as the degree
> +of its POSIX compliance, is provided on a `best effort' basis.  Full
> +compatibility is not guaranteed, and is not necessarily a goal of the
> +project.

I'm concerned that saying "is not necessarily a goal of the project"
might discourage people from even reporting bugs in the first place.
No objection to setting expectations, of course, but could we phrase it
differently?  E.g., by documenting a list of known incompatibilities
that won't be fixed?

Sorry for going off-topic ;-)

Cheers,

Daniel


^ permalink raw reply	[relevance 5%]

* Re: [PATCH] Document imperfections in POSIX/sh compatibility
  2021-04-13 16:01  5% ` Daniel Shahaf
@ 2021-04-13 16:12  9%   ` Peter Stephenson
  2021-04-13 20:28 10%   ` Oliver Kiddle
  1 sibling, 0 replies; 200+ results
From: Peter Stephenson @ 2021-04-13 16:12 UTC (permalink / raw)
  To: Zsh hackers list

> On 13 April 2021 at 17:01 Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
> dana wrote on Sat, Apr 10, 2021 at 18:31:31 -0500:
> > +Please note that zsh's emulation of other shells, as well as the degree
> > +of its POSIX compliance, is provided on a `best effort' basis.  Full
> > +compatibility is not guaranteed, and is not necessarily a goal of the
> > +project.
> 
> I'm concerned that saying "is not necessarily a goal of the project"
> might discourage people from even reporting bugs in the first place.
> No objection to setting expectations, of course, but could we phrase it
> differently?  E.g., by documenting a list of known incompatibilities
> that won't be fixed?

This is certainly a good point.

The classic list of differences is in the FAQ, "how does zsh differ from..>".
It refers to "sh", implying the classic Bourne shell, rather than POSIX,
but this is probably the right starting point.  I think referring to the
FAQ here is probably the right thing to do --- it simultaneously makes
the points that (i) we are in principle interested (ii) it's not, however,
necessarily something that's ultimately going to be dealt with in the
shell itself.

pws


^ permalink raw reply	[relevance 9%]

* Re: sh emulation POSIX non-conformances (printf %10s and bytes vs character)
  2021-04-13 15:57  5%           ` Daniel Shahaf
@ 2021-04-13 18:03  5%             ` Stephane Chazelas
  2021-04-13 21:09  5%               ` Bart Schaefer
  0 siblings, 1 reply; 200+ results
From: Stephane Chazelas @ 2021-04-13 18:03 UTC (permalink / raw)
  To: Daniel Shahaf; +Cc: Zsh hackers list

2021-04-13 15:57:44 +0000, Daniel Shahaf:
> Stephane Chazelas wrote on Sun, Apr 11, 2021 at 20:42:05 +0100:
> > Another POSIX bug fixed by zsh (but which makes it non-compliant):
> > 
> > With multibyte characters:
> > 
> > $ printf '|%10s|\n' Stéphane Chazelas
> > |  Stéphane|
> > |  Chazelas|
> > 
> > POSIX requires:
> > 
> > | Stéphane|
> > |  Chazelas|
> > 
> > (with a UTF-8 é encoded one 2 bytes
> 
> Note that e-with-acute has two encodings in Unicode:
> 
> é, one codepoint, two UTF-8 bytes
> é, two codepoints, three UTF-8 bytes
> 
> https://en.wikipedia.org/wiki/Unicode_equivalence#Normal_forms

That was shown already in the part of my message you didn't
quote, where I pointed out how ksh93 addresses it with its %Ls
(zsh also has ${(ml[10])var} for that though).

See also:

https://unix.stackexchange.com/questions/350240/why-is-printf-shrinking-umlaut

Cheers,
Stephane


^ permalink raw reply	[relevance 5%]

* Re: [PATCH] Document imperfections in POSIX/sh compatibility
  2021-04-13 16:01  5% ` Daniel Shahaf
  2021-04-13 16:12  9%   ` Peter Stephenson
@ 2021-04-13 20:28 10%   ` Oliver Kiddle
  2021-04-13 21:40 11%     ` dana
  1 sibling, 1 reply; 200+ results
From: Oliver Kiddle @ 2021-04-13 20:28 UTC (permalink / raw)
  To: Zsh hackers list

Daniel Shahaf wrote:
> dana wrote on Sat, Apr 10, 2021 at 18:31:31 -0500:
> > +Please note that zsh's emulation of other shells, as well as the degree
> > +of its POSIX compliance, is provided on a `best effort' basis.  Full
> > +compatibility is not guaranteed, and is not necessarily a goal of the
> > +project.
>
> I'm concerned that saying "is not necessarily a goal of the project"
> might discourage people from even reporting bugs in the first place.

Or of contributing fixes. In the past we've been open to POSIX related
fixes.
The entire project is done on a `best effort' basis with no guarantees.

> No objection to setting expectations, of course, but could we phrase it
> differently?  E.g., by documenting a list of known incompatibilities
> that won't be fixed?

It might be sensible to have a file separate from Etc/BUGS for listing
issues related to POSIX compliance. I don't imagine there is anything that
"won't be fixed" in the sense that it has been outright rejected as
opposed to nobody has come forward with an implementation.

Mostly when I've come across people complaining about zsh's lack of
compliance, they either aren't using emulation at all or are expecting
bash scripts to work unchanged. And they're too lazy to understand the
issues. It doesn't help when even something like the Intel C compiler
comes with idiotic advice to use bash -c 'source ...;exec zsh' despite
the necessary fix being no more than a one-line tweak.

In the repository is the file Etc/STD-TODO that documents some
incompatibilities, mainly against ksh93. In that context, "standard" is
not used to mean a formal standard such as POSIX but rather features
common to several shells. That file is excluded from a release
distribution.

Oliver


^ permalink raw reply	[relevance 10%]

* Re: sh emulation POSIX non-conformances (printf %10s and bytes vs character)
  2021-04-13 18:03  5%             ` Stephane Chazelas
@ 2021-04-13 21:09  5%               ` Bart Schaefer
  0 siblings, 0 replies; 200+ results
From: Bart Schaefer @ 2021-04-13 21:09 UTC (permalink / raw)
  To: Daniel Shahaf, Zsh hackers list

On Tue, Apr 13, 2021 at 11:05 AM Stephane Chazelas
<stephane@chazelas.org> wrote:
>
> That was shown already in the part of my message you didn't
> quote, where I pointed out how ksh93 addresses it with its %Ls

Zsh printf currently flat-out ignores size modifiers (%ls %Ls %hs).
Just skips over them.  That might leave some room for a change, if
anyone cares.


^ permalink raw reply	[relevance 5%]

* Re: [PATCH] Document imperfections in POSIX/sh compatibility
  2021-04-13 20:28 10%   ` Oliver Kiddle
@ 2021-04-13 21:40 11%     ` dana
  2021-04-13 22:02  5%       ` Bart Schaefer
  2021-04-14 12:38  5%       ` Daniel Shahaf
  0 siblings, 2 replies; 200+ results
From: dana @ 2021-04-13 21:40 UTC (permalink / raw)
  To: Oliver Kiddle; +Cc: Zsh hackers list, Daniel Shahaf

On 13 Apr 2021, at 11:01, Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
> I'm concerned that saying "is not necessarily a goal of the project"
> might discourage people from even reporting bugs in the first place.

On 13 Apr 2021, at 15:28, Oliver Kiddle <opk@zsh.org> wrote:
> Or of contributing fixes.

Yeah, i did worry about that myself. What about this?

dana


diff --git a/Doc/Zsh/compat.yo b/Doc/Zsh/compat.yo
index f1be15fee..ab8f4d8dc 100644
--- a/Doc/Zsh/compat.yo
+++ b/Doc/Zsh/compat.yo
@@ -74,3 +74,9 @@ tt(PROMPT_SUBST)
 and
 tt(SINGLE_LINE_ZLE)
 options are set if zsh is invoked as tt(ksh).
+
+Please note that, whilst reasonable efforts are taken to address
+incompatibilities where they arise, zsh does not guarantee complete
+emulation of other shells, nor POSIX compliance. For more information on
+the differences between zsh and other shells, please refer to chapter 2
+of the shell FAQ, uref(http://www.zsh.org/FAQ/).



^ permalink raw reply	[relevance 11%]

* Re: [PATCH] Document imperfections in POSIX/sh compatibility
  2021-04-13 21:40 11%     ` dana
@ 2021-04-13 22:02  5%       ` Bart Schaefer
  2021-04-14 12:38  5%       ` Daniel Shahaf
  1 sibling, 0 replies; 200+ results
From: Bart Schaefer @ 2021-04-13 22:02 UTC (permalink / raw)
  To: dana; +Cc: Oliver Kiddle, Zsh hackers list, Daniel Shahaf

On Tue, Apr 13, 2021 at 2:40 PM dana <dana@dana.is> wrote:
>
> Yeah, i did worry about that myself. What about this?

This seems fine, although perhaps part of the problem is that the
whole section begins with the words "Zsh tries to emulate ..." (where
"tries" is open to interpretation).


^ permalink raw reply	[relevance 5%]

* Re: [BUG] getopts OPTIND
  @ 2021-04-13 23:28  2%   ` dana
  2021-04-14 13:08  0%     ` Daniel Shahaf
  0 siblings, 1 reply; 200+ results
From: dana @ 2021-04-13 23:28 UTC (permalink / raw)
  To: Zsh hackers list; +Cc: franciscodezuviria, Bart Schaefer

(Resurrecting this per workers/48509)

bin_getopts() has changed a little since i posted my patch before, this looks
a bit weirder. The test is also weird. But i confirmed that this makes it
behave like dash, bash, and mksh (my ksh93 doesn't support local, and i still
don't know what yash is doing):

% pbpaste | zsh-dev -f
<1><1><3><5><7><6>
% pbpaste | zsh-dev -f --posix-builtins
<2><2><3><6><7><7>
% pbpaste | dash
<2><2><3><6><7><7>
% pbpaste | bash
<2><2><3><6><7><7>
% pbpaste | mksh
<2><2><3><6><7><7>
% pbpaste | yash
<3><3><3><7><7><7>

tbh i don't think i fully understand why this needs to work this way, or
whether there are other cases that should be tested. Open to review obv

dana


diff --git a/Doc/Zsh/builtins.yo b/Doc/Zsh/builtins.yo
index a7afe42cf..4b9778e40 100644
--- a/Doc/Zsh/builtins.yo
+++ b/Doc/Zsh/builtins.yo
@@ -982,7 +982,8 @@ vindex(OPTARG, use of)
 The first option to be examined may be changed by explicitly assigning
 to tt(OPTIND).  tt(OPTIND) has an initial value of tt(1), and is
 normally set to tt(1) upon entry to a shell function and restored
-upon exit (this is disabled by the tt(POSIX_BUILTINS) option).  tt(OPTARG)
+upon exit.  (The tt(POSIX_BUILTINS) option disables this, and also changes
+the way the value is calculated to match other shells).  tt(OPTARG)
 is not reset and retains its value from the most recent call to
 tt(getopts).  If either of tt(OPTIND) or tt(OPTARG) is explicitly
 unset, it remains unset, and the index or option argument is not
diff --git a/Src/builtin.c b/Src/builtin.c
index 26335a2e8..13dfdf8be 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -5556,6 +5556,11 @@ bin_getopts(UNUSED(char *name), char **argv, UNUSED(Options ops), UNUSED(int fun
     /* check for legality */
     if(opch == ':' || !(p = memchr(optstr, opch, lenoptstr))) {
 	p = "?";
+	/* Keep OPTIND correct if the user doesn't return after the error */
+	if (isset(POSIXBUILTINS)) {
+	    optcind = 0;
+	    zoptind++;
+	}
 	zsfree(zoptarg);
 	setsparam(var, ztrdup(p));
 	if(quiet) {
@@ -5572,6 +5577,11 @@ bin_getopts(UNUSED(char *name), char **argv, UNUSED(Options ops), UNUSED(int fun
     if(p[1] == ':') {
 	if(optcind == lenstr) {
 	    if(!args[zoptind]) {
+		/* Fix OPTIND as above */
+		if (isset(POSIXBUILTINS)) {
+		    optcind = 0;
+		    zoptind++;
+		}
 		zsfree(zoptarg);
 		if(quiet) {
 		    setsparam(var, ztrdup(":"));
diff --git a/Test/B10getopts.ztst b/Test/B10getopts.ztst
index 72c9e209e..69b3d63f4 100644
--- a/Test/B10getopts.ztst
+++ b/Test/B10getopts.ztst
@@ -96,3 +96,29 @@
   done
 0:missing option-argument (quiet mode)
 >:,x
+
+  # This function is written so it can be easily referenced against other shells
+  t() {
+    local o i=0 n=$1
+    shift
+    while [ $i -lt $n ]; do
+      i=$(( i + 1 ))
+      getopts a: o "$@" 2> /dev/null
+    done
+    printf '<%d>' "$OPTIND"
+  }
+  # Try all these the native way, then the POSIX_BUILTINS way
+  for 1 in no_posix_builtins posix_builtins; do (
+    setopt $1
+    print -rn - "$1: "
+    t 1 -a
+    t 1 -w
+    t 2 -a -w
+    t 4 -a -w -e -r -a
+    t 5 -a -w -e -a -w -e
+    t 5 -a -w -e -r -ax -a
+    print
+  ); done
+0:OPTIND calculation with and without POSIX_BUILTINS (workers/42248)
+>no_posix_builtins: <1><1><3><5><7><6>
+>posix_builtins: <2><2><3><6><7><7>



^ permalink raw reply	[relevance 2%]

* [PATCH] TYPESET_TO_UNSET + misc.
@ 2021-04-14  5:52  8% Bart Schaefer
    0 siblings, 1 reply; 200+ results
From: Bart Schaefer @ 2021-04-14  5:52 UTC (permalink / raw)
  To: Zsh hackers list

[-- Attachment #1: Type: text/plain, Size: 1259 bytes --]

Attached is the final (I hope) version of the changes I've been
pushing to the "declarednull" branch in git.  tl;dr with this option
set "typeset foo" leaves foo unset, in contrast to the default
behavior which assigns foo="".

For those who've lost track, this originated from the thread "Bug with
unset variables" in workers/47351 and the first pass at this approach
appeared in workers/47697.  The doc update includes mention of the
problems with searching for (or in) empty strings, from the thread at
workers/47729, and the new test file E03posix.ztst has "xfail" tests
for nine incompatibilities that were recently enumerated in a number
of messages on the list.  I considered making a couple of patches but
one would have been very small and the other would patch a
newly-created file, so it didn't seem worthwhile.

I chose TYPESET_TO_UNSET as the option to control this, to go along
with TYPESET_SILENT and because it works a bit better when negated as
NO_TYPESET_TO_UNSET.  E03posix.ztst runs with this option set to avoid
having to duplicate all the tests; that can be fixed later if
necessary.

I documented the default initialization behavior to contrast it with
the TYPESET_TO_UNSET behavior, rather than try to explain the latter
in isolation.

[-- Attachment #2: typesettounset-patch.txt --]
[-- Type: text/plain, Size: 16320 bytes --]

diff --git a/Completion/compinit b/Completion/compinit
index e81cd1604..1f2e7c634 100644
--- a/Completion/compinit
+++ b/Completion/compinit
@@ -165,6 +165,7 @@ _comp_options=(
     NO_posixidentifiers
     NO_shwordsplit
     NO_shglob
+    NO_typesettounset
     NO_warnnestedvar
     NO_warncreateglobal
 )
diff --git a/Doc/Zsh/builtins.yo b/Doc/Zsh/builtins.yo
index a7afe42cf..61dc6986f 100644
--- a/Doc/Zsh/builtins.yo
+++ b/Doc/Zsh/builtins.yo
@@ -1872,7 +1872,11 @@ ifnzman(noderef(Local Parameters))\
 retain their special attributes when made local.
 
 For each var(name)tt(=)var(value) assignment, the parameter
-var(name) is set to var(value).
+var(name) is set to var(value).  If the assignment is omitted and var(name)
+does em(not) refer to an existing parameter, a new parameter is intialized
+to empty string, zero, or empty array (as appropriate), em(unless) the
+shell option tt(TYPESET_TO_UNSET) is set.  When that option is set,
+the parameter attributes are recorded but the parameter remains unset.
 
 If the shell option tt(TYPESET_SILENT) is not set, for each remaining
 var(name) that refers to a parameter that is already set, the name and
diff --git a/Doc/Zsh/options.yo b/Doc/Zsh/options.yo
index 714e8a1a1..6e862fae8 100644
--- a/Doc/Zsh/options.yo
+++ b/Doc/Zsh/options.yo
@@ -1942,6 +1942,16 @@ If the option is set, they will only be shown when parameters are selected
 with the `tt(-m)' option.  The option `tt(-p)' is available whether or not
 the option is set.
 )
+pindex(TYPESET_TO_UNSET)
+pindex(NO_TYPESET_TO_UNSET)
+pindex(TYPESETTOUNSET)
+pindex(NOTYPESETTOUNSET)
+item(tt(TYPESET_TO_UNSET) <K> <S>)(
+When declaring a new parameter with any of the `tt(typeset)' family of
+related commands, the parameter remains unset unless and until a
+value is explicity assigned to it, either in the `tt(typeset)' command
+itself or as a later assignment statement.
+)
 pindex(VERBOSE)
 pindex(NO_VERBOSE)
 pindex(NOVERBOSE)
diff --git a/Doc/Zsh/params.yo b/Doc/Zsh/params.yo
index 36c1ae4c2..a9044336f 100644
--- a/Doc/Zsh/params.yo
+++ b/Doc/Zsh/params.yo
@@ -393,6 +393,11 @@ is compared to the pattern, and the first matching key found is the
 result.  On failure substitutes the length of the array plus one, as
 discussed under the description of `tt(r)', or the empty string for an
 associative array.
+
+Note: Although `tt(i)' may be applied to a scalar substitution to find
+the offset of a substring, the results are likely to be misleading when
+searching within substitutions that yield an empty string, or when
+searching for the empty substring.
 )
 item(tt(I))(
 Like `tt(i)', but gives the index of the last match, or all possible
diff --git a/Src/builtin.c b/Src/builtin.c
index 26335a2e8..6d119f7a5 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -2491,6 +2491,8 @@ typeset_single(char *cname, char *pname, Param pm, UNUSED(int func),
 		return NULL;
 	    }
 	}
+	if (isset(TYPESETTOUNSET))
+	    pm->node.flags |= PM_DEFAULTED;
     } else {
 	if (idigit(*pname))
 	    zerrnam(cname, "not an identifier: %s", pname);
@@ -2836,7 +2838,7 @@ bin_typeset(char *name, char **argv, LinkList assigns, Options ops, int func)
 	    unqueue_signals();
 	    return 1;
 	} else if (pm) {
-	    if (!(pm->node.flags & PM_UNSET)
+	    if ((!(pm->node.flags & PM_UNSET) || pm->node.flags & PM_DECLARED)
 		&& (locallevel == pm->level || !(on & PM_LOCAL))) {
 		if (pm->node.flags & PM_TIED) {
 		    if (PM_TYPE(pm->node.flags) != PM_SCALAR) {
@@ -2889,6 +2891,8 @@ bin_typeset(char *name, char **argv, LinkList assigns, Options ops, int func)
 	 *
 	 * Don't attempt to set it yet, it's too early
 	 * to be exported properly.
+	 *
+	 * This may create the array with PM_DEFAULTED.
 	 */
 	asg2.name = asg->name;
 	asg2.flags = 0;
@@ -2930,8 +2934,12 @@ bin_typeset(char *name, char **argv, LinkList assigns, Options ops, int func)
 	if (asg->value.array) {
 	    int flags = (asg->flags & ASG_KEY_VALUE) ? ASSPM_KEY_VALUE : 0;
 	    assignaparam(asg->name, zlinklist2array(asg->value.array, 1), flags);
-	} else if (oldval)
-	    assignsparam(asg0.name, oldval, 0);
+	} else if (asg0.value.scalar || oldval) {
+	    /* We have to undo what we did wrong with asg2 */
+	    apm->node.flags &= ~PM_DEFAULTED;
+	    if (oldval)
+		assignsparam(asg0.name, oldval, 0);
+	}
 	unqueue_signals();
 
 	return 0;
diff --git a/Src/options.c b/Src/options.c
index 6ea6290e5..783022591 100644
--- a/Src/options.c
+++ b/Src/options.c
@@ -259,6 +259,7 @@ static struct optname optns[] = {
 {{NULL, "transientrprompt",   0},			 TRANSIENTRPROMPT},
 {{NULL, "trapsasync",	      0},			 TRAPSASYNC},
 {{NULL, "typesetsilent",      OPT_EMULATE|OPT_BOURNE},	 TYPESETSILENT},
+{{NULL, "typesettounset",     OPT_EMULATE|OPT_BOURNE},	 TYPESETTOUNSET},
 {{NULL, "unset",	      OPT_EMULATE|OPT_BSHELL},	 UNSET},
 {{NULL, "verbose",	      0},			 VERBOSE},
 {{NULL, "vi",		      0},			 VIMODE},
diff --git a/Src/params.c b/Src/params.c
index 122f5da7d..33bbc54f6 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -2093,7 +2093,8 @@ fetchvalue(Value v, char **pptr, int bracks, int flags)
 	if (sav)
 	    *s = sav;
 	*pptr = s;
-	if (!pm || (pm->node.flags & PM_UNSET))
+	if (!pm || ((pm->node.flags & PM_UNSET) &&
+		    !(pm->node.flags & PM_DECLARED)))
 	    return NULL;
 	if (v)
 	    memset(v, 0, sizeof(*v));
@@ -3055,6 +3056,7 @@ assignsparam(char *s, char *val, int flags)
 	     * Don't warn about anything.
 	     */
 	    flags &= ~ASSPM_WARN;
+	    v->pm->node.flags &= ~PM_DEFAULTED;
 	}
 	*ss = '[';
 	v = NULL;
@@ -3080,6 +3082,7 @@ assignsparam(char *s, char *val, int flags)
     }
     if (flags & ASSPM_WARN)
 	check_warn_pm(v->pm, "scalar", created, 1);
+    v->pm->node.flags &= ~PM_DEFAULTED;
     if (flags & ASSPM_AUGMENT) {
 	if (v->start == 0 && v->end == -1) {
 	    switch (PM_TYPE(v->pm->node.flags)) {
@@ -3232,6 +3235,7 @@ assignaparam(char *s, char **val, int flags)
 
     if (flags & ASSPM_WARN)
 	check_warn_pm(v->pm, "array", created, may_warn_about_nested_vars);
+    v->pm->node.flags &= ~PM_DEFAULTED;
 
     /*
      * At this point, we may have array entries consisting of
@@ -3444,6 +3448,7 @@ sethparam(char *s, char **val)
 	    return NULL;
 	}
     check_warn_pm(v->pm, "associative array", checkcreate, 1);
+    v->pm->node.flags &= ~PM_DEFAULTED;
     setarrvalue(v, val);
     unqueue_signals();
     return v->pm;
@@ -3515,6 +3520,7 @@ assignnparam(char *s, mnumber val, int flags)
 	if (flags & ASSPM_WARN)
 	    check_warn_pm(v->pm, "numeric", 0, 1);
     }
+    v->pm->node.flags &= ~PM_DEFAULTED;
     setnumvalue(v, val);
     unqueue_signals();
     return v->pm;
@@ -3619,6 +3625,7 @@ unsetparam_pm(Param pm, int altflag, int exp)
     else
 	altremove = NULL;
 
+    pm->node.flags &= ~PM_DECLARED;	/* like ksh, not like bash */
     if (!(pm->node.flags & PM_UNSET))
 	pm->gsu.s->unsetfn(pm, exp);
     if (pm->env)
@@ -3652,6 +3659,8 @@ unsetparam_pm(Param pm, int altflag, int exp)
 	}
 
 	zsfree(altremove);
+	if (!(pm->node.flags & PM_SPECIAL))
+	    pm->gsu.s = &stdscalar_gsu;
     }
 
     /*
@@ -4116,6 +4125,11 @@ tiedarrsetfn(Param pm, char *x)
 
     if (*dptr->arrptr)
 	freearray(*dptr->arrptr);
+    else if (pm->ename) {
+	Param altpm = (Param) paramtab->getnode(paramtab, pm->ename);
+	if (altpm)
+	    altpm->node.flags &= ~PM_DEFAULTED;
+    }
     if (x) {
 	char sepbuf[3];
 	if (imeta(dptr->joinchar))
@@ -5035,6 +5049,7 @@ arrfixenv(char *s, char **t)
 
     if (isset(ALLEXPORT))
 	pm->node.flags |= PM_EXPORTED;
+    pm->node.flags &= ~PM_DEFAULTED;
 
     /*
      * Do not "fix" parameters that were not exported
@@ -5839,8 +5854,9 @@ printparamnode(HashNode hn, int printflags)
     Param peer = NULL;
 
     if (p->node.flags & PM_UNSET) {
-	if (printflags & (PRINT_POSIX_READONLY|PRINT_POSIX_EXPORT) &&
-	    p->node.flags & (PM_READONLY|PM_EXPORTED)) {
+	if ((printflags & (PRINT_POSIX_READONLY|PRINT_POSIX_EXPORT) &&
+	     p->node.flags & (PM_READONLY|PM_EXPORTED)) ||
+	    (p->node.flags & PM_DEFAULTED) == PM_DEFAULTED) {
 	    /*
 	     * Special POSIX rules: show the parameter as readonly/exported
 	     * even though it's unset, but with no value.
diff --git a/Src/subst.c b/Src/subst.c
index 96e0914eb..9928be0e9 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -2563,7 +2563,8 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int pf_flags,
 	     * Handle the (t) flag: value now becomes the type
 	     * information for the parameter.
 	     */
-	    if (v && v->pm && !(v->pm->node.flags & PM_UNSET)) {
+	    if (v && v->pm && ((v->pm->node.flags & PM_DECLARED) ||
+			       !(v->pm->node.flags & PM_UNSET))) {
 		int f = v->pm->node.flags;
 
 		switch (PM_TYPE(f)) {
diff --git a/Src/zsh.h b/Src/zsh.h
index d70a4017c..af9b4fb67 100644
--- a/Src/zsh.h
+++ b/Src/zsh.h
@@ -1929,8 +1929,10 @@ struct tieddata {
 				   made read-only by the user               */
 #define PM_READONLY_SPECIAL (PM_SPECIAL|PM_READONLY|PM_RO_BY_DESIGN)
 #define PM_DONTIMPORT	(1<<22)	/* do not import this variable              */
+#define PM_DECLARED	(1<<22) /* explicitly named with typeset            */
 #define PM_RESTRICTED	(1<<23) /* cannot be changed in restricted mode     */
 #define PM_UNSET	(1<<24)	/* has null value                           */
+#define PM_DEFAULTED	(PM_DECLARED|PM_UNSET)
 #define PM_REMOVABLE	(1<<25)	/* special can be removed from paramtab     */
 #define PM_AUTOLOAD	(1<<26) /* autoloaded from module                   */
 #define PM_NORESTORE	(1<<27)	/* do not restore value of local special    */
@@ -2536,6 +2538,7 @@ enum {
     TRANSIENTRPROMPT,
     TRAPSASYNC,
     TYPESETSILENT,
+    TYPESETTOUNSET,
     UNSET,
     VERBOSE,
     VIMODE,
diff --git a/Test/D06subscript.ztst b/Test/D06subscript.ztst
index c1a8d79cf..adbd398c4 100644
--- a/Test/D06subscript.ztst
+++ b/Test/D06subscript.ztst
@@ -289,3 +289,8 @@ F:Regression test for workers/42297
 >14 24
 >b b
 >b?rbaz foob?r
+
+  i=1,3
+  [[ ${a[$i]} = ${a[i]} ]]
+0f:Math evaluation of commas in array subscripts
+F:In math, (($i)) should be the same as ((i)), see workers/47748.
diff --git a/Test/E01options.ztst b/Test/E01options.ztst
index 415f46cd7..72749e6ab 100644
--- a/Test/E01options.ztst
+++ b/Test/E01options.ztst
@@ -1451,3 +1451,18 @@ F:If this test fails at the first unsetopt, refer to P01privileged.ztst.
 0q:RM_STAR_SILENT
 *>zsh: sure you want to delete all 15 files in ${PWD:h}/options.tmp \[yn\]\? ${BEL}(|n)
 *>zsh: sure you want to delete (all <->|more than <->) files in / \[yn\]\? ${BEL}(|n)
+
+  () {
+    local var
+    print ${(t)var}
+  }
+0:(t) returns correct type
+>scalar-local
+
+  () {
+    readonly var
+    typeset -p var
+  }
+0:readonly with typeset -p
+F:compare E03posix.ztst
+>typeset -r var=''
diff --git a/Test/E03posix.ztst b/Test/E03posix.ztst
new file mode 100644
index 000000000..7db4c0c84
--- /dev/null
+++ b/Test/E03posix.ztst
@@ -0,0 +1,163 @@
+# Test POSIX-specific behavior
+# Currently this covers only POSIXBUILTINS, other behaviors are in their
+# more directly related sections
+#
+
+%prep
+ setopt POSIX_BUILTINS TYPESET_TO_UNSET
+
+%test
+
+ local parentenv=preserved
+ fn() {
+  typeset -h +g -m \*
+  unset -m \*
+  integer i=9
+  float -H f=9
+  declare -t scalar
+  declare -H -a array
+  typeset
+  typeset +
+ }
+ fn
+ echo $parentenv
+0:Parameter hiding and tagging, printing types and values
+>array local array
+>float local f
+>integer local i=9
+>local tagged scalar
+>array local array
+>float local f
+>integer local i
+>local tagged scalar
+>preserved
+
+  readonly foo=bar novalue
+  readonly -p
+0:readonly -p output (no readonly specials)
+>readonly foo=bar
+>readonly novalue
+
+  local -a myarray
+  typeset -p1 myarray
+  myarray=("&" sand '""' "" plugh)
+  typeset -p1 myarray
+0:typeset -p1 output for array
+>typeset -a myarray
+>typeset -a myarray=(
+>  '&'
+>  sand
+>  '""'
+>  ''
+>  plugh
+>)
+
+  local -A myhash
+  typeset -p1 myhash
+  myhash=([one]=two [three]= [four]="[]")
+  typeset -p1 myhash
+0:typeset -p1 output for associative array
+>typeset -A myhash
+>typeset -A myhash=(
+>  [four]='[]'
+>  [one]=two
+>  [three]=''
+>)
+
+  str=s
+  arr=(a)
+  typeset -A ass
+  ass=(a a)
+  integer i=0
+  float f=0
+  print ${(t)str} ${(t)arr} ${(t)ass} ${(t)i} ${(t)f}
+0:${(t)...}
+>scalar array association-local integer-local float-local
+
+  print $empty[(i)] $empty[(I)]
+0:(i) and (I) return nothing for empty array
+>
+
+  (
+  # reserved words are handled during parsing,
+  # hence eval...
+  disable -r typeset
+  eval '
+  setopt kshtypeset
+  ktvars=(ktv1 ktv2)
+  typeset ktfoo=`echo arg1 arg2` $ktvars
+  () {
+    local ktfoo
+    print $+ktv1 $+ktv2 $+ktv3 $+ktfoo
+  }
+  print $ktfoo
+  unsetopt kshtypeset
+  typeset noktfoo=`echo noktarg1 noktarg2`
+  print $noktfoo
+  print $+noktarg1 $+noktarg2
+  unset ktfoo ktv1 ktv2 noktfoo noktarg2
+  '
+  )
+0:KSH_TYPESET option
+>0 0 0 0
+>arg1 arg2
+>noktarg1
+>0 0
+
+  () {
+    local var
+    print ${(t)var}
+  }
+0:(t) returns correct type
+>scalar-local
+
+  () {
+    readonly var
+    typeset -p var
+  }
+0:readonly with typeset -p
+>typeset -g -r var
+
+# Tests expected to fail
+
+  echo -
+0f:A single "-" for echo does not end the arguments
+F:POSIX requires a solitary "-" to be a plain argument
+>-
+
+  ARGV0=sh $ZTST_testdir/../Src/zsh -c 'foreach() { true; }'
+-f:"foreach" is not a reserved word
+
+  ARGV0=sh $ZTST_testdir/../Src/zsh -c 'end() { true; }
+-f:"end" is not a reserved word
+
+  a='a:b:' ARGV0=sh $ZTST_testdir/../Src/zsh -c 'IFS=:; printf "<%s>\n" $a'
+0f:IFS is a separator, not a delimiter
+><a>
+><b>
+
+  a=$'\ra\r\rb' ARGV0=sh $ZTST_testdir/../Src/zsh -c 'IFS=:; printf "<%s>\n" $a'
+0f:All whitespace characters are "IFS whitespace"
+F:isspace('\r') is true so \r should behave like space, \t, \n
+F:This may also need to apply to multibyte whitespace
+><a>
+><b>
+
+  ARGV0=sh $ZTST_testdir/../Src/zsh -c 'IFS=2; printf "<%s>\n" $((11*11))'
+0f:IFS applies to math results (numbers treated as strings)
+><1>
+><1>
+
+  ARGV0=sh $ZTST_testdir/../Src/zsh -c 'inf=42; echo $((inf))'
+0f:All identifiers are variable references in POSIX arithmetic
+F:POSIX has neither math functions nor floating point
+>42
+
+  ARGV0=sh $ZTST_testdir/../Src/zsh -c 'EUID=10; echo "$EUID"'
+-f:EUID is not a special variable
+>10
+
+  ARGV0=sh $ZTST_testdir/../Src/zsh -c "printf '<%10s>\n' St$'\M-C\M-)'phane"
+0f:Width of %s is computed in bytes not characters
+F:This is considered a bugfix in zsh
+><  Stéphane>
diff --git a/Test/V10private.ztst b/Test/V10private.ztst
index a3a63867b..03e8259d5 100644
--- a/Test/V10private.ztst
+++ b/Test/V10private.ztst
@@ -19,14 +19,14 @@
  () {
   print $scalar_test
   private scalar_test
-  print $+scalar_test
+  typeset +m scalar_test
   unset scalar_test
   print $+scalar_test
  }
  print $scalar_test
 0:basic scope hiding
 >toplevel
->1
+>local scalar_test
 >0
 >toplevel
 
@@ -45,14 +45,14 @@
  print $+unset_test
  () {
   private unset_test
-  print $+unset_test
+  typeset +m unset_test
   unset_test=setme
   print $unset_test
  }
  print $+unset_test
 0:variable defined only in scope
 >0
->1
+>local unset_test
 >setme
 >0
 
@@ -62,13 +62,13 @@
   local -Pa array_test=(in function)
   () {
    private array_test
-   print $+array_test
+   typeset +m array_test
   }
   print $array_test
  }
  print $array_test
 0:nested scope with different type, correctly restored
->1
+>local array_test
 >in function
 >top level
 
diff --git a/Test/runtests.zsh b/Test/runtests.zsh
index 562234d91..b66d579b6 100644
--- a/Test/runtests.zsh
+++ b/Test/runtests.zsh
@@ -7,7 +7,7 @@ emulate zsh
 # protect from catastrophic failure of an individual test.
 # We could probably do that with subshells instead.
 
-integer success failure skipped retval
+integer success=0 failure=0 skipped=0 retval
 for file in "${(f)ZTST_testlist}"; do
   $ZTST_exe +Z -f $ZTST_srcdir/ztst.zsh $file
   retval=$?
diff --git a/Test/ztst.zsh b/Test/ztst.zsh
index e668ae942..a59c06dcf 100755
--- a/Test/ztst.zsh
+++ b/Test/ztst.zsh
@@ -60,7 +60,7 @@ ZTST_mainopts=(${(kv)options})
 ZTST_testdir=$PWD
 ZTST_testname=$1
 
-integer ZTST_testfailed
+integer ZTST_testfailed=0
 
 # This is POSIX nonsense.  Because of the vague feeling someone, somewhere
 # may one day need to examine the arguments of "tail" using a standard

^ permalink raw reply	[relevance 8%]

* Re: [PATCH] Document imperfections in POSIX/sh compatibility
  2021-04-13 21:40 11%     ` dana
  2021-04-13 22:02  5%       ` Bart Schaefer
@ 2021-04-14 12:38  5%       ` Daniel Shahaf
  2021-04-18  4:50  5%         ` dana
  1 sibling, 1 reply; 200+ results
From: Daniel Shahaf @ 2021-04-14 12:38 UTC (permalink / raw)
  To: dana; +Cc: Zsh hackers list

dana wrote on Tue, Apr 13, 2021 at 16:40:19 -0500:
> +++ b/Doc/Zsh/compat.yo
> @@ -74,3 +74,9 @@ tt(PROMPT_SUBST)
>  and
>  tt(SINGLE_LINE_ZLE)
>  options are set if zsh is invoked as tt(ksh).

Looks good.  A couple of minor points:

> +Please note that, whilst reasonable efforts are taken to address
> +incompatibilities where they arise, zsh does not guarantee complete

s/where/when/ ?

> +emulation of other shells, nor POSIX compliance. For more information on
> +the differences between zsh and other shells, please refer to chapter 2

s/chapter/Chapter/. 

There is some relevant information in §3 as well, specifically, in 3.31
"Why does my bash script report an error when I run it under zsh?".
However, that question hasn't been published yet, so perhaps we should
just move it to §2.

The space in "Chapter 2" should be a non-breaking one.  An nbsp() macro
was added to yodl in 4.02.00, which is the version I have, but when I
try to use it (without worrying about compatibility to older versions,
for the sake of testing), I just get «expn.yo:36: No macro: nbsp(...)».
I'm not sure why.

(Compatibility to older versions could probably be done with
IFBUILTIN().)

> +of the shell FAQ, uref(http://www.zsh.org/FAQ/).

s/http/https/

Cheers,

Daniel


^ permalink raw reply	[relevance 5%]

* Re: [BUG] getopts OPTIND
  2021-04-13 23:28  2%   ` dana
@ 2021-04-14 13:08  0%     ` Daniel Shahaf
  2021-04-18  5:16  4%       ` dana
  0 siblings, 1 reply; 200+ results
From: Daniel Shahaf @ 2021-04-14 13:08 UTC (permalink / raw)
  To: dana; +Cc: Zsh hackers list, franciscodezuviria

dana wrote on Tue, Apr 13, 2021 at 18:28:50 -0500:
> (Resurrecting this per workers/48509)
> 
> bin_getopts() has changed a little since i posted my patch before, this looks
> a bit weirder. The test is also weird. But i confirmed that this makes it
> behave like dash, bash, and mksh (my ksh93 doesn't support local, and i still
> don't know what yash is doing):
> 
> % pbpaste | zsh-dev -f
> <1><1><3><5><7><6>
> % pbpaste | zsh-dev -f --posix-builtins
> <2><2><3><6><7><7>
> % pbpaste | dash
> <2><2><3><6><7><7>
> % pbpaste | bash
> <2><2><3><6><7><7>
> % pbpaste | mksh
> <2><2><3><6><7><7>
> % pbpaste | yash
> <3><3><3><7><7><7>
> 
> tbh i don't think i fully understand why this needs to work this way, or
> whether there are other cases that should be tested. Open to review obv

Should the descriptions of OPTIND and/or POSIX_BUILTINS in the manual be
extended as well?  (Once the behaviour is decided on, if there are still
open questions about that.)

Some more cases to test:
.
       t 0
       t 1 foo
       t 1 -- foo
       t 1 -b
.
where -b doesn't take an argument.

> @@ -96,3 +96,29 @@
> +  # Try all these the native way, then the POSIX_BUILTINS way
> +  for 1 in no_posix_builtins posix_builtins; do (
> +    setopt $1
> +    print -rn - "$1: "
> +    t 1 -a
> +    t 1 -w

> +    t 2 -a -w
> +    t 4 -a -w -e -r -a
> +    t 5 -a -w -e -a -w -e
> +    t 5 -a -w -e -r -ax -a
> +    print
> +  ); done
> +0:OPTIND calculation with and without POSIX_BUILTINS (workers/42248)
> +>no_posix_builtins: <1><1><3><5><7><6>
> +>posix_builtins: <2><2><3><6><7><7>
> 
> 


^ permalink raw reply	[relevance 0%]

* Tests: A03quoting.ztst and B03print.ztst fail on Alpine
@ 2021-04-14 19:48  1% Sören Tempel
  0 siblings, 0 replies; 200+ results
From: Sören Tempel @ 2021-04-14 19:48 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 1302 bytes --]

Hello,

The test cases A03quoting.ztst B03print.ztst started failing on Alpine
Linux (which uses musl libc instead of glibc) recently with zsh 5.8. The
error messages for both tests are below. The entire build log is
attached. Any idea what might be causing this?

Please CC me, I am not subscribed to the list.

A03quoting:

./A03quoting.ztst: starting.
--- /tmp/zsh.ztst.7165/ztst.out	2021-04-14 19:25:19.195321984 +0000
+++ /tmp/zsh.ztst.7165/ztst.tout	2021-04-14 19:25:19.198655320 +0000
@@ -4,4 +4,4 @@
 16#4D
 16#42
 16#53
-16#DC
+16#DFDC
Test ./A03quoting.ztst failed: output differs from expected as shown above for:
  chars=$(print -r $'BS\\MBS\M-\\')
  for (( i = 1; i <= $#chars; i++ )); do
    char=$chars[$i]
    print $(( [#16] #char ))
  done
Was testing: $'-style quote with metafied backslash
./A03quoting.ztst: test failed.

B03print:

./B03print.ztst: starting.
--- /tmp/zsh.ztst.14907/ztst.out	2021-04-14 19:25:30.405330894 +0000
+++ /tmp/zsh.ztst.14907/ztst.tout	2021-04-14 19:25:30.405330894 +0000
@@ -1 +1 @@
-f0
+dff0
Test ./B03print.ztst failed: output differs from expected as shown above for:
 printf '%x\n' $(printf '"\xf0')
Was testing: numeric value of high numbered character
./B03print.ztst: test failed.

Greetings,
Sören


[-- Attachment #2: zsh-5.8-r2.log --]
[-- Type: text/plain, Size: 93045 bytes --]

>>> zsh: Building main/zsh 5.8-r2 (using abuild 3.7.0-r1) started Wed, 14 Apr 2021 19:23:25 +0000
>>> zsh: Checking sanity of /home/buildozer/aports/main/zsh/APKBUILD...
>>> zsh: Analyzing dependencies...
>>> zsh: Installing for build: build-base ncurses-dev diffutils
(1/3) Installing ncurses-dev (6.2_p20210403-r0)
(2/3) Installing diffutils (3.7-r0)
(3/3) Installing .makedepends-zsh (20210414.192326)
Executing busybox-1.33.0-r6.trigger
OK: 341 MiB in 96 packages
>>> zsh: Cleaning up srcdir
>>> zsh: Cleaning up pkgdir
>>> zsh: Fetching https://download.sourceforge.net/project/zsh/zsh/5.8/zsh-5.8.tar.xz
>>> zsh: Fetching https://download.sourceforge.net/project/zsh/zsh/5.8/zsh-5.8.tar.xz
>>> zsh: Checking sha512sums...
zsh-5.8.tar.xz: OK
zprofile: OK
>>> zsh: Unpacking /var/cache/distfiles/zsh-5.8.tar.xz...
configuring for zsh 5.8
checking build system type... x86_64-alpine-linux-musl
checking host system type... x86_64-alpine-linux-musl
checking for x86_64-alpine-linux-musl-gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking how to run the C preprocessor... gcc -E
checking for an ANSI C-conforming const... yes
checking for gcc option to accept ANSI C... 
checking whether to use prototypes... yes
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for size_t... yes
checking for working alloca.h... yes
checking for alloca... yes
checking if the compiler supports union initialisation... yes
checking if signed to unsigned casting is broken... no
checking if the compiler supports variable-length arrays... yes
checking whether make sets $(MAKE)... yes
checking for a BSD-compatible install... /usr/bin/install -c
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether ln works... yes
checking whether ln -s works... yes
checking for egrep... (cached) /bin/grep -E
checking for yodl... no
checking for texi2dvi... no
checking for texi2pdf... no
checking for texi2any... no
checking for texi2html... no
checking for ansi2knr... no
checking for dirent.h that defines DIR... yes
checking for library containing opendir... none required
checking for ANSI C header files... (cached) yes
checking whether time.h and sys/time.h may both be included... yes
checking whether stat file-mode macros are broken... no
checking for sys/wait.h that is POSIX.1 compatible... yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking sys/times.h usability... yes
checking sys/times.h presence... yes
checking for sys/times.h... yes
checking sys/select.h usability... yes
checking sys/select.h presence... yes
checking for sys/select.h... yes
checking termcap.h usability... yes
checking termcap.h presence... yes
checking for termcap.h... yes
checking termio.h usability... no
checking termio.h presence... no
checking for termio.h... no
checking termios.h usability... yes
checking termios.h presence... yes
checking for termios.h... yes
checking sys/param.h usability... yes
checking sys/param.h presence... yes
checking for sys/param.h... yes
checking sys/filio.h usability... no
checking sys/filio.h presence... no
checking for sys/filio.h... no
checking for string.h... (cached) yes
checking for memory.h... (cached) yes
checking limits.h usability... yes
checking limits.h presence... yes
checking for limits.h... yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking libc.h usability... no
checking libc.h presence... no
checking for libc.h... no
checking sys/utsname.h usability... yes
checking sys/utsname.h presence... yes
checking for sys/utsname.h... yes
checking sys/resource.h usability... yes
checking sys/resource.h presence... yes
checking for sys/resource.h... yes
checking locale.h usability... yes
checking locale.h presence... yes
checking for locale.h... yes
checking errno.h usability... yes
checking errno.h presence... yes
checking for errno.h... yes
checking stdio.h usability... yes
checking stdio.h presence... yes
checking for stdio.h... yes
checking stdarg.h usability... yes
checking stdarg.h presence... yes
checking for stdarg.h... yes
checking varargs.h usability... no
checking varargs.h presence... no
checking for varargs.h... no
checking for stdlib.h... (cached) yes
checking for unistd.h... (cached) yes
checking sys/capability.h usability... no
checking sys/capability.h presence... no
checking for sys/capability.h... no
checking utmp.h usability... yes
checking utmp.h presence... yes
checking for utmp.h... yes
checking utmpx.h usability... yes
checking utmpx.h presence... yes
checking for utmpx.h... yes
checking for sys/types.h... (cached) yes
checking pwd.h usability... yes
checking pwd.h presence... yes
checking for pwd.h... yes
checking grp.h usability... yes
checking grp.h presence... yes
checking for grp.h... yes
checking poll.h usability... yes
checking poll.h presence... yes
checking for poll.h... yes
checking sys/mman.h usability... yes
checking sys/mman.h presence... yes
checking for sys/mman.h... yes
checking netinet/in_systm.h usability... yes
checking netinet/in_systm.h presence... yes
checking for netinet/in_systm.h... yes
checking pcre.h usability... no
checking pcre.h presence... no
checking for pcre.h... no
checking langinfo.h usability... yes
checking langinfo.h presence... yes
checking for langinfo.h... yes
checking wchar.h usability... yes
checking wchar.h presence... yes
checking for wchar.h... yes
checking stddef.h usability... yes
checking stddef.h presence... yes
checking for stddef.h... yes
checking sys/stropts.h usability... yes
checking sys/stropts.h presence... yes
checking for sys/stropts.h... yes
checking iconv.h usability... yes
checking iconv.h presence... yes
checking for iconv.h... yes
checking ncurses.h usability... yes
checking ncurses.h presence... yes
checking for ncurses.h... yes
checking ncursesw/ncurses.h usability... no
checking ncursesw/ncurses.h presence... no
checking for ncursesw/ncurses.h... no
checking ncurses/ncurses.h usability... no
checking ncurses/ncurses.h presence... no
checking for ncurses/ncurses.h... no
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking dl.h usability... no
checking dl.h presence... no
checking for dl.h... no
checking for conflicts in sys/time.h and sys/select.h... no
checking TIOCGWINSZ in termios.h... no
checking TIOCGWINSZ in sys/ioctl.h... yes
checking for streams headers including struct winsize... no
checking for printf in -lc... yes
checking for pow in -lm... yes
checking for clock_gettime in -lrt... yes
checking if _XOPEN_SOURCE_EXTENDED should not be defined... no
checking for library containing tigetstr... -lncursesw
checking for library containing tigetflag... none required
checking for library containing tgetent... none required
checking curses.h usability... yes
checking curses.h presence... yes
checking for curses.h... yes
checking if we need to ignore ncurses... no
checking for library containing getpwnam... none required
checking for dlopen in -ldl... yes
checking for socket in -lsocket... no
checking for library containing gethostbyname2... none required
checking for iconv... yes
checking whether _libiconv_version is declared... no
checking for iconv declaration... 
checking if an include file defines ospeed... yes
checking gdbm.h usability... no
checking gdbm.h presence... no
checking for gdbm.h... no
checking for gdbm_open in -lgdbm... no
checking sys/xattr.h usability... yes
checking sys/xattr.h presence... yes
checking for sys/xattr.h... yes
checking for pid_t... yes
checking for off_t... yes
checking for ino_t... yes
checking for mode_t... yes
checking for uid_t in sys/types.h... yes
checking for size_t... (cached) yes
checking if long is 64 bits... yes
checking for %lld printf support... yes
checking for sigset_t... yes
checking for struct stat.st_atim.tv_nsec... yes
checking for struct stat.st_atimespec.tv_nsec... no
checking for struct stat.st_atimensec... no
checking for struct stat.st_mtim.tv_nsec... yes
checking for struct stat.st_mtimespec.tv_nsec... no
checking for struct stat.st_mtimensec... no
checking for struct stat.st_ctim.tv_nsec... yes
checking for struct stat.st_ctimespec.tv_nsec... no
checking for struct stat.st_ctimensec... no
checking for struct timezone... yes
checking for struct timespec... yes
checking for struct utmp... yes
checking for struct utmpx... yes
checking for ut_host in struct utmp... yes
checking for ut_host in struct utmpx... yes
checking for ut_xtime in struct utmpx... no
checking for ut_tv in struct utmpx... yes
checking for d_ino in struct dirent... yes
checking for d_stat in struct dirent... no
checking for d_ino in struct direct... no
checking for d_stat in struct direct... no
checking for sin6_scope_id in struct sockaddr_in6... yes
checking if we need our own h_errno... no
checking for strftime... yes
checking for strptime... yes
checking for mktime... yes
checking for timelocal... no
checking for difftime... yes
checking for gettimeofday... yes
checking for clock_gettime... yes
checking for select... yes
checking for poll... yes
checking for readlink... yes
checking for faccessx... no
checking for fchdir... yes
checking for ftruncate... yes
checking for fstat... yes
checking for lstat... yes
checking for lchown... yes
checking for fchown... yes
checking for fchmod... yes
checking for fseeko... yes
checking for ftello... yes
checking for mkfifo... yes
checking for _mktemp... no
checking for mkstemp... yes
checking for waitpid... yes
checking for wait3... yes
checking for sigaction... yes
checking for sigblock... no
checking for sighold... yes
checking for sigrelse... yes
checking for sigsetmask... no
checking for sigprocmask... yes
checking for killpg... yes
checking for setpgid... yes
checking for setpgrp... yes
checking for tcsetpgrp... yes
checking for tcgetattr... yes
checking for nice... yes
checking for gethostname... yes
checking for gethostbyname2... yes
checking for getipnodebyname... no
checking for inet_aton... yes
checking for inet_pton... yes
checking for inet_ntop... yes
checking for getlogin... yes
checking for getpwent... yes
checking for getpwnam... yes
checking for getpwuid... yes
checking for getgrgid... yes
checking for getgrnam... yes
checking for initgroups... yes
checking for nis_list... no
checking for setuid... yes
checking for seteuid... yes
checking for setreuid... yes
checking for setresuid... yes
checking for setsid... yes
checking for setgid... yes
checking for setegid... yes
checking for setregid... yes
checking for setresgid... yes
checking for memcpy... yes
checking for memmove... yes
checking for strstr... yes
checking for strerror... yes
checking for strtoul... yes
checking for getrlimit... yes
checking for getrusage... yes
checking for setlocale... yes
checking for isblank... yes
checking for iswblank... yes
checking for uname... yes
checking for signgam... yes
checking for tgamma... yes
checking for log2... yes
checking for scalbn... yes
checking for putenv... yes
checking for getenv... yes
checking for setenv... yes
checking for unsetenv... yes
checking for xw... no
checking for brk... yes
checking for sbrk... yes
checking for pathconf... yes
checking for sysconf... yes
checking for tgetent... yes
checking for tigetflag... yes
checking for tigetnum... yes
checking for tigetstr... yes
checking for setupterm... yes
checking for initscr... yes
checking for resize_term... yes
checking for getcchar... yes
checking for setcchar... yes
checking for waddwstr... yes
checking for wget_wch... yes
checking for win_wch... yes
checking for use_default_colors... yes
checking for pcre_compile... no
checking for pcre_study... no
checking for pcre_exec... no
checking for nl_langinfo... yes
checking for erand48... yes
checking for open_memstream... yes
checking for posix_openpt... yes
checking for wctomb... yes
checking for iconv... (cached) yes
checking for grantpt... yes
checking for unlockpt... yes
checking for ptsname... yes
checking for htons... yes
checking for ntohs... yes
checking for regcomp... yes
checking for regexec... yes
checking for regerror... yes
checking for regfree... yes
checking for gdbm_open... no
checking for getxattr... yes
checking for realpath... yes
checking for canonicalize_file_name... no
checking for symlink... yes
checking for getcwd... yes
checking for cygwin_conv_path... no
checking for nanosleep... yes
checking for srand_deterministic... no
checking for setutxent... yes
checking for getutxent... yes
checking for endutxent... yes
checking for getutent... yes
checking for working strcoll... yes
checking for isinf... yes
checking for isnan... yes
checking if realpath accepts NULL... yes
checking if tgetent accepts NULL... yes
checking if tgetent returns 0 on success... no
checking for stdlib.h... (cached) yes
checking for unistd.h... (cached) yes
checking for sys/param.h... (cached) yes
checking for getpagesize... yes
checking for working mmap... yes
checking for munmap... yes
checking for msync... yes
checking whether getpgrp requires zero arguments... yes
checking for dlopen... yes
checking for dlerror... yes
checking for dlsym... yes
checking for dlclose... yes
checking for load... no
checking for loadquery... no
checking for loadbind... no
checking for unload... no
checking for shl_load... no
checking for shl_unload... no
checking for shl_findsym... no
checking if getxattr etc. are Linux-like... yes
checking if getxattr etc. are usable... yes
checking what style of signals to use... POSIX_SIGNALS
checking where signal.h is located...  /usr/include/bits/signal.h
checking where error names are located...  /usr/include/bits/errno.h
checking location of curses header... ncurses.h
checking where curses key definitions are located... /usr/include/curses.h
checking for ncursesw/term.h... no
checking for ncurses/term.h... no
checking for term.h... yes
checking where term.h is located... term.h
checking if boolcodes is available... yes
checking if numcodes is available... yes
checking if strcodes is available... yes
checking if boolnames is available... yes
checking if numnames is available... yes
checking if strnames is available... yes
checking if tgoto prototype is missing... no
checking where the RLIMIT macros are located... /usr/include/sys/resource.h
checking if rlim_t is longer than a long... no
checking if the rlim_t is unsigned... yes
checking for rlim_t... yes
checking for limit RLIMIT_AIO_MEM... no
checking for limit RLIMIT_AIO_OPS... no
checking for limit RLIMIT_AS... yes
checking for limit RLIMIT_LOCKS... yes
checking for limit RLIMIT_MEMLOCK... yes
checking for limit RLIMIT_NPROC... yes
checking for limit RLIMIT_NTHR... no
checking for limit RLIMIT_NOFILE... yes
checking for limit RLIMIT_PTHREAD... no
checking for limit RLIMIT_RSS... yes
checking for limit RLIMIT_SBSIZE... no
checking for limit RLIMIT_TCACHE... no
checking for limit RLIMIT_VMEM... no
checking for limit RLIMIT_SIGPENDING... yes
checking for limit RLIMIT_MSGQUEUE... yes
checking for limit RLIMIT_NICE... yes
checking for limit RLIMIT_RTPRIO... yes
checking for limit RLIMIT_POSIXLOCKS... no
checking for limit RLIMIT_NPTS... no
checking for limit RLIMIT_SWAP... no
checking for limit RLIMIT_KQUEUES... no
checking for limit RLIMIT_UMTXP... no
checking if RLIMIT_VMEM and RLIMIT_RSS are the same... no
checking if RLIMIT_VMEM and RLIMIT_AS are the same... no
checking if RLIMIT_RSS and RLIMIT_AS are the same... no
checking for struct rusage.ru_maxrss... yes
checking for struct rusage.ru_ixrss... yes
checking for struct rusage.ru_idrss... yes
checking for struct rusage.ru_isrss... yes
checking for struct rusage.ru_minflt... yes
checking for struct rusage.ru_majflt... yes
checking for struct rusage.ru_nswap... yes
checking for struct rusage.ru_inblock... yes
checking for struct rusage.ru_oublock... yes
checking for struct rusage.ru_msgsnd... yes
checking for struct rusage.ru_msgrcv... yes
checking for struct rusage.ru_nsignals... yes
checking for struct rusage.ru_nvcsw... yes
checking for struct rusage.ru_nivcsw... yes
checking for /dev/fd filesystem... /proc/self/fd
checking for RFS superroot directory... no
checking whether we should use the native getcwd... no
checking whether getcwd calls malloc to allocate memory... yes
checking for setproctitle... no
checking for library containing setproctitle... no
checking for NIS... no
checking for NIS+... no
checking for utmp file... /var/run/utmp
checking for wtmp file... /var/log/wtmp
checking for utmpx file... no
checking for wtmpx file... no
checking for brk() prototype in <unistd.h>... yes
checking for sbrk() prototype in <unistd.h>... yes
checking for mknod prototype in <sys/stat.h>... yes
checking for ioctl prototype in <unistd.h> or <termios.h>... no
checking for ioctl prototype in <sys/ioctl.h>... yes
checking if named FIFOs work... yes
checking if link() works... yes
checking if kill(pid, 0) returns ESRCH correctly... yes
checking if POSIX sigsuspend() works... yes
checking if getpwnam() is faked... no
checking base type of the third argument to accept... socklen_t
checking if your system has /dev/ptmx... yes
checking if /dev/ptmx is usable... yes
checking if the wcwidth() and/or iswprint() functions are broken... no
checking if the isprint() function is broken... no
checking if your system uses ELF binaries... yes
checking if we can use -rdynamic... yes
checking if your dlsym() needs a leading underscore... no
checking if environ is available in shared libraries... yes
checking if tgetent is available in shared libraries... yes
checking if tigetstr is available in shared libraries... yes
checking if name clashes in shared objects are OK... yes
checking for working RTLD_GLOBAL... yes
checking whether symbols in the executable are available... yes
checking whether executables can be stripped... yes
checking whether libraries can be stripped... yes
configure: creating ./config.status
config.status: creating Config/defs.mk
config.status: creating Makefile
config.status: creating Doc/Makefile
config.status: creating Etc/Makefile
config.status: creating Src/Makefile
config.status: creating Test/Makefile
config.status: creating config.h
config.status: executing config.modules commands
creating ./config.modules
config.status: executing stamp-h commands

zsh configuration
-----------------
zsh version               : 5.8
host operating system     : x86_64-alpine-linux-musl
source code location      : .
compiler                  : gcc
preprocessor flags        : -Os -fomit-frame-pointer
executable compiler flags : -Os -fomit-frame-pointer
module compiler flags     : -Os -fomit-frame-pointer -fPIC
executable linker flags   : -Wl,--as-needed  -rdynamic
module linker flags       : -Wl,--as-needed  -shared
library flags             : -ldl -lncursesw -lrt -lm  -lc
installation basename     : zsh
binary install path       : /bin
man page install path     : /usr/share/man
info install path         : /usr/share/info
functions install path    : /usr/share/zsh/5.8/functions
See config.modules for installed modules and functions.

make[1]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src'
cd .. && /bin/sh $top_srcdir/Src/mkmakemod.sh Src Makemod
creating Src/Makemod.in
config.status: creating Src/Makemod
make[2]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src'
awk -f ./signames1.awk  /usr/include/bits/signal.h >sigtmp.c
case "`gcc -E --version </dev/null 2>&1`" in \
*"Free Software Foundation"*) \
gcc -E -P sigtmp.c >sigtmp.out;; \
*) \
gcc -E sigtmp.c >sigtmp.out;; \
esac
awk -f ./signames2.awk sigtmp.out > signames.c
rm -f sigtmp.c sigtmp.out
grep 'define.*SIGCOUNT' signames.c > sigcount.h
make[3]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src'
make[3]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src'
Updated `zsh.mdh'.
echo 'timestamp for zsh.mdh against zsh.mdd' > zsh.mdhs
awk -f ../Src/makepro.awk builtin.c Src > builtin.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < builtin.syms) \
	> builtin.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < builtin.syms) \
	> `echo builtin.epro | sed 's/\.epro$/.pro/'`
awk -f ../Src/makepro.awk compat.c Src > compat.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < compat.syms) \
	> compat.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < compat.syms) \
	> `echo compat.epro | sed 's/\.epro$/.pro/'`
awk -f ../Src/makepro.awk cond.c Src > cond.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < cond.syms) \
	> cond.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < cond.syms) \
	> `echo cond.epro | sed 's/\.epro$/.pro/'`
awk -f ../Src/makepro.awk context.c Src > context.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < context.syms) \
	> context.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < context.syms) \
	> `echo context.epro | sed 's/\.epro$/.pro/'`
awk -f ../Src/makepro.awk exec.c Src > exec.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < exec.syms) \
	> exec.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < exec.syms) \
	> `echo exec.epro | sed 's/\.epro$/.pro/'`
awk -f ../Src/makepro.awk glob.c Src > glob.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < glob.syms) \
	> glob.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < glob.syms) \
	> `echo glob.epro | sed 's/\.epro$/.pro/'`
awk -f ../Src/makepro.awk hashtable.c Src > hashtable.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < hashtable.syms) \
	> hashtable.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < hashtable.syms) \
	> `echo hashtable.epro | sed 's/\.epro$/.pro/'`
awk -f ../Src/makepro.awk hashnameddir.c Src > hashnameddir.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < hashnameddir.syms) \
	> hashnameddir.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < hashnameddir.syms) \
	> `echo hashnameddir.epro | sed 's/\.epro$/.pro/'`
awk -f ../Src/makepro.awk hist.c Src > hist.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < hist.syms) \
	> hist.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < hist.syms) \
	> `echo hist.epro | sed 's/\.epro$/.pro/'`
awk -f ../Src/makepro.awk init.c Src > init.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < init.syms) \
	> init.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < init.syms) \
	> `echo init.epro | sed 's/\.epro$/.pro/'`
awk -f ../Src/makepro.awk input.c Src > input.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < input.syms) \
	> input.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < input.syms) \
	> `echo input.epro | sed 's/\.epro$/.pro/'`
awk -f ../Src/makepro.awk jobs.c Src > jobs.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < jobs.syms) \
	> jobs.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < jobs.syms) \
	> `echo jobs.epro | sed 's/\.epro$/.pro/'`
awk -f ../Src/makepro.awk lex.c Src > lex.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < lex.syms) \
	> lex.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < lex.syms) \
	> `echo lex.epro | sed 's/\.epro$/.pro/'`
awk -f ../Src/makepro.awk linklist.c Src > linklist.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < linklist.syms) \
	> linklist.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < linklist.syms) \
	> `echo linklist.epro | sed 's/\.epro$/.pro/'`
awk -f ../Src/makepro.awk loop.c Src > loop.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < loop.syms) \
	> loop.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < loop.syms) \
	> `echo loop.epro | sed 's/\.epro$/.pro/'`
awk -f ../Src/makepro.awk math.c Src > math.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < math.syms) \
	> math.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < math.syms) \
	> `echo math.epro | sed 's/\.epro$/.pro/'`
awk -f ../Src/makepro.awk mem.c Src > mem.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < mem.syms) \
	> mem.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < mem.syms) \
	> `echo mem.epro | sed 's/\.epro$/.pro/'`
awk -f ../Src/makepro.awk module.c Src > module.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < module.syms) \
	> module.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < module.syms) \
	> `echo module.epro | sed 's/\.epro$/.pro/'`
awk -f ../Src/makepro.awk options.c Src > options.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < options.syms) \
	> options.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < options.syms) \
	> `echo options.epro | sed 's/\.epro$/.pro/'`
awk -f ../Src/makepro.awk params.c Src > params.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < params.syms) \
	> params.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < params.syms) \
	> `echo params.epro | sed 's/\.epro$/.pro/'`
awk -f ../Src/makepro.awk parse.c Src > parse.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < parse.syms) \
	> parse.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < parse.syms) \
	> `echo parse.epro | sed 's/\.epro$/.pro/'`
awk -f ../Src/makepro.awk pattern.c Src > pattern.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < pattern.syms) \
	> pattern.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < pattern.syms) \
	> `echo pattern.epro | sed 's/\.epro$/.pro/'`
awk -f ../Src/makepro.awk prompt.c Src > prompt.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < prompt.syms) \
	> prompt.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < prompt.syms) \
	> `echo prompt.epro | sed 's/\.epro$/.pro/'`
awk -f ../Src/makepro.awk signals.c Src > signals.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < signals.syms) \
	> signals.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < signals.syms) \
	> `echo signals.epro | sed 's/\.epro$/.pro/'`
awk -f ../Src/makepro.awk signames.c Src > signames.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < signames.syms) \
	> signames.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < signames.syms) \
	> `echo signames.epro | sed 's/\.epro$/.pro/'`
awk -f ../Src/makepro.awk sort.c Src > sort.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < sort.syms) \
	> sort.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < sort.syms) \
	> `echo sort.epro | sed 's/\.epro$/.pro/'`
awk -f ../Src/makepro.awk string.c Src > string.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < string.syms) \
	> string.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < string.syms) \
	> `echo string.epro | sed 's/\.epro$/.pro/'`
awk -f ../Src/makepro.awk subst.c Src > subst.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < subst.syms) \
	> subst.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < subst.syms) \
	> `echo subst.epro | sed 's/\.epro$/.pro/'`
awk -f ../Src/makepro.awk text.c Src > text.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < text.syms) \
	> text.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < text.syms) \
	> `echo text.epro | sed 's/\.epro$/.pro/'`
awk -f ../Src/makepro.awk utils.c Src > utils.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < utils.syms) \
	> utils.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < utils.syms) \
	> `echo utils.epro | sed 's/\.epro$/.pro/'`
awk -f ../Src/makepro.awk watch.c Src > watch.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < watch.syms) \
	> watch.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < watch.syms) \
	> `echo watch.epro | sed 's/\.epro$/.pro/'`
awk -f ../Src/makepro.awk openssh_bsd_setres_id.c Src > openssh_bsd_setres_id.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < openssh_bsd_setres_id.syms) \
	> openssh_bsd_setres_id.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < openssh_bsd_setres_id.syms) \
	> `echo openssh_bsd_setres_id.epro | sed 's/\.epro$/.pro/'`
make[3]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src'
make[3]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src'
Updated `zsh.mdh'.
make -f Makemod prefix='/usr' exec_prefix='/usr' bindir='/bin' libdir='/usr/lib' MODDIR='/usr/lib/zsh/5.8' infodir='/usr/share/info' mandir='/usr/share/man' datadir='/usr/share' fndir='/usr/share/zsh/5.8/functions' htmldir='/usr/share/zsh/htmldoc' runhelpdir='/usr/share/zsh/5.8/help' CC='gcc' CPPFLAGS='-Os -fomit-frame-pointer' DEFS='-DHAVE_CONFIG_H' CFLAGS='-Os -fomit-frame-pointer' LDFLAGS='-Wl,--as-needed' EXTRA_LDFLAGS='-rdynamic' DLCFLAGS='-fPIC' DLLDFLAGS='-shared' LIBLDFLAGS='' EXELDFLAGS='' LIBS='-ldl -lncursesw -lrt -lm  -lc' DL_EXT='so' DLLD='gcc' AWK='awk' ANSI2KNR=': ansi2knr' YODL=': yodl ' YODL2TXT=': yodl2txt' YODL2HTML=': yodl2html' FUNCTIONS_INSTALL='' tzsh='zsh' prep
make[3]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src'
creating Src/Builtins/Makefile.in
config.status: creating Src/Builtins/Makefile
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Builtins'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Builtins'
creating Src/Modules/Makefile.in
config.status: creating Src/Modules/Makefile
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
creating Src/Zle/Makefile.in
config.status: creating Src/Zle/Makefile
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Zle'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Zle'
make[3]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src'
echo 'timestamp for *.mdd files' > ../Src/modules.stamp
make[3]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Builtins'
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Builtins'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Builtins'
Updated `rlimits.mdh'.
echo 'timestamp for rlimits.mdh against rlimits.mdd' > rlimits.mdhs
awk -f ../../Src/makepro.awk rlimits.c Src/Builtins > rlimits.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < rlimits.syms) \
	> rlimits.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < rlimits.syms) \
	> `echo rlimits.epro | sed 's/\.epro$/.pro/'`
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Builtins'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Builtins'
Updated `rlimits.mdh'.
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Builtins'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Builtins'
Updated `sched.mdh'.
echo 'timestamp for sched.mdh against sched.mdd' > sched.mdhs
awk -f ../../Src/makepro.awk sched.c Src/Builtins > sched.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < sched.syms) \
	> sched.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < sched.syms) \
	> `echo sched.epro | sed 's/\.epro$/.pro/'`
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Builtins'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Builtins'
Updated `sched.mdh'.
make[3]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Builtins'
make[3]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
Updated `attr.mdh'.
echo 'timestamp for attr.mdh against attr.mdd' > attr.mdhs
awk -f ../../Src/makepro.awk attr.c Src/Modules > attr.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < attr.syms) \
	> attr.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < attr.syms) \
	> `echo attr.epro | sed 's/\.epro$/.pro/'`
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
Updated `attr.mdh'.
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
Updated `cap.mdh'.
echo 'timestamp for cap.mdh against cap.mdd' > cap.mdhs
awk -f ../../Src/makepro.awk cap.c Src/Modules > cap.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < cap.syms) \
	> cap.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < cap.syms) \
	> `echo cap.epro | sed 's/\.epro$/.pro/'`
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
Updated `cap.mdh'.
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
Updated `clone.mdh'.
echo 'timestamp for clone.mdh against clone.mdd' > clone.mdhs
awk -f ../../Src/makepro.awk clone.c Src/Modules > clone.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < clone.syms) \
	> clone.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < clone.syms) \
	> `echo clone.epro | sed 's/\.epro$/.pro/'`
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
Updated `clone.mdh'.
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
Updated `curses.mdh'.
echo 'timestamp for curses.mdh against curses.mdd' > curses.mdhs
awk -f ../../Src/makepro.awk curses.c Src/Modules > curses.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < curses.syms) \
	> curses.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < curses.syms) \
	> `echo curses.epro | sed 's/\.epro$/.pro/'`
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
Updated `curses.mdh'.
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
Updated `datetime.mdh'.
echo 'timestamp for datetime.mdh against datetime.mdd' > datetime.mdhs
awk -f ../../Src/makepro.awk datetime.c Src/Modules > datetime.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < datetime.syms) \
	> datetime.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < datetime.syms) \
	> `echo datetime.epro | sed 's/\.epro$/.pro/'`
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
Updated `datetime.mdh'.
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
Updated `example.mdh'.
echo 'timestamp for example.mdh against example.mdd' > example.mdhs
awk -f ../../Src/makepro.awk example.c Src/Modules > example.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < example.syms) \
	> example.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < example.syms) \
	> `echo example.epro | sed 's/\.epro$/.pro/'`
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
Updated `example.mdh'.
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
Updated `files.mdh'.
echo 'timestamp for files.mdh against files.mdd' > files.mdhs
awk -f ../../Src/makepro.awk files.c Src/Modules > files.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < files.syms) \
	> files.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < files.syms) \
	> `echo files.epro | sed 's/\.epro$/.pro/'`
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
Updated `files.mdh'.
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
Updated `langinfo.mdh'.
echo 'timestamp for langinfo.mdh against langinfo.mdd' > langinfo.mdhs
awk -f ../../Src/makepro.awk langinfo.c Src/Modules > langinfo.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < langinfo.syms) \
	> langinfo.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < langinfo.syms) \
	> `echo langinfo.epro | sed 's/\.epro$/.pro/'`
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
Updated `langinfo.mdh'.
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
Updated `mapfile.mdh'.
echo 'timestamp for mapfile.mdh against mapfile.mdd' > mapfile.mdhs
awk -f ../../Src/makepro.awk mapfile.c Src/Modules > mapfile.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < mapfile.syms) \
	> mapfile.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < mapfile.syms) \
	> `echo mapfile.epro | sed 's/\.epro$/.pro/'`
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
Updated `mapfile.mdh'.
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
Updated `mathfunc.mdh'.
echo 'timestamp for mathfunc.mdh against mathfunc.mdd' > mathfunc.mdhs
awk -f ../../Src/makepro.awk mathfunc.c Src/Modules > mathfunc.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < mathfunc.syms) \
	> mathfunc.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < mathfunc.syms) \
	> `echo mathfunc.epro | sed 's/\.epro$/.pro/'`
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
Updated `mathfunc.mdh'.
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
Updated `nearcolor.mdh'.
echo 'timestamp for nearcolor.mdh against nearcolor.mdd' > nearcolor.mdhs
awk -f ../../Src/makepro.awk nearcolor.c Src/Modules > nearcolor.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < nearcolor.syms) \
	> nearcolor.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < nearcolor.syms) \
	> `echo nearcolor.epro | sed 's/\.epro$/.pro/'`
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
Updated `nearcolor.mdh'.
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
Updated `newuser.mdh'.
echo 'timestamp for newuser.mdh against newuser.mdd' > newuser.mdhs
awk -f ../../Src/makepro.awk newuser.c Src/Modules > newuser.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < newuser.syms) \
	> newuser.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < newuser.syms) \
	> `echo newuser.epro | sed 's/\.epro$/.pro/'`
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
Updated `newuser.mdh'.
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
Updated `param_private.mdh'.
echo 'timestamp for param_private.mdh against param_private.mdd' > param_private.mdhs
awk -f ../../Src/makepro.awk param_private.c Src/Modules > param_private.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < param_private.syms) \
	> param_private.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < param_private.syms) \
	> `echo param_private.epro | sed 's/\.epro$/.pro/'`
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
Updated `param_private.mdh'.
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
Updated `parameter.mdh'.
echo 'timestamp for parameter.mdh against parameter.mdd' > parameter.mdhs
awk -f ../../Src/makepro.awk parameter.c Src/Modules > parameter.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < parameter.syms) \
	> parameter.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < parameter.syms) \
	> `echo parameter.epro | sed 's/\.epro$/.pro/'`
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
Updated `parameter.mdh'.
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
Updated `regex.mdh'.
echo 'timestamp for regex.mdh against regex.mdd' > regex.mdhs
awk -f ../../Src/makepro.awk regex.c Src/Modules > regex.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < regex.syms) \
	> regex.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < regex.syms) \
	> `echo regex.epro | sed 's/\.epro$/.pro/'`
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
Updated `regex.mdh'.
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
Updated `socket.mdh'.
echo 'timestamp for socket.mdh against socket.mdd' > socket.mdhs
awk -f ../../Src/makepro.awk socket.c Src/Modules > socket.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < socket.syms) \
	> socket.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < socket.syms) \
	> `echo socket.epro | sed 's/\.epro$/.pro/'`
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
Updated `socket.mdh'.
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
Updated `stat.mdh'.
echo 'timestamp for stat.mdh against stat.mdd' > stat.mdhs
awk -f ../../Src/makepro.awk stat.c Src/Modules > stat.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < stat.syms) \
	> stat.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < stat.syms) \
	> `echo stat.epro | sed 's/\.epro$/.pro/'`
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
Updated `stat.mdh'.
if [ x" /usr/include/bits/errno.h" = x ]; then \
	touch errtmp.out; \
   else \
	awk -f ./errnames1.awk  /usr/include/bits/errno.h >errtmp.c; \
	case "`gcc -E --version </dev/null 2>&1`" in \
	*"Free Software Foundation"*) \
	gcc -E -P errtmp.c >errtmp.out;; \
	*) \
	gcc -E errtmp.c >errtmp.out;; \
	esac; \
   fi
awk -f ./errnames2.awk errtmp.out > errnames.c
rm -f errtmp.c errtmp.out
grep 'define.*ERRCOUNT' errnames.c > errcount.h
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
Updated `system.mdh'.
echo 'timestamp for system.mdh against system.mdd' > system.mdhs
awk -f ../../Src/makepro.awk system.c Src/Modules > system.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < system.syms) \
	> system.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < system.syms) \
	> `echo system.epro | sed 's/\.epro$/.pro/'`
awk -f ../../Src/makepro.awk errnames.c Src/Modules > errnames.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < errnames.syms) \
	> errnames.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < errnames.syms) \
	> `echo errnames.epro | sed 's/\.epro$/.pro/'`
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
Updated `system.mdh'.
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
Updated `tcp.mdh'.
echo 'timestamp for tcp.mdh against tcp.mdd' > tcp.mdhs
awk -f ../../Src/makepro.awk tcp.c Src/Modules > tcp.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < tcp.syms) \
	> tcp.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < tcp.syms) \
	> `echo tcp.epro | sed 's/\.epro$/.pro/'`
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
Updated `tcp.mdh'.
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
Updated `termcap.mdh'.
echo 'timestamp for termcap.mdh against termcap.mdd' > termcap.mdhs
awk -f ../../Src/makepro.awk termcap.c Src/Modules > termcap.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < termcap.syms) \
	> termcap.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < termcap.syms) \
	> `echo termcap.epro | sed 's/\.epro$/.pro/'`
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
Updated `termcap.mdh'.
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
Updated `terminfo.mdh'.
echo 'timestamp for terminfo.mdh against terminfo.mdd' > terminfo.mdhs
awk -f ../../Src/makepro.awk terminfo.c Src/Modules > terminfo.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < terminfo.syms) \
	> terminfo.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < terminfo.syms) \
	> `echo terminfo.epro | sed 's/\.epro$/.pro/'`
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
Updated `terminfo.mdh'.
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
Updated `zftp.mdh'.
echo 'timestamp for zftp.mdh against zftp.mdd' > zftp.mdhs
awk -f ../../Src/makepro.awk zftp.c Src/Modules > zftp.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < zftp.syms) \
	> zftp.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < zftp.syms) \
	> `echo zftp.epro | sed 's/\.epro$/.pro/'`
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
Updated `zftp.mdh'.
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
Updated `zprof.mdh'.
echo 'timestamp for zprof.mdh against zprof.mdd' > zprof.mdhs
awk -f ../../Src/makepro.awk zprof.c Src/Modules > zprof.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < zprof.syms) \
	> zprof.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < zprof.syms) \
	> `echo zprof.epro | sed 's/\.epro$/.pro/'`
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
Updated `zprof.mdh'.
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
Updated `zpty.mdh'.
echo 'timestamp for zpty.mdh against zpty.mdd' > zpty.mdhs
awk -f ../../Src/makepro.awk zpty.c Src/Modules > zpty.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < zpty.syms) \
	> zpty.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < zpty.syms) \
	> `echo zpty.epro | sed 's/\.epro$/.pro/'`
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
Updated `zpty.mdh'.
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
Updated `zselect.mdh'.
echo 'timestamp for zselect.mdh against zselect.mdd' > zselect.mdhs
awk -f ../../Src/makepro.awk zselect.c Src/Modules > zselect.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < zselect.syms) \
	> zselect.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < zselect.syms) \
	> `echo zselect.epro | sed 's/\.epro$/.pro/'`
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
Updated `zselect.mdh'.
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Zle'
( \
    echo '/** thingies.list                            **/'; \
    echo '/** thingy structures for the known thingies **/'; \
    echo; \
    echo '/* format: T("name", TH_FLAGS, w_widget, t_nextthingy) */'; \
    echo; \
    sed -e 's/#.*//; /^$/d; s/" *,.*/"/' \
	-e 's/^"/T("/; s/$/, 0,/; h' \
	-e 's/-//g; s/^.*"\(.*\)".*/w_\1, t_D\1)/' \
	-e 'H; g; s/\n/ /' \
	< ./iwidgets.list; \
    sed -e 's/#.*//; /^$/d; s/" *,.*/"/' \
	-e 's/^"/T("./; s/$/, TH_IMMORTAL,/; h' \
	-e 's/-//g; s/^.*"\.\(.*\)".*/w_\1, t_\1)/' \
	-e 'H; g; s/\n/ /' \
	< ./iwidgets.list; \
) > thingies.list
( \
    echo '/** zle_things.h                              **/'; \
    echo '/** indices of and pointers to known thingies **/'; \
    echo; \
    echo 'enum {'; \
    sed -n -f ./zle_things.sed < thingies.list; \
    echo '    ZLE_BUILTIN_THINGY_COUNT'; \
    echo '};'; \
) > zle_things.h
make[5]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Zle'
make[5]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Zle'
Updated `zle.mdh'.
echo 'timestamp for zle.mdh against zle.mdd' > zle.mdhs
awk -f ../../Src/makepro.awk zle_bindings.c Src/Zle > zle_bindings.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < zle_bindings.syms) \
	> zle_bindings.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < zle_bindings.syms) \
	> `echo zle_bindings.epro | sed 's/\.epro$/.pro/'`
awk -f ../../Src/makepro.awk zle_hist.c Src/Zle > zle_hist.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < zle_hist.syms) \
	> zle_hist.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < zle_hist.syms) \
	> `echo zle_hist.epro | sed 's/\.epro$/.pro/'`
awk -f ../../Src/makepro.awk zle_keymap.c Src/Zle > zle_keymap.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < zle_keymap.syms) \
	> zle_keymap.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < zle_keymap.syms) \
	> `echo zle_keymap.epro | sed 's/\.epro$/.pro/'`
awk -f ../../Src/makepro.awk zle_main.c Src/Zle > zle_main.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < zle_main.syms) \
	> zle_main.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < zle_main.syms) \
	> `echo zle_main.epro | sed 's/\.epro$/.pro/'`
awk -f ../../Src/makepro.awk zle_misc.c Src/Zle > zle_misc.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < zle_misc.syms) \
	> zle_misc.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < zle_misc.syms) \
	> `echo zle_misc.epro | sed 's/\.epro$/.pro/'`
awk -f ../../Src/makepro.awk zle_move.c Src/Zle > zle_move.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < zle_move.syms) \
	> zle_move.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < zle_move.syms) \
	> `echo zle_move.epro | sed 's/\.epro$/.pro/'`
awk -f ../../Src/makepro.awk zle_params.c Src/Zle > zle_params.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < zle_params.syms) \
	> zle_params.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < zle_params.syms) \
	> `echo zle_params.epro | sed 's/\.epro$/.pro/'`
awk -f ../../Src/makepro.awk zle_refresh.c Src/Zle > zle_refresh.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < zle_refresh.syms) \
	> zle_refresh.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < zle_refresh.syms) \
	> `echo zle_refresh.epro | sed 's/\.epro$/.pro/'`
awk -f ../../Src/makepro.awk zle_thingy.c Src/Zle > zle_thingy.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < zle_thingy.syms) \
	> zle_thingy.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < zle_thingy.syms) \
	> `echo zle_thingy.epro | sed 's/\.epro$/.pro/'`
awk -f ../../Src/makepro.awk zle_tricky.c Src/Zle > zle_tricky.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < zle_tricky.syms) \
	> zle_tricky.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < zle_tricky.syms) \
	> `echo zle_tricky.epro | sed 's/\.epro$/.pro/'`
awk -f ../../Src/makepro.awk zle_utils.c Src/Zle > zle_utils.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < zle_utils.syms) \
	> zle_utils.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < zle_utils.syms) \
	> `echo zle_utils.epro | sed 's/\.epro$/.pro/'`
awk -f ../../Src/makepro.awk zle_vi.c Src/Zle > zle_vi.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < zle_vi.syms) \
	> zle_vi.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < zle_vi.syms) \
	> `echo zle_vi.epro | sed 's/\.epro$/.pro/'`
awk -f ../../Src/makepro.awk zle_word.c Src/Zle > zle_word.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < zle_word.syms) \
	> zle_word.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < zle_word.syms) \
	> `echo zle_word.epro | sed 's/\.epro$/.pro/'`
awk -f ../../Src/makepro.awk textobjects.c Src/Zle > textobjects.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < textobjects.syms) \
	> textobjects.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < textobjects.syms) \
	> `echo textobjects.epro | sed 's/\.epro$/.pro/'`
make[5]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Zle'
make[5]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Zle'
Updated `zle.mdh'.
make[5]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Zle'
make[5]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Zle'
Updated `complete.mdh'.
echo 'timestamp for complete.mdh against complete.mdd' > complete.mdhs
awk -f ../../Src/makepro.awk complete.c Src/Zle > complete.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < complete.syms) \
	> complete.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < complete.syms) \
	> `echo complete.epro | sed 's/\.epro$/.pro/'`
awk -f ../../Src/makepro.awk compcore.c Src/Zle > compcore.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < compcore.syms) \
	> compcore.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < compcore.syms) \
	> `echo compcore.epro | sed 's/\.epro$/.pro/'`
awk -f ../../Src/makepro.awk compmatch.c Src/Zle > compmatch.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < compmatch.syms) \
	> compmatch.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < compmatch.syms) \
	> `echo compmatch.epro | sed 's/\.epro$/.pro/'`
awk -f ../../Src/makepro.awk compresult.c Src/Zle > compresult.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < compresult.syms) \
	> compresult.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < compresult.syms) \
	> `echo compresult.epro | sed 's/\.epro$/.pro/'`
make[5]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Zle'
make[5]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Zle'
Updated `complete.mdh'.
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Zle'
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
Updated `zutil.mdh'.
echo 'timestamp for zutil.mdh against zutil.mdd' > zutil.mdhs
awk -f ../../Src/makepro.awk zutil.c Src/Modules > zutil.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < zutil.syms) \
	> zutil.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < zutil.syms) \
	> `echo zutil.epro | sed 's/\.epro$/.pro/'`
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
Updated `zutil.mdh'.
make[3]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
make[3]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Zle'
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Zle'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Zle'
Updated `compctl.mdh'.
echo 'timestamp for compctl.mdh against compctl.mdd' > compctl.mdhs
awk -f ../../Src/makepro.awk compctl.c Src/Zle > compctl.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < compctl.syms) \
	> compctl.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < compctl.syms) \
	> `echo compctl.epro | sed 's/\.epro$/.pro/'`
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Zle'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Zle'
Updated `compctl.mdh'.
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Zle'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Zle'
Updated `complist.mdh'.
echo 'timestamp for complist.mdh against complist.mdd' > complist.mdhs
awk -f ../../Src/makepro.awk complist.c Src/Zle > complist.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < complist.syms) \
	> complist.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < complist.syms) \
	> `echo complist.epro | sed 's/\.epro$/.pro/'`
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Zle'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Zle'
Updated `complist.mdh'.
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Zle'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Zle'
Updated `computil.mdh'.
echo 'timestamp for computil.mdh against computil.mdd' > computil.mdhs
awk -f ../../Src/makepro.awk computil.c Src/Zle > computil.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < computil.syms) \
	> computil.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < computil.syms) \
	> `echo computil.epro | sed 's/\.epro$/.pro/'`
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Zle'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Zle'
Updated `computil.mdh'.
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Zle'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Zle'
Updated `deltochar.mdh'.
echo 'timestamp for deltochar.mdh against deltochar.mdd' > deltochar.mdhs
awk -f ../../Src/makepro.awk deltochar.c Src/Zle > deltochar.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < deltochar.syms) \
	> deltochar.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < deltochar.syms) \
	> `echo deltochar.epro | sed 's/\.epro$/.pro/'`
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Zle'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Zle'
Updated `deltochar.mdh'.
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Zle'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Zle'
Updated `zleparameter.mdh'.
echo 'timestamp for zleparameter.mdh against zleparameter.mdd' > zleparameter.mdhs
awk -f ../../Src/makepro.awk zleparameter.c Src/Zle > zleparameter.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < zleparameter.syms) \
	> zleparameter.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < zleparameter.syms) \
	> `echo zleparameter.epro | sed 's/\.epro$/.pro/'`
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Zle'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Zle'
Updated `zleparameter.mdh'.
make[3]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Zle'
make[2]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src'
rm -f stamp-modobjs.tmp
make[2]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src'
gcc -c -I. -I../Src -I../Src -I../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -Os -fomit-frame-pointer  -o builtin.o builtin.c
gcc -c -I. -I../Src -I../Src -I../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -Os -fomit-frame-pointer  -o compat.o compat.c
gcc -c -I. -I../Src -I../Src -I../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -Os -fomit-frame-pointer  -o cond.o cond.c
gcc -c -I. -I../Src -I../Src -I../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -Os -fomit-frame-pointer  -o context.o context.c
gcc -c -I. -I../Src -I../Src -I../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -Os -fomit-frame-pointer  -o exec.o exec.c
gcc -c -I. -I../Src -I../Src -I../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -Os -fomit-frame-pointer  -o glob.o glob.c
gcc -c -I. -I../Src -I../Src -I../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -Os -fomit-frame-pointer  -o hashtable.o hashtable.c
gcc -c -I. -I../Src -I../Src -I../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -Os -fomit-frame-pointer  -o hashnameddir.o hashnameddir.c
gcc -c -I. -I../Src -I../Src -I../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -Os -fomit-frame-pointer  -o hist.o hist.c
srcdir='.' CFMOD='../config.modules' \
  /bin/sh ./mkbltnmlst.sh bltinmods.list
Updated `zshpaths.h'.
Creating `zshxmods.h'.
echo '#define ZSH_VERSION "'5.8'"' > version.h
gcc -c -I. -I../Src -I../Src -I../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -Os -fomit-frame-pointer  -o init.o init.c
gcc -c -I. -I../Src -I../Src -I../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -Os -fomit-frame-pointer  -o input.o input.c
gcc -c -I. -I../Src -I../Src -I../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -Os -fomit-frame-pointer  -o jobs.o jobs.c
gcc -c -I. -I../Src -I../Src -I../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -Os -fomit-frame-pointer  -o lex.o lex.c
gcc -c -I. -I../Src -I../Src -I../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -Os -fomit-frame-pointer  -o linklist.o linklist.c
gcc -c -I. -I../Src -I../Src -I../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -Os -fomit-frame-pointer  -o loop.o loop.c
gcc -c -I. -I../Src -I../Src -I../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -Os -fomit-frame-pointer  -o math.o math.c
gcc -c -I. -I../Src -I../Src -I../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -Os -fomit-frame-pointer  -o mem.o mem.c
gcc -c -I. -I../Src -I../Src -I../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -Os -fomit-frame-pointer  -o module.o module.c
gcc -c -I. -I../Src -I../Src -I../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -Os -fomit-frame-pointer  -o options.o options.c
gcc -c -I. -I../Src -I../Src -I../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -Os -fomit-frame-pointer  -o params.o params.c
gcc -c -I. -I../Src -I../Src -I../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -Os -fomit-frame-pointer  -o parse.o parse.c
gcc -c -I. -I../Src -I../Src -I../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -Os -fomit-frame-pointer  -o pattern.o pattern.c
gcc -c -I. -I../Src -I../Src -I../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -Os -fomit-frame-pointer  -o prompt.o prompt.c
gcc -c -I. -I../Src -I../Src -I../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -Os -fomit-frame-pointer  -o signals.o signals.c
gcc -c -I. -I../Src -I../Src -I../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -Os -fomit-frame-pointer  -o signames.o signames.c
gcc -c -I. -I../Src -I../Src -I../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -Os -fomit-frame-pointer  -o sort.o sort.c
gcc -c -I. -I../Src -I../Src -I../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -Os -fomit-frame-pointer  -o string.o string.c
gcc -c -I. -I../Src -I../Src -I../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -Os -fomit-frame-pointer  -o subst.o subst.c
gcc -c -I. -I../Src -I../Src -I../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -Os -fomit-frame-pointer  -o text.o text.c
gcc -c -I. -I../Src -I../Src -I../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -Os -fomit-frame-pointer  -o utils.o utils.c
utils.c: In function 'getkeystring':
cc1: warning: function may return address of local variable [-Wreturn-local-addr]
utils.c:6644:16: note: declared here
 6644 |     char *buf, tmp[1];
      |                ^~~
gcc -c -I. -I../Src -I../Src -I../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -Os -fomit-frame-pointer  -o watch.o watch.c
gcc -c -I. -I../Src -I../Src -I../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -Os -fomit-frame-pointer  -o openssh_bsd_setres_id.o openssh_bsd_setres_id.c
make[3]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Builtins'
make[3]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Builtins'
make[3]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
make[3]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
make[3]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Zle'
make[3]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Zle'
make[2]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src'
Updated `stamp-modobjs'.
make[2]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src'
awk -f ../Src/makepro.awk main.c Src > main.syms
(echo '/* Generated automatically */'; sed -n '/^E/{s/^E//;p;}' < main.syms) \
	> main.epro
(echo '/* Generated automatically */'; sed -n '/^L/{s/^L//;p;}' < main.syms) \
	> `echo main.epro | sed 's/\.epro$/.pro/'`
gcc -c -I. -I../Src -Os -fomit-frame-pointer -DHAVE_CONFIG_H -Os -fomit-frame-pointer -o main.o ./main.c
make[2]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src'
make[2]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src'
make[2]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src'
rm -f zsh
gcc -Wl,--as-needed  -rdynamic -o zsh main.o  `cat stamp-modobjs`   -ldl -lncursesw -lrt -lm  -lc
make[2]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src'
make[3]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Builtins'
awk -f ./rlimits.awk /usr/include/sys/resource.h /dev/null > rlimits.h
gcc -c -I. -I../../Src -I../../Src -I../../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -DMODULE -Os -fomit-frame-pointer -fPIC -o rlimits..o rlimits.c
rm -f rlimits.so
gcc -Wl,--as-needed  -shared -o rlimits.so   rlimits..o    -ldl -lncursesw -lrt -lm  -lc 
gcc -c -I. -I../../Src -I../../Src -I../../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -DMODULE -Os -fomit-frame-pointer -fPIC -o sched..o sched.c
rm -f sched.so
gcc -Wl,--as-needed  -shared -o sched.so   sched..o    -ldl -lncursesw -lrt -lm  -lc 
make[3]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Builtins'
make[3]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
gcc -c -I. -I../../Src -I../../Src -I../../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -DMODULE -Os -fomit-frame-pointer -fPIC -o attr..o attr.c
rm -f attr.so
gcc -Wl,--as-needed  -shared -o attr.so   attr..o    -ldl -lncursesw -lrt -lm  -lc 
gcc -c -I. -I../../Src -I../../Src -I../../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -DMODULE -Os -fomit-frame-pointer -fPIC -o cap..o cap.c
rm -f cap.so
gcc -Wl,--as-needed  -shared -o cap.so   cap..o    -ldl -lncursesw -lrt -lm  -lc 
gcc -c -I. -I../../Src -I../../Src -I../../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -DMODULE -Os -fomit-frame-pointer -fPIC -o clone..o clone.c
rm -f clone.so
gcc -Wl,--as-needed  -shared -o clone.so   clone..o    -ldl -lncursesw -lrt -lm  -lc 
awk -f ./curses_keys.awk /usr/include/curses.h /dev/null >curses_keys.h
gcc -c -I. -I../../Src -I../../Src -I../../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -DMODULE -Os -fomit-frame-pointer -fPIC -o curses..o curses.c
rm -f curses.so
gcc -Wl,--as-needed  -shared -o curses.so   curses..o    -ldl -lncursesw -lrt -lm  -lc 
gcc -c -I. -I../../Src -I../../Src -I../../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -DMODULE -Os -fomit-frame-pointer -fPIC -o datetime..o datetime.c
rm -f datetime.so
gcc -Wl,--as-needed  -shared -o datetime.so   datetime..o    -ldl -lncursesw -lrt -lm  -lc 
gcc -c -I. -I../../Src -I../../Src -I../../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -DMODULE -Os -fomit-frame-pointer -fPIC -o example..o example.c
rm -f example.so
gcc -Wl,--as-needed  -shared -o example.so   example..o    -ldl -lncursesw -lrt -lm  -lc 
gcc -c -I. -I../../Src -I../../Src -I../../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -DMODULE -Os -fomit-frame-pointer -fPIC -o files..o files.c
rm -f files.so
gcc -Wl,--as-needed  -shared -o files.so   files..o    -ldl -lncursesw -lrt -lm  -lc 
gcc -c -I. -I../../Src -I../../Src -I../../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -DMODULE -Os -fomit-frame-pointer -fPIC -o langinfo..o langinfo.c
rm -f langinfo.so
gcc -Wl,--as-needed  -shared -o langinfo.so   langinfo..o    -ldl -lncursesw -lrt -lm  -lc 
gcc -c -I. -I../../Src -I../../Src -I../../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -DMODULE -Os -fomit-frame-pointer -fPIC -o mapfile..o mapfile.c
rm -f mapfile.so
gcc -Wl,--as-needed  -shared -o mapfile.so   mapfile..o    -ldl -lncursesw -lrt -lm  -lc 
gcc -c -I. -I../../Src -I../../Src -I../../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -DMODULE -Os -fomit-frame-pointer -fPIC -o mathfunc..o mathfunc.c
rm -f mathfunc.so
gcc -Wl,--as-needed  -shared -o mathfunc.so   mathfunc..o    -ldl -lncursesw -lrt -lm  -lc 
gcc -c -I. -I../../Src -I../../Src -I../../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -DMODULE -Os -fomit-frame-pointer -fPIC -o nearcolor..o nearcolor.c
rm -f nearcolor.so
gcc -Wl,--as-needed  -shared -o nearcolor.so   nearcolor..o    -ldl -lncursesw -lrt -lm  -lc 
gcc -c -I. -I../../Src -I../../Src -I../../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -DMODULE -Os -fomit-frame-pointer -fPIC -o newuser..o newuser.c
rm -f newuser.so
gcc -Wl,--as-needed  -shared -o newuser.so   newuser..o    -ldl -lncursesw -lrt -lm  -lc 
gcc -c -I. -I../../Src -I../../Src -I../../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -DMODULE -Os -fomit-frame-pointer -fPIC -o param_private..o param_private.c
rm -f param_private.so
gcc -Wl,--as-needed  -shared -o param_private.so   param_private..o    -ldl -lncursesw -lrt -lm  -lc 
gcc -c -I. -I../../Src -I../../Src -I../../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -DMODULE -Os -fomit-frame-pointer -fPIC -o parameter..o parameter.c
rm -f parameter.so
gcc -Wl,--as-needed  -shared -o parameter.so   parameter..o    -ldl -lncursesw -lrt -lm  -lc 
gcc -c -I. -I../../Src -I../../Src -I../../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -DMODULE -Os -fomit-frame-pointer -fPIC -o regex..o regex.c
rm -f regex.so
gcc -Wl,--as-needed  -shared -o regex.so   regex..o    -ldl -lncursesw -lrt -lm  -lc 
gcc -c -I. -I../../Src -I../../Src -I../../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -DMODULE -Os -fomit-frame-pointer -fPIC -o socket..o socket.c
rm -f socket.so
gcc -Wl,--as-needed  -shared -o socket.so   socket..o    -ldl -lncursesw -lrt -lm  -lc 
gcc -c -I. -I../../Src -I../../Src -I../../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -DMODULE -Os -fomit-frame-pointer -fPIC -o stat..o stat.c
rm -f stat.so
gcc -Wl,--as-needed  -shared -o stat.so   stat..o    -ldl -lncursesw -lrt -lm  -lc 
gcc -c -I. -I../../Src -I../../Src -I../../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -DMODULE -Os -fomit-frame-pointer -fPIC -o system..o system.c
gcc -c -I. -I../../Src -I../../Src -I../../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -DMODULE -Os -fomit-frame-pointer -fPIC -o errnames..o errnames.c
rm -f system.so
gcc -Wl,--as-needed  -shared -o system.so   system..o errnames..o    -ldl -lncursesw -lrt -lm  -lc 
gcc -c -I. -I../../Src -I../../Src -I../../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -DMODULE -Os -fomit-frame-pointer -fPIC -o tcp..o tcp.c
rm -f tcp.so
gcc -Wl,--as-needed  -shared -o tcp.so   tcp..o    -ldl -lncursesw -lrt -lm  -lc 
gcc -c -I. -I../../Src -I../../Src -I../../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -DMODULE -Os -fomit-frame-pointer -fPIC -o termcap..o termcap.c
rm -f termcap.so
gcc -Wl,--as-needed  -shared -o termcap.so   termcap..o    -ldl -lncursesw -lrt -lm  -lc 
gcc -c -I. -I../../Src -I../../Src -I../../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -DMODULE -Os -fomit-frame-pointer -fPIC -o terminfo..o terminfo.c
rm -f terminfo.so
gcc -Wl,--as-needed  -shared -o terminfo.so   terminfo..o    -ldl -lncursesw -lrt -lm  -lc 
gcc -c -I. -I../../Src -I../../Src -I../../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -DMODULE -Os -fomit-frame-pointer -fPIC -o zftp..o zftp.c
rm -f zftp.so
gcc -Wl,--as-needed  -shared -o zftp.so   zftp..o    -ldl -lncursesw -lrt -lm  -lc 
gcc -c -I. -I../../Src -I../../Src -I../../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -DMODULE -Os -fomit-frame-pointer -fPIC -o zprof..o zprof.c
rm -f zprof.so
gcc -Wl,--as-needed  -shared -o zprof.so   zprof..o    -ldl -lncursesw -lrt -lm  -lc 
gcc -c -I. -I../../Src -I../../Src -I../../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -DMODULE -Os -fomit-frame-pointer -fPIC -o zpty..o zpty.c
rm -f zpty.so
gcc -Wl,--as-needed  -shared -o zpty.so   zpty..o    -ldl -lncursesw -lrt -lm  -lc 
gcc -c -I. -I../../Src -I../../Src -I../../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -DMODULE -Os -fomit-frame-pointer -fPIC -o zselect..o zselect.c
rm -f zselect.so
gcc -Wl,--as-needed  -shared -o zselect.so   zselect..o    -ldl -lncursesw -lrt -lm  -lc 
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Zle'
make[4]: 'complete.mdh' is up to date.
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Zle'
gcc -c -I. -I../../Src -I../../Src -I../../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -DMODULE -Os -fomit-frame-pointer -fPIC -o zutil..o zutil.c
make[4]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Zle'
make[4]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Zle'
rm -f zutil.so
gcc -Wl,--as-needed  -shared -o zutil.so   zutil..o    -ldl -lncursesw -lrt -lm  -lc 
make[3]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Modules'
make[3]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Zle'
gcc -c -I. -I../../Src -I../../Src -I../../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -DMODULE -Os -fomit-frame-pointer -fPIC -o compctl..o compctl.c
rm -f compctl.so
gcc -Wl,--as-needed  -shared -o compctl.so   compctl..o    -ldl -lncursesw -lrt -lm  -lc 
gcc -c -I. -I../../Src -I../../Src -I../../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -DMODULE -Os -fomit-frame-pointer -fPIC -o complete..o complete.c
gcc -c -I. -I../../Src -I../../Src -I../../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -DMODULE -Os -fomit-frame-pointer -fPIC -o compcore..o compcore.c
gcc -c -I. -I../../Src -I../../Src -I../../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -DMODULE -Os -fomit-frame-pointer -fPIC -o compmatch..o compmatch.c
gcc -c -I. -I../../Src -I../../Src -I../../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -DMODULE -Os -fomit-frame-pointer -fPIC -o compresult..o compresult.c
rm -f complete.so
gcc -Wl,--as-needed  -shared -o complete.so   complete..o compcore..o compmatch..o compresult..o    -ldl -lncursesw -lrt -lm  -lc 
gcc -c -I. -I../../Src -I../../Src -I../../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -DMODULE -Os -fomit-frame-pointer -fPIC -o complist..o complist.c
rm -f complist.so
gcc -Wl,--as-needed  -shared -o complist.so   complist..o    -ldl -lncursesw -lrt -lm  -lc 
gcc -c -I. -I../../Src -I../../Src -I../../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -DMODULE -Os -fomit-frame-pointer -fPIC -o computil..o computil.c
rm -f computil.so
gcc -Wl,--as-needed  -shared -o computil.so   computil..o    -ldl -lncursesw -lrt -lm  -lc 
gcc -c -I. -I../../Src -I../../Src -I../../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -DMODULE -Os -fomit-frame-pointer -fPIC -o deltochar..o deltochar.c
rm -f deltochar.so
gcc -Wl,--as-needed  -shared -o deltochar.so   deltochar..o    -ldl -lncursesw -lrt -lm  -lc 
( \
    echo '/** widgets.list                               **/'; \
    echo '/** widget structures for the internal widgets **/'; \
    echo; \
    echo '/* format: W(ZLE_FLAGS, t_firstname, functionname) */'; \
    echo; \
    sed -e 's/#.*//; /^$/d; s/-//g' \
	-e 's/^"\(.*\)" *, *\([^ ]*\) *, *\(.*\)/W(\3, t_\1, \2)/' \
	< ./iwidgets.list; \
) > widgets.list
( \
    echo '/** zle_widget.h                                **/'; \
    echo '/** indices of and pointers to internal widgets **/'; \
    echo; \
    echo 'enum {'; \
    sed -n -f ./zle_widget.sed < widgets.list; \
    echo '    ZLE_BUILTIN_WIDGET_COUNT'; \
    echo '};'; \
) > zle_widget.h
gcc -c -I. -I../../Src -I../../Src -I../../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -DMODULE -Os -fomit-frame-pointer -fPIC -o zle_bindings..o zle_bindings.c
gcc -c -I. -I../../Src -I../../Src -I../../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -DMODULE -Os -fomit-frame-pointer -fPIC -o zle_hist..o zle_hist.c
gcc -c -I. -I../../Src -I../../Src -I../../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -DMODULE -Os -fomit-frame-pointer -fPIC -o zle_keymap..o zle_keymap.c
gcc -c -I. -I../../Src -I../../Src -I../../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -DMODULE -Os -fomit-frame-pointer -fPIC -o zle_main..o zle_main.c
gcc -c -I. -I../../Src -I../../Src -I../../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -DMODULE -Os -fomit-frame-pointer -fPIC -o zle_misc..o zle_misc.c
gcc -c -I. -I../../Src -I../../Src -I../../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -DMODULE -Os -fomit-frame-pointer -fPIC -o zle_move..o zle_move.c
gcc -c -I. -I../../Src -I../../Src -I../../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -DMODULE -Os -fomit-frame-pointer -fPIC -o zle_params..o zle_params.c
gcc -c -I. -I../../Src -I../../Src -I../../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -DMODULE -Os -fomit-frame-pointer -fPIC -o zle_refresh..o zle_refresh.c
gcc -c -I. -I../../Src -I../../Src -I../../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -DMODULE -Os -fomit-frame-pointer -fPIC -o zle_thingy..o zle_thingy.c
gcc -c -I. -I../../Src -I../../Src -I../../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -DMODULE -Os -fomit-frame-pointer -fPIC -o zle_tricky..o zle_tricky.c
gcc -c -I. -I../../Src -I../../Src -I../../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -DMODULE -Os -fomit-frame-pointer -fPIC -o zle_utils..o zle_utils.c
gcc -c -I. -I../../Src -I../../Src -I../../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -DMODULE -Os -fomit-frame-pointer -fPIC -o zle_vi..o zle_vi.c
gcc -c -I. -I../../Src -I../../Src -I../../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -DMODULE -Os -fomit-frame-pointer -fPIC -o zle_word..o zle_word.c
gcc -c -I. -I../../Src -I../../Src -I../../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -DMODULE -Os -fomit-frame-pointer -fPIC -o textobjects..o textobjects.c
rm -f zle.so
gcc -Wl,--as-needed  -shared -o zle.so   zle_bindings..o zle_hist..o zle_keymap..o zle_main..o zle_misc..o zle_move..o zle_params..o zle_refresh..o zle_thingy..o zle_tricky..o zle_utils..o zle_vi..o zle_word..o textobjects..o    -ldl -lncursesw -lrt -lm  -lc 
gcc -c -I. -I../../Src -I../../Src -I../../Src/Zle -I. -Os -fomit-frame-pointer -DHAVE_CONFIG_H -DMODULE -Os -fomit-frame-pointer -fPIC -o zleparameter..o zleparameter.c
rm -f zleparameter.so
gcc -Wl,--as-needed  -shared -o zleparameter.so   zleparameter..o    -ldl -lncursesw -lrt -lm  -lc 
make[3]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src/Zle'
make[2]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src'
make[1]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Src'
make[1]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Doc'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Doc'
cd Test ; make check
make[1]: Entering directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Test'
if test -n "gcc"; then \
  cd .. && DESTDIR= \
  make MODDIR=`pwd`/Test/Modules install.modules > /dev/null; \
fi
if test -z "$ZTST_handler"; then \
  ZTST_handler=runtests.zsh; \
fi; \
if ZTST_testlist="`for f in ./*.ztst; \
           do echo $f; done`" \
 ZTST_srcdir="." \
 ZTST_exe=../Src/zsh \
 ../Src/zsh +Z -f ./$ZTST_handler; then \
 stat=0; \
else \
 stat=1; \
fi; \
sleep 1; \
rm -rf Modules .zcompdump; \
exit $stat
./A02alias.ztst: starting.
This test hangs the shell when it fails...
./A02alias.ztst: all tests successful.
./A03quoting.ztst: starting.
--- /tmp/zsh.ztst.7165/ztst.out	2021-04-14 19:25:19.195321984 +0000
+++ /tmp/zsh.ztst.7165/ztst.tout	2021-04-14 19:25:19.198655320 +0000
@@ -4,4 +4,4 @@
 16#4D
 16#42
 16#53
-16#DC
+16#DFDC
Test ./A03quoting.ztst failed: output differs from expected as shown above for:
  chars=$(print -r $'BS\\MBS\M-\\')
  for (( i = 1; i <= $#chars; i++ )); do
    char=$chars[$i]
    print $(( [#16] #char ))
  done
Was testing: $'-style quote with metafied backslash
./A03quoting.ztst: test failed.
./A04redirect.ztst: starting.
./A04redirect.ztst: all tests successful.
./A05execution.ztst: starting.
Unable to change MONITOR option
This test takes 5 seconds to fail...
Skipping pipe leak test, requires MONITOR option
This test takes 3 seconds and hangs the shell when it fails...
./A05execution.ztst: all tests successful.
./A06assign.ztst: starting.
./A06assign.ztst: all tests successful.
./A07control.ztst: starting.
./A07control.ztst: all tests successful.
./B01cd.ztst: starting.
./B01cd.ztst: all tests successful.
./B02typeset.ztst: starting.
./B02typeset.ztst: all tests successful.
./B03print.ztst: starting.
--- /tmp/zsh.ztst.14907/ztst.out	2021-04-14 19:25:30.405330894 +0000
+++ /tmp/zsh.ztst.14907/ztst.tout	2021-04-14 19:25:30.405330894 +0000
@@ -1 +1 @@
-f0
+dff0
Test ./B03print.ztst failed: output differs from expected as shown above for:
 printf '%x\n' $(printf '"\xf0')
Was testing: numeric value of high numbered character
./B03print.ztst: test failed.
./B04read.ztst: starting.
./B04read.ztst: all tests successful.
./B05eval.ztst: starting.
./B05eval.ztst: all tests successful.
./B06fc.ztst: starting.
./B06fc.ztst: all tests successful.
./B07emulate.ztst: starting.
./B07emulate.ztst: all tests successful.
./B08shift.ztst: starting.
./B08shift.ztst: all tests successful.
./B09hash.ztst: starting.
./B09hash.ztst: all tests successful.
./B10getopts.ztst: starting.
./B10getopts.ztst: all tests successful.
./C01arith.ztst: starting.
./C01arith.ztst: all tests successful.
./C02cond.ztst: starting.
Warning: Not testing [[ -b blockdevice ]] (no devices found)
Warning: Not testing [[ -f blockdevice ]] (no devices found)
This test takes two seconds...
./C02cond.ztst: all tests successful.
./C03traps.ztst: starting.
This test takes at least three seconds...
This test, too, takes at least three seconds...
Another test that takes three seconds
./C03traps.ztst: all tests successful.
./C04funcdef.ztst: starting.
./C04funcdef.ztst: all tests successful.
./C05debug.ztst: starting.
./C05debug.ztst: all tests successful.
./D01prompt.ztst: starting.
./D01prompt.ztst: all tests successful.
./D02glob.ztst: starting.
./D02glob.ztst: all tests successful.
./D03procsubst.ztst: starting.
./D03procsubst.ztst: all tests successful.
./D04parameter.ztst: starting.
./D04parameter.ztst: all tests successful.
./D05array.ztst: starting.
./D05array.ztst: all tests successful.
./D06subscript.ztst: starting.
./D06subscript.ztst: all tests successful.
./D07multibyte.ztst: starting.
Testing multibyte with locale en_US.UTF-8
./D07multibyte.ztst: all tests successful.
./D08cmdsubst.ztst: starting.
./D08cmdsubst.ztst: all tests successful.
./D09brace.ztst: starting.
./D09brace.ztst: all tests successful.
./E01options.ztst: starting.
This test hangs the shell when it fails...
./E01options.ztst: all tests successful.
./E02xtrace.ztst: starting.
./E02xtrace.ztst: all tests successful.
./P01privileged.ztst: starting.
./P01privileged.ztst: skipped (PRIVILEGED tests require super-user privileges (or env var))
./V01zmodload.ztst: starting.
./V01zmodload.ztst: all tests successful.
./V02zregexparse.ztst: starting.
./V02zregexparse.ztst: all tests successful.
./V03mathfunc.ztst: starting.
./V03mathfunc.ztst: all tests successful.
./V04features.ztst: starting.
./V04features.ztst: all tests successful.
./V05styles.ztst: starting.
./V05styles.ztst: all tests successful.
./V06parameter.ztst: starting.
./V06parameter.ztst: all tests successful.
./V07pcre.ztst: starting.
./V07pcre.ztst: skipped (the zsh/pcre module was disabled by configure (see config.modules))
./V08zpty.ztst: starting.
./V08zpty.ztst: all tests successful.
./V10private.ztst: starting.
./V10private.ztst: all tests successful.
./V11db_gdbm.ztst: starting.
./V11db_gdbm.ztst: skipped (can't load zsh/db/gdbm module for testing)
./V12zparseopts.ztst: starting.
./V12zparseopts.ztst: all tests successful.
./W01history.ztst: starting.
./W01history.ztst: all tests successful.
./W02jobs.ztst: starting.
./W02jobs.ztst: all tests successful.
./X02zlevi.ztst: starting.
This test may hang the shell when it fails...
./X02zlevi.ztst: all tests successful.
./X03zlebindkey.ztst: starting.
./X03zlebindkey.ztst: all tests successful.
./X04zlehighlight.ztst: starting.
./X04zlehighlight.ztst: all tests successful.
./Y01completion.ztst: starting.
./Y01completion.ztst: all tests successful.
./Y02compmatch.ztst: starting.
./Y02compmatch.ztst: all tests successful.
./Y03arguments.ztst: starting.
./Y03arguments.ztst: all tests successful.
**************************************
47 successful test scripts, 2 failures, 3 skipped
**************************************
make[1]: *** [Makefile:190: check] Error 1
make[1]: Leaving directory '/home/buildozer/aports/main/zsh/src/zsh-5.8/Test'
make: *** [Makefile:263: test] Error 2
>>> ERROR: zsh: check failed
>>> zsh: Uninstalling dependencies...
(1/3) Purging .makedepends-zsh (20210414.192326)
(2/3) Purging ncurses-dev (6.2_p20210403-r0)
(3/3) Purging diffutils (3.7-r0)
Executing busybox-1.33.0-r6.trigger
OK: 340 MiB in 93 packages

^ permalink raw reply	[relevance 1%]

* Re: [PATCH] Document imperfections in POSIX/sh compatibility
  2021-04-14 12:38  5%       ` Daniel Shahaf
@ 2021-04-18  4:50  5%         ` dana
  2021-04-20 21:26  5%           ` Daniel Shahaf
  0 siblings, 1 reply; 200+ results
From: dana @ 2021-04-18  4:50 UTC (permalink / raw)
  To: Daniel Shahaf; +Cc: Zsh hackers list

On 14 Apr 2021, at 07:38, Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
> s/where/when/ ?

I guess so

On 14 Apr 2021, at 07:38, Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
> s/chapter/Chapter/.

I'd specifically checked to see if there was a preference here and found that
the FAQ itself uses lower-case. Should i go against that?

On 14 Apr 2021, at 07:38, Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
> There is some relevant information in §3 as well, specifically, in 3.31
> "Why does my bash script report an error when I run it under zsh?".
> However, that question hasn't been published yet, so perhaps we should
> just move it to §2.

Looking at the contents of the two chapters, it does seem like moving it might
make sense. I can do that

On 14 Apr 2021, at 07:38, Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
> The space in "Chapter 2" should be a non-breaking one.  An nbsp() macro
> was added to yodl in 4.02.00, which is the version I have, but when I
> try to use it (without worrying about compatibility to older versions,
> for the sake of testing), I just get «expn.yo:36: No macro: nbsp(...)».

So what would you suggest? I only have yodl 3.05, and i can't find any
instances of 'nbsp' or '00a0' or $'\u00a0' in Doc/ or Etc/ to use as
precedent. Should i just use a literal nbsp?

On 14 Apr 2021, at 07:38, Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
> s/http/https/

I also based that on existing precedent. Maybe i should do another patch to
find-and-replace them throughout the docs

dana



^ permalink raw reply	[relevance 5%]

* Re: [BUG] getopts OPTIND
  2021-04-14 13:08  0%     ` Daniel Shahaf
@ 2021-04-18  5:16  4%       ` dana
  0 siblings, 0 replies; 200+ results
From: dana @ 2021-04-18  5:16 UTC (permalink / raw)
  To: Daniel Shahaf; +Cc: Zsh hackers list, franciscodezuviria

On 14 Apr 2021, at 08:08, Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
> Should the descriptions of OPTIND and/or POSIX_BUILTINS in the manual be
> extended as well?

The latter, yes; done that. The former, idk, it doesn't currently mention
anything about how it's calculated or about POSIX_BUILTINS effects so i'm
inclined to leave it alone

On 14 Apr 2021, at 08:08, Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
> Some more cases to test:
> .
>       t 0
>       t 1 foo
>       t 1 -- foo
>       t 1 -b
> .
> where -b doesn't take an argument.

`t 0` doesn't test anything, the loop is just skipped. `t 1 -b` tests the same
thing as `t 1 -w`, but i guess it's confusing that i picked -a -w -e -r as the
options; i've changed them to -a -b -c -d. I've also added the two foo ones
you suggested, as well as just `t 1`. (All three behaved the same as other
shells already)

dana


diff --git a/Doc/Zsh/builtins.yo b/Doc/Zsh/builtins.yo
index a7afe42cf..4b9778e40 100644
--- a/Doc/Zsh/builtins.yo
+++ b/Doc/Zsh/builtins.yo
@@ -982,7 +982,8 @@ vindex(OPTARG, use of)
 The first option to be examined may be changed by explicitly assigning
 to tt(OPTIND).  tt(OPTIND) has an initial value of tt(1), and is
 normally set to tt(1) upon entry to a shell function and restored
-upon exit (this is disabled by the tt(POSIX_BUILTINS) option).  tt(OPTARG)
+upon exit.  (The tt(POSIX_BUILTINS) option disables this, and also changes
+the way the value is calculated to match other shells).  tt(OPTARG)
 is not reset and retains its value from the most recent call to
 tt(getopts).  If either of tt(OPTIND) or tt(OPTARG) is explicitly
 unset, it remains unset, and the index or option argument is not
diff --git a/Doc/Zsh/options.yo b/Doc/Zsh/options.yo
index 714e8a1a1..ffe2d1a0d 100644
--- a/Doc/Zsh/options.yo
+++ b/Doc/Zsh/options.yo
@@ -2239,7 +2239,8 @@ command found in the path.
 
 Furthermore, the tt(getopts) builtin behaves in a POSIX-compatible
 fashion in that the associated variable tt(OPTIND) is not made
-local to functions.
+local to functions, and its value is calculated differently to match
+other shells.
 
 Moreover, the warning and special exit code from
 tt([[ -o )var(non_existent_option)tt( ]]) are suppressed.
diff --git a/Src/builtin.c b/Src/builtin.c
index 26335a2e8..13dfdf8be 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -5556,6 +5556,11 @@ bin_getopts(UNUSED(char *name), char **argv, UNUSED(Options ops), UNUSED(int fun
     /* check for legality */
     if(opch == ':' || !(p = memchr(optstr, opch, lenoptstr))) {
 	p = "?";
+	/* Keep OPTIND correct if the user doesn't return after the error */
+	if (isset(POSIXBUILTINS)) {
+	    optcind = 0;
+	    zoptind++;
+	}
 	zsfree(zoptarg);
 	setsparam(var, ztrdup(p));
 	if(quiet) {
@@ -5572,6 +5577,11 @@ bin_getopts(UNUSED(char *name), char **argv, UNUSED(Options ops), UNUSED(int fun
     if(p[1] == ':') {
 	if(optcind == lenstr) {
 	    if(!args[zoptind]) {
+		/* Fix OPTIND as above */
+		if (isset(POSIXBUILTINS)) {
+		    optcind = 0;
+		    zoptind++;
+		}
 		zsfree(zoptarg);
 		if(quiet) {
 		    setsparam(var, ztrdup(":"));
diff --git a/Test/B10getopts.ztst b/Test/B10getopts.ztst
index 72c9e209e..e50d177c7 100644
--- a/Test/B10getopts.ztst
+++ b/Test/B10getopts.ztst
@@ -96,3 +96,32 @@
   done
 0:missing option-argument (quiet mode)
 >:,x
+
+  # This function is written so it can be easily referenced against other shells
+  t() {
+    local o i=0 n=$1
+    shift
+    while [ $i -lt $n ]; do
+      i=$(( i + 1 ))
+      getopts a: o "$@" 2> /dev/null
+    done
+    printf '<%d>' "$OPTIND"
+  }
+  # Try all these the native way, then the POSIX_BUILTINS way
+  for 1 in no_posix_builtins posix_builtins; do (
+    setopt $1
+    print -rn - "$1: "
+    t 1
+    t 1 foo
+    t 1 -- foo
+    t 1 -a
+    t 1 -b
+    t 2 -a -b
+    t 4 -a -b -c -d -a
+    t 5 -a -b -c -a -b -c
+    t 5 -a -b -c -d -ax -a
+    print
+  ); done
+0:OPTIND calculation with and without POSIX_BUILTINS (workers/42248)
+>no_posix_builtins: <1><1><2><1><1><3><5><7><6>
+>posix_builtins: <1><1><2><2><2><3><6><7><7>



^ permalink raw reply	[relevance 4%]

* Re: [PATCH] Document imperfections in POSIX/sh compatibility
  2021-04-18  4:50  5%         ` dana
@ 2021-04-20 21:26  5%           ` Daniel Shahaf
  2021-05-03 23:42  5%             ` dana
  0 siblings, 1 reply; 200+ results
From: Daniel Shahaf @ 2021-04-20 21:26 UTC (permalink / raw)
  To: dana; +Cc: Zsh hackers list

dana wrote on Sat, Apr 17, 2021 at 23:50:11 -0500:
> On 14 Apr 2021, at 07:38, Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
> > s/where/when/ ?
> 
> I guess so
> 
> On 14 Apr 2021, at 07:38, Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
> > s/chapter/Chapter/.
> 
> I'd specifically checked to see if there was a preference here and found that
> the FAQ itself uses lower-case. Should i go against that?

No; consistency comes first.

> On 14 Apr 2021, at 07:38, Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
> > There is some relevant information in §3 as well, specifically, in 3.31
> > "Why does my bash script report an error when I run it under zsh?".
> > However, that question hasn't been published yet, so perhaps we should
> > just move it to §2.
> 
> Looking at the contents of the two chapters, it does seem like moving it might
> make sense. I can do that

That'd be great.

> On 14 Apr 2021, at 07:38, Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
> > The space in "Chapter 2" should be a non-breaking one.  An nbsp() macro
> > was added to yodl in 4.02.00, which is the version I have, but when I
> > try to use it (without worrying about compatibility to older versions,
> > for the sake of testing), I just get «expn.yo:36: No macro: nbsp(...)».
> 
> So what would you suggest? I only have yodl 3.05, and i can't find any
> instances of 'nbsp' or '00a0' or $'\u00a0' in Doc/ or Etc/ to use as
> precedent. Should i just use a literal nbsp?

I suppose we could try that and see if someone complains it breaks their
build.  (Feel free to blame me ;-))  Or we could just put a literal
space (plus or minus a «COMMENT(TODO: )»).

> On 14 Apr 2021, at 07:38, Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
> > s/http/https/
> 
> I also based that on existing precedent. Maybe i should do another patch to
> find-and-replace them throughout the docs

*nod*

Thanks, dana.

Daniel


^ permalink raw reply	[relevance 5%]

* Re: [PATCH] TYPESET_TO_UNSET + misc.
  @ 2021-04-21 22:07  3%         ` Bart Schaefer
  0 siblings, 0 replies; 200+ results
From: Bart Schaefer @ 2021-04-21 22:07 UTC (permalink / raw)
  To: Daniel Shahaf; +Cc: Zsh hackers list

On Wed, Apr 21, 2021 at 2:37 PM Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
>
> Bart Schaefer wrote on Tue, Apr 20, 2021 at 17:06:10 -0700:
> > Is it worth attempting to explain [...]
>
> I suppose this is somewhat implied by the fact that there's no «typeset»
> syntax to create an unset variable when no_typesettounset is in effect?

Even if there were such syntax, it'd be questionable whether "typeset
-p" should employ it, because that would increase the bash/ksh
dissonance and could not be used with "readonly" or "export" in the
case where POSIX_BUILTINS is set.

Come to think of it, separating this from POSIX_BUILTINS as I did, may
have already reduced (or rather, failed to improve) POSIX
compatibility for those two commands.


^ permalink raw reply	[relevance 3%]

* Re: sh emulation POSIX non-conformances (printf %10s and bytes vs character)
  2021-04-11 19:42 10%         ` sh emulation POSIX non-conformances (printf %10s and bytes vs character) Stephane Chazelas
  2021-04-13 15:57  5%           ` Daniel Shahaf
@ 2021-04-22 13:59  5%           ` Vincent Lefevre
  2021-04-22 14:28  8%             ` Vincent Lefevre
  2021-04-22 19:22  5%             ` Bart Schaefer
  1 sibling, 2 replies; 200+ results
From: Vincent Lefevre @ 2021-04-22 13:59 UTC (permalink / raw)
  To: zsh-workers

On 2021-04-11 20:42:05 +0100, Stephane Chazelas wrote:
> 2021-04-11 18:57:26 +0100, Stephane Chazelas:
> > Some non-POSIX conformances I can think of ATM:
> [...]
> 
> Another POSIX bug fixed by zsh (but which makes it non-compliant):
> 
> With multibyte characters:
> 
> $ printf '|%10s|\n' Stéphane Chazelas
> |  Stéphane|
> |  Chazelas|
> 
> POSIX requires:
> 
> | Stéphane|
> |  Chazelas|

I would think that's intentional, at least for the precision
(e.g. %.4s) in order to prevent buffer overflow.

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


^ permalink raw reply	[relevance 5%]

* Re: sh emulation POSIX non-conformances (printf %10s and bytes vs character)
  2021-04-22 13:59  5%           ` Vincent Lefevre
@ 2021-04-22 14:28  8%             ` Vincent Lefevre
  2021-04-22 19:22  5%             ` Bart Schaefer
  1 sibling, 0 replies; 200+ results
From: Vincent Lefevre @ 2021-04-22 14:28 UTC (permalink / raw)
  To: zsh-workers

On 2021-04-22 15:59:34 +0200, Vincent Lefevre wrote:
> I would think that's intentional, at least for the precision
> (e.g. %.4s) in order to prevent buffer overflow.

The behavior with incomplete UTF-8 sequences (the one with "\x84\x9d")
is rather ugly:

zira% printf "%3s\n" $(printf "\xe2\x84\x9d") | hd
00000000  20 20 e2 84 9d 0a                                 |  ....|
00000006
zira% printf "%3s\n" $(printf "\x84\x9d") | hd
00000000  20 84 9d 0a                                       | ...|
00000004

zira% printf "%.1s\n" $(printf "\xe2\x84\x9d") | hd
00000000  e2 84 9d 0a                                       |....|
00000004
zira% printf "%.1s\n" $(printf "\x84\x9d") | hd 
00000000  84 9d 0a                                          |...|
00000003

I think that only the POSIX spec makes sense, unless you consider
that %s must handle valid characters, in which case it should fail
with an error on any invalid sequence. But I would say that a
different conversion specifier should be used, as an extension.

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


^ permalink raw reply	[relevance 8%]

* Re: sh emulation POSIX non-conformances (no word splitting upon arithmetic expansion)
  2021-04-11 19:18 10%         ` sh emulation POSIX non-conformances (no word splitting upon arithmetic expansion) Stephane Chazelas
@ 2021-04-22 15:03  5%           ` Vincent Lefevre
  2021-04-22 18:27  5%             ` Bart Schaefer
  0 siblings, 1 reply; 200+ results
From: Vincent Lefevre @ 2021-04-22 15:03 UTC (permalink / raw)
  To: zsh-workers

On 2021-04-11 20:18:05 +0100, Stephane Chazelas wrote:
> 2021-04-11 18:57:26 +0100, Stephane Chazelas:
> > Some non-POSIX conformances I can think of ATM:
> [...]
> 
> Another one:
> 
> $ zsh --emulate sh -c 'IFS=2; printf "<%s>\n" $((11*11))'
> <121>
> 
> While POSIX (beleive it or not) requires:
> 
> <1>
> <1>
> 
> Again, that's one of the cases where many shells (most ash-based ones,
> pdksh, yash at least) behaved like zsh but switched for POSIX
> compliance (even though that hardly makes sense).

I disagree. I think that the fact that $((11*11)) behaves in
a way similar to parameter expansion makes more sense and is
less surprising:

$ sh -c 'foo=121; IFS=2; echo $foo $((11*11))'
1 1 1 1
$ zsh --emulate sh -c 'foo=121; IFS=2; echo $foo $((11*11))'
1 1 121
$ 

If something hardly makes sense, this is "IFS=2".

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


^ permalink raw reply	[relevance 5%]

* Re: sh emulation POSIX non-conformances ("inf"/"Inf" in arithmetic expressions)
  2021-04-13  7:17  9%             ` Stephane Chazelas
@ 2021-04-22 15:31  5%               ` Vincent Lefevre
  2021-04-22 18:55  5%                 ` Bart Schaefer
  0 siblings, 1 reply; 200+ results
From: Vincent Lefevre @ 2021-04-22 15:31 UTC (permalink / raw)
  To: zsh-workers; +Cc: Bart Schaefer

On 2021-04-13 08:17:42 +0100, Stephane Chazelas wrote:
> 2021-04-12 13:41:58 -0700, Bart Schaefer:
> > On Sun, Apr 11, 2021 at 12:32 PM Stephane Chazelas
> > <stephane@chazelas.org> wrote:
> > >
> > > $ zsh --emulate sh -c 'inf=42; echo $((inf))'
> > > Inf
> > >
> > > (POSIX requires 42 there).
> > 
> > Is that because "Inf" is case-sensitive, or because POSIX requires
> > evaluating the variable?  E.g. what does
> 
> That was because "inf" in an arithmetic expression, where inf is
> the name of a variable whose contents is an integer constant
> (decimal, octal or hex) is meant to represent the corresponding
> integer number (and an empty or unset variable is meant to yield
> 0)..

I think that it would have been better if zsh chose something that
does not correspond to the name of a variable, e.g. @Inf@ and @NaN@
(this is what MPFR does, so that it cannot be confused with numbers
in large bases, where letters are used as digits).

> I think it would be worth documenting that nan and inf are
> recognised in arithmetic expressions (and warn against using
> variables with the same name).

IMHO, zsh should also output a warning when such variables are used.

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


^ permalink raw reply	[relevance 5%]

* Re: sh emulation POSIX non-conformances (no word splitting upon arithmetic expansion)
  2021-04-22 15:03  5%           ` Vincent Lefevre
@ 2021-04-22 18:27  5%             ` Bart Schaefer
  0 siblings, 0 replies; 200+ results
From: Bart Schaefer @ 2021-04-22 18:27 UTC (permalink / raw)
  To: Zsh hackers list

On Thu, Apr 22, 2021 at 8:04 AM Vincent Lefevre <vincent@vinc17.net> wrote:
>
> I disagree. I think that the fact that $((11*11)) behaves in
> a way similar to parameter expansion makes more sense

I think it would make the most sense if number results were never
field-split, but given this ...

% integer x=121
% IFS=2 emulate sh -c 'print $[11*11]'
121
% IFS=2 emulate sh -c 'print $x'
1 1

... I think applying splitting to math expansions is probably the
right thing (to do at some point).


^ permalink raw reply	[relevance 5%]

* Re: sh emulation POSIX non-conformances ("inf"/"Inf" in arithmetic expressions)
  2021-04-22 15:31  5%               ` Vincent Lefevre
@ 2021-04-22 18:55  5%                 ` Bart Schaefer
  2021-04-22 20:45  5%                   ` Daniel Shahaf
  2021-04-23 16:45  5%                   ` Vincent Lefevre
  0 siblings, 2 replies; 200+ results
From: Bart Schaefer @ 2021-04-22 18:55 UTC (permalink / raw)
  To: Zsh hackers list

On Thu, Apr 22, 2021 at 8:31 AM Vincent Lefevre <vincent@vinc17.net> wrote:
>
> On 2021-04-13 08:17:42 +0100, Stephane Chazelas wrote:
> > I think it would be worth documenting that nan and inf are
> > recognised in arithmetic expressions (and warn against using
> > variables with the same name).
>
> IMHO, zsh should also output a warning when such variables are used.

Exactly how would that work?

Warning anytime the names "inf" or "nan" (and case variants) get
values assigned to them seems like overkill.

If they appear as $inf or $nan then there's no conflict.  Still warn?

If "inf" and "nan" appear in math context as the bare strings they're
currently taken as constants.  Always make a (usually
wasted/fruitless) check to see whether there happens to be a variable
of the same name and emit a "watch out, not used" message?


^ permalink raw reply	[relevance 5%]

* Re: sh emulation POSIX non-conformances (printf %10s and bytes vs character)
  2021-04-22 13:59  5%           ` Vincent Lefevre
  2021-04-22 14:28  8%             ` Vincent Lefevre
@ 2021-04-22 19:22  5%             ` Bart Schaefer
  2021-04-23 16:53  5%               ` Vincent Lefevre
  1 sibling, 1 reply; 200+ results
From: Bart Schaefer @ 2021-04-22 19:22 UTC (permalink / raw)
  To: Zsh hackers list

On Thu, Apr 22, 2021 at 7:01 AM Vincent Lefevre <vincent@vinc17.net> wrote:
>
> > POSIX requires:
> >
> > | Stéphane|
> > |  Chazelas|
>
> I would think that's intentional, at least for the precision
> (e.g. %.4s) in order to prevent buffer overflow.

That makes sense for C-ish languages, but I would think it was a bad
idea in general for the shell to allocate buffer sizes based on user
input.

Someone can probably point to the rationale document, but I'm guessing
this is really because of equivalence with sprintf() formats.


^ permalink raw reply	[relevance 5%]

* Re: sh emulation POSIX non-conformances ("inf"/"Inf" in arithmetic expressions)
  2021-04-22 18:55  5%                 ` Bart Schaefer
@ 2021-04-22 20:45  5%                   ` Daniel Shahaf
  2021-04-22 21:25  8%                     ` Bart Schaefer
  2021-04-23 16:45  5%                   ` Vincent Lefevre
  1 sibling, 1 reply; 200+ results
From: Daniel Shahaf @ 2021-04-22 20:45 UTC (permalink / raw)
  To: zsh-workers

Bart Schaefer wrote on Thu, Apr 22, 2021 at 11:55:25 -0700:
> On Thu, Apr 22, 2021 at 8:31 AM Vincent Lefevre <vincent@vinc17.net> wrote:
> >
> > On 2021-04-13 08:17:42 +0100, Stephane Chazelas wrote:
> > > I think it would be worth documenting that nan and inf are
> > > recognised in arithmetic expressions (and warn against using
> > > variables with the same name).
> >
> > IMHO, zsh should also output a warning when such variables are used.
> 
> Exactly how would that work?
> 
> Warning anytime the names "inf" or "nan" (and case variants) get
> values assigned to them seems like overkill.
> 

Warn only when the variable is created, e.g., upon «typeset -F inf» or
«(( nan = 3.14 ))», but not subsequent assignments?

> If they appear as $inf or $nan then there's no conflict.  Still warn?

No, I guess?  No one expects «$42» and «42» to mean the same thing, nor
«$0.0» and «0.0».

> If "inf" and "nan" appear in math context as the bare strings they're
> currently taken as constants.  Always make a (usually
> wasted/fruitless) check to see whether there happens to be a variable
> of the same name and emit a "watch out, not used" message?

No; optimize for the common case that $inf and $nan don't exist.
Warning upon creation of those suffices.

>

Predefine $inf and $nan as readonly float variables initialized to the
respective values?  (Not saying this is a good idea; just mentioning it
for completeness)

Cheers,

Daniel


^ permalink raw reply	[relevance 5%]

* Re: sh emulation POSIX non-conformances ("inf"/"Inf" in arithmetic expressions)
  2021-04-22 20:45  5%                   ` Daniel Shahaf
@ 2021-04-22 21:25  8%                     ` Bart Schaefer
  0 siblings, 0 replies; 200+ results
From: Bart Schaefer @ 2021-04-22 21:25 UTC (permalink / raw)
  To: Zsh hackers list

On Thu, Apr 22, 2021 at 1:46 PM Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
>
> Warn only when the variable is created, e.g., upon «typeset -F inf» or
> «(( nan = 3.14 ))», but not subsequent assignments?

The latter is already an error.  The former warns spuriously if the
user has no intention of ever mentioning the variable in math context
(or of ever using math at all).  And the problem exists in math
context whether or not the variable is declared to be of a numeric
type.

> Predefine $inf and $nan as readonly float variables initialized to the
> respective values?  (Not saying this is a good idea; just mentioning it
> for completeness)

The constants are case-insensitive, so we'd have to predefine twelve
names.  And we couldn't do this in POSIX (sh) context, which sort of
defeats the purpose.

I'm waiting for Vincent to tell us when/where he thinks the warning
should come from, but I don't think there's any sensible place for it.

The only good solution would have been to pick
otherwise-syntactically-impossible tokens in the first place (as
Vincent also mentioned), but it may be too late.


^ permalink raw reply	[relevance 8%]

* Re: sh emulation POSIX non-conformances ("inf"/"Inf" in arithmetic expressions)
  2021-04-22 18:55  5%                 ` Bart Schaefer
  2021-04-22 20:45  5%                   ` Daniel Shahaf
@ 2021-04-23 16:45  5%                   ` Vincent Lefevre
  2021-04-23 20:31  4%                     ` Bart Schaefer
  1 sibling, 1 reply; 200+ results
From: Vincent Lefevre @ 2021-04-23 16:45 UTC (permalink / raw)
  To: zsh-workers

On 2021-04-22 11:55:25 -0700, Bart Schaefer wrote:
> On Thu, Apr 22, 2021 at 8:31 AM Vincent Lefevre <vincent@vinc17.net> wrote:
> >
> > On 2021-04-13 08:17:42 +0100, Stephane Chazelas wrote:
> > > I think it would be worth documenting that nan and inf are
> > > recognised in arithmetic expressions (and warn against using
> > > variables with the same name).
> >
> > IMHO, zsh should also output a warning when such variables are used.
> 
> Exactly how would that work?

When inf or nan is used in a math context and the corresponding
variable exists. For instance:

zira% echo $((inf))
Inf
zira% inf=17
zira% echo $((inf))
Inf

There should be a warning for the 3rd command.

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


^ permalink raw reply	[relevance 5%]

* Re: sh emulation POSIX non-conformances (printf %10s and bytes vs character)
  2021-04-22 19:22  5%             ` Bart Schaefer
@ 2021-04-23 16:53  5%               ` Vincent Lefevre
  2021-04-23 23:01  9%                 ` Oliver Kiddle
  2021-04-24  7:09  9%                 ` Stephane Chazelas
  0 siblings, 2 replies; 200+ results
From: Vincent Lefevre @ 2021-04-23 16:53 UTC (permalink / raw)
  To: zsh-workers

On 2021-04-22 12:22:12 -0700, Bart Schaefer wrote:
> On Thu, Apr 22, 2021 at 7:01 AM Vincent Lefevre <vincent@vinc17.net> wrote:
> >
> > > POSIX requires:
> > >
> > > | Stéphane|
> > > |  Chazelas|
> >
> > I would think that's intentional, at least for the precision
> > (e.g. %.4s) in order to prevent buffer overflow.
> 
> That makes sense for C-ish languages, but I would think it was a bad
> idea in general for the shell to allocate buffer sizes based on user
> input.
> 
> Someone can probably point to the rationale document, but I'm guessing
> this is really because of equivalence with sprintf() formats.

Some file formats have fields with a byte-size limit. Providing
more than this limit could have unexpected effects. One may also
want to limit the size of generated filenames (see NAME_MAX).

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


^ permalink raw reply	[relevance 5%]

* Re: sh emulation POSIX non-conformances ("inf"/"Inf" in arithmetic expressions)
  2021-04-23 16:45  5%                   ` Vincent Lefevre
@ 2021-04-23 20:31  4%                     ` Bart Schaefer
  2021-04-23 22:46  9%                       ` Oliver Kiddle
  0 siblings, 1 reply; 200+ results
From: Bart Schaefer @ 2021-04-23 20:31 UTC (permalink / raw)
  To: Zsh hackers list

On Fri, Apr 23, 2021 at 9:46 AM Vincent Lefevre <vincent@vinc17.net> wrote:
>
> On 2021-04-22 11:55:25 -0700, Bart Schaefer wrote:
> > On Thu, Apr 22, 2021 at 8:31 AM Vincent Lefevre <vincent@vinc17.net> wrote:
> > >
> > > IMHO, zsh should also output a warning when such variables are used.
> >
> > Exactly how would that work?
>
> When inf or nan is used in a math context and the corresponding
> variable exists.

So, it's the "expend effort on a check that is nearly always going to
fail" option.

Not advocating for the below patch, just providing for reference.
gmail may have munged tabs causing indentation to look funny.

diff --git a/Src/math.c b/Src/math.c
index 1d0d86639..50c34416d 100644
--- a/Src/math.c
+++ b/Src/math.c
@@ -865,12 +865,22 @@ zzlex(void)
         ptr = ie;
         if (ie - p == 3) {
             if (strncasecmp(p, "NaN", 3) == 0) {
+                char iec = *ie; *ie = 0;
+            if (issetvar(p)) {
+                zwarn("%s: using constant NaN", p);
+            }
+            *ie = iec;
             yyval.type = MN_FLOAT;
             yyval.u.d = 0.0;
             yyval.u.d /= yyval.u.d;
             return NUM;
             }
             else if (strncasecmp(p, "Inf", 3) == 0) {
+                char iec = *ie; *ie = 0;
+            if (issetvar(p)) {
+                zwarn("%s: using constant Inf", p);
+            }
+            *ie = iec;
             yyval.type = MN_FLOAT;
             yyval.u.d = 0.0;
             yyval.u.d = 1.0 / yyval.u.d;
diff --git a/Test/C01arith.ztst b/Test/C01arith.ztst
index d0092fefa..e6333890c 100644
--- a/Test/C01arith.ztst
+++ b/Test/C01arith.ztst
@@ -306,17 +306,22 @@
   in=1 info=2 Infinity=3 Inf=4
   print $(( in )) $(( info )) $(( Infinity )) $(( $Inf )) $(( inf ))
$(( INF )) $(( Inf )) $(( iNF ))
 0:Infinity parsing
+?(eval):2: Inf: using constant Inf
 >1 2 3 4 Inf Inf Inf Inf

   integer Inf
   print $(( Inf[0] ))
 1:Refer to Inf with an array subscript
+?(eval):2: Inf: using constant Inf
 ?(eval):2: bad base syntax

+  integer NaN
   (( NaN = 1 ))
 2:Assign to NaN
-?(eval):1: bad math expression: lvalue required
+?(eval):2: NaN: using constant NaN
+?(eval):2: bad math expression: lvalue required

+  unset Inf
   a='Inf'
   (( b = 1e500 ))
   print $((1e500)) $(($((1e500)))) $(( a )) $b $(( b )) $(( 3.0 / 0 ))


^ permalink raw reply	[relevance 4%]

* Re: sh emulation POSIX non-conformances ("inf"/"Inf" in arithmetic expressions)
  2021-04-23 20:31  4%                     ` Bart Schaefer
@ 2021-04-23 22:46  9%                       ` Oliver Kiddle
  2021-04-23 23:34  5%                         ` Bart Schaefer
  2021-04-24 23:02  8%                         ` Vincent Lefevre
  0 siblings, 2 replies; 200+ results
From: Oliver Kiddle @ 2021-04-23 22:46 UTC (permalink / raw)
  To: Zsh hackers list

Bart Schaefer wrote:
> On Fri, Apr 23, 2021 at 9:46 AM Vincent Lefevre <vincent@vinc17.net> wrote:
> > > > IMHO, zsh should also output a warning when such variables are used.

I disagree. We also have variables named 0, 1, 2, 3 and so on - the
positional parameters. But nobody would suggest warning about literal
value 7 in maths context.

> So, it's the "expend effort on a check that is nearly always going to
> fail" option.

I can just about see the case for warning on typeset -i/-F inf or nan
but not on use. The traditional Unix approach is not to stop people who
choose to shoot themselves in the foot. In a maths expression, you're
going to end up with inf, -inf or nan as your result anyway so it
quickly becomes fairly obvious what is going on.

If we're worrying about POSIX compliance, it'd be easy enough to disable
Inf and NaN in POSIX mode but there are dozens of special variables
defined that aren't in the POSIX spec either and which could clash.

While @inf would have avoided clashing with the variable, I've not seen
any other language which does that and consistency makes it easier. The
shell is one language where special characters should be especially
avoided because it is used interactively. Not everyone has a US-layout
keyboard and @ is often in weird places. It'd also raise the question of
what we should output. printf should follow the standard.

Note that in bash (and quite a few other implementations):
printf '%f\n' inf
inf

It is generally helpful to be able to re-input the output as input in a
later line of code.

> +            if (issetvar(p)) {
> +                zwarn("%s: using constant NaN", p);

I'm not sure that "constant" is even the correct term for what NaN
or even Inf is? Note that NaN == NaN is, by definition, false. For an
accurate description perhaps check IEEE754 but it is more along the
lines of being an intrinsic literal value.

>    integer Inf
>    print $(( Inf[0] ))
>  1:Refer to Inf with an array subscript

That could potentially be made to work as an array lookup because
subscripts have no other meaning that would clash.

Oliver


^ permalink raw reply	[relevance 9%]

* Re: sh emulation POSIX non-conformances (printf %10s and bytes vs character)
  2021-04-23 16:53  5%               ` Vincent Lefevre
@ 2021-04-23 23:01  9%                 ` Oliver Kiddle
  2021-04-24 21:41  5%                   ` Vincent Lefevre
  2021-04-24 21:46  5%                   ` Vincent Lefevre
  2021-04-24  7:09  9%                 ` Stephane Chazelas
  1 sibling, 2 replies; 200+ results
From: Oliver Kiddle @ 2021-04-23 23:01 UTC (permalink / raw)
  To: zsh-workers

Vincent Lefevre wrote:
> On 2021-04-22 12:22:12 -0700, Bart Schaefer wrote:
> > Someone can probably point to the rationale document, but I'm guessing
> > this is really because of equivalence with sprintf() formats.
>
> Some file formats have fields with a byte-size limit. Providing
> more than this limit could have unexpected effects. One may also
> want to limit the size of generated filenames (see NAME_MAX).

And for every one time that someone needs something like that, there
are a zillion cases where people just want to line up output neatly in
columns and are thwarted. More likely, this was just standards people
insisting on exactly matching the C printf().

A high level language like a shell should not force users to know about
low-level character encodings. Python 3 gets this fairly badly wrong.
I'd prefer that we make it useful first and if the POSIX committee
decree some crazyness, we have the emulation facility.

Oliver


^ permalink raw reply	[relevance 9%]

* Re: sh emulation POSIX non-conformances ("inf"/"Inf" in arithmetic expressions)
  2021-04-23 22:46  9%                       ` Oliver Kiddle
@ 2021-04-23 23:34  5%                         ` Bart Schaefer
  2021-04-24  2:10  5%                           ` Daniel Shahaf
  2021-04-24 23:02  8%                         ` Vincent Lefevre
  1 sibling, 1 reply; 200+ results
From: Bart Schaefer @ 2021-04-23 23:34 UTC (permalink / raw)
  To: Zsh hackers list

On Fri, Apr 23, 2021 at 3:47 PM Oliver Kiddle <opk@zsh.org> wrote:
>
> I can just about see the case for warning on typeset -i/-F inf or nan
> but not on use.

Warning on -i/-F but not on simple scalar nor on array/hash is not
very useful because math context doesn't limit expansions to just
numerics.

> If we're worrying about POSIX compliance, it'd be easy enough to disable
> Inf and NaN in POSIX mode but there are dozens of special variables

Inf and NaN are actually lexical tokens in context, so it's not quite
the same situation as special variables.

> Bart Schaefer wrote:
> > +            if (issetvar(p)) {
> > +                zwarn("%s: using constant NaN", p);
>
> I'm not sure that "constant" is even the correct term for what NaN
> or even Inf is?

Perhaps not.  The patch was more to show the cost of implementing the
warning than to attempt to get the warning text right.

> >    integer Inf
> >    print $(( Inf[0] ))
> >  1:Refer to Inf with an array subscript
>
> That could potentially be made to work as an array lookup because
> subscripts have no other meaning that would clash.

Here though you mean array lookup in math context generically, not
specifically for variables with these names?


^ permalink raw reply	[relevance 5%]

* Re: sh emulation POSIX non-conformances ("inf"/"Inf" in arithmetic expressions)
  2021-04-23 23:34  5%                         ` Bart Schaefer
@ 2021-04-24  2:10  5%                           ` Daniel Shahaf
  2021-04-24  3:42  5%                             ` Bart Schaefer
  0 siblings, 1 reply; 200+ results
From: Daniel Shahaf @ 2021-04-24  2:10 UTC (permalink / raw)
  To: zsh-workers

Bart Schaefer wrote on Fri, 23 Apr 2021 23:34 +00:00:
> On Fri, Apr 23, 2021 at 3:47 PM Oliver Kiddle <opk@zsh.org> wrote:
> >
> > I can just about see the case for warning on typeset -i/-F inf or nan
> > but not on use.
> 
> Warning on -i/-F but not on simple scalar nor on array/hash is not
> very useful because math context doesn't limit expansions to just
> numerics.

Disagree.  The fact that «zsh -fc 'inf=42; : $((inf))'» has a shadowing
issue doesn't make warning on «zsh -fc 'typeset -F inf=42; : $((inf))'»
"not useful".  The latter code doesn't do what its author likely
expected it to, so warning about it would be useful.

In general, a patch needn't fix every variant of a problem in order to
be committable.

Bart Schaefer wrote on Thu, 22 Apr 2021 21:25 +00:00:
> The former warns spuriously if the user has no intention of ever
> mentioning the variable in math context (or of ever using math at all).

What's a use-case for declaring an *integer or float* variable that
doesn't get ever get mentioned in math context?

Cheers,

Daniel


^ permalink raw reply	[relevance 5%]

* Re: sh emulation POSIX non-conformances ("inf"/"Inf" in arithmetic expressions)
  2021-04-24  2:10  5%                           ` Daniel Shahaf
@ 2021-04-24  3:42  5%                             ` Bart Schaefer
  2021-04-24  7:33  9%                               ` Stephane Chazelas
  0 siblings, 1 reply; 200+ results
From: Bart Schaefer @ 2021-04-24  3:42 UTC (permalink / raw)
  To: Daniel Shahaf; +Cc: Zsh hackers list

On Fri, Apr 23, 2021 at 7:13 PM Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
>
> Bart Schaefer wrote on Fri, 23 Apr 2021 23:34 +00:00:
> > Warning on -i/-F but not on simple scalar nor on array/hash is not
> > very useful
>
> Disagree.

There's room for that.

> Bart Schaefer wrote on Thu, 22 Apr 2021 21:25 +00:00:
> > The former warns spuriously if the user has no intention of ever
> > mentioning the variable in math context (or of ever using math at all).
>
> What's a use-case for declaring an *integer or float* variable that
> doesn't get ever get mentioned in math context?

I was (not clearly) using "spuriously" with an assumption that the
warning would apply to non-numeric type[def]s as well.


^ permalink raw reply	[relevance 5%]

* Re: sh emulation POSIX non-conformances (printf %10s and bytes vs character)
  2021-04-23 16:53  5%               ` Vincent Lefevre
  2021-04-23 23:01  9%                 ` Oliver Kiddle
@ 2021-04-24  7:09  9%                 ` Stephane Chazelas
  2021-04-24 21:52  5%                   ` Vincent Lefevre
  1 sibling, 1 reply; 200+ results
From: Stephane Chazelas @ 2021-04-24  7:09 UTC (permalink / raw)
  To: zsh-workers

2021-04-23 18:53:26 +0200, Vincent Lefevre:
[...]
> Some file formats have fields with a byte-size limit. Providing
> more than this limit could have unexpected effects. One may also
> want to limit the size of generated filenames (see NAME_MAX).
[...]

printf is to print formatted text.

If you want to work at byte level, you need to use the C locale
(or in zsh disable the multibyte option). In zsh, that applies
to printf and all other text utilities and operators which is
more consistent than the POSIX API.

Note that the printf of perl, fish, gawk (and I'd expect most
modern languages) work at character level (possibly as wrappers
for C's wprintf()).

$ perl -CLSA -le 'for (@ARGV) {printf "|%10s|\n", $_}' Stephane Stéphane
|  Stephane|
|  Stéphane|

-- 
Stephane


^ permalink raw reply	[relevance 9%]

* Re: sh emulation POSIX non-conformances ("inf"/"Inf" in arithmetic expressions)
  2021-04-24  3:42  5%                             ` Bart Schaefer
@ 2021-04-24  7:33  9%                               ` Stephane Chazelas
  2021-04-24 16:04  5%                                 ` Bart Schaefer
  0 siblings, 1 reply; 200+ results
From: Stephane Chazelas @ 2021-04-24  7:33 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: Daniel Shahaf, Zsh hackers list

BTW, there's also:

$ var=42 zsh -c 'printf "%g\n" var'
42
$ Infinity=42 zsh -c 'printf "%g\n" Infinity'
inf

In ksh93:

$ var=42 ksh -c 'printf "%g\n" var'
42
$ Infinity=42 ksh -c 'printf "%g\n" Infinity'
42

POSIX leaves it implementation-defined whether %g/%f... are
supported, but I'd expect it requires that "inf" output in the
second case where it is (as that's what strtod() returns), so
zsh would be more compliant than ksh in that regard.

There's still possibly scope for improving documentation.

IMO, the code doesn't need to be changed to add warnings.

-- 
Stephane


^ permalink raw reply	[relevance 9%]

* Re: sh emulation POSIX non-conformances ("inf"/"Inf" in arithmetic expressions)
  2021-04-24  7:33  9%                               ` Stephane Chazelas
@ 2021-04-24 16:04  5%                                 ` Bart Schaefer
  0 siblings, 0 replies; 200+ results
From: Bart Schaefer @ 2021-04-24 16:04 UTC (permalink / raw)
  To: Zsh hackers list

On Sat, Apr 24, 2021 at 12:33 AM Stephane Chazelas
<stephane@chazelas.org> wrote:
>
> $ Infinity=42 zsh -c 'printf "%g\n" Infinity'
> inf

That's ... curious ...

Infinity=42 zsh -c 'printf "%g\n" $(( Infinity ))'
42

> (as that's what strtod() returns)

Er, hm.  Does that mean we should be using strtod() in math context
instead of hard-coding "Inf" into the lexer?


^ permalink raw reply	[relevance 5%]

* Re: sh emulation POSIX non-conformances (printf %10s and bytes vs character)
  2021-04-23 23:01  9%                 ` Oliver Kiddle
@ 2021-04-24 21:41  5%                   ` Vincent Lefevre
  2021-04-24 21:46  5%                   ` Vincent Lefevre
  1 sibling, 0 replies; 200+ results
From: Vincent Lefevre @ 2021-04-24 21:41 UTC (permalink / raw)
  To: zsh-workers

On 2021-04-24 01:01:59 +0200, Oliver Kiddle wrote:
> Vincent Lefevre wrote:
> > On 2021-04-22 12:22:12 -0700, Bart Schaefer wrote:
> > > Someone can probably point to the rationale document, but I'm guessing
> > > this is really because of equivalence with sprintf() formats.
> >
> > Some file formats have fields with a byte-size limit. Providing
> > more than this limit could have unexpected effects. One may also
> > want to limit the size of generated filenames (see NAME_MAX).
> 
> And for every one time that someone needs something like that, there
> are a zillion cases where people just want to line up output neatly in
> columns and are thwarted. More likely, this was just standards people
> insisting on exactly matching the C printf().

Why not define an extension, then?

> A high level language like a shell should not force users to know about
> low-level character encodings.

So the current zsh behavior is wrong: If one wants an output that
doesn't take more than N bytes, one must take the low-level character
encoding into account.

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


^ permalink raw reply	[relevance 5%]

* Re: sh emulation POSIX non-conformances (printf %10s and bytes vs character)
  2021-04-23 23:01  9%                 ` Oliver Kiddle
  2021-04-24 21:41  5%                   ` Vincent Lefevre
@ 2021-04-24 21:46  5%                   ` Vincent Lefevre
  1 sibling, 0 replies; 200+ results
From: Vincent Lefevre @ 2021-04-24 21:46 UTC (permalink / raw)
  To: zsh-workers

On 2021-04-24 01:01:59 +0200, Oliver Kiddle wrote:
> Vincent Lefevre wrote:
> > On 2021-04-22 12:22:12 -0700, Bart Schaefer wrote:
> > > Someone can probably point to the rationale document, but I'm guessing
> > > this is really because of equivalence with sprintf() formats.
> >
> > Some file formats have fields with a byte-size limit. Providing
> > more than this limit could have unexpected effects. One may also
> > want to limit the size of generated filenames (see NAME_MAX).
> 
> And for every one time that someone needs something like that, there
> are a zillion cases where people just want to line up output neatly in
> columns and are thwarted. More likely, this was just standards people
> insisting on exactly matching the C printf().

And even for that, this is currently buggy (at least under Debian)
with double-width characters. Try:

  printf "|%3s|\n" a 🍸

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


^ permalink raw reply	[relevance 5%]

* Re: sh emulation POSIX non-conformances (printf %10s and bytes vs character)
  2021-04-24  7:09  9%                 ` Stephane Chazelas
@ 2021-04-24 21:52  5%                   ` Vincent Lefevre
  2021-04-24 22:28  5%                     ` Bart Schaefer
  0 siblings, 1 reply; 200+ results
From: Vincent Lefevre @ 2021-04-24 21:52 UTC (permalink / raw)
  To: zsh-workers

On 2021-04-24 08:09:40 +0100, Stephane Chazelas wrote:
> Note that the printf of perl, fish, gawk (and I'd expect most
> modern languages) work at character level (possibly as wrappers
> for C's wprintf()).
> 
> $ perl -CLSA -le 'for (@ARGV) {printf "|%10s|\n", $_}' Stephane Stéphane
> |  Stephane|
> |  Stéphane|

And perl has the same issue as zsh with double-width characters.

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


^ permalink raw reply	[relevance 5%]

* Re: sh emulation POSIX non-conformances (printf %10s and bytes vs character)
  2021-04-24 21:52  5%                   ` Vincent Lefevre
@ 2021-04-24 22:28  5%                     ` Bart Schaefer
  2021-04-24 23:18  5%                       ` Vincent Lefevre
  0 siblings, 1 reply; 200+ results
From: Bart Schaefer @ 2021-04-24 22:28 UTC (permalink / raw)
  To: Zsh hackers list

On Sat, Apr 24, 2021 at 2:53 PM Vincent Lefevre <vincent@vinc17.net> wrote:
>
> And perl has the same issue as zsh with double-width characters.

This implies to me that it's not actually a zsh problem.


^ permalink raw reply	[relevance 5%]

* Re: sh emulation POSIX non-conformances ("inf"/"Inf" in arithmetic expressions)
  2021-04-23 22:46  9%                       ` Oliver Kiddle
  2021-04-23 23:34  5%                         ` Bart Schaefer
@ 2021-04-24 23:02  8%                         ` Vincent Lefevre
  2021-04-25  2:18  5%                           ` Bart Schaefer
  1 sibling, 1 reply; 200+ results
From: Vincent Lefevre @ 2021-04-24 23:02 UTC (permalink / raw)
  To: zsh-workers

On 2021-04-24 00:46:44 +0200, Oliver Kiddle wrote:
> Bart Schaefer wrote:
> > On Fri, Apr 23, 2021 at 9:46 AM Vincent Lefevre <vincent@vinc17.net> wrote:
> > > > > IMHO, zsh should also output a warning when such variables are used.
> 
> I disagree. We also have variables named 0, 1, 2, 3 and so on - the
> positional parameters. But nobody would suggest warning about literal
> value 7 in maths context.

This is different: the digits are already used in integers, and the
behavior is the same in all shells.

> > So, it's the "expend effort on a check that is nearly always going to
> > fail" option.
> 
> I can just about see the case for warning on typeset -i/-F inf or nan
> but not on use. The traditional Unix approach is not to stop people who
> choose to shoot themselves in the foot. In a maths expression, you're
> going to end up with inf, -inf or nan as your result anyway so it
> quickly becomes fairly obvious what is going on.

People could waste a lot of time finding what is going on,
in particular those who don't use floating point at all.

> If we're worrying about POSIX compliance, it'd be easy enough to disable
> Inf and NaN in POSIX mode but there are dozens of special variables
> defined that aren't in the POSIX spec either and which could clash.

However, it is a bit easier to see what is going on with special
variables. And they have been documented for a long time. On the
opposite, the zsh manual (for 5.8) is silent on Inf and NaN. And
both for the behavior and documentation, be careful with the
locales, in particular in Turkish ones. I don't know whether
this is expected in zsh, but...

zira% zsh -fc 'export LC_ALL=fr_FR.utf8; echo $((Inf)) $((inf))'
Inf Inf
zira% zsh -fc 'export LC_ALL=tr_TR.utf8; echo $((Inf)) $((inf))'
Inf 0

With ksh93:

zira% ksh93 -fc 'export LC_ALL=fr_FR.utf8; echo $((Inf)) $((inf))'
inf inf
zira% ksh93 -fc 'export LC_ALL=tr_TR.utf8; echo $((Inf)) $((inf))'
inf inf

> It is generally helpful to be able to re-input the output as input
> in a later line of code.

Even with the POSIX behavior, a problem is unlikely to occur,
because zsh uses a mix of uppercase and lowercase letters, and
this is uncommon in variable names. Moreover, if people get Inf
or NaN in their computation, I doubt that they would use such
variable names.

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


^ permalink raw reply	[relevance 8%]

* Re: sh emulation POSIX non-conformances (printf %10s and bytes vs character)
  2021-04-24 22:28  5%                     ` Bart Schaefer
@ 2021-04-24 23:18  5%                       ` Vincent Lefevre
  2021-04-25  2:20  5%                         ` Bart Schaefer
  0 siblings, 1 reply; 200+ results
From: Vincent Lefevre @ 2021-04-24 23:18 UTC (permalink / raw)
  To: zsh-workers

On 2021-04-24 15:28:21 -0700, Bart Schaefer wrote:
> On Sat, Apr 24, 2021 at 2:53 PM Vincent Lefevre <vincent@vinc17.net> wrote:
> >
> > And perl has the same issue as zsh with double-width characters.
> 
> This implies to me that it's not actually a zsh problem.

Why not?

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


^ permalink raw reply	[relevance 5%]

* Re: sh emulation POSIX non-conformances ("inf"/"Inf" in arithmetic expressions)
  2021-04-24 23:02  8%                         ` Vincent Lefevre
@ 2021-04-25  2:18  5%                           ` Bart Schaefer
  2021-04-25 20:17  5%                             ` Vincent Lefevre
  0 siblings, 1 reply; 200+ results
From: Bart Schaefer @ 2021-04-25  2:18 UTC (permalink / raw)
  To: Zsh hackers list

On Sat, Apr 24, 2021 at 4:03 PM Vincent Lefevre <vincent@vinc17.net> wrote:
>
> both for the behavior and documentation, be careful with the
> locales, in particular in Turkish ones. I don't know whether
> this is expected in zsh, but...
>
> zira% zsh -fc 'export LC_ALL=fr_FR.utf8; echo $((Inf)) $((inf))'
> Inf Inf
> zira% zsh -fc 'export LC_ALL=tr_TR.utf8; echo $((Inf)) $((inf))'
> Inf 0

schaefer[856] ls -ld /usr/share/i18n/locales/tr_TR
-rw-r--r-- 1 root root 168368 Dec 16 03:04 /usr/share/i18n/locales/tr_TR
schaefer[857] Src/zsh -fc 'export LC_ALL=tr_TR.utf8; echo $((Inf)) $((inf))'
Inf Inf

??


^ permalink raw reply	[relevance 5%]

* Re: sh emulation POSIX non-conformances (printf %10s and bytes vs character)
  2021-04-24 23:18  5%                       ` Vincent Lefevre
@ 2021-04-25  2:20  5%                         ` Bart Schaefer
  2021-04-25 11:07  5%                           ` Vincent Lefevre
  0 siblings, 1 reply; 200+ results
From: Bart Schaefer @ 2021-04-25  2:20 UTC (permalink / raw)
  To: Zsh hackers list

On Sat, Apr 24, 2021 at 4:18 PM Vincent Lefevre <vincent@vinc17.net> wrote:
>
> On 2021-04-24 15:28:21 -0700, Bart Schaefer wrote:
> > On Sat, Apr 24, 2021 at 2:53 PM Vincent Lefevre <vincent@vinc17.net> wrote:
> > >
> > > And perl has the same issue as zsh with double-width characters.
> >
> > This implies to me that it's not actually a zsh problem.
>
> Why not?

Because multiple programs exhibiting identical incorrect behavior
points to a problem in the C library or a system call.


^ permalink raw reply	[relevance 5%]

* Re: sh emulation POSIX non-conformances (printf %10s and bytes vs character)
  2021-04-25  2:20  5%                         ` Bart Schaefer
@ 2021-04-25 11:07  5%                           ` Vincent Lefevre
  0 siblings, 0 replies; 200+ results
From: Vincent Lefevre @ 2021-04-25 11:07 UTC (permalink / raw)
  To: zsh-workers

On 2021-04-24 19:20:53 -0700, Bart Schaefer wrote:
> On Sat, Apr 24, 2021 at 4:18 PM Vincent Lefevre <vincent@vinc17.net> wrote:
> >
> > On 2021-04-24 15:28:21 -0700, Bart Schaefer wrote:
> > > On Sat, Apr 24, 2021 at 2:53 PM Vincent Lefevre <vincent@vinc17.net> wrote:
> > > >
> > > > And perl has the same issue as zsh with double-width characters.
> > >
> > > This implies to me that it's not actually a zsh problem.
> >
> > Why not?
> 
> Because multiple programs exhibiting identical incorrect behavior
> points to a problem in the C library or a system call.

Perl is not the same language as zsh. For instance:

$ perl -le 'for (@ARGV) {printf "|%10s|\n", $_}' Stephane Stéphane
|  Stephane|
| Stéphane|

So, now, you have a different behavior with Perl.

I assume that the intent in Perl was not column formatting, but to be
similar to C. So I suppose that the Perl printf behaves like printf(3)
for 8-bit strings, and like wprintf(3) for Unicode strings. Note that
this is independent of the locales, i.e. the Perl printf is not
sensitive to the locales for %s, this is more like a datatype-based
behavior.

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


^ permalink raw reply	[relevance 5%]

* Re: sh emulation POSIX non-conformances ("inf"/"Inf" in arithmetic expressions)
  2021-04-25  2:18  5%                           ` Bart Schaefer
@ 2021-04-25 20:17  5%                             ` Vincent Lefevre
  2021-04-25 21:58  5%                               ` Bart Schaefer
  2021-04-25 22:00  5%                               ` Bart Schaefer
  0 siblings, 2 replies; 200+ results
From: Vincent Lefevre @ 2021-04-25 20:17 UTC (permalink / raw)
  To: zsh-workers

On 2021-04-24 19:18:25 -0700, Bart Schaefer wrote:
> On Sat, Apr 24, 2021 at 4:03 PM Vincent Lefevre <vincent@vinc17.net> wrote:
> >
> > both for the behavior and documentation, be careful with the
> > locales, in particular in Turkish ones. I don't know whether
> > this is expected in zsh, but...
> >
> > zira% zsh -fc 'export LC_ALL=fr_FR.utf8; echo $((Inf)) $((inf))'
> > Inf Inf
> > zira% zsh -fc 'export LC_ALL=tr_TR.utf8; echo $((Inf)) $((inf))'
> > Inf 0
> 
> schaefer[856] ls -ld /usr/share/i18n/locales/tr_TR
> -rw-r--r-- 1 root root 168368 Dec 16 03:04 /usr/share/i18n/locales/tr_TR
> schaefer[857] Src/zsh -fc 'export LC_ALL=tr_TR.utf8; echo $((Inf)) $((inf))'
> Inf Inf
> 
> ??

You may have non-standard Turkish locales, because the following line
in math.c is obviously incorrect:

                    else if (strncasecmp(p, "Inf", 3) == 0) {

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


^ permalink raw reply	[relevance 5%]

* Re: sh emulation POSIX non-conformances ("inf"/"Inf" in arithmetic expressions)
  2021-04-25 20:17  5%                             ` Vincent Lefevre
@ 2021-04-25 21:58  5%                               ` Bart Schaefer
  2021-04-26 10:28  5%                                 ` Vincent Lefevre
  2021-04-25 22:00  5%                               ` Bart Schaefer
  1 sibling, 1 reply; 200+ results
From: Bart Schaefer @ 2021-04-25 21:58 UTC (permalink / raw)
  To: Zsh hackers list

On Sun, Apr 25, 2021 at 1:18 PM Vincent Lefevre <vincent@vinc17.net> wrote:
>
> You may have non-standard Turkish locales

I have whatever is standard for Ubuntu 20.04.2 LTS.


^ permalink raw reply	[relevance 5%]

* Re: sh emulation POSIX non-conformances ("inf"/"Inf" in arithmetic expressions)
  2021-04-25 20:17  5%                             ` Vincent Lefevre
  2021-04-25 21:58  5%                               ` Bart Schaefer
@ 2021-04-25 22:00  5%                               ` Bart Schaefer
  2021-04-26 10:34  5%                                 ` Vincent Lefevre
  1 sibling, 1 reply; 200+ results
From: Bart Schaefer @ 2021-04-25 22:00 UTC (permalink / raw)
  To: Zsh hackers list

On Sun, Apr 25, 2021 at 1:18 PM Vincent Lefevre <vincent@vinc17.net> wrote:
>
> math.c is obviously incorrect:
>
>                     else if (strncasecmp(p, "Inf", 3) == 0) {

What should it (and the corresponding NaN line) be, then?


^ permalink raw reply	[relevance 5%]

* Re: sh emulation POSIX non-conformances ("inf"/"Inf" in arithmetic expressions)
  2021-04-25 21:58  5%                               ` Bart Schaefer
@ 2021-04-26 10:28  5%                                 ` Vincent Lefevre
  0 siblings, 0 replies; 200+ results
From: Vincent Lefevre @ 2021-04-26 10:28 UTC (permalink / raw)
  To: zsh-workers

On 2021-04-25 14:58:33 -0700, Bart Schaefer wrote:
> On Sun, Apr 25, 2021 at 1:18 PM Vincent Lefevre <vincent@vinc17.net> wrote:
> >
> > You may have non-standard Turkish locales
> 
> I have whatever is standard for Ubuntu 20.04.2 LTS.

Indeed, this depends on the system.

Under Debian:

zira% export LC_ALL=tr_TR.utf8
zira% echo ${${:-Inf}:l} ${${:-inf}:u}
ınf İNF

Ditto under CentOS Linux 7 (AltArch):

gcc1-power7% export LC_ALL=tr_TR.utf8
gcc1-power7% echo ${${:-Inf}:l} ${${:-inf}:u}
ınf İNF

But under macOS:

vinc17@minimac ~ % export LC_ALL=tr_TR.UTF-8
vinc17@minimac ~ % echo ${${:-Inf}:l} ${${:-inf}:u}
inf INF

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


^ permalink raw reply	[relevance 5%]

* Re: sh emulation POSIX non-conformances ("inf"/"Inf" in arithmetic expressions)
  2021-04-25 22:00  5%                               ` Bart Schaefer
@ 2021-04-26 10:34  5%                                 ` Vincent Lefevre
  2021-04-26 23:25  4%                                   ` Vincent Lefevre
  0 siblings, 1 reply; 200+ results
From: Vincent Lefevre @ 2021-04-26 10:34 UTC (permalink / raw)
  To: zsh-workers

On 2021-04-25 15:00:03 -0700, Bart Schaefer wrote:
> On Sun, Apr 25, 2021 at 1:18 PM Vincent Lefevre <vincent@vinc17.net> wrote:
> >
> > math.c is obviously incorrect:
> >
> >                     else if (strncasecmp(p, "Inf", 3) == 0) {
> 
> What should it (and the corresponding NaN line) be, then?

This depends on the expected behavior: Should it match only
[Ii][Nn][Ff], or also the lowercase and uppercase versions?
... so that in Turkish locales under Debian: [Iıİi][Nn][Ff],
i.e. also with
  U+0130 LATIN CAPITAL LETTER I WITH DOT ABOVE
  U+0131 LATIN SMALL LETTER DOTLESS I

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


^ permalink raw reply	[relevance 5%]

* Re: sh emulation POSIX non-conformances ("inf"/"Inf" in arithmetic expressions)
  2021-04-26 10:34  5%                                 ` Vincent Lefevre
@ 2021-04-26 23:25  4%                                   ` Vincent Lefevre
  0 siblings, 0 replies; 200+ results
From: Vincent Lefevre @ 2021-04-26 23:25 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 1269 bytes --]

On 2021-04-26 12:34:36 +0200, Vincent Lefevre wrote:
> On 2021-04-25 15:00:03 -0700, Bart Schaefer wrote:
> > On Sun, Apr 25, 2021 at 1:18 PM Vincent Lefevre <vincent@vinc17.net> wrote:
> > >
> > > math.c is obviously incorrect:
> > >
> > >                     else if (strncasecmp(p, "Inf", 3) == 0) {
> > 
> > What should it (and the corresponding NaN line) be, then?
> 
> This depends on the expected behavior: Should it match only
> [Ii][Nn][Ff], or also the lowercase and uppercase versions?
> ... so that in Turkish locales under Debian: [Iıİi][Nn][Ff],
> i.e. also with
>   U+0130 LATIN CAPITAL LETTER I WITH DOT ABOVE
>   U+0131 LATIN SMALL LETTER DOTLESS I

I think that matching ASCII only would be the expected behavior,
as this would not depend on the locales and this would be like
ksh93, strtod(), and so on. See attached patch. Alternatively,
you could keep the strncasecmp for NaN and possibly for the "nf"
part of "Inf" since AFAIK, 'i' is the only letter to have such
an issue, but for 3 characters, individual comparisons seem OK.

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)

[-- Attachment #2: inf-nan.patch --]
[-- Type: text/plain, Size: 706 bytes --]

diff --git a/Src/math.c b/Src/math.c
index 1d0d86639..ade02d80c 100644
--- a/Src/math.c
+++ b/Src/math.c
@@ -864,13 +864,17 @@ zzlex(void)
 		p = ptr;
 		ptr = ie;
 		if (ie - p == 3) {
-		    if (strncasecmp(p, "NaN", 3) == 0) {
+		    if ((p[0] == 'N' || p[0] == 'n') &&
+			(p[1] == 'A' || p[1] == 'a') &&
+			(p[2] == 'N' || p[2] == 'n')) {
 			yyval.type = MN_FLOAT;
 			yyval.u.d = 0.0;
 			yyval.u.d /= yyval.u.d;
 			return NUM;
 		    }
-		    else if (strncasecmp(p, "Inf", 3) == 0) {
+		    else if ((p[0] == 'I' || p[0] == 'i') &&
+			     (p[1] == 'N' || p[1] == 'n') &&
+			     (p[2] == 'F' || p[2] == 'f')) {
 			yyval.type = MN_FLOAT;
 			yyval.u.d = 0.0;
 			yyval.u.d = 1.0 / yyval.u.d;

^ permalink raw reply	[relevance 4%]

* Re: [PATCH v2] regexp-replace and ^, word boundary or look-behind operators
  @ 2021-04-30  6:11 10%           ` Stephane Chazelas
    0 siblings, 1 reply; 200+ results
From: Stephane Chazelas @ 2021-04-30  6:11 UTC (permalink / raw)
  To: Zsh hackers list

ping.

2020-01-01 14:03:43 +0000, Stephane Chazelas:
2019-12-18 00:22:53 +0000, Daniel Shahaf:
[...]
> > +
> > +Note that if not using PCRE, using the tt(^) or word boundary operators
> > +(where available) may not work properly.
> 
> Suggest to avoid the double negative:
> 
> 1. s/not using PCRE/using POSIX ERE's/
> 
> 2. Add "(ERE's)" after "POSIX extended regular expressions" in the first paragraph
> 
> I'll push a minor change to that first paragraph in a moment.
[...]

Thanks, I've incorporated that suggesting and fixed an issue
with PCRE when the replacement was empty or generated more than
one element.

diff --git a/Doc/Zsh/contrib.yo b/Doc/Zsh/contrib.yo
index 558342711..9a804fc11 100644
--- a/Doc/Zsh/contrib.yo
+++ b/Doc/Zsh/contrib.yo
@@ -4284,7 +4284,7 @@ See also the tt(pager), tt(prompt) and tt(rprompt) styles below.
 findex(regexp-replace)
 item(tt(regexp-replace) var(var) var(regexp) var(replace))(
 Use regular expressions to perform a global search and replace operation
-on a variable.  POSIX extended regular expressions are used,
+on a variable.  POSIX extended regular expressions (ERE) are used,
 unless the option tt(RE_MATCH_PCRE) has been set, in which case
 Perl-compatible regular expressions are used
 (this requires the shell to be linked against the tt(pcre)
@@ -4302,6 +4302,9 @@ and arithmetic expressions which will be replaced:  in particular, a
 reference to tt($MATCH) will be replaced by the text matched by the pattern.
 
 The return status is 0 if at least one match was performed, else 1.
+
+Note that if using POSIX EREs, the tt(^) or word boundary operators
+(where available) may not work properly.
 )
 findex(run-help)
 item(tt(run-help) var(cmd))(
diff --git a/Functions/Example/zpgrep b/Functions/Example/zpgrep
index 8b1edaa1c..556e58cd6 100644
--- a/Functions/Example/zpgrep
+++ b/Functions/Example/zpgrep
@@ -2,24 +2,31 @@
 #
 
 zpgrep() {
-local file pattern
+local file pattern ret
 
 pattern=$1
 shift
+ret=1
 
 if ((! ARGC)) then
 	set -- -
 fi
 
-pcre_compile $pattern
+zmodload zsh/pcre || return
+pcre_compile -- "$pattern"
 pcre_study
 
 for file
 do
 	if [[ "$file" == - ]] then
-		while read -u0 buf; do pcre_match $buf && print $buf; done
+		while IFS= read -ru0 buf; do
+			pcre_match -- "$buf" && ret=0 && print -r -- "$buf"
+		done
 	else
-		while read -u0 buf; do pcre_match $buf && print $buf; done < "$file"
+		while IFS= read -ru0 buf; do
+			pcre_match -- "$buf" && ret=0 && print -r -- "$buf"
+		done < "$file"
 	fi
 done
+return "$ret"
 }
diff --git a/Functions/Misc/regexp-replace b/Functions/Misc/regexp-replace
index dec105524..0d5948075 100644
--- a/Functions/Misc/regexp-replace
+++ b/Functions/Misc/regexp-replace
@@ -8,36 +8,84 @@
 # $ and backtick substitutions; in particular, $MATCH will be replaced
 # by the portion of the string matched by the regular expression.
 
-integer pcre
+# we use positional parameters instead of variables to avoid
+# clashing with the user's variable. Make sure we start with 3 and only
+# 3 elements:
+argv=("$1" "$2" "$3")
 
-[[ -o re_match_pcre ]] && pcre=1
+# $4 records whether pcre is enabled as that information would otherwise
+# be lost after emulate -L zsh
+4=0
+[[ -o re_match_pcre ]] && 4=1
 
 emulate -L zsh
-(( pcre )) && setopt re_match_pcre
-
-# $4 is the string to be matched
-4=${(P)1}
-# $5 is the final string
-5=
-# 6 indicates if we made a change
-6=
+
+
 local MATCH MBEGIN MEND
 local -a match mbegin mend
 
-while [[ -n $4 ]]; do
-  if [[ $4 =~ $2 ]]; then
-    # append initial part and subsituted match
-    5+=${4[1,MBEGIN-1]}${(e)3}
-    # truncate remaining string
-    4=${4[MEND+1,-1]}
-    # indicate we did something
-    6=1
-  else
-    break
-  fi
-done
-5+=$4
-
-eval ${1}=${(q)5}
-# status 0 if we did something, else 1.
-[[ -n $6 ]]
+if (( $4 )); then
+  # if using pcre, we're using pcre_match and a running offset
+  # That's needed for ^, \A, \b, and look-behind operators to work
+  # properly.
+
+  zmodload zsh/pcre || return 2
+  pcre_compile -- "$2" && pcre_study || return 2
+
+  # $4 is the current *byte* offset, $5, $6 reserved for later use
+  4=0 6=
+
+  local ZPCRE_OP
+  while pcre_match -b -n $4 -- "${(P)1}"; do
+    # append offsets and computed replacement to the array
+    # we need to perform the evaluation in a scalar assignment so that if
+    # it generates an array, the elements are converted to string (by
+    # joining with the first chararacter of $IFS as usual)
+    5=${(e)3}
+    argv+=(${(s: :)ZPCRE_OP} "$5")
+
+    # for 0-width matches, increase offset by 1 to avoid
+    # infinite loop
+    4=$((argv[-2] + (argv[-3] == argv[-2])))
+  done
+
+  (($# > 6)) || return # no match
+
+  set +o multibyte
+
+  # $5 contains the result, $6 the current offset
+  5= 6=1
+  for 2 3 4 in "$@[7,-1]"; do
+    5+=${(P)1[$6,$2]}$4
+    6=$(($3 + 1))
+  done
+  5+=${(P)1[$6,-1]}
+else
+  # in ERE, we can't use an offset so ^, (and \<, \b, \B, [[:<:]] where
+  # available) won't work properly.
+
+  # $4 is the string to be matched
+  4=${(P)1}
+
+  while [[ -n $4 ]]; do
+    if [[ $4 =~ $2 ]]; then
+      # append initial part and substituted match
+      5+=${4[1,MBEGIN-1]}${(e)3}
+      # truncate remaining string
+      if ((MEND < MBEGIN)); then
+        # zero-width match, skip one character for the next match
+        ((MEND++))
+	5+=${4[1]}
+      fi
+      4=${4[MEND+1,-1]}
+      # indicate we did something
+      6=1
+    else
+      break
+    fi
+  done
+  [[ -n $6 ]] || return # no match
+  5+=$4
+fi
+
+eval $1=\$5


^ permalink raw reply	[relevance 10%]

* tilde expansion after quoted : in assignments
  @ 2021-04-30  8:17  4%   ` Stephane Chazelas
  2021-04-30 17:43  0%     ` Bart Schaefer
  0 siblings, 1 reply; 200+ results
From: Stephane Chazelas @ 2021-04-30  8:17 UTC (permalink / raw)
  To: Zsh hackers list

2021-04-30 07:51:23 +0100, Stephane Chazelas:
[...]
> BTW, zsh is the only shell where ~ is expanded in:
> 
> $ zsh -c 'a=a\:~; echo $a'
> a:/home/chazelas
[...]

That's a POSIX non-conformance btw:

https://pubs.opengroup.org/onlinepubs/9699919799.2018edition/utilities/V3_chap02.html#tag_18_06_01

Tilde expansion is only meant to be done after unquoted : per
POSIX. Though I can't imagine being a problem in practice. If
people don't want tilde expansion, they'd quote the ~, not the
:.

Also, there's a lot of variation between shells in how tilde
expansion is done and the specification is quite vague there.

See also ~$user or ~"user" or var=foo$COLON~ or var=foo${-+:}~
...

See also https://www.austingroupbugs.net/view.php?id=1172
(I had completely forgotten I'd raised that).

-- 
Stephane


^ permalink raw reply	[relevance 4%]

* Re: tilde expansion after quoted : in assignments
  2021-04-30  8:17  4%   ` tilde expansion after quoted : in assignments Stephane Chazelas
@ 2021-04-30 17:43  0%     ` Bart Schaefer
  0 siblings, 0 replies; 200+ results
From: Bart Schaefer @ 2021-04-30 17:43 UTC (permalink / raw)
  To: Zsh hackers list

On Fri, Apr 30, 2021 at 1:18 AM Stephane Chazelas <stephane@chazelas.org> wrote:
>
> Tilde expansion is only meant to be done after unquoted : per
> POSIX. Though I can't imagine being a problem in practice.

I was expecting this to mean that colons in e.g. $PATH could be
escaped with a backslash, but that's not the case.

Therefore I suppose it's so that one can do
  a=${this}\:${that}
without having to worry whether $that begins with a tilde, while
simultaneously allowing ${that} to be whitespace-split or to itself
contain unquoted colons.  Although again that seems a pretty weird
case since the only reason to care whether those colons are quoted is
if they are followed by more tildes and I can't imagine what splitting
makes sense in that context.


^ permalink raw reply	[relevance 0%]

* Re: [PATCH] Document imperfections in POSIX/sh compatibility
  2021-04-20 21:26  5%           ` Daniel Shahaf
@ 2021-05-03 23:42  5%             ` dana
  0 siblings, 0 replies; 200+ results
From: dana @ 2021-05-03 23:42 UTC (permalink / raw)
  To: Daniel Shahaf; +Cc: Zsh hackers list

On 20 Apr 2021, at 16:26, Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
> That'd be great.
> *nod*

I've committed the disclaimer plus the http:// -> https:// update and the FAQ
move. You're probably aware of this, but just to be clear, the zsh.org FAQ
links redirect to zsh.sourceforge.net, which is HTTP only, so the link changes
don't really have any functional effect at the moment

dana



^ permalink raw reply	[relevance 5%]

* [PATCH v3] regexp-replace and ^, word boundary or look-behind operators (and more).
  @ 2021-05-05 11:45  7%               ` Stephane Chazelas
  0 siblings, 0 replies; 200+ results
From: Stephane Chazelas @ 2021-05-05 11:45 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: Zsh hackers list

2021-04-30 16:13:34 -0700, Bart Schaefer:
[...]
> I went back and looked at the patch again.

Thanks. Here's a third version with further improvements
addressing some of the comments here.

> Tangential question:  "pgrep" commonly refers to grepping the process
> list, and is linked to "pkill".  I know "zpgrep" precedes this patch,
> but I'm wondering if we should rename it.

I agree, zshpcregrep or zpmatch may be better names. There
exists a pcregrep command, zpcregrep would be likely interpreted
as zip-pcregrep. I'll leave it out for now. IMO, that zpgrep
serves more as example code than a command people would actually
use, so it probably doesn't matter much.

> More directly about regexp-replace:
> 
> If $argv[4,-1] are going to be ignored/discarded, perhaps there should
> be a warning?  (Another thing that predates the patch, I know)

Agreed. I've addressed that.

> What do you think about replacing the final eval with typeset -g, as
> mentioned in workers/48760 ?

I've compared:

(1) eval -- $lvalue=\$value
(2) Bart's typeset -g -- $lvalue=$value
(3) Daniel's (zsh-workers 45073) : ${(P)lvalue::="$value"}

(1) to me is the most legible but if $lvalue is not a valid
lvalue, it doesn't necessarily return a useful error message to
the user (like when lvalue='reboot;var'...)

(2) is also very legible. It has the benefit (or inconvenience
depending on PoV) of returning an error if the lvalue is not a
scalar. It reports an error (and exits the shell process)  upon
incorrect lvalues (except ones such as "var=foo"). A major
drawback though is that if chokes on lvalue='array[n=1]' or
lvalue='assoc[keywith=characters]'

(3) is the least legible. It also causes the lvalue to be
dereferenced twice. For instance with lvalue='a[++n]', n is
incremented twice. However, it does report an error upon invalid
lvalue (even though ${(P)lvalue} alone doesn't), and as we use
${(P)lvalue} above already, that has the benefit of that lvalue
being interpreted consistently. Non-scalar variables are
converted to scalar (like with (1)). It works OK for
lvalue='assoc[$key]' and lvalue='assoc[=]' or
lvalue='assoc[\]]' for instance.

Performance wise, for usual cases (lvalue being a simple
variable name and value short enough), (1) seems to be the worst
in my tests and (3) best, (2) very close. But that's reversed
for the less usual cases.

So, I've gone for (3), changed the code to limit the number of
times the lvalue is dereferenced. I've also addressed an issue
whereby regexp-replace empty '^' x would not insert x in ERE
mode.

(note that it is affected by the (e) failure exit code issue
I've just raised separately; I'm not attempting to work around
it here; though I've added the X flag for error reporting to be
more consistent)

diff --git a/Doc/Zsh/contrib.yo b/Doc/Zsh/contrib.yo
index 8bf1a208e..db06d7925 100644
--- a/Doc/Zsh/contrib.yo
+++ b/Doc/Zsh/contrib.yo
@@ -4328,7 +4328,7 @@ See also the tt(pager), tt(prompt) and tt(rprompt) styles below.
 findex(regexp-replace)
 item(tt(regexp-replace) var(var) var(regexp) var(replace))(
 Use regular expressions to perform a global search and replace operation
-on a variable.  POSIX extended regular expressions are used,
+on a variable.  POSIX extended regular expressions (ERE) are used,
 unless the option tt(RE_MATCH_PCRE) has been set, in which case
 Perl-compatible regular expressions are used
 (this requires the shell to be linked against the tt(pcre)
@@ -4346,6 +4346,9 @@ and arithmetic expressions which will be replaced:  in particular, a
 reference to tt($MATCH) will be replaced by the text matched by the pattern.
 
 The return status is 0 if at least one match was performed, else 1.
+
+Note that if using POSIX EREs, the tt(^) or word boundary operators
+(where available) may not work properly.
 )
 findex(run-help)
 item(tt(run-help) var(cmd))(
diff --git a/Functions/Example/zpgrep b/Functions/Example/zpgrep
index 8b1edaa1c..556e58cd6 100644
--- a/Functions/Example/zpgrep
+++ b/Functions/Example/zpgrep
@@ -2,24 +2,31 @@
 #
 
 zpgrep() {
-local file pattern
+local file pattern ret
 
 pattern=$1
 shift
+ret=1
 
 if ((! ARGC)) then
 	set -- -
 fi
 
-pcre_compile $pattern
+zmodload zsh/pcre || return
+pcre_compile -- "$pattern"
 pcre_study
 
 for file
 do
 	if [[ "$file" == - ]] then
-		while read -u0 buf; do pcre_match $buf && print $buf; done
+		while IFS= read -ru0 buf; do
+			pcre_match -- "$buf" && ret=0 && print -r -- "$buf"
+		done
 	else
-		while read -u0 buf; do pcre_match $buf && print $buf; done < "$file"
+		while IFS= read -ru0 buf; do
+			pcre_match -- "$buf" && ret=0 && print -r -- "$buf"
+		done < "$file"
 	fi
 done
+return "$ret"
 }
diff --git a/Functions/Misc/regexp-replace b/Functions/Misc/regexp-replace
index dec105524..c947a2043 100644
--- a/Functions/Misc/regexp-replace
+++ b/Functions/Misc/regexp-replace
@@ -1,43 +1,109 @@
-# Replace all occurrences of a regular expression in a variable.  The
-# variable is modified directly.  Respects the setting of the
-# option RE_MATCH_PCRE.
+# Replace all occurrences of a regular expression in a scalar variable.
+# The variable is modified directly.  Respects the setting of the option
+# RE_MATCH_PCRE, but otherwise sets the zsh emulation mode.
 #
-# First argument: *name* (not contents) of variable.
-# Second argument: regular expression
-# Third argument: replacement string.  This can contain all forms of
-# $ and backtick substitutions; in particular, $MATCH will be replaced
-# by the portion of the string matched by the regular expression.
-
-integer pcre
+# Arguments:
+#
+# 1. *name* (not contents) of variable or more generally any lvalue,
+#    expected to be scalar.  That lvalue will be evaluated once to
+#    retrieve the current value, and two more times (not just one as a
+#    side effect of using ${(P)varname::=$value}; FIXME) for the
+#    assignment of the new value if a substitution was made.  So lvalues
+#    such as array[++n] where the subscript is dynamic should be
+#    avoided.
+#
+# 2. regular expression
+#
+# 3. replacement string.  This can contain all forms of
+#    $ and backtick substitutions; in particular, $MATCH will be
+#    replaced by the portion of the string matched by the regular
+#    expression. Parsing errors are fatal to the shell process.
+#
+# we use positional parameters instead of variables to avoid
+# clashing with the user's variable.
 
-[[ -o re_match_pcre ]] && pcre=1
+if (( $# < 2 || $# > 3 )); then
+  setopt localoptions functionargzero
+  print -ru2 "Usage: $0 <varname> <regexp> [<replacement>]"
+  return 2
+fi
 
+# $4 records whether pcre is enabled as that information would otherwise
+# be lost after emulate -L zsh
+4=0
+[[ -o re_match_pcre ]] && 4=1
 emulate -L zsh
-(( pcre )) && setopt re_match_pcre
-
-# $4 is the string to be matched
-4=${(P)1}
-# $5 is the final string
-5=
-# 6 indicates if we made a change
-6=
-local MATCH MBEGIN MEND
+
+# $5 is the string to be matched
+5=${(P)1}
+
+local    MATCH MBEGIN MEND
 local -a match mbegin mend
 
-while [[ -n $4 ]]; do
-  if [[ $4 =~ $2 ]]; then
-    # append initial part and subsituted match
-    5+=${4[1,MBEGIN-1]}${(e)3}
-    # truncate remaining string
-    4=${4[MEND+1,-1]}
-    # indicate we did something
-    6=1
-  else
-    break
-  fi
-done
-5+=$4
-
-eval ${1}=${(q)5}
-# status 0 if we did something, else 1.
-[[ -n $6 ]]
+if (( $4 )); then
+  # if using pcre, we're using pcre_match and a running offset
+  # That's needed for ^, \A, \b, and look-behind operators to work
+  # properly.
+
+  zmodload zsh/pcre || return 2
+  pcre_compile -- "$2" && pcre_study || return 2
+
+  # $4 is the current *byte* offset, $6, $7 reserved for later use
+  4=0 7=
+
+  local ZPCRE_OP
+  while pcre_match -b -n $4 -- "$5"; do
+    # append offsets and computed replacement to the array
+    # we need to perform the evaluation in a scalar assignment so that if
+    # it generates an array, the elements are converted to string (by
+    # joining with the first chararacter of $IFS as usual)
+    6=${(Xe)3}
+    argv+=(${(s: :)ZPCRE_OP} "$6")
+
+    # for 0-width matches, increase offset by 1 to avoid
+    # infinite loop
+    4=$(( argv[-2] + (argv[-3] == argv[-2]) ))
+  done
+
+  (( $# > 7 )) || return # no match
+
+  set +o multibyte
+
+  # $6 contains the result, $7 the current offset
+  6= 7=1
+  for 2 3 4 in "$@[8,-1]"; do
+    6+=${5[$7,$2]}$4
+    7=$(( $3 + 1 ))
+  done
+  6+=${5[$7,-1]}
+else
+  # in ERE, we can't use an offset so ^, (and \<, \b, \B, [[:<:]] where
+  # available) won't work properly.
+  while
+    if [[ $5 =~ $2 ]]; then
+      # append initial part and substituted match
+      6+=${5[1,MBEGIN-1]}${(Xe)3}
+      # truncate remaining string
+      if (( MEND < MBEGIN )); then
+	# zero-width match, skip one character for the next match
+	(( MEND++ ))
+	6+=${5[1]}
+      fi
+      5=${5[MEND+1,-1]}
+      # indicate we did something
+      7=1
+    fi
+    [[ -n $5 ]]
+  do
+    continue
+  done
+  [[ -n $7 ]] || return # no match
+  6+=$5
+fi
+
+# assign result to target variable if at least one substitution was
+# made.  At this point, if the variable was originally array or assoc, it
+# is converted to scalar. If $1 doesn't contain a valid lvalue
+# specification, an exception is raised (exits the shell process if
+# non-interactive).
+: ${(P)1::="$6"}


^ permalink raw reply	[relevance 7%]

* Re: 'while do done' hangs interactive zsh
  @ 2021-05-16 16:43  4% ` Stephane Chazelas
    0 siblings, 1 reply; 200+ results
From: Stephane Chazelas @ 2021-05-16 16:43 UTC (permalink / raw)
  To: Arseny Maslennikov; +Cc: zsh-workers

2021-05-16 12:16:24 +0300, Arseny Maslennikov:
> Hi everyone!
> 
> When zsh tries to execute "while do; done", it enters a busy loop:
> 
> % dash -c 'while do; done'
> dash: 1: Syntax error: "do" unexpected
> % bash -c 'while do; done'
> bash: -c: line 1: syntax error near unexpected token `do'
> bash: -c: line 1: `while do; done'
> % zsh -c 'while do; done' 	# never finishes/prompts by itself
> ^C
> zsh -c 'while do; done'  27,73s user 0,00s system 99% cpu 27,732 total 4k maxrss
> 
> Even more, if the user enters "while do; done" in an interactive zsh
> instance, the busy loop is not interruptible by ^C, ^\ or ^Z; the shell
> has to be killed via some external means.
> 
> To be fair, I have discovered the bug with the semicolon omitted ("while do done").
[...]

As far as I can tell, it works as documented.

while LIST do LIST done

LIST is not explicitely specified, but it does appear to be a
list of 0 or more pipelines. Or in other words any script.

So:

while do done

Runs the empty list of pipelines as long as the empty list of
pipelines is successful.

You'll see you can also do

if then echo the empty list is successful; fi

repeat 1000000 do done

myfunc() { }

if [ -e x ]; then else echo does not exist; fi

That does not even make zsh non-POSIX compliant, as those are
not valid POSIX sh syntax, so implementations are free to do
whatever they want.

If you want your *script* to be portable, you should not write:

while do echo yes; done

as a forever loop, as other shells require at least one pipeline
in the condition LIST (which to me just looks like an
arbitrary, unecessary limitation), but that does not mean shell
implementations have to return an error here.

-- 
Stephane






^ permalink raw reply	[relevance 4%]

* Re: 'while do done' hangs interactive zsh
  @ 2021-05-16 18:25  5%     ` Martijn Dekker
  0 siblings, 0 replies; 200+ results
From: Martijn Dekker @ 2021-05-16 18:25 UTC (permalink / raw)
  To: zsh-workers

Op 16-05-21 om 20:02 schreef Bart Schaefer:
> Bash requires at least one pipeline in the do-LIST as well.
> 
> Is this worth making into an emulation-mode thing, i.e., adding a
> couple of more conditions to my while-do-done patch?

My understanding of the emulation mode is that it attempts to make the 
changes necessary to eliminate incompatibilities with the POSIX 
standard. This does not require disabling extensions that are compatible 
with it.

The two empty command lists in 'while do done' are both straightforward 
syntax errors in POSIX, so the extension to allow them is not 
incompatible with the standard; there's no syntactic clash with the 
POSIX equivalent, 'while :; do :; done'. So I see no need for the 
emulation mode to disallow empty command lists.

AFAIK there's only one shell with a POSIX mode that attempts to disallow 
(almost) everything not specified by the standard, and that's yash.

-- 
||	modernish -- harness the shell
||	https://github.com/modernish/modernish
||
||	KornShell lives!
||	https://github.com/ksh93/ksh


^ permalink raw reply	[relevance 5%]

* Re: $PPID not updated when the PPID changes (parent killed)
    @ 2021-05-18 15:56  4%         ` Stephane Chazelas
  1 sibling, 0 replies; 200+ results
From: Stephane Chazelas @ 2021-05-18 15:56 UTC (permalink / raw)
  To: zsh-workers

2021-05-17 18:27:00 -0400, Phil Pennock:
> On 2021-05-17 at 14:00 -0700, Bart Schaefer wrote:
> > Still mulling over possible rewording (at the very least change "for"
> > to "with" in that phrase).  Suggestions that don't try to explain unix
> > process hierarchy management in detail, are welcome.
> 
> PPID <S>
>   The initial parent process ID; that is, the process ID of the process
>   which created this shell process, at the time that it did so.
>   Just as for $$, the value is only set for the original shell and does
>   not dynamically change for implicit subshells (as created for (list)
>   and for pipelines).
[...]


processes don't really create shell processes. A process may or
may  not fork itself, and then, maybe at a later point in
either the parent or the child (generally the child) execute a
shell (and generally, the parent will be waiting for that child).

For PPID, POSIX specification of sh says:

> Set by the shell to the decimal value of its parent process ID
> during initialization of the shell

Which is more accurate and clearer than any wording I can think
of. Note that by the time the shell "initialises" (where it
calls getppid() to fill in $PPID), the process that did fork the
process that executed the shell ($$) may alread be gone.

As in:

$ ( (sleep 1; exec zsh -c 'print $PPID') &)
1

I kind of agree with Vincent that it would be more useful if
$PPID reported the realtime value of the parent pid, but no
other shell does it and that would break POSIX compliance, and we
already have sysparam[ppid] as already noted.

-- 
Stephane


^ permalink raw reply	[relevance 4%]

* Re: $PPID not updated when the PPID changes (parent killed)
    @ 2021-05-18 18:06  3%           ` Stephane Chazelas
  2021-05-18 18:12  0%             ` Bart Schaefer
  1 sibling, 1 reply; 200+ results
From: Stephane Chazelas @ 2021-05-18 18:06 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: Zsh hackers list

2021-05-17 16:15:24 -0700, Bart Schaefer:
[...]
> Indeed.  I'm tempted to say
> 
>   Just as with $$, the value is updated only within a new shell
>   that increases $SHLVL, and not in other subshells.
[...]

$ (SHLVL=0; zsh -c 'echo $SHLVL $$ $PPID; sleep 2; exec zsh -c "echo \$SHLVL \$$ \$PPID"' & sleep 1)
1 485756 485755
1 485756 302910

(where in that case 302910 is the pid of the systemd user's
session child subreaper, traditionally, one would get 1
instead).

$PPID, like $$ are set when the shell is initialised, just after
it had been executed.

In the example above, the same 485756 process executed zsh twice
and $$ and $PPID were set twice.

Because of the exec (and it would have been the same without
exec in a few contexts where zsh skips forks implicitly), $SHLVL
is not incremented (well it is decremented by the first zsh
before exec and incremented again by the second).

$SHLVL (a (t)csh thing IIRC, not handled by all shells) is the
number of shell *invocations* you need to exit before that logs
you out.

I would find it much clearer if we described $$/$PPID in
relation to shell invocation initialisation like POSIX does.

-- 
Stephane



^ permalink raw reply	[relevance 3%]

* Re: $PPID not updated when the PPID changes (parent killed)
  2021-05-18 18:06  3%           ` Stephane Chazelas
@ 2021-05-18 18:12  0%             ` Bart Schaefer
  2021-05-18 18:50  3%               ` $SHLVL origin (was: $PPID not updated when the PPID changes (parent killed)) Stephane Chazelas
  0 siblings, 1 reply; 200+ results
From: Bart Schaefer @ 2021-05-18 18:12 UTC (permalink / raw)
  To: Bart Schaefer, Zsh hackers list

On Tue, May 18, 2021 at 11:06 AM Stephane Chazelas
<stephane@chazelas.org> wrote:
>
> $SHLVL (a (t)csh thing IIRC, not handled by all shells)

Bash has it, for sure.

> I would find it much clearer if we described $$/$PPID in
> relation to shell invocation initialisation like POSIX does.

I'm tending to agree.


^ permalink raw reply	[relevance 0%]

* $SHLVL origin (was: $PPID not updated when the PPID changes (parent killed))
  2021-05-18 18:12  0%             ` Bart Schaefer
@ 2021-05-18 18:50  3%               ` Stephane Chazelas
  0 siblings, 0 replies; 200+ results
From: Stephane Chazelas @ 2021-05-18 18:50 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: Zsh hackers list

2021-05-18 11:12:54 -0700, Bart Schaefer:
> On Tue, May 18, 2021 at 11:06 AM Stephane Chazelas
> <stephane@chazelas.org> wrote:
> >
> > $SHLVL (a (t)csh thing IIRC, not handled by all shells)
> 
> Bash has it, for sure.
[...]

I remember looking up the origin of it when we were discussing
https://www.zsh.org/mla/workers/2016/msg01574.html

It does come from tcsh in the early 80s (see
https://groups.google.com/forum/message/raw?msg=net.sources/3eER9GEdo2c/B9G1KGziIx4J
for instance).

Also supported by bash, ksh93, fish, zsh and yash (implement in
startup file as shell code only for interactive instances
there), but not much else and not in POSIX.

-- 
Stephane


^ permalink raw reply	[relevance 3%]

* Re: $PPID not updated when the PPID changes (parent killed)
  @ 2021-05-19  4:25  9%               ` Bart Schaefer
  0 siblings, 0 replies; 200+ results
From: Bart Schaefer @ 2021-05-19  4:25 UTC (permalink / raw)
  To: Zsh hackers list

[-- Attachment #1: Type: text/plain, Size: 906 bytes --]

On Tue, May 18, 2021 at 7:53 AM Bart Schaefer <schaefer@brasslantern.com> wrote
>
> PPID is not a special variable.

Well, I have to take that back; it IS documented as special, but only
because it's readonly (which it also is in e.g. bash).

Anyway, as per Stephane Chazelas,
> POSIX specification of sh says:
>
> > Set by the shell to the decimal value of its parent process ID
> > during initialization of the shell
>
> [...] it would be more useful if
> $PPID reported the realtime value of the parent pid, but no
> other shell does it and that would break POSIX compliance, and we
> already have sysparam[ppid] as already noted.

POSIX doesn't say whether it should be readonly, as far as I can tell.
It is not readonly when bash is invoked as "sh" but remains readonly
in zsh's sh emulation, which might be considered a bug.

So ... hopefully the attached patch addresses the assorted issues raised.

[-- Attachment #2: PPID.txt --]
[-- Type: text/plain, Size: 2403 bytes --]

diff --git a/Doc/Zsh/params.yo b/Doc/Zsh/params.yo
index dc28a45ae..b514eb072 100644
--- a/Doc/Zsh/params.yo
+++ b/Doc/Zsh/params.yo
@@ -654,10 +654,11 @@ Same as tt(#).
 )
 vindex($)
 item(tt($) <S>)(
-The process ID of this shell.  Note that this indicates the original
-shell started by invoking tt(zsh); all processes forked from the shells
-without executing a new program, such as subshells started by
-tt(LPAR())var(...)tt(RPAR()), substitute the same value.
+The process ID of this shell, set when the shell initializes.  Processes
+forked from the shell without executing a new program, such as command
+substitutions and commands grouped with tt(LPAR())var(...)tt(RPAR()),
+are subshells that duplicate the current shell, and thus substitute the
+same value for tt($$) as their parent shell.
 )
 vindex(-)
 item(tt(-) <S>)(
@@ -817,9 +818,9 @@ The operating system, as determined at compile time.
 )
 vindex(PPID)
 item(tt(PPID) <S>)(
-The process ID of the parent of the shell.  As for tt($$), the
-value indicates the parent of the original shell and does not
-change in subshells.
+The process ID of the parent of the shell, set when the shell initializes.
+As with tt($$), the value does not change in subshells created as a
+duplicate of the current shell.
 )
 vindex(PWD)
 item(tt(PWD))(
diff --git a/Test/E03posix.ztst b/Test/E03posix.ztst
index 7db4c0c84..564afac29 100644
--- a/Test/E03posix.ztst
+++ b/Test/E03posix.ztst
@@ -161,3 +161,6 @@ F:POSIX has neither math functions nor floating point
 0f:Width of %s is computed in bytes not characters
 F:This is considered a bugfix in zsh
 ><  Stéphane>
+
+  PPID=foo
+-f:PPID is not a readonly variable
diff --git a/Doc/Zsh/mod_system.yo b/Doc/Zsh/mod_system.yo
index 8f525c576..399b6fe03 100644
--- a/Doc/Zsh/mod_system.yo
+++ b/Doc/Zsh/mod_system.yo
@@ -263,9 +263,9 @@ tt($$), which returns the process ID of the main shell process.
 )
 item(tt(ppid))(
 vindex(ppid, sysparams)
-Returns the process ID of the parent of the current process, even in
-subshells.  Compare tt($PPID), which returns the process ID of the parent
-of the main shell process.
+Returns the current process ID of the parent of the current process, even
+in subshells.  Compare tt($PPID), which returns the process ID of the
+initial parent of the main shell process.
 )
 item(tt(procsubstpid))(
 Returns the process ID of the last process started for process

^ permalink raw reply	[relevance 9%]

* Re: [PATCH (not final)] (take three?) unset "array[$anything]"
  @ 2021-06-05 17:05  4%                   ` Stephane Chazelas
  0 siblings, 0 replies; 200+ results
From: Stephane Chazelas @ 2021-06-05 17:05 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: Zsh hackers list

2021-06-04 17:20:29 -0700, Bart Schaefer:
[...]
> > array[1 + 1]=4
> >
> > That is pretty annoying.
> 
> That's just shell whitespace rules, though.  If you have nobadpattern
> set, you get
> 
> zsh: command not found: array[1
> 
> And if the parser doesn't eventually find ]= then what?  Re-parse the
> whole thing to word-split it?
[...]

Note that all other shells that support a[1]=value (ksh, pdksh,
bash) do it.

In effect that makes them non-POSIX as there's nothing in the
spec POSIX that says

a[1 + 1]=2

May not run the a[1 with +] and =2 as arguments.

I did bring that up a few years ago at:
https://www.mail-archive.com/austin-group-l@opengroup.org/msg04563.html
(see also https://austingroupbugs.net/view.php?id=1279)

There is variation in behaviour between shells if the first word
starts with name[ and either a matching ] or matching ] followed
by = is not found, and how that matching is done or what kind of
quoting are supported inside the [...].

But all in all, even if it may not be pretty when you look closely,
that does work fine there as long as you're not trying to fool
the parser.

In zsh, that would be even less problematic as (at least when
not in sh emulation), zsh complains about unmatched [s or ]s
(except for [ alone)

Even:

$ /bin/[ a = a ]
zsh: bad pattern: /bin/[

So we wouldn't be breaking anything if we started to accept:

hash[foo bar; baz]=x

or

array[1 + 1]=x

We would if we started to accept.

hash['x]y'-$'\n']=x

like ksh93/bash do though.

For literal hash[key]=value assignment, I never remember what needs
to be quoted and how. I generally resort to doing
var=key; hash[$var]=x
or
hash+=(key x)
which I know are fine.

-- 
Stephane


^ permalink raw reply	[relevance 4%]

* Re: [BUG] builtin echo doesn't check write error
  @ 2021-06-09 18:16  3%   ` Stephane Chazelas
  2021-06-10  8:11  0%     ` Vincent Lefevre
  2021-06-24  8:47  0%     ` Vincent Lefevre
  0 siblings, 2 replies; 200+ results
From: Stephane Chazelas @ 2021-06-09 18:16 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: Zsh hackers list

2021-06-09 09:13:42 -0700, Bart Schaefer:
[...]
> My (possibly poor) recollection is that this was made this way in part
> for ports to environments that don't have a /dev/null device

While that sounds like a very plausible reason for the original
behaviour whereby "print" would not report any write error,
that doesn't really tie up with the current behaviour where
the error is supressed only when print/echo's stdout is
explicitly closed.

Why would one write print foo >&- in the first place, other than
to check whether print reports error or not (and in that regard,
the behaviour is very misleading)

From looking at the history, it looks more like:

1990 (1.0) echo ignores write failures (by design or not).
1999 workers/9129 Peter writes the "print foo >&-" succeeds, no
     error test case, just documenting the actual behaviour of
     print ignoring errors (here using >&- as the easiest way to
     trigger a write error).
2002 workers/16503 Clint adds some error messages upon write
     errors.
2002 workers/16556 we realise it breaks the test case above, so
     Bart removes the error message on EBADF for that test case
     to pass again. The fact that there's still an error message
     in (print)>&- looks like an oversight. The error in that
     case is output by execcmd_exec after print has returned as
     it tries to fflush stdout again,, not bin_print (you'll
     notice the error message doesn't mention "print").
2011 workers/29845 Peter notices the error is displayed in
     (exec >&-; print) and adds a test case for it, but I'm not
     sure he correctly identified why.

It very much looks like an (multiple) accident of
implementation.

POSIX does say that printf/echo should return with a non-zero
exit status upon error, and stderr be used for diagnostix
errors as usual. It's not clear to me if implementations are at
liberty to decide whether a write() error is considered an error
or not.

In any case, it would be useful from an error point of view to
be able to detect when writing fails.

-- 
Stephane


^ permalink raw reply	[relevance 3%]

* Re: [BUG] builtin echo doesn't check write error
  2021-06-09 18:16  3%   ` Stephane Chazelas
@ 2021-06-10  8:11  0%     ` Vincent Lefevre
  2021-06-24  8:47  0%     ` Vincent Lefevre
  1 sibling, 0 replies; 200+ results
From: Vincent Lefevre @ 2021-06-10  8:11 UTC (permalink / raw)
  To: zsh-workers; +Cc: Bart Schaefer

On 2021-06-09 19:16:17 +0100, Stephane Chazelas wrote:
> 2011 workers/29845 Peter notices the error is displayed in
>      (exec >&-; print) and adds a test case for it, but I'm not
>      sure he correctly identified why.

I also find this disturbing:

zira% (exec >&-; echo)
zsh: write error: bad file descriptor
zira% (exec >&-; echo >&-)
zira% 

(or with "print" instad of "echo").

> POSIX does say that printf/echo should return with a non-zero
> exit status upon error, and stderr be used for diagnostix
> errors as usual. It's not clear to me if implementations are at
> liberty to decide whether a write() error is considered an error
> or not.

Well, in almost all cases, e.g. when the close is not in the same
command, and when this is not fd 1 (stdout), but other fd, such as
in "echo foo 3>&- >&3", one gets an error. So this is already very
inconsistent.

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


^ permalink raw reply	[relevance 0%]

* Re: Where is this =(:) construct documented?
  @ 2021-06-11 19:58  3%   ` Roman Perepelitsa
  0 siblings, 0 replies; 200+ results
From: Roman Perepelitsa @ 2021-06-11 19:58 UTC (permalink / raw)
  To: Zach Riggle, Zsh hackers list

On Fri, Jun 11, 2021 at 9:53 PM Stephane Chazelas <stephane@chazelas.org> wrote:
>
> That's the third form of process substitution.

And the colon in =(:) is a builtin that does nothing (the same as
true). It's mandated by POSIX.

Roman.


^ permalink raw reply	[relevance 3%]

* Re: [PATCH (not final)] (take three?) unset "array[$anything]"
  @ 2021-06-14  7:19  5%                         ` Stephane Chazelas
  0 siblings, 0 replies; 200+ results
From: Stephane Chazelas @ 2021-06-14  7:19 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: Peter Stephenson, Zsh hackers list

2021-06-13 14:44:03 -0700, Bart Schaefer:
> On Sun, Jun 13, 2021 at 12:50 PM Peter Stephenson
> <p.w.stephenson@ntlworld.com> wrote:
> >
> > Yes, in fact those are the same thoughts that flitted through my mind.
> 
> One other idea ... NO_UNSET could warn if you unset something that's
> not set, as well as when you $deref something that's not set.  That
> would at least blat at you if your hash key was misinterpreted.

Note that nounset is a POSIX option. And for the unset special
utility:

"Unsetting a variable or function that was not previously set
shall not be considered an error and does not cause the shell to
abort."

POSIX has no jurisdiction over arrays/hashes, but that does mean
we can't have unset fail on unset variables when in sh emulation
at least.

A shell that would fail upon:

  unset var

When var was not previously set would not be compliant.

A script that would do

  unset "var[foo]"

Would not be a POSIX script as var[foo] is not a valid variable
name, so implementations are free to do whatever they want for
them. But if zsh returned failure for when var[foo] is not set
and not in unset var, that would make it quite inconsistent.

Changing the behaviour would likely break some scripts that use
errexit as well.

-- 
Stephane


^ permalink raw reply	[relevance 5%]

* archived messages with "From " get truncated
@ 2021-06-24  8:36  2% Vincent Lefevre
  0 siblings, 0 replies; 200+ results
From: Vincent Lefevre @ 2021-06-24  8:36 UTC (permalink / raw)
  To: zsh-workers

Below is a message that was sent by Stephane to workers.
It has been archived here:

  https://www.zsh.org/mla/workers/2021/msg01272.html

but got truncated just before a line starting with "From ".
It seems that the mail archive software is buggy, thinking
that this starts a new mail message.

In the archives, there is a risk that this message gets truncated
in the forwarded message below, for the same reason. For those who
read the archive, one has, with quotes to avoid the truncation:

[...]
> Why would one write print foo >&- in the first place, other than
> to check whether print reports error or not (and in that regard,
> the behaviour is very misleading)
> 
> From looking at the history, it looks more like:
> 
> 1990 (1.0) echo ignores write failures (by design or not).
[...]

----- Forwarded message from Stephane Chazelas <stephane@chazelas.org> -----

Date: Wed, 9 Jun 2021 19:16:17 +0100
From: Stephane Chazelas <stephane@chazelas.org>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: [BUG] builtin echo doesn't check write error

2021-06-09 09:13:42 -0700, Bart Schaefer:
[...]
> My (possibly poor) recollection is that this was made this way in part
> for ports to environments that don't have a /dev/null device

While that sounds like a very plausible reason for the original
behaviour whereby "print" would not report any write error,
that doesn't really tie up with the current behaviour where
the error is supressed only when print/echo's stdout is
explicitly closed.

Why would one write print foo >&- in the first place, other than
to check whether print reports error or not (and in that regard,
the behaviour is very misleading)

From looking at the history, it looks more like:

1990 (1.0) echo ignores write failures (by design or not).
1999 workers/9129 Peter writes the "print foo >&-" succeeds, no
     error test case, just documenting the actual behaviour of
     print ignoring errors (here using >&- as the easiest way to
     trigger a write error).
2002 workers/16503 Clint adds some error messages upon write
     errors.
2002 workers/16556 we realise it breaks the test case above, so
     Bart removes the error message on EBADF for that test case
     to pass again. The fact that there's still an error message
     in (print)>&- looks like an oversight. The error in that
     case is output by execcmd_exec after print has returned as
     it tries to fflush stdout again,, not bin_print (you'll
     notice the error message doesn't mention "print").
2011 workers/29845 Peter notices the error is displayed in
     (exec >&-; print) and adds a test case for it, but I'm not
     sure he correctly identified why.

It very much looks like an (multiple) accident of
implementation.

POSIX does say that printf/echo should return with a non-zero
exit status upon error, and stderr be used for diagnostix
errors as usual. It's not clear to me if implementations are at
liberty to decide whether a write() error is considered an error
or not.

In any case, it would be useful from an error point of view to
be able to detect when writing fails.

-- 
Stephane

----- End of forwarded message -----

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


^ permalink raw reply	[relevance 2%]

* Re: [BUG] builtin echo doesn't check write error
  2021-06-09 18:16  3%   ` Stephane Chazelas
  2021-06-10  8:11  0%     ` Vincent Lefevre
@ 2021-06-24  8:47  0%     ` Vincent Lefevre
  1 sibling, 0 replies; 200+ results
From: Vincent Lefevre @ 2021-06-24  8:47 UTC (permalink / raw)
  To: zsh-workers; +Cc: Bart Schaefer

Since this message from Stephane got truncated in the archives
before a line starting with "From "

  https://www.zsh.org/mla/workers/2021/msg01272.html

I'm including it entirely below, quoted to avoid this issue.
I've just posted a message

  https://www.zsh.org/mla/workers/2021/msg01334.html
  archived messages with "From " get truncated

about this truncation issue.

Note also about the bug in echo/print/etc., this actually seems
to affect *all* builtins. For instance:

zira% (exec >&-; echo)
zsh: write error: bad file descriptor
zira% (exec >&-; echo >&-)
zira% (exec >&-; print)
zsh: write error: bad file descriptor
zira% (exec >&-; print >&-)
zira% (exec >&-; printf "\n")
zsh: write error: bad file descriptor
zira% (exec >&-; printf "\n" >&-)
zira% (exec >&-; pwd)
zsh: write error: bad file descriptor
zira% (exec >&-; pwd >&-)
zira% (exec >&-; history)
zsh: write error: bad file descriptor
zira% (exec >&-; history >&-)
zira% 

On 2021-06-09 19:16:17 +0100, Stephane Chazelas wrote:
> 2021-06-09 09:13:42 -0700, Bart Schaefer:
> [...]
> > My (possibly poor) recollection is that this was made this way in part
> > for ports to environments that don't have a /dev/null device
> 
> While that sounds like a very plausible reason for the original
> behaviour whereby "print" would not report any write error,
> that doesn't really tie up with the current behaviour where
> the error is supressed only when print/echo's stdout is
> explicitly closed.
> 
> Why would one write print foo >&- in the first place, other than
> to check whether print reports error or not (and in that regard,
> the behaviour is very misleading)
> 
> From looking at the history, it looks more like:
> 
> 1990 (1.0) echo ignores write failures (by design or not).
> 1999 workers/9129 Peter writes the "print foo >&-" succeeds, no
>      error test case, just documenting the actual behaviour of
>      print ignoring errors (here using >&- as the easiest way to
>      trigger a write error).
> 2002 workers/16503 Clint adds some error messages upon write
>      errors.
> 2002 workers/16556 we realise it breaks the test case above, so
>      Bart removes the error message on EBADF for that test case
>      to pass again. The fact that there's still an error message
>      in (print)>&- looks like an oversight. The error in that
>      case is output by execcmd_exec after print has returned as
>      it tries to fflush stdout again,, not bin_print (you'll
>      notice the error message doesn't mention "print").
> 2011 workers/29845 Peter notices the error is displayed in
>      (exec >&-; print) and adds a test case for it, but I'm not
>      sure he correctly identified why.
> 
> It very much looks like an (multiple) accident of
> implementation.
> 
> POSIX does say that printf/echo should return with a non-zero
> exit status upon error, and stderr be used for diagnostix
> errors as usual. It's not clear to me if implementations are at
> liberty to decide whether a write() error is considered an error
> or not.
> 
> In any case, it would be useful from an error point of view to
> be able to detect when writing fails.

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


^ permalink raw reply	[relevance 0%]

* Re: [PR] vcs_info-examples: optimize +vi-git-untracked() #76
  @ 2021-06-28 17:16  3%   ` Suraj N. Kurapati
  0 siblings, 0 replies; 200+ results
From: Suraj N. Kurapati @ 2021-06-28 17:16 UTC (permalink / raw)
  To: Oliver Kiddle; +Cc: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 517 bytes --]

On Sun, 27 Jun 2021 11:13:53 +0200, Oliver Kiddle wrote:
> > Speed up the prompt on large and/or deep working directories by
> > stopping grep(1) as soon as it finds a single match, with `-q`.  
> 
> The -q option to grep isn't strictly portable. It is certainly lacking
> on Solaris.

POSIX (IEEE Std 1003.1-2017) says that grep(1) supports the `-q` option:

  https://pubs.opengroup.org/onlinepubs/9699919799/utilities/grep.html

Consequently, I'm surprised to hear that Solaris doesn't implement this.

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 963 bytes --]

^ permalink raw reply	[relevance 3%]

* PATCH: use singular form for completion group descriptions for consistency
@ 2021-07-06 23:53  1% Oliver Kiddle
  0 siblings, 0 replies; 200+ results
From: Oliver Kiddle @ 2021-07-06 23:53 UTC (permalink / raw)
  To: Zsh workers

When fixing one small thing in a completion function, it can be hard
to resist the temptation to clean up lots of other issues. Resulting
patches likely aren't easy to review. So I'll try the opposite tack for
a few particular issues that can be corrected across many functions. I
don't know if this is any easier for anyone else to digest? It is still
a patch touching many files but it mostly only does one thing.

The convention we generally use for the headings on completion match
groups is to use the singular form. I assume the original rationale is
that only one value gets completed (even if it forms one of a list). But
for the purposes of this patch, the rationale is consistency.

I was using grep to find plural descriptions so relied on most English
plurals ending in an s. I tried to avoid making other changes but have
corrected indentation, capitalised descriptions and fixed the tag where
tag and description were transposed (e.g. with _alternative). Also,
there were cases where the plural was indicative that a list was allowed
and _dir_list or _sequence could be used so I did correct that.

A common case that I didn't bother with is unused descriptions on
states, such as '*::args:->state'

Oliver

diff --git a/Completion/BSD/Command/_portmaster b/Completion/BSD/Command/_portmaster
index 48390c9ad..ee6fefc6e 100644
--- a/Completion/BSD/Command/_portmaster
+++ b/Completion/BSD/Command/_portmaster
@@ -8,11 +8,11 @@ _portmaster_ports() {
   local expl ret=1 _fbsd_ports _fbsd_cat
    _fbsd_cat=(${PORTSDIR:-/usr/ports}/[a-z]*(/:t))
    if [[ $PREFIX != */* ]] ; then
-     _wanted cat_packages expl 'category/ports' compadd -S '/' $_fbsd_cat
+     _wanted cat_packages expl 'category/port' compadd -S '/' $_fbsd_cat
    else
      compset -P '*/'
      _fbsd_ports=(${PORTSDIR:-/usr/ports}/$IPREFIX/*(/:t))
-     _wanted cat_packages expl 'category/ports' compadd $_fbsd_ports
+     _wanted cat_packages expl 'category/port' compadd $_fbsd_ports
    fi
   return ret
 }
@@ -77,7 +77,7 @@ _portmaster() {
       _arguments -s \
       $standalone_args \
       $common_args \
-      '*:packages and ports:_portmaster_pkgs_and_ports'
+        '*:package or port:_portmaster_pkgs_and_ports'
     else 
       case "$words[2]" in
 	--clean-distfiles|--clean-distfiles-all|--check-depends|--check-port-dbdir|--version|-help|-h)
@@ -86,14 +86,14 @@ _portmaster() {
 	*)
 	if (( $words[(I)-(e|r)] ));then
 	  _arguments -s \
-	  '*:packages:_portmaster_pkgs'
+            '*:package:_portmaster_pkgs'
 	elif (( kid=$words[(I)-o] ));then
 	  if (( CURRENT == $kid + 1 ));then
 	    _arguments -s \
-	    '*:ports replacing:_portmaster_ports'
+              '*:replacement port:_portmaster_ports'
 	  elif (( CURRENT == $kid + 2 )); then
 	    _arguments -s \
-	    '*:package to replace:_portmaster_pkgs'
+              '*:package to replace:_portmaster_pkgs'
 	  else 
 	    return 0
 	  fi
@@ -102,7 +102,7 @@ _portmaster() {
 	else
 	  _arguments -s \
 	  $common_args \
-	  '*:packages and ports:_portmaster_pkgs_and_ports'
+            '*:package or port:_portmaster_pkgs_and_ports'
 	fi
 	;;
       esac
diff --git a/Completion/BSD/Command/_sysrc b/Completion/BSD/Command/_sysrc
index f0c12a2be..892dac407 100644
--- a/Completion/BSD/Command/_sysrc
+++ b/Completion/BSD/Command/_sysrc
@@ -29,7 +29,7 @@ _sysrc() {
     '(- *)-h[print short usage message]' \
     '(- *)--help[print full usage message]' \
     '-i[ignore unknown variables]' \
-    '-j+[jail to operate within]:jails:_jails' \
+    '-j+[jail to operate within]:jail:_jails' \
     '-n[print only variable values]' \
     '-N[print only variable names]' \
     '-R+[specify an alternative root]:alternative root:_files -/' \
diff --git a/Completion/BSD/Command/_systat b/Completion/BSD/Command/_systat
index 7d837790a..03df07631 100644
--- a/Completion/BSD/Command/_systat
+++ b/Completion/BSD/Command/_systat
@@ -84,7 +84,7 @@ esac
 
 if (( $#screens )); then
   _arguments -M 'r:|.=* r:|=*' : $opts \
-    '1:systat(1) displays:(( ${pre}$^screens ))' \
+    '1:systat(1) display:(( ${pre}$^screens ))' \
     '2:refresh interval'
   return
 fi
diff --git a/Completion/Base/Widget/_bash_completions b/Completion/Base/Widget/_bash_completions
index 7abb654d4..feb721451 100644
--- a/Completion/Base/Widget/_bash_completions
+++ b/Completion/Base/Widget/_bash_completions
@@ -32,7 +32,7 @@ local key=$KEYS[-1] expl
 case $key in
   '!') _main_complete _command_names
        ;;
-  '$') _main_complete - parameters _wanted parameters expl 'exported parameters' \
+  '$') _main_complete - parameters _wanted parameters expl 'exported parameter' \
                                        _parameters -g '*export*'
        ;;
   '@') _main_complete _hosts
diff --git a/Completion/Base/Widget/_complete_tag b/Completion/Base/Widget/_complete_tag
index 5b50f1d85..397b8d901 100644
--- a/Completion/Base/Widget/_complete_tag
+++ b/Completion/Base/Widget/_complete_tag
@@ -50,13 +50,13 @@ if [[ -f $c_path$c_Tagsfile ]]; then
         -e '/^[a-zA-Z_].*/p' $c_path$c_Tagsfile))
 #  c_tags_array=($(perl -ne '/([a-zA-Z_0-9]+)[ \t:;,\(]*\x7f/ &&
 #                  print "$1\n"' $c_path$c_Tagsfile))
-  _main_complete - '' _wanted etags expl 'emacs tags' \
+  _main_complete - '' _wanted etags expl 'emacs tag' \
       compadd -a c_tags_array
 elif [[ -f $c_path$c_tagsfile ]]; then
   # tags doesn't have as much in, but the tag is easy to find.
   # we can use awk here.
   c_tags_array=($(awk '{ print $1 }' $c_path$c_tagsfile))
-  _main_complete - '' _wanted vtags expl 'vi tags' compadd -a c_tags_array
+  _main_complete - '' _wanted vtags expl 'vi tag' compadd -a c_tags_array
 else
   return 1
 fi
diff --git a/Completion/Darwin/Command/_defaults b/Completion/Darwin/Command/_defaults
index ca5d87e65..b05222af6 100644
--- a/Completion/Darwin/Command/_defaults
+++ b/Completion/Darwin/Command/_defaults
@@ -42,7 +42,7 @@ _defaults(){
       _arguments \
         "(1)-app:application:_mac_applications" \
         "(-app)1:domain:_defaults_domains" \
-        "2:keys:_defaults_keys"
+        "2:key:_defaults_keys"
       ;;
     write)
       _arguments \
diff --git a/Completion/Darwin/Command/_hdiutil b/Completion/Darwin/Command/_hdiutil
index 04e81e655..20e69cbc5 100644
--- a/Completion/Darwin/Command/_hdiutil
+++ b/Completion/Darwin/Command/_hdiutil
@@ -10,7 +10,7 @@ _hdiutil_disk() {
       disk_desc+=( "$disk_name:${${(M)REPLY%	*}#?}" )
     fi
   done
-  _describe -t devices disks disk_desc
+  _describe -t devices disk disk_desc
 }
 
 _hdiutil_device() {
@@ -143,7 +143,7 @@ _hdiutil(){
   _arguments -C '*:: :->subcmds'
 
   if (( CURRENT == 1 )); then
-    _describe -t commands "hdiutil subcommands" _1st_arguments
+    _describe -t commands "hdiutil subcommand" _1st_arguments
     return
   fi
 
diff --git a/Completion/Darwin/Command/_softwareupdate b/Completion/Darwin/Command/_softwareupdate
index 6db577b06..6054fd768 100644
--- a/Completion/Darwin/Command/_softwareupdate
+++ b/Completion/Darwin/Command/_softwareupdate
@@ -55,7 +55,7 @@ _softwareupdate() {
       ignored_subcmd=(add remove)
 
       if (( CURRENT == 1 )); then
-        _describe -t commands "subcommands" ignored_subcmd && return 0
+        _describe -t commands "subcommand" ignored_subcmd && return 0
       fi
       case $words[1] in
         add)
diff --git a/Completion/Debian/Command/_apt b/Completion/Debian/Command/_apt
index 4d60cd249..494d3bf82 100644
--- a/Completion/Debian/Command/_apt
+++ b/Completion/Debian/Command/_apt
@@ -531,7 +531,7 @@ _apt-cache () {
     --installed:bool \
     -- \
     /$'help\0'/ \| \
-    /$'add\0'/ /$'[^\0]#\0'/ ':files:index files:_files' \# \| \
+    /$'add\0'/ /$'[^\0]#\0'/ ':files:index file:_files' \# \| \
     /$'gencaches\0'/ \| \
     /$'showpkg\0'/ /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" avail' \# \| \
     /$'showsrc\0'/ /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" avail' \# \| \
diff --git a/Completion/Debian/Command/_axi-cache b/Completion/Debian/Command/_axi-cache
index bdefdd979..5fd4c38f8 100644
--- a/Completion/Debian/Command/_axi-cache
+++ b/Completion/Debian/Command/_axi-cache
@@ -10,7 +10,7 @@ _arguments \
   '*:args:->args' && return 0
 
 if (( CURRENT == 2 )); then
-  _wanted tag expl 'axi-cache commands' \
+  _wanted tag expl 'axi-cache command' \
     compadd help search more last show again info \
     rdetails depends madison policy showpkg showsrc
 else
diff --git a/Completion/Debian/Command/_lintian b/Completion/Debian/Command/_lintian
index 71e71ee3d..03491624f 100644
--- a/Completion/Debian/Command/_lintian
+++ b/Completion/Debian/Command/_lintian
@@ -8,8 +8,8 @@ case "$service" in
       '(-c -r -u -C -R -S -X --check --check-part --dont-check-part --remove --remove-lab --setup-lab --unpack)'{-S,--setup-lab}'[setup or update the laboratory]' \
       '(-c -r -u -C -R -S -X --check --check-part --dont-check-part --remove --remove-lab --setup-lab --unpack)'{-R,--remove-lab}'[remove the laboratory directory]' \
       '(-c -r -u -C -R -S -X --check --check-part --dont-check-part --remove --remove-lab --setup-lab --unpack)'{-c,--check}'[run all checks over the specified packages]' \
-      '(-c -r -u -C -R -S -X --check --check-part --dont-check-part --remove --remove-lab --setup-lab --unpack)'{-C,--check-part}'[run only the specified checks]:checks:_values -s , "lintian checks" binaries bin changelog-file chg conffiles cnf control-file dctrl control-files ctl copyright-file cpy cruft deb deb-format dfmt debconf dc debdiff dif debian-readme drm debhelper dh description des etcfiles etc fields fld files fil huge-usr-share hus infofiles info init.d ini manpages man md5sums md5 menus men menu-format mnf perl prl po-debconf pd scripts scr shared-libs shl spelling splr standards-version std' \
-      '(-c -r -u -C -R -S -X --check --check-part --dont-check-part --remove --remove-lab --setup-lab --unpack)'{-X,--dont-check-part}'[run only the specified checks]:checks:_values -s , "lintian checks" binaries bin changelog-file chg conffiles cnf control-file dctrl control-files ctl copyright-file cpy cruft deb deb-format dfmt debconf dc debdiff dif debian-readme drm debhelper dh description des etcfiles etc fields fld files fil huge-usr-share hus infofiles info init.d ini manpages man md5sums md5 menus men menu-format mnf perl prl po-debconf pd scripts scr shared-libs shl spelling splr standards-version std' \
+      '(-c -r -u -C -R -S -X --check --check-part --dont-check-part --remove --remove-lab --setup-lab --unpack)'{-C,--check-part}'[run only the specified checks]: :_values -s , "lintian check" binaries bin changelog-file chg conffiles cnf control-file dctrl control-files ctl copyright-file cpy cruft deb deb-format dfmt debconf dc debdiff dif debian-readme drm debhelper dh description des etcfiles etc fields fld files fil huge-usr-share hus infofiles info init.d ini manpages man md5sums md5 menus men menu-format mnf perl prl po-debconf pd scripts scr shared-libs shl spelling splr standards-version std' \
+      '(-c -r -u -C -R -S -X --check --check-part --dont-check-part --remove --remove-lab --setup-lab --unpack)'{-X,--dont-check-part}'[run only the specified checks]: :_values -s , "lintian check" binaries bin changelog-file chg conffiles cnf control-file dctrl control-files ctl copyright-file cpy cruft deb deb-format dfmt debconf dc debdiff dif debian-readme drm debhelper dh description des etcfiles etc fields fld files fil huge-usr-share hus infofiles info init.d ini manpages man md5sums md5 menus men menu-format mnf perl prl po-debconf pd scripts scr shared-libs shl spelling splr standards-version std' \
       '(-c -r -u -C -R -S -X --check --check-part --dont-check-part --remove --remove-lab --setup-lab --unpack)'{-u,--unpack}'[unpack up to unpack level]' \
       '(-c -r -u -C -R -S -X --check --check-part --dont-check-part --remove --remove-lab --setup-lab --unpack)'{-r,--remove}'[clean packages up to current unpack level]' \
       '(-h --help)'{-h,--help}'[help]' \
@@ -23,7 +23,7 @@ case "$service" in
       '(-o --no-override)'{-o,--no-override}'[do not use the overrides file]' \
       '--show-overrides[output tags that have been overridden]' \
       '--color:when:(never always auto)' \
-      '(-U --unpack-info)'{-U,--unpack-info}'[collect information]:info:_values -s , "collectibles" changelog-file copyright-file debfiles debian-readme diffstat doc-base-files file-info init.d md5sums menu-files objdump-info override-file scripts source-control-file' \
+      '(-U --unpack-info)'{-U,--unpack-info}'[collect information]:info:_values -s , "collectible" changelog-file copyright-file debfiles debian-readme diffstat doc-base-files file-info init.d md5sums menu-files objdump-info override-file scripts source-control-file' \
       '(-m --md5sums)'{-m,--md5sums}'[check md5sums when processing a .changes file]' \
       '--allow-root[override warning when run with superuser privileges]' \
       '--cfg:config file:_files' \
diff --git a/Completion/Debian/Command/_module-assistant b/Completion/Debian/Command/_module-assistant
index d75284954..b2c1e56ee 100644
--- a/Completion/Debian/Command/_module-assistant
+++ b/Completion/Debian/Command/_module-assistant
@@ -33,5 +33,5 @@ _arguments -A \
   '(-k --kernel-dir)'{-k,--kernel-dir}'[list of kernel headers/source directories, comma separated]:list of dirs:_files -/' \
   '(-t --text-mode)'{-t,--text-mode}'[no progress bars]' \
   '1:list of commands:_values -s , subcommands "${_module_assistant_commands[@]}"' \
-  '*:packages: compadd /usr/src/modass/var_cache_modass/*.avail_version(N:t:r) /var/cache/modass/*.avail_version(N:t:r)'
+  '*:package: compadd /usr/src/modass/var_cache_modass/*.avail_version(N:t:r) /var/cache/modass/*.avail_version(N:t:r)'
 
diff --git a/Completion/Linux/Command/_fusermount b/Completion/Linux/Command/_fusermount
index 02cb57237..41d3dec72 100644
--- a/Completion/Linux/Command/_fusermount
+++ b/Completion/Linux/Command/_fusermount
@@ -6,7 +6,7 @@ typeset -A opt_args
 _arguments \
   '-h[display help information]' \
   '-V[display version information]' \
-  '-o[specify mount options]:mount options:_fuse_values "mount options"' \
+  '-o[specify mount options]:mount option:_fuse_values "mount option"' \
   '-u[unmount a fuse mount]' \
   '-z[unmount lazily (work even when if the resource is still busy)]' \
   '-q[suppress nonessential output]' \
diff --git a/Completion/Linux/Command/_ipset b/Completion/Linux/Command/_ipset
index d05f13caf..061d16799 100644
--- a/Completion/Linux/Command/_ipset
+++ b/Completion/Linux/Command/_ipset
@@ -25,7 +25,7 @@ _set_types () {
 _ipsets () {
 	local -a vals
 	vals=( ${${(M)${(f)"$(_call_program ipsets ipset -L)"}%Name: *}#Name: } )
-	_describe -t ipsets "IP sets" vals
+	_describe -t ipsets "IP set" vals
 }
 _sets () {
 	_ipsets
@@ -118,7 +118,7 @@ _ips () {
 			if (( $ips )); then vals1+=$i; else bindings+=${i/ ->/:}; fi
 		done
 		_describe -t ips "IPs from $words[offset+3] set" vals1
-		_describe -t special_values "special values" vals2
+		_describe -t special_values "special value" vals2
 	fi
 }
 
diff --git a/Completion/Linux/Command/_mdadm b/Completion/Linux/Command/_mdadm
index b6dce7ccb..5b73ef4be 100644
--- a/Completion/Linux/Command/_mdadm
+++ b/Completion/Linux/Command/_mdadm
@@ -156,7 +156,7 @@ _mds () {
 	  return 1
 	fi
 	vals=( ${${${(M)${(f)"$(< $mdadm_conf)"}##ARRAY *}//ARRAY /}%%[[:blank:]]*} )
-	_describe -t mds "RAID devices" vals
+	_describe -t mds "RAID device" vals
 	_arguments \
 		"(-h --help)"{-h,--help}'[display a mode specific help message]'
 }
diff --git a/Completion/Linux/Command/_sysstat b/Completion/Linux/Command/_sysstat
index e091dd3ea..4de855b69 100644
--- a/Completion/Linux/Command/_sysstat
+++ b/Completion/Linux/Command/_sysstat
@@ -96,12 +96,12 @@ _sar() {
     '(--human -p)-h[make output easier to read: implies --human and -p]' \
     '(- 1 2)--help[display usage information]' \
     '--human[print sizes in human readable format]' \
-    '*-I[report statistics for interrupts]:interrupts: _values -s "," interrupts 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 SUM ALL XALL' \
+    '*-I[report statistics for interrupts]: : _values -s "," interrupt 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 SUM ALL XALL' \
     '-i[select records as close as possible to interval]:interval' \
     '--iface=-[specify network interfaces for which statistics are to be displayed]:network interface:_sequence _net_interfaces' \
     '-j[display persistent device names]:type:(ID LABEL PATH UUID)' \
-    '-m[report power management statistics]:keywords: _values -s "," keywords CPU FAN FREQ IN TEMP USB ALL' \
-    '-n[report network statistics]:keywords: _values -s "," keywords DEV EDEV NFS NFSD SOCK IP EIP ICMP EICMP TCP ETCP UDP SOCK6 IP6 EIP6 ICMP6 EICMP6 UDP6 FC SOFT ALL' \
+    '-m[report power management statistics]:keyword:_sequence compadd - CPU FAN FREQ IN TEMP USB ALL' \
+    '-n[report network statistics]:keyword:_sequence compadd - DEV EDEV NFS NFSD SOCK IP EIP ICMP EICMP TCP ETCP UDP SOCK6 IP6 EIP6 ICMP6 EICMP6 UDP6 FC SOFT ALL' \
     '-o[save readings to file in binary form]:file:_files' \
     '-P[report per-processor statistics]:processor: _values -s "," processors ALL' \
     '-p[pretty-print device names]' \
diff --git a/Completion/Linux/Type/_fuse_values b/Completion/Linux/Type/_fuse_values
index be830cb40..211eb5b35 100644
--- a/Completion/Linux/Type/_fuse_values
+++ b/Completion/Linux/Type/_fuse_values
@@ -47,7 +47,7 @@ fvals=(
 [[ -n $cvalsvar ]] && set -- "$@" ${(P)cvalsvar}
 
 if [[ $# -eq 0 ]]; then
-  set -- 'mount options' $fvals
+  set -- 'mount option' $fvals
 else
   set -- "$@" $fvals
 fi
diff --git a/Completion/Mandriva/Command/_urpmi b/Completion/Mandriva/Command/_urpmi
index d897f2c4b..9ab9e45b7 100644
--- a/Completion/Mandriva/Command/_urpmi
+++ b/Completion/Mandriva/Command/_urpmi
@@ -286,7 +286,7 @@ _urpmi() {
 	"($help --all --interactive  --name)--summary[print tag summary: summary]" \
 	"($help)--uniq[do not print identical lines]" \
 	"($help --all --interactive  --name)--url[print tag url: url]" \
-	"*:hdlist files:_files -g '*.cz(-.)'" \
+	"*:hdlist file:_files -g '*.cz(-.)'" \
       && ret=0
     ;;
   esac
diff --git a/Completion/Redhat/Command/_yum b/Completion/Redhat/Command/_yum
index a30aa579f..9425ba57c 100644
--- a/Completion/Redhat/Command/_yum
+++ b/Completion/Redhat/Command/_yum
@@ -167,7 +167,7 @@ _yumdb() {
 
       if [ "$cmd" = "help" ]; then
         if (( CURRENT == 2 )); then
-          _describe -t commands 'yum commands' _yum_cmds && ret=0
+          _describe -t commands 'yum command' _yum_cmds && ret=0
         else
           # help takes one argument
           _message 'no more arguments'
diff --git a/Completion/Solaris/Command/_coreadm b/Completion/Solaris/Command/_coreadm
index 7262e6423..655b48e63 100644
--- a/Completion/Solaris/Command/_coreadm
+++ b/Completion/Solaris/Command/_coreadm
@@ -40,6 +40,6 @@ _arguments -s \
   - set2 \
   '-p[PID-specific per-process core file name pattern]:' \
   '-P[PID-specific per-process core file content]:content:_values -s + "content" $content' \
-  '*:pids:_pids' \
+  '*:pid:_pids' \
   - set3 \
   '-u[update options from coreadm.conf]'
diff --git a/Completion/Solaris/Type/_svcs_fmri b/Completion/Solaris/Type/_svcs_fmri
index ffade6985..b090461c5 100644
--- a/Completion/Solaris/Type/_svcs_fmri
+++ b/Completion/Solaris/Type/_svcs_fmri
@@ -66,18 +66,18 @@ _svcs_fmri() {
 		# _wanted fmri expl "full or unambiguously abbreviated FMRIs" \
 		# 	_multi_parts -i / fmri_abbrevs
 
-		_wanted fmri expl "full or unambiguously abbreviated FMRIs" \
+		_wanted fmri expl "full or unambiguously abbreviated FMRI" \
 			compadd $fmri_abbrevs
 		;;
 
 	(-m)
-		_wanted fmri expl "milestone FMRIs" \
+		_wanted fmri expl "milestone FMRI" \
 			compadd $(svcs -H -o fmri svc:/milestone/\*) all
 		;;
 
 	(-r)
 		# TODO: need some way to pick out only restarters
-		_wanted fmri expl "restarter FMRIs" \
+		_wanted fmri expl "restarter FMRI" \
 			compadd master reset svc:/network/inetd:default
 		;;
 
diff --git a/Completion/Unix/Command/_ack b/Completion/Unix/Command/_ack
index e83a9330e..6dc3ab0d1 100644
--- a/Completion/Unix/Command/_ack
+++ b/Completion/Unix/Command/_ack
@@ -72,7 +72,7 @@ _arguments -C -s -S \
   '(1)-g[print files where the relative path + filename matches the given pattern]:pattern to match against filenames' \
   '--sort-files[sorts the found files lexically]' \
   '--show-types[print the file types that ack associates with each file]' \
-  '(--files-from -x)--files-from=[read the list of files to search from specified file]:files:_files' \
+  '(--files-from -x)--files-from=[read the list of files to search from specified file]:file:_files' \
   '(-x --files-from)-x[read the list of files to search from standard input]' \
   '*--ignore-dir'{,ectory}'=[ignore directory]:directory:_directories' \
   '*--noignore-dir'{,ectory}'=[remove directory from ignored list]:directory:_directories' \
@@ -86,7 +86,7 @@ _arguments -C -s -S \
   '*--type-'{add,set}'=[files with the given extensions are recognized as being of the given type]:type-def:->type-defs' \
   '*--type-del=[remove all filters associated with specified file type]: :->file-types' \
   '(--env)--noenv[ignore environment variables and global ackrc files]' '!(--noenv)--env)' \
-  '--ackrc=[specify an ackrc file to use]:files:_files' \
+  '--ackrc=[specify an ackrc file to use]:file:_files' \
   '--ignore-ack-defaults[ignore default definitions included with ack]' \
   "${ign}(- 1 *)--create-ackrc[output an ackrc based on customizations]" \
   "${ign}(- 1 *)"{-\?,--help}'[display usage information]' \
diff --git a/Completion/Unix/Command/_adb b/Completion/Unix/Command/_adb
index 75a447dfc..21cd68761 100644
--- a/Completion/Unix/Command/_adb
+++ b/Completion/Unix/Command/_adb
@@ -85,7 +85,7 @@ _adb() {
 	'-s[serial]: :_adb_device_serial' \
 	'(   -e)-d[device]' \
 	'(-d   )-e[emulator]' \
-	'1:options:_adb_options_handler' \
+	'1:option:_adb_options_handler' \
 	'*: : _default'
       
       return
@@ -141,7 +141,7 @@ _adb_dispatch_command () {
 	'(-d -e)-s[serial]: :_adb_device_serial' \
 	'(-s -e)-d[device]' \
 	'(-d -s)-e[emulator]' \
-	'*:options:_adb_options_handler'
+	'*:option:_adb_options_handler'
       ;;
   esac
 }
@@ -392,7 +392,7 @@ _adb_check_log_redirect () {
 
 (( $+functions[_adb_trace_opts] )) ||
 _adb_trace_opts() {
-  _values -s , 'adb trace options' \
+  _values -s , 'adb trace option' \
 	'(1 adb sockets packets rwx usb sync sysdeps transport jdwp)all' \
 	'(all adb sockets packets rwx usb sync sysdeps transport jdwp)1' \
 	'adb' \
@@ -418,7 +418,7 @@ _adb_device_serial() {
       devices[(i)${device%:*}:*]=$device
     fi
   done
-  _describe -t dev_serial 'available devices' devices
+  _describe -t dev_serial 'available device' devices
 }
 
 (( $+functions[_adb_logcat_filter_specification] )) ||
@@ -459,13 +459,13 @@ _adb_dispatch_logcat() {
 (( $+functions[_adb_options_handler] )) ||
 _adb_options_handler() {
   local expl
-  _wanted adb_options expl 'adb options' compadd "${ALL_ADB_COMMANDS[@]}"
+  _wanted adb_options expl 'adb option' compadd "${ALL_ADB_COMMANDS[@]}"
 }
 
 (( $+functions[_adb_shell_commands_handler] )) ||
 _adb_shell_commands_handler() {
   local expl
-  _wanted adb_shell_commands expl 'adb shell commands' compadd ls pm am mkdir rmdir rm cat 
+  _wanted adb_shell_commands expl 'adb shell command' compadd ls pm am mkdir rmdir rm cat
 }
 
 (( $+functions[_adb_device_available] )) ||
@@ -514,7 +514,7 @@ _adb_installed_packages() {
 _adb_users() {
   local -a users
   users=( ${${${(M)${(f)"$(adb shell pm list users)"}:#*UserInfo*}#*UserInfo\{}%:*} )
-  _describe -t users 'users' users
+  _describe -t users 'user' users
 }
 
 (( $+functions[_adb_cache_policy_single_command] )) ||
diff --git a/Completion/Unix/Command/_baz b/Completion/Unix/Command/_baz
index 6787f41e2..4dfcdf882 100644
--- a/Completion/Unix/Command/_baz
+++ b/Completion/Unix/Command/_baz
@@ -38,8 +38,8 @@ _baz_revisions () { _arch_namespace baz 4 "$argv[@]" }
 (( $+functions[_baz_local_revisions] )) ||
 _baz_local_revisions () {
   local expl1 expl2 tree_version=`$BAZ tree-version`
-  _description -V applied-patches expl1 "patches from this version"
-  _description -V other-patches expl2 "patches from other versions"
+  _description -V applied-patches expl1 "patch from this version"
+  _description -V other-patches expl2 "patch from other versions"
   compadd "$expl1[@]" `$BAZ logs`
   compadd "$expl2[@]" `$BAZ logs --full $($BAZ log-versions | grep -v $tree_version)`
   # This is incredibly slow.
@@ -82,7 +82,7 @@ _baz_limit () { #presently only does push-mirror style limits
 
     if [[ $PREFIX != *--* ]]; then
       _description -V categories expl "categories in $archive"
-      compadd -q -S -- "$expl[@]" `$BAZ categories $archive`
+      compadd -q -S -- "$expl[@]" `$BAZ category $archive`
     else
       _baz_namespace_branches 3
     fi
@@ -98,7 +98,7 @@ _baz_tree_or_rev () {
 _baz_libraries () {
   local libraries expl
   libraries=($(_call_program baz $BAZ my-revision-library))
-  _description -V libraries expl "revision libraries"
+  _description -V libraries expl "revision library"
   compadd "$expl[@]" -a libraries
 }
 
@@ -115,7 +115,7 @@ _baz_my_revision_library () {
 _baz_log_versions () {
   local logs expl
   logs=($(_call_program baz $BAZ log-versions))
-  _description -V versions expl "log versions"
+  _description -V versions expl "log version"
   compadd "$expl[@]" -a logs
 }
 
@@ -238,12 +238,12 @@ methods=(
 cmd_tagging_method=($cmd_id_tagging_method)
 
 local cmd_add cmd_add_id cmd_add_tag
-cmd_add=('*:files to add:_files')
+cmd_add=('*:file to add:_files')
 cmd_add_id=($cmd_add)
 cmd_add_tag=($cmd_add)
 
 local cmd_delete cmd_delete_id cmd_delete_tag
-cmd_delete=('*:files to delete:_files')
+cmd_delete=('*:file to delete:_files')
 cmd_delete_id=($cmd_delete)
 cmd_delete_tag=($cmd_delete)
 
@@ -272,7 +272,7 @@ cmd_changeset=(
   ':ORIG:_files -/'
   ':MOD:_files -/'
   ':DEST:_files -/'
-  '*:files:_files'
+  '*:file:_files'
 )
 cmd_mkpatch=("$cmd_changeset[@]")
 
@@ -288,7 +288,7 @@ local cmd_make_archive
 cmd_make_archive=('::name:' ':location:_files -/')
 
 local cmd_archive_setup
-cmd_archive_setup=('*:versions:_baz_branches --trailing-dashes')
+cmd_archive_setup=('*:version:_baz_branches --trailing-dashes')
 
 local cmd_make_category
 cmd_make_category=(':category:_baz_archives -S /')
@@ -304,7 +304,7 @@ cmd_import=('::version:_baz_versions')
 cmd_imprev=($cmd_import)
 
 local cmd_commit cmd_cmtrev
-cmd_commit=('*:files:_files')
+cmd_commit=('*:file:_files')
 cmd_cmtrev=($cmd_commit)
 
 local cmd_get cmd_getrev
@@ -573,7 +573,7 @@ _baz_main () {
     local -U cmds
     help=(${(f)"$($BAZ help)"})
     cmds=(${${${${(M)help:#* :*}/ #: #/:}%% ##}## #})
-    arguments=(':commands:(($cmds))')
+    arguments=(':command:(($cmds))')
   fi
   _arguments -S -A '-*' \
     {"${hide_short}(: -)-V",'(: -)--version'}'[display version]' \
diff --git a/Completion/Unix/Command/_bzr b/Completion/Unix/Command/_bzr
index 1b755b4ec..121c28166 100644
--- a/Completion/Unix/Command/_bzr
+++ b/Completion/Unix/Command/_bzr
@@ -65,7 +65,7 @@ case $cmd in
 	'--no-recurse[do not recurse into subdirectories]'
 	'(-q --quiet -v --verbose)'{--quiet,-q}'[be quiet]'
 	'(-v --verbose -q --quiet)'{--verbose,-v}'[display more information]'
-	'*:unknown files:_bzr_unknownFiles'
+	'*:unknown file:_bzr_unknownFiles'
 	)
     ;;
 
@@ -74,7 +74,7 @@ case $cmd in
 	'--all[show annotations on all lines]'
 	'--long[show date in annotations]'
 	'(-r --revision)'{--revision=,-r}'[the revision to show]:rev:'
-	'*:files:_bzr_versionedFiles'
+	'*:file:_bzr_versionedFiles'
 	)
     ;;
 
@@ -100,7 +100,7 @@ case $cmd in
 
 (rename|move|mv)
     if (( CURRENT == 2 )); then
-	args+=( '*:files:_bzr_versionedFiles' )
+	args+=( '*:file:_bzr_versionedFiles' )
     else
 	args=( '*:destination dir:_files -/' )
     fi
@@ -218,7 +218,7 @@ case $cmd in
 	'--unchanged[include unchanged files]'
 	'(-q --quiet -v --verbose)'{--quiet,-q}'[be quiet]'
 	'(-v --verbose -q --quiet)'{--verbose,-v}'[display more information]'
-	'*:modified files:_bzr_modifiedFiles'
+	'*:modified file:_bzr_modifiedFiles'
 	)
     ;;
 
@@ -229,7 +229,7 @@ case $cmd in
 	'--all[shelve all changes]'
 	'(-q --quiet)'{--quiet,-q}'[be quiet]'
 	'(-v --verbose)'{--verbose,-v}'[display more information]'
-	'*:modified files:_bzr_modifiedFiles'
+	'*:modified file:_bzr_modifiedFiles'
 	)
     ;;
 
@@ -279,7 +279,7 @@ case $cmd in
 	'(-r --revision)'{--revision=,-r}'[revision]:revision:'
 	'--diff-options=[options to pass to gdiff]:diff options:'
 	'(-p --prefix)'{--prefix,-p}'[set prefix added to old and new filenames]'
-	'*:files:_files'
+	'*:file:_files'
 	)
     ;;
 
@@ -376,7 +376,7 @@ case $cmd in
     args+=(
 	'--all[show annotations on all lines]'
 	"--plain[don't highlight annotation lines]"
-	'*:files:_bzr_versionedFiles'
+	'*:file:_bzr_versionedFiles'
 	)
     ;;
 
diff --git a/Completion/Unix/Command/_ctags b/Completion/Unix/Command/_ctags
index 3c80ba1c5..e2b28011b 100644
--- a/Completion/Unix/Command/_ctags
+++ b/Completion/Unix/Command/_ctags
@@ -147,7 +147,7 @@ if [ "$_ctags_type" = "universal" ]; then
     "--roles--[enable/disable tag roles for kinds of <lang>]:language:->languagedot"
     "--sort=-[should tags be sorted]:argument:(yes no foldcase)"
     "--tag-relative=-[should paths be relative to location of tag file]:argument:(yes no always never)"
-    "--totals=-[print stats about input and tag files]:arguments:(yes no extra)"
+    "--totals=-[print stats about input and tag files]:argument:(yes no extra)"
     "(--verbose -V)--verbose=-[enable verbose messages describing actions]:bool:(yes no)"
     "(--verbose -V)-V[enable verbose messages describing actions]"
     "--version[print version]"
@@ -196,7 +196,7 @@ elif [ "$_ctags_type" = "exuberant" ]; then
     "--regex--[define regex for locating tags in specific lang]:language:->language"
     "--sort=-[should tags be sorted]:argument:(yes no foldcase)"
     "--tag-relative=-[should paths be relative to location of tag file]:argument:(yes no)"
-    "--totals=-[print stats about input and tag files]:arguments:(yes no)"
+    "--totals=-[print stats about input and tag files]:argument:(yes no)"
     "(--verbose -V)--verbose=-[enable verbose messages describing actions]:bool:(yes no)"
     "(--verbose -V)-V[enable verbose messages describing actions]"
     "--version[print version]"
diff --git a/Completion/Unix/Command/_cvs b/Completion/Unix/Command/_cvs
index cba3eb773..4dc5b6c60 100644
--- a/Completion/Unix/Command/_cvs
+++ b/Completion/Unix/Command/_cvs
@@ -371,10 +371,10 @@ _cvs_log() {
     '-R[print the name of RCS file in the repository]' \
     '-N[don'\''t list tags]' \
     '(-h)-t[header with descriptive text]' \
-    '-d+[specify dates]:dates' \
+    '-d+[specify dates]:date range' \
     '-r-[specify revisions]:revisions' \
-    '-s+[specify states]:states:(Exp Stab Rel dead)' \
-    '-w-[specify logins]:logins' \
+    '-s+[specify states]:state:_sequence compadd - Exp Stab Rel dead' \
+    '-w-[specify logins]:login list' \
     '*:file:_cvs_files'
 }
 
@@ -388,10 +388,10 @@ _cvs_rlog() {
     '(-l)-R[recursive]' \
     '-N[don'\''t list tags]' \
     '(-h)-t[header with descriptive text]' \
-    '-d+[specify dates]:dates' \
+    '-d+[specify dates]:date range' \
     '-r-[specify revisions]:revisions' \
-    '-s+[specify states]:states:(Exp Stab Rel dead)' \
-    '-w-[specify logins]:logins' \
+    '-s+[specify states]:state:_sequence compadd - Exp Stab Rel dead' \
+    '-w-[specify logins]:login list' \
     '*:file:_cvs_modules'
 }
 
diff --git a/Completion/Unix/Command/_ecasound b/Completion/Unix/Command/_ecasound
index a39e426db..5fd9055a7 100644
--- a/Completion/Unix/Command/_ecasound
+++ b/Completion/Unix/Command/_ecasound
@@ -102,9 +102,9 @@ case $state in
     elif compset -P '*,*,'; then
       _message 'sampling rate'
     elif compset -P '*,'; then
-      _message 'channels'
+      _message 'channel'
     else
-      _values 'sampling parameters' \
+      _values 'sampling parameter' \
         'u8[unsigned 8-bit]' \
 	's16_le[signed 16-bit little endian]' \
 	's16_be[signed 16-bit big endian]' \
diff --git a/Completion/Unix/Command/_fetchmail b/Completion/Unix/Command/_fetchmail
index 31a92d984..bc5a39688 100644
--- a/Completion/Unix/Command/_fetchmail
+++ b/Completion/Unix/Command/_fetchmail
@@ -4,7 +4,7 @@ _arguments -S \
   {--bsmtp,'(--logfile)-L','(-L)--logfile','(--fetchmailrc)-f','(-f)--fetchmailrc','(--idfile)-i','(-i)--idfile'}':file:_files' \
   {--plugin,--plugout,'(--mda)-m','(-m)--mda'}':command:_command_names -e' \
   {'(--username)-u','(-u)--username'}:user:_users \
-  '--auth:authentication types:(password kerberos kerberos_v5)' \
+  '--auth:authentication type:(password kerberos kerberos_v5)' \
   {'(--protocol)-p','(-p)--protocol'}:protocol:'(auto pop2 pop3 apop rpop kpop sdps imap imap-k4 imap-gss etrn)' \
   {'(--port)-P','(-P)--port'}':port number' \
   '*:mail server:_hosts' \
diff --git a/Completion/Unix/Command/_ffmpeg b/Completion/Unix/Command/_ffmpeg
index c0b229f35..1329939cd 100644
--- a/Completion/Unix/Command/_ffmpeg
+++ b/Completion/Unix/Command/_ffmpeg
@@ -6,7 +6,7 @@ typeset -A opt_args
 (( $+functions[_ffmpeg_presets] )) || _ffmpeg_presets() {
     local presets
     presets=(~/.ffmpeg/*.ffpreset(:t:r) "$FFMPEG_DATADIR"/*.ffpreset(:t:r))
-    _wanted ffmpeg-presets expl 'select preset' compadd -a presets
+    _wanted ffmpeg-presets expl 'preset' compadd -a presets
 }
 
 (( $+functions[_ffmpeg_acodecs] )) || _ffmpeg_acodecs() {
@@ -49,7 +49,7 @@ typeset -A _ffmpeg_flags
 
 (( $+functions[_ffmpeg_flag_options] )) || _ffmpeg_flag_options() {
     local expl
-    _wanted options expl 'select flags' compadd -S '' -- {-,+}${^flag_options}
+    _wanted options expl 'flag' compadd -S '' -- {-,+}${^flag_options}
 }
 
 (( $+functions[_ffmpeg_more_flag_options] )) || _ffmpeg_more_flag_options() {
@@ -177,7 +177,7 @@ _arguments -C -S \
     && return
 
 [[ "$state" == "vfilters" ]] &&
-    _values -s , -S = 'video filters' \
+    _values -s , -S = 'video filter' \
     'aspect:set aspect ratio (rational number X\:Y or decimal number):' \
     'crop:crop input video (x\:y\:width\:height):' \
     'format: :_sequence -s : _ffmpeg_pix_fmts' \
diff --git a/Completion/Unix/Command/_find b/Completion/Unix/Command/_find
index 916fcf2e6..8ff60baf2 100644
--- a/Completion/Unix/Command/_find
+++ b/Completion/Unix/Command/_find
@@ -89,7 +89,7 @@ case $variant in
       '-X[warn if filename contains characters special to xargs]'
       '-f[specify file hierarchy to traverse]:path:_directories'
       "-x[don't span filesystems]"
-      '*-flags:flags:_chflags'
+      '*-flags:flag:_chflags'
     )
   ;|
   freebsd*|dragonfly*) args+=( '*-sparse' ) ;|
diff --git a/Completion/Unix/Command/_fuser b/Completion/Unix/Command/_fuser
index f497729fc..05de1c529 100644
--- a/Completion/Unix/Command/_fuser
+++ b/Completion/Unix/Command/_fuser
@@ -50,7 +50,7 @@ case $variant in
     )
     argf=( '*:name: _alternative "files:file:_files" "services:service:_fuser_services"' )
     [[ -prefix -  && -z ${${words[1,CURRENT-1]}[(r)-[A-Z][A-Z]*]} ]] &&
-        argf[1]+=' "signal:signals:_signals -P-"'
+        argf[1]+=' "signals:signal:_signals -P-"'
   ;;
   freebsd*|openbsd*|solaris2.<9->)
     args+=(
diff --git a/Completion/Unix/Command/_gem b/Completion/Unix/Command/_gem
index b35a5c358..53adfb89c 100644
--- a/Completion/Unix/Command/_gem
+++ b/Completion/Unix/Command/_gem
@@ -46,7 +46,7 @@ if [[ $state = command ]]; then
         'gem_dependencies:gem dependencies file guide'
         'platforms:show information about platforms'
       )
-      _describe -t topics 'help topics' helptopics -- && ret=0
+      _describe -t topics 'help topic' helptopics -- && ret=0
     ;&
     subcommands)
       cmds=( ${${${(M)${(f)"$(_call_program commands gem help commands)"}:#    [^ ]*}## #}/ ##/:} )
diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index 0267acfa8..d27b43098 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -76,8 +76,8 @@ _git-add () {
       declare -a ignored_files_alternatives
       if [[ -n ${opt_args[(I)-f|--force]} ]]; then
         ignored_files_alternatives=(
-          'ignored-modified-files:ignored modified files:__git_ignore_line_inside_arguments __git_modified_files --ignored'
-          'ignored-other-files:ignored other files:__git_ignore_line_inside_arguments __git_other_files --ignored')
+          'ignored-modified-files:ignored modified file:__git_ignore_line_inside_arguments __git_modified_files --ignored'
+          'ignored-other-files:ignored other file:__git_ignore_line_inside_arguments __git_other_files --ignored')
       fi
 
       _alternative \
@@ -330,7 +330,7 @@ _git-branch () {
     "($l $m $d -f --force)"{-f,--force}'[force the creation of a new branch]' \
     "($l $m $d -t --track)"{-t,--track}'[setup configuration so that pull merges from the start point]' \
     "($l $m $d)--no-track[override the branch.autosetupmerge configuration variable]" \
-    "($l $m $d -u --set-upstream --set-upstream-to --unset-upstream)"{-u+,--set-upstream-to=}'[set up configuration so that pull merges]:remote-branches:__git_remote_branch_names' \
+    "($l $m $d -u --set-upstream --set-upstream-to --unset-upstream)"{-u+,--set-upstream-to=}'[set up configuration so that pull merges]:remote branch:__git_remote_branch_names' \
     "($l $m $d -u --set-upstream --set-upstream-to --unset-upstream)--unset-upstream[remove upstream configuration]" \
     "($l $m $d)*--contains=[only list branches that contain the specified commit]: :__git_committishs" \
     "($l $m $d)*--no-contains=[only list branches that don't contain the specified commit]: :__git_committishs" \
@@ -3138,7 +3138,7 @@ __git_config_option-or-value () {
             ;;
           (*.)
             local -a existing_subsections=( ${${${(M)git_present_options:#${IPREFIX}*.*}#${IPREFIX}}%.*} )
-            _describe -t existing-subsections "existing subsections" existing_subsections -S . && ret=0
+            _describe -t existing-subsections "existing subsection" existing_subsections -S . && ret=0
             ;;
         esac
       else
@@ -4070,7 +4070,7 @@ _git-help () {
     '(-a --all -g --guides -c --config -i --info -m --man)'{-w,--web}'[display manual for the command in HTML format]' \
     '(-g --guides -c --config -i --info -m --man -w --web)'{-g,--guides}'[prints a list of useful guides on the standard output]' \
     '(-v --verbose)'{-v,--verbose}'[print command descriptions]' \
-    ': : _alternative commands:command:_git_commands "guides:git guides:(attributes cli core-tutorial cvs-migration diffcore everyday glossary hooks ignore modules namespaces repository-layout revisions tutorial tutorial-2 workflows)"'
+    ': : _alternative commands:command:_git_commands "guides:git guide:(attributes cli core-tutorial cvs-migration diffcore everyday glossary hooks ignore modules namespaces repository-layout revisions tutorial tutorial-2 workflows)"'
 }
 
 (( $+functions[_git-instaweb] )) ||
@@ -5381,7 +5381,7 @@ _git-pack-redundant () {
     '(:)--all[process all packs]' \
     '--alt-odb[do not require objects to be present in local packs]' \
     '--verbose[output some statistics to standard error]' \
-    '(--all)*::packs:_files -g "*.pack(-.)"'
+    '(--all)*::pack:_files -g "*.pack(-.)"'
 }
 
 (( $+functions[_git-rev-list] )) ||
@@ -7317,7 +7317,7 @@ __git_repositories () {
 __git_local_repositories () {
   local expl
 
-  _wanted local-repositories expl 'local repositories' _directories
+  _wanted local-repositories expl 'local repository' _directories
 }
 
 (( $+functions[__git_repositories_or_urls] )) ||
diff --git a/Completion/Unix/Command/_gradle b/Completion/Unix/Command/_gradle
index 9a75daefb..adf5e9aa8 100644
--- a/Completion/Unix/Command/_gradle
+++ b/Completion/Unix/Command/_gradle
@@ -95,18 +95,18 @@ if [[ $words[CURRENT] != -* ]]; then
                 _tags gradle_group gradle_all
                 while _tags; do
                     # Offer main tasks and secondary tasks in different tags.
-                    _requested gradle_group && _describe 'group tasks' gradle_group_tasks && ret=0
-                    _requested gradle_all && _describe 'secondary tasks' gradle_all_tasks && ret=0
+                    _requested gradle_group && _describe 'group task' gradle_group_tasks && ret=0
+                    _requested gradle_all && _describe 'secondary task' gradle_all_tasks && ret=0
                     (( ret )) || break
                 done
             elif [[ $state == alltask ]]; then
                 # After '--exclude-task', we don't make a distinction between main tasks and
                 # secondary tasks.
-                _describe 'all tasks' gradle_group_tasks -- gradle_all_tasks && ret=0
+                _describe 'task' gradle_group_tasks -- gradle_all_tasks && ret=0
             fi
         fi
     else
-        _describe 'built-in tasks' '(
+        _describe 'built-in task' '(
             "dependencies:Displays all dependencies declared in root project."
             "dependencyInsight:Displays the insight into a specific dependency in root project."
             "help:Displays a help message."
diff --git a/Completion/Unix/Command/_initctl b/Completion/Unix/Command/_initctl
index 2d7c2494b..b404c0c16 100644
--- a/Completion/Unix/Command/_initctl
+++ b/Completion/Unix/Command/_initctl
@@ -51,14 +51,14 @@ _initctl_known_events()
 _initctl_multiple_known_events()
 {
   [[ ${#_initctl_events_list} -eq 0 ]] && _initctl_fillarray_events_args
-  _values -s "," "Events" "$_initctl_events_list[@]"
+  _values -s "," "event" "$_initctl_events_list[@]"
 }
 
 # list KEY= arguments, generate array if necessary
 _initctl_known_eventargs()
 {
   [[ ${#_initctl_eventargs_list} -eq 0 ]] && _initctl_fillarray_events_args
-  _values "Argument Keys" "$_initctl_eventargs_list[@]"
+  _values "argument key" "$_initctl_eventargs_list[@]"
 }
 
 # describe and offer commands for initctl, then call matching completion function
@@ -82,7 +82,7 @@ _initctl_command()
     )
 
     if (( CURRENT == 1 )); then
-        _describe -t command "initctl Commands" cmds
+        _describe -t command "initctl command" cmds
     fi
 
     local cmd=$words[1]
@@ -97,8 +97,8 @@ _initctl_startstop()
     _arguments \
         '--no-wait[do not wait for operation to complete before exiting]' \
         "${common_args[@]}" \
-        ':Upstart Jobs:_initctl_helper_jobs' \
-        '*::Argument Keys:_initctl_known_eventargs'
+        ':upstart job:_initctl_helper_jobs' \
+        '*::argument key:_initctl_known_eventargs'
 }
 
 # completion for anything that takes one job
@@ -106,7 +106,7 @@ _initctl_argjob()
 {
     _arguments \
         "${common_args[@]}" \
-        ':Upstart Jobs:_initctl_helper_jobs' \
+        ':upstart job:_initctl_helper_jobs' \
         '*::'
 }
 
@@ -116,8 +116,8 @@ _initctl_emit()
     _arguments \
         '--no-wait[do not wait for event to finish before exiting]' \
         "${common_args[@]}" \
-        ':Events:_initctl_known_events' \
-        '*::Argument Keys:_initctl_known_eventargs'
+        ':event:_initctl_known_events' \
+        '*::argument key:_initctl_known_eventargs'
 }
 
 # the fallback, just the options
@@ -133,7 +133,7 @@ _initctl_show-config()
     _arguments \
       "(-e --enumerate)"{-e,--enumerate}"[enumerate emit lines]" \
         "${common_args[@]}" \
-        '::Upstart Jobs:_initctl_helper_jobs' \
+        '::upstart job:_initctl_helper_jobs' \
         '*::'
 }
 
@@ -144,7 +144,7 @@ _initctl_check-config()
       "(-i --ignore-events)"{-i,--ignore-events}"[list of comma-separated events to ignore]:Events:_initctl_multiple_known_events" \
       "(-w --warn)"{-w,--warn}"[treat any unknown jobs or events as error]" \
         "${common_args[@]}" \
-        '::Upstart Jobs:_initctl_helper_jobs' \
+        '::upstart job:_initctl_helper_jobs' \
         '*::'
 }
 
@@ -172,7 +172,7 @@ _initctl()
   # depending on which command was used, call different completion functions
   case $service in
     initctl)
-      _arguments "${common_args[@]}" '*::Initctl Commands:_initctl_command'
+      _arguments "${common_args[@]}" '*::initctl command:_initctl_command'
     ;;
     start|stop|restart|reload|status)
       _call_function ret _initctl_${cmd_completion_funcs[${service}]-${cmd_completion_default}}
diff --git a/Completion/Unix/Command/_install b/Completion/Unix/Command/_install
index 5ad84645e..364119961 100644
--- a/Completion/Unix/Command/_install
+++ b/Completion/Unix/Command/_install
@@ -106,7 +106,7 @@ case $state in
       'a[symlinks use absolute path]'
       'r[symlinks use relative path]'
     )
-    _values -S '' 'link flags' $tmp && ret=0
+    _values -S '' 'link flag' $tmp && ret=0
     ;;
 esac
 
diff --git a/Completion/Unix/Command/_joe b/Completion/Unix/Command/_joe
index 592c34a10..74b0bf1a3 100644
--- a/Completion/Unix/Command/_joe
+++ b/Completion/Unix/Command/_joe
@@ -36,4 +36,4 @@ _arguments \
   '-linums[display line numbers before each line]' \
   '-rdonly[make file read-only]' \
   '-keymap[use an alternate section of joerc for keybindings]:keymap name' \
-  '*:files:_files'
+  '*:file:_files'
diff --git a/Completion/Unix/Command/_locate b/Completion/Unix/Command/_locate
index 23305f798..af07473b3 100644
--- a/Completion/Unix/Command/_locate
+++ b/Completion/Unix/Command/_locate
@@ -44,7 +44,7 @@ case $variant in
       -u'[create slocate database starting at path /]'
       -U'[create slocate database starting at given path]:directory:_files -/'
       -c'[parse GNU locate updatedb with -u, -U]'
-      -e'[exclude directories with -u, -U]:directories:_files -/'
+      -e'[exclude directories with -u, -U]: : _dir_list -s,'
       -f'[exclude file system types from db with -u, -U]:file system:_file_systems'
       -l'[security level]:level:(0 1)'
       -q'[quiet mode]'
diff --git a/Completion/Unix/Command/_lp b/Completion/Unix/Command/_lp
index 914d63ff2..ad7e97203 100644
--- a/Completion/Unix/Command/_lp
+++ b/Completion/Unix/Command/_lp
@@ -83,7 +83,7 @@ _lp_job_options()
 	  "DuplexTumble:flip short side"
 	  "DuplexNoTumble:flip long side"
 	  "None")
-	_describe "duplex options" desc_opts
+	_describe "duplex option" desc_opts
 	;;
 
       (*)
@@ -103,11 +103,11 @@ _lp_job_options()
       eq_suffix=(-S '=')
     fi
 
-    _description lpopts expl "generic printer options"
+    _description lpopts expl "generic printer option"
     compadd "$expl[@]" $eq_suffix $lopts_with_args
     compadd "$expl[@]" $lopts_no_args
 
-    _description printeropts expl "printer specific options"
+    _description printeropts expl "printer specific option"
     compadd "$expl[@]" $eq_suffix \
       $(_call_program list-printer-options \
 	lpoptions $printer -l | cut -d/ -f1)
diff --git a/Completion/Unix/Command/_ls b/Completion/Unix/Command/_ls
index 1fd9383f5..df14e7e2c 100644
--- a/Completion/Unix/Command/_ls
+++ b/Completion/Unix/Command/_ls
@@ -196,7 +196,7 @@ else
     '(-q --hide-control-chars)--show-control-chars'
     '(- :)--help[display help information]'
     '(- :)--version[display version information]'
-    '*:files:_files'
+    '*:file:_files'
   )
   if [[ $OSTYPE = linux* ]]; then
     arguments+=(
diff --git a/Completion/Unix/Command/_make b/Completion/Unix/Command/_make
index 21ed56184..ae91440f0 100644
--- a/Completion/Unix/Command/_make
+++ b/Completion/Unix/Command/_make
@@ -204,7 +204,7 @@ _make() {
     ;;
 
     (debug)
-    _values -s , 'debug options' \
+    _values -s , 'debug option' \
       '(b v i j m)a[all debugging output]' \
       'b[basic debugging output]' \
       '(b)v[one level above basic]' \
diff --git a/Completion/Unix/Command/_moosic b/Completion/Unix/Command/_moosic
index 54d768c8c..475a0c75c 100644
--- a/Completion/Unix/Command/_moosic
+++ b/Completion/Unix/Command/_moosic
@@ -216,7 +216,7 @@ _moosic_cmd_version() {
 _moosic_song_files()
 {
     _arguments -A '-*' $main_opts $filelist_opts $auto_opts \
-               '*:song files:_files'
+               '*:song file:_files'
 }
 
 _moosic_cmd_append() {
@@ -282,7 +282,7 @@ _moosic_cmd_stagger-merge() {
 _moosic_cmd_interval-add() {
     _arguments -A '-*' $main_opts $filelist_opts \
                   '1:interval:' \
-                  '*:song files:_files'
+                  '*:song file:_files'
 }
 
 ### REMOVING COMMANDS
diff --git a/Completion/Unix/Command/_mysql_utils b/Completion/Unix/Command/_mysql_utils
index f1ad97bcd..a7b285f1c 100644
--- a/Completion/Unix/Command/_mysql_utils
+++ b/Completion/Unix/Command/_mysql_utils
@@ -187,7 +187,7 @@ _mysqladmin() {
 	  _wanted databases expl "MySQL database" _mysql_databases && ret=0
 	;;
 	kill)
-	  _message -e ids 'thread ids'
+	  _message -e ids 'thread id'
 	;;
 	password)
 	  _message -e passwords 'new password'
diff --git a/Completion/Unix/Command/_mysqldiff b/Completion/Unix/Command/_mysqldiff
index 4b46c86df..52b96ef21 100644
--- a/Completion/Unix/Command/_mysqldiff
+++ b/Completion/Unix/Command/_mysqldiff
@@ -20,8 +20,8 @@ _mysqldiff () {
 
 _mysql_db_or_file () {
   _alternative \
-    'databases:MySQL databases:_mysql_databases' \
-    'files:MySQL database definition files:_files -g "*.(my|)sql(-.)"'
+    'databases:MySQL database:_mysql_databases' \
+    'files:MySQL database definition file:_files -g "*.(my|)sql(-.)"'
 }
 
 _mysql_utils
diff --git a/Completion/Unix/Command/_nm b/Completion/Unix/Command/_nm
index 423fd3223..2f608c5fc 100644
--- a/Completion/Unix/Command/_nm
+++ b/Completion/Unix/Command/_nm
@@ -66,7 +66,7 @@ if _pick_variant -r variant binutils=GNU elftoolchain=elftoolchain elfutils=elfu
 	'--plugin[load specified plugin]:plugin'
 	'--special-syms[include special symbols in the output]'
 	'--synthetic[display synthetic symbols as well]'
-	"--target=[target object format]:targets:(${${(@M)${(f)$(_call_program targets nm --help)}:#*supported targets:*}##*: })"
+	"--target=[target object format]:target:(${${(@M)${(f)$(_call_program targets nm --help)}:#*supported targets:*}##*: })"
 	'--with-symbol-versions[display version strings after symbol names]'
       )
     ;;
diff --git a/Completion/Unix/Command/_objdump b/Completion/Unix/Command/_objdump
index 989cd3f0b..5152e6b6e 100644
--- a/Completion/Unix/Command/_objdump
+++ b/Completion/Unix/Command/_objdump
@@ -184,7 +184,7 @@ case "$state" in
         ${=${(M)${(f)"$(_call_program targets objdump --help)"}##* supported architectures:*}##*: } && ret=0
   ;;
   disassembler_options)
-    _values -s , "disassembler options" "${(@)${(@)${(@M)${(f)${(ps.-M switch.)$(_call_program targets objdump --help)}[2]}:#  [^ ]*}#  }%% *}" && ret=0
+    _values -s , "disassembler option" "${(@)${(@)${(@M)${(f)${(ps.-M switch.)$(_call_program targets objdump --help)}[2]}:#  [^ ]*}#  }%% *}" && ret=0
   ;;
   llvm_targets)
     _values "target architecture" "${(z)${(@)${(f)$(_call_program targets
diff --git a/Completion/Unix/Command/_perforce b/Completion/Unix/Command/_perforce
index 0d007e3bc..4e69dee78 100644
--- a/Completion/Unix/Command/_perforce
+++ b/Completion/Unix/Command/_perforce
@@ -1354,7 +1354,7 @@ _perforce_fstat_fields() {
     ${${${${(M)${(f)"$(_perforce_call_p4 help-fstat help fstat)"}:#[[:blank:]]#[a-zA-Z]##(|\#)[[:blank:]]##--*}##[[:blank:]]#}:#fstat *}//[[:blank:]]##--[[:blank:]]##/:}
   )
   compset -P '*[,[:blank:]]'
-  _describe -t fstat-fields 'Perforce fstat fields' values -S, -q
+  _describe -t fstat-fields 'Perforce fstat field' values -S, -q
 }
 
 
diff --git a/Completion/Unix/Command/_perl b/Completion/Unix/Command/_perl
index 4a917903c..d7e8f1b51 100644
--- a/Completion/Unix/Command/_perl
+++ b/Completion/Unix/Command/_perl
@@ -31,7 +31,7 @@ _perl () {
     "-u[dump core after parsing script]" \
     "-U[allow unsafe operations]" \
     "-v[print version, patchlevel and license]" \
-    "-V-[print perl configuration information]:configuration keys:_perl_config_vars" \
+    "-V-[print perl configuration information]:configuration key:_perl_config_vars" \
     '(   -W -X)-w[turn warnings on for compilation of your script (recommended)]' \
     "(-w    -X)-W[enable all warnings (ignores 'no warnings')]" \
     "(-w -W   )-X[disable all warnings (ignores 'use warnings')]" \
@@ -96,7 +96,7 @@ _perl_config_vars () {
 }
 
 _perl_unicode_flags () {
-  _values -s '' 'unicode bitmask or flags' \
+  _values -s '' 'unicode bitmask or flag' \
     '(S)I[  1 STDIN is assumed to be in UTF-8]' \
     '(S)O[  2 STDOUT will be in UTF-8]' \
     '(S)E[  4 STDERR will be in UTF-8]' \
diff --git a/Completion/Unix/Command/_perldoc b/Completion/Unix/Command/_perldoc
index 3e58d5a50..b724d74ee 100644
--- a/Completion/Unix/Command/_perldoc
+++ b/Completion/Unix/Command/_perldoc
@@ -3,7 +3,7 @@
 local curcontext="$curcontext" state line expl args ret=1
 typeset -A opt_args
 
-args=( '*:Perl pod pages:->perl-pods' )
+args=( '*:Perl pod page:->perl-pods' )
 
 if [[ $service = *PERLDOC* ]]; then
   compset -q
@@ -46,7 +46,7 @@ case  $state in
 
   perl-pods)
     if (( $+opt_args[-F] )); then
-      _wanted files expl 'Perl modules and .pods' \
+      _wanted files expl 'Perl module or .pod' \
           _files -g "*.(pod|pm)(-.)" && ret=0
     else
       _alternative \
diff --git a/Completion/Unix/Command/_ps b/Completion/Unix/Command/_ps
index 98dcd1cd0..9b54cbcc6 100644
--- a/Completion/Unix/Command/_ps
+++ b/Completion/Unix/Command/_ps
@@ -236,8 +236,8 @@ else
   [[ -z "$state" ]] && return ret
 fi
 
-_values -s '' -S ' ' 'options' $bsd && ret=0
-_values -S ' ' 'options' $bsdarg && ret=0
+_values -s '' -S ' ' 'option' $bsd && ret=0
+_values -S ' ' 'option' $bsdarg && ret=0
 if [[ -z $pids ]]; then
   _pids && ret=0
 fi
diff --git a/Completion/Unix/Command/_qemu b/Completion/Unix/Command/_qemu
index 3c21c3e74..30fcd6757 100644
--- a/Completion/Unix/Command/_qemu
+++ b/Completion/Unix/Command/_qemu
@@ -6,7 +6,7 @@ _qemu_log_items () {
     [[ $hline[1] = Log ]] && continue
     opts=($opts "${hline[1]}[${hline[2,-1]}]")
   done
-  _values -s , 'log items' $opts
+  _values -s , 'log item' $opts
 }
 
 local _qemu_machines
@@ -45,7 +45,7 @@ _arguments \
   '-s[wait gdb connection to port 1234]' \
   '-p[change gdb connection port]:port:_ports' \
   '-S[do not start CPU at startup]' \
-  '-d[output log in /tmp/qemu.log]:log items:_qemu_log_items' \
+  '-d[output log in /tmp/qemu.log]:log item:_qemu_log_items' \
   '-hdachs[force hard disk 0 geometry (usually qemu can guess it)]:hd0 geometry c,h,s:' \
   '-vga[select video card type]:card type:(std cirrus vmware qxl xenfb none)' \
   '-no-acpi[disable ACPI]' \
diff --git a/Completion/Unix/Command/_quilt b/Completion/Unix/Command/_quilt
index 8167bce1e..8f39dadac 100644
--- a/Completion/Unix/Command/_quilt
+++ b/Completion/Unix/Command/_quilt
@@ -36,7 +36,7 @@ _quilt_unapplied() {
 
 _arguments $help \
   '--trace[run the command in bash trace mode]' \
-  '--quiltrc=[use the specified configuration file]:files:_files' \
+  '--quiltrc=[use the specified configuration file]:file:_files' \
   '--version[print the version number and exit]' \
   ':quilt command:->cmd' \
   '*:: :->subcmd' && return
@@ -116,12 +116,12 @@ case $words[1] in
   add)
     _arguments -S $help \
       '-P+[specify patch to add files to]:patch:_quilt_applied' \
-      '*:files:_files' && return
+      '*:file:_files' && return
   ;;
   annotate)
     _arguments $help \
       '-P[stop checking for changes at the specified rather than the topmost patch]:patch:_quilt_series' \
-      ':files:_files' && return
+      ':file:_files' && return
   ;;
   applied) _arguments $help ':quilt series:_quilt_series' && return ;;
   delete)
@@ -142,9 +142,9 @@ case $words[1] in
       '(-P -z)--snapshot[diff against snapshot]' \
       '--diff=[use the specified utility for generating the diff]:diff utility:_command_names -e' \
       '--sort[sort files by name]' \
-      '*:files:_files' && return
+      '*:file:_files' && return
   ;;
-  edit) _arguments $help '*:files:_files' && return ;;
+  edit) _arguments $help '*:file:_files' && return ;;
   files)
     _arguments -s $help $verbose \
       '-a[list all files in all applied patches]' \
@@ -187,14 +187,14 @@ case $words[1] in
       '-P+[patch filename to use inside quilt]:quilt select patch filename: ' \
       '-f[overwrite/update existing patches]' \
       '-d+[header resolution when overwriting in existing patch]:resolution:((a\:all\ headers n\:new\ headers o\:old\ headers))' \
-      '*:files:_files' && return
+      '*:file:_files' && return
   ;;
   mail)
     _arguments $help \
       '(-h -M)-m[introduction text to use]:introduction text' \
       '(-h -m)-M[read introduction text from file]:file:_files' \
       '--prefix=[use an alternate prefix in the bracketed part of the subjects generated]:quilt select prefix: ' \
-      '--mbox=[store all messages in the specified file in mbox format]:files:_files' \
+      '--mbox=[store all messages in the specified file in mbox format]:file:_files' \
       '--send[send the messages directly]' \
       '--sender=[specify envelope sender address to use]:sender:_email_addresses -c' \
       '--from=[from header]:address:_email_addresses' \
@@ -202,13 +202,13 @@ case $words[1] in
       '*--to=[append a recipient to the To header]:recipient:_email_addresses' \
       '*--cc=[append a recipient to the Cc header]:recipient:_email_addresses' \
       '*--bcc=[append a recipient to the Bcc header]:recipient:_email_addresses' \
-      '--signature=[append specified signature file to messages]:files:_files' \
+      '--signature=[append specified signature file to messages]:file:_files' \
       '--reply-to=[add reply address to message]:address:_email_addresses' \
       '*:patch:_quilt_series' && return
   ;;
   new) _arguments $help $pstyle ':patch name' && return ;;
   next) _arguments $help ':patch:_quilt_series' && return ;;
-  patches) _arguments -S $help $verbose $color '*:files:_files' && return ;;
+  patches) _arguments -S $help $verbose $color '*:file:_files' && return ;;
   pop)
     _arguments -s $help $verbose \
       '-a[remove all applied patches]' \
@@ -253,7 +253,7 @@ case $words[1] in
   revert)
     _arguments $help \
       '-P[revert changes in the named patch]:patch:_quilt_series' \
-      '*:files:_files' && return
+      '*:file:_files' && return
   ;;
   series) _arguments $help $verbose $color && return ;;
   setup)
@@ -261,7 +261,7 @@ case $words[1] in
       '-d[specify path prefix for resulting source tree]:prefix:_files -W / -P /' \
       '--sourcedir[specify location of package sources]:directory:_directories' \
       '--fuzz=[set the maximum fuzz factor]:factor' \
-      ':files:_files' && return
+      ':file:_files' && return
   ;;
   snapshot) _arguments $help '-d[only remove current snapshot]' && return ;;
   unapplied) _arguments $help ':patch:_quilt_series' && return ;;
diff --git a/Completion/Unix/Command/_rclone b/Completion/Unix/Command/_rclone
index 40f06e0ba..27b4dd926 100644
--- a/Completion/Unix/Command/_rclone
+++ b/Completion/Unix/Command/_rclone
@@ -79,7 +79,7 @@ _arguments -C \
   '--dump-bodies[dump HTTP headers and bodies - may contain sensitive info]' \
   '--dump-headers[dump HTTP headers - may contain sensitive info]' \
   '--exclude[exclude files matching pattern]:stringArray' \
-  '--exclude-from[read exclude patterns from file]:files:_files' \
+  '--exclude-from[read exclude patterns from file]:file:_files' \
   '--exclude-if-present[exclude directories if filename is present]:string' \
   '--fast-list[use recursive list if available]' \
   '--files-from[read list of source-file names from file]:file:_files' \
@@ -339,8 +339,8 @@ _arguments -C \
 if [[ $state == 'files_or_remotes' ]]; then
   remotes=( $(_call_program rclone-remotes rclone listremotes) )
   _alternative \
-    "remote:rclone-remotes:compadd -a remotes" \
-    "file:files:_files" && ret=0
+    "rclone-remotes:remote:compadd -a remotes" \
+    "files:file:_files" && ret=0
 fi
 
 return ret
diff --git a/Completion/Unix/Command/_rsync b/Completion/Unix/Command/_rsync
index e14c99cc6..b1a4f6046 100644
--- a/Completion/Unix/Command/_rsync
+++ b/Completion/Unix/Command/_rsync
@@ -71,14 +71,14 @@ _rsync_info() {
   local opts
   opts=( ${${(M)${(f)"$(_call_program values $words[1] --info=help)"}:#*Mention*}/ ##Me/[me} )
   (( $#opts )) && opts=( '(ALL NONE HELP)'${^opts}\] )
-  _values -s , 'info options' $opts ALL NONE HELP
+  _values -s , 'info option' $opts ALL NONE HELP
 }
 
 _rsync_debug() {
   local opts
   opts=( ${${(M)${(f)"$(_call_program values $words[1] --debug=help)"}:#*Debug*}/ ##De/[de} )
   (( $#opts )) && opts=( '(ALL NONE HELP)'${^opts}\] )
-  _values -s , 'debug options' $opts ALL NONE HELP
+  _values -s , 'debug option' $opts ALL NONE HELP
 }
 
 _rsync_files() {
diff --git a/Completion/Unix/Command/_runit b/Completion/Unix/Command/_runit
index 81ba26a44..5c22cc54e 100644
--- a/Completion/Unix/Command/_runit
+++ b/Completion/Unix/Command/_runit
@@ -19,7 +19,7 @@ _sv_commands() {
     'kill':'send SIGKILL if service is running'
     'exit':'send SIGTERM and SIGCONT if service is running. Do not restart service.'
   )
-  _describe -t commands "sv commands" sv_ary -V sv_commands
+  _describe -t commands "sv command" sv_ary -V sv_commands
 }
 
 _sv_lsb() {
@@ -41,7 +41,7 @@ _sv_lsb() {
 }
 
 _sv_additional() {
-  _describe -t additional-commands "sv additional commands" '("check:check status of service")' -V sv_addl_comm
+  _describe -t additional-commands "sv additional command" '("check:check status of service")' -V sv_addl_comm
 }
 
 local curcontext="$curcontext" state line
@@ -68,6 +68,6 @@ case $state in
     )
 
     sv_services=( ${sv_services#$svdir/} )
-    _describe -t services "sv services" sv_services
+    _describe -t services "sv service" sv_services
   ;;
 esac
diff --git a/Completion/Unix/Command/_scons b/Completion/Unix/Command/_scons
index 2c620cc1a..77fe6dfb0 100644
--- a/Completion/Unix/Command/_scons
+++ b/Completion/Unix/Command/_scons
@@ -19,7 +19,7 @@ _arguments -s -S \
   '(-)-'{h,-help}'[display defined usage information]' \
   '(-)-'{H,-help-options}'[display usage information]' \
   '(-i -ignore-errors)-'{i,-ignore-errors}'[ignore errors from build actions]' \
-  \*{-I,--include-dir=}'[add directory to search Python modules]:directories:_directories' \
+  \*{-I,--include-dir=}'[add directory to search Python modules]:directory:_directories' \
   '(--implicit-deps-changed --implicit-deps-unchanged)--implicit-cache[cache scanned dependencies]' \
   '(--implicit-cache --implicit-deps-changed)--implicit-deps-changed[rescan dependencies]' \
   '(--implicit-cache --implicit-deps-unchanged)--implicit-deps-unchanged[ignore changes to scanned dependencies]' \
diff --git a/Completion/Unix/Command/_ssh b/Completion/Unix/Command/_ssh
index 82a2a1827..ffdc4999f 100644
--- a/Completion/Unix/Command/_ssh
+++ b/Completion/Unix/Command/_ssh
@@ -392,7 +392,7 @@ _ssh () {
           state=dynforward
           ;;
         (#i)kbdinteractivedevices=*)
-          _values -s , 'keyboard-interactive authentication methods' \
+          _values -s , 'keyboard-interactive authentication method' \
               'bsdauth' 'pam' 'skey' && ret=0
           ;;
         (#i)(kexalgorithms|gssapikexalgorithms)=*)
diff --git a/Completion/Unix/Command/_tla b/Completion/Unix/Command/_tla
index 1e4cdd8d9..33dfc005f 100644
--- a/Completion/Unix/Command/_tla
+++ b/Completion/Unix/Command/_tla
@@ -45,8 +45,8 @@ _tla_revisions () { _arch_namespace tla 4 "$argv[@]" }
 (( $+functions[_tla_local_revisions] )) ||
 _tla_local_revisions () {
   local expl1 expl2 tree_version=`$TLA tree-version`
-  _description -V applied-patches expl1 "patches from this version"
-  _description -V other-patches expl2 "patches from other versions"
+  _description -V applied-patches expl1 "patch from this version"
+  _description -V other-patches expl2 "patch from other versions"
   compadd "$expl1[@]" `$TLA logs`
   compadd "$expl2[@]" `$TLA logs --full $($TLA log-versions | grep -v $tree_version)`
   # This is incredibly slow.
@@ -90,7 +90,7 @@ _tla_limit () { #presently only does push-mirror style limits
   if [ $archive ]; then
 
     if [[ $PREFIX != *--* ]]; then
-      _description -V categories expl "categories in $archive"
+      _description -V categories expl "category in $archive"
       compadd -q -S -- "$expl[@]" `$TLA categories -A $archive`
     else
       _tla_namespace_branches 3
@@ -107,7 +107,7 @@ _tla_tree_or_rev () {
 _tla_libraries () {
   local libraries expl
   libraries=($(_call_program tla $TLA my-revision-library))
-  _description -V libraries expl "revision libraries"
+  _description -V libraries expl "revision library"
   compadd "$expl[@]" -a libraries
 }
 
@@ -128,7 +128,7 @@ _tla_log_versions () {
   else
     logs=($(_call_program tla $TLA logs))
   fi
-  _description -V versions expl "log versions"
+  _description -V versions expl "log version"
   compadd "$expl[@]" -a logs
 }
 
@@ -278,12 +278,12 @@ methods=(
 cmd_tagging_method=($cmd_id_tagging_method)
 
 local cmd_add cmd_add_id cmd_add_tag
-cmd_add=('*:files to add:_files')
+cmd_add=('*:file to add:_files')
 cmd_add_id=($cmd_add)
 cmd_add_tag=($cmd_add)
 
 local cmd_delete cmd_delete_id cmd_delete_tag
-cmd_delete=('*:files to delete:_files')
+cmd_delete=('*:file to delete:_files')
 cmd_delete_id=($cmd_delete)
 cmd_delete_tag=($cmd_delete)
 
@@ -312,7 +312,7 @@ cmd_changeset=(
   ':ORIG:_files -/'
   ':MOD:_files -/'
   ':DEST:_files -/'
-  '*:files:_files'
+  '*:file:_files'
 )
 cmd_mkpatch=("$cmd_changeset[@]")
 
@@ -328,7 +328,7 @@ local cmd_make_archive
 cmd_make_archive=('::name:' ':location:_files -/')
 
 local cmd_archive_setup
-cmd_archive_setup=('*:versions:_tla_branches --trailing-dashes')
+cmd_archive_setup=('*:version:_tla_branches --trailing-dashes')
 
 local cmd_make_category
 cmd_make_category=(':category:_tla_archives -S /')
@@ -344,7 +344,7 @@ cmd_import=('::version:_tla_versions')
 cmd_imprev=($cmd_import)
 
 local cmd_commit cmd_cmtrev
-cmd_commit=('::version:_tla_versions' ':separator:(--)' '*:files:_files')
+cmd_commit=('::version:_tla_versions' ':separator:(--)' '*:file:_files')
 cmd_cmtrev=($cmd_commit)
 
 local cmd_get cmd_getrev
@@ -619,7 +619,7 @@ _tla_main () {
     local -U cmds
     help=(${(f)"$($TLA help)"})
     cmds=(${${${${(M)help:#* :*}/ #: #/:}%% ##}## #})
-    arguments=(':commands:(($cmds))')
+    arguments=(':command:(($cmds))')
   fi
   _arguments -S -A '-*' \
     {"${hide_short}(: -)-V",'(: -)--version'}'[display version]' \
diff --git a/Completion/Unix/Command/_tmux b/Completion/Unix/Command/_tmux
index f4e5619a0..284a325e5 100644
--- a/Completion/Unix/Command/_tmux
+++ b/Completion/Unix/Command/_tmux
@@ -1114,7 +1114,7 @@ function __tmux-buffers() {
     fi
 
     buffers=( ${${(f)"$(command tmux 2> /dev/null list-buffers "${bopts[@]}")"}/:[ $'\t']##/:} )
-    _describe -t buffers 'buffers' buffers
+    _describe -t buffers 'buffer' buffers
 }
 
 function __tmux-bound-keys() {
@@ -1122,14 +1122,14 @@ function __tmux-bound-keys() {
     local -a keys
 
     keys=( ${${${${(f)"$(command tmux 2> /dev/null list-keys "$@")"}/:[ $'\t']##/:}/(#s)[ $'\t']##/}/(#s):/\\:} )
-    _describe -t keys 'keys' keys
+    _describe -t keys 'key' keys
 }
 
 function __tmux-clients() {
     local expl
     local -a clients
     clients=( ${${(f)"$(command tmux 2> /dev/null list-clients)"}/:[ $'\t']##/:} )
-    _describe -t clients 'clients' clients
+    _describe -t clients 'client' clients
 }
 
 function __tmux-environment-variables() {
@@ -1165,7 +1165,7 @@ function __tmux-environment-variables() {
                 descriptions+=( "${k//:/\\:}:$v" )
             done
             # TODO: this if/else is because '_describe ${hint:+"-x"}' prints the "No matches" error in addition to the message.
-            local msg="${dash_g[1]:+"global "}environment variables${hint}"
+            local msg="${dash_g[1]:+"global "}environment variable${hint}"
             if _describe -t parameters $msg descriptions; then
                 :
             elif [[ -n $hint ]]; then
@@ -1621,9 +1621,9 @@ function __tmux-panes() {
     command tmux 2> /dev/null list-panes "${opts[@]}" | while IFS= read -r line; do
         panes+=( $(( num++ )):${line//:/} )
     done
-    _describe -t panes 'panes' panes "$@"
+    _describe -t panes 'pane' panes "$@"
     if [[ ${IPREFIX} != *. ]]; then
-        _wanted windows expl 'windows' __tmux-windows -S.
+        _wanted windows expl 'window' __tmux-windows -S.
     fi
 }
 
@@ -1648,14 +1648,14 @@ function __tmux-server-options() {
 function __tmux-sessions() {
     local -a sessions
     sessions=( ${${(f)"$(command tmux 2> /dev/null list-sessions)"}/:[ $'\t']##/:} )
-    _describe -t sessions 'sessions' sessions "$@"
+    _describe -t sessions 'session' sessions "$@"
 }
 
 function __tmux-sessions-attached() {
     local -a sessions
     sessions=( ${${(f)"$(command tmux 2> /dev/null list-sessions)"}/:[ $'\t']##/:} )
     sessions=( ${(M)sessions:#*"(attached)"} )
-    _describe -t sessions 'attached sessions' sessions "$@"
+    _describe -t sessions 'attached session' sessions "$@"
 }
 
 # Complete attached-sessions and detached-sessions as separate tags.
@@ -1671,8 +1671,8 @@ function __tmux-sessions-separately() {
     _tags detached-sessions attached-sessions
     # Placing detached before attached means the default behaviour of this
     # function better suits its only current caller, _tmux-attach-session().
-    _requested detached-sessions && _describe -t detached-sessions 'detached sessions' detached_sessions "$@" && ret=0
-    _requested attached-sessions && _describe -t attached-sessions 'attached sessions' attached_sessions "$@" && ret=0
+    _requested detached-sessions && _describe -t detached-sessions 'detached session' detached_sessions "$@" && ret=0
+    _requested attached-sessions && _describe -t attached-sessions 'attached session' attached_sessions "$@" && ret=0
 
     return ret
 }
@@ -1744,9 +1744,9 @@ function __tmux-windows() {
         opts=( )
     fi
     wins=( ${${(M)${(f)"$(command tmux 2> /dev/null list-windows "${opts[@]}")"}:#<->*}/:[ $'\t']##/:} )
-    _describe -t windows 'windows' wins "$@"
+    _describe -t windows 'window' wins "$@"
     if [[ ${IPREFIX} != *: ]]; then
-        _wanted sessions expl 'sessions' __tmux-sessions -S:
+        _wanted sessions expl 'session' __tmux-sessions -S:
     fi
 }
 
@@ -1775,11 +1775,11 @@ _tmux() {
   if (( CURRENT == 1 )); then
     zstyle -s ":completion:${curcontext}:subcommands" mode mode || mode='both'
     if [[ ${mode} == 'commands' ]]; then
-      _describe -t subcommands 'tmux commands' _tmux_commands && ret=0
+      _describe -t subcommands 'tmux command' _tmux_commands && ret=0
     elif [[ ${mode} == 'aliases' ]]; then
-      _describe -t subcommands 'tmux aliases' _tmux_aliases && ret=0
+      _describe -t subcommands 'tmux alias' _tmux_aliases && ret=0
     else
-      _describe -t subcommands 'tmux commands and aliases' _tmux_commands -- _tmux_aliases && ret=0
+      _describe -t subcommands 'tmux command or alias' _tmux_commands -- _tmux_aliases && ret=0
     fi
   else
     tmuxcommand="${words[1]}"
diff --git a/Completion/Unix/Command/_tput b/Completion/Unix/Command/_tput
index a3b4e949c..abba3e8c0 100644
--- a/Completion/Unix/Command/_tput
+++ b/Completion/Unix/Command/_tput
@@ -14,5 +14,5 @@ esac
 _arguments : \
   $args - set3 \
   '(-S -V)-T+[terminal type]:terminal type:_terminals' \
-  '1:terminal capabilities:( init reset longname ${(k)terminfo} )' \
+  '1:terminal capability:( init reset longname ${(k)terminfo} )' \
   '*:capability parameters:{ [[ $words[1] != (init|reset|longname) ]] && _message parameter }'
diff --git a/Completion/Unix/Command/_unison b/Completion/Unix/Command/_unison
index 5963d66c6..91fa57e5b 100644
--- a/Completion/Unix/Command/_unison
+++ b/Completion/Unix/Command/_unison
@@ -6,7 +6,7 @@ typeset -A opt_args
 _arguments \
     '-auto[automatically accept default (nonconflicting) actions]' \
     '-batch[batch mode\: ask no questions at all]' \
-    '-doc[show documentation]:topics:(about people lists status copying ack install tutorial basics failures running ssh news all topics)' \
+    '-doc[show documentation]:topic:(about people lists status copying ack install tutorial basics failures running ssh news all topics)' \
     '-follow[add a pattern to the follow list]:pattern:' \
     '-force[force changes from this replica to the other]:replica:' \
     '-group[synchronize group attributes]' \
diff --git a/Completion/Unix/Command/_w3m b/Completion/Unix/Command/_w3m
index 6e83a6781..8b45ad730 100644
--- a/Completion/Unix/Command/_w3m
+++ b/Completion/Unix/Command/_w3m
@@ -84,7 +84,7 @@ case "$state" in
     _alternative \
       'files:file:_files -g "*.x#html(-.)"' \
       'urls:URL:_urls' \
-      'bookmarks:bookmarks:compadd -a bookmarks' \
+      'bookmarks:bookmark:compadd -a bookmarks' \
       'history:history:compadd -a w3mhistory' && ret=0
   ;;
   option)
diff --git a/Completion/Unix/Command/_wget b/Completion/Unix/Command/_wget
index 49c8e8b01..d061fcd06 100644
--- a/Completion/Unix/Command/_wget
+++ b/Completion/Unix/Command/_wget
@@ -137,7 +137,7 @@ _arguments -C -s \
   '(--reject -R)'{--reject=,-R+}'[specify rejected extensions]:extensions' \
   --{accept,reject}-regex=:regex '--regex-type=:regex type:(posix pcre)' \
   '(--domains -D)'{--domains=,-D+}'[specify accepted domains]:domains:_domains' \
-  '--exclude-domains=:rejected domains:_domains' \
+  '--exclude-domains=:rejected domain:_sequence _domains' \
   '--follow-ftp' \
   '--follow-tags=:HTML tags:' \
   '--ignore-tags=[specify ignored HTML tags]:HTML tags' \
diff --git a/Completion/Unix/Command/_xmlsoft b/Completion/Unix/Command/_xmlsoft
index 487974fdb..6f7e3b7c9 100644
--- a/Completion/Unix/Command/_xmlsoft
+++ b/Completion/Unix/Command/_xmlsoft
@@ -45,7 +45,7 @@ case $service in
       '--encoding[the input document character encoding]:encoding:(${encoding[@]})' \
       '*--param[pass a parameter,value pair]:name::value (xpath expression)' \
       '*--stringparam[pass a parameter]:name::value' \
-      '--path[provide a set of paths for resources]:paths:_files -/' \
+      '--path[provide a set of paths for resources]:path:_dir_list' \
       '--nonet[refuse to fetch DTDs or entities over network]' \
       '--nowrite[refuse to write to any file or resource]' \
       '--nomkdir[refuse to create directories]' \
@@ -70,7 +70,7 @@ case $service in
       '--noent[substitute entity references by their value]' \
       '--noenc[ignore any encoding specified inside the document]' \
       "(--output -o)--noout[don't output the result tree]" \
-      '--path[provide a set of paths for resources]:paths:_files -/' \
+      '--path[provide a set of paths for resources]:path:_dir_list' \
       '--load-trace[print trace of all external entities loaded]' \
       '--nonet[refuse to fetch DTDs or entities over network]' \
       '--nocompact[do not generate compact text nodes]' \
diff --git a/Completion/Unix/Command/_xmms2 b/Completion/Unix/Command/_xmms2
index 525d5177c..ca2383b2f 100644
--- a/Completion/Unix/Command/_xmms2
+++ b/Completion/Unix/Command/_xmms2
@@ -43,7 +43,7 @@ _xmms2_command() {
 	)
 
     if (( CURRENT == 1 )); then
-	_describe -t command "xmms2 commands" xmms2_cmds
+	_describe -t command "xmms2 command" xmms2_cmds
     else
 	local curcontext="$curcontext"
     fi
@@ -63,7 +63,7 @@ _xmms2_command() {
 	 fi
      done
      
-     _values -s ' ' 'playlist items' ${(On)playlistitems}
+     _values -s ' ' 'playlist item' ${(On)playlistitems}
 
 }
 
@@ -84,7 +84,7 @@ _xmms2_mlib() {
 
 	)
     if (( CURRENT == 2 )); then
-	_describe -t command "xmms2 mlib commands" mlib_cmds
+	_describe -t command "xmms2 mlib command" mlib_cmds
     else
 	local curcontext="$curcontext"
     fi
@@ -107,7 +107,7 @@ _xmms2_playlist() {
 	remove:"Remove a playlist"
 	)
     if (( CURRENT == 2 )); then
-	_describe -t command "xmms2 playlist commands" playlist_cmds
+	_describe -t command "xmms2 playlist command" playlist_cmds
     else
 	local curcontext="$curcontext"
     fi
@@ -121,14 +121,14 @@ _xmms2_playlist() {
 _xmms2_playlist_load() {
     local list
     list=($(xmms2 playlist list))
-    _describe -t command "xmms2 playlists" list
+    _describe -t command "xmms2 playlist" list
 }
 
 
 _xmms2_playlist_remove() {
     local list
     list=($(xmms2 playlist list))
-    _describe -t command "xmms2 playlists" list
+    _describe -t command "xmms2 playlist" list
 }
 
 
@@ -146,7 +146,7 @@ _xmms2_coll() {
 	attr:"Get/set an attribute for a saved collection"
 	)
     if (( CURRENT == 2 )); then
-	_describe -t command "xmms2 collection commands" coll_cmds
+	_describe -t command "xmms2 collection command" coll_cmds
     else
 	local curcontext="$curcontext"
     fi
@@ -160,7 +160,7 @@ _xmms2_coll() {
 _xmms2_coll_helper() {
     local list
     list=($(xmms2 coll list))
-    _describe -t command "xmms2 playlists" list
+    _describe -t command "xmms2 playlist" list
 }
 
 _xmms2_coll_rename() {
diff --git a/Completion/Unix/Command/_yafc b/Completion/Unix/Command/_yafc
index 1e0a601a1..946c0b4ce 100644
--- a/Completion/Unix/Command/_yafc
+++ b/Completion/Unix/Command/_yafc
@@ -32,7 +32,7 @@ _yafc_bookmarks() {
     if [[ -f $bkmfile ]]; then
         local -a bkms expl
         bkms=(${${${(M)"${(f)$(<$bkmfile)}":#machine*alias ##\'*\' #}##machine*alias ##\'}%%\' #}) #" vim syntax goes crazy
-        _wanted bookmarks expl 'bookmarks' compadd "$@" -a - bkms
+        _wanted bookmarks expl 'bookmark' compadd "$@" -a - bkms
     fi
 }
 
diff --git a/Completion/Unix/Type/_email_addresses b/Completion/Unix/Type/_email_addresses
index 8a5877a9c..d5f175a79 100644
--- a/Completion/Unix/Type/_email_addresses
+++ b/Completion/Unix/Type/_email_addresses
@@ -69,7 +69,7 @@ _email-ldap() {
     fi
   done
   compstate[insert]=menu
-  _wanted email-ldap expl 'matching names' \
+  _wanted email-ldap expl 'matching name' \
       compadd -U -i "$IPREFIX" -I "$ISUFFIX" "$@" -a - ali
 }
 
diff --git a/Completion/Unix/Type/_urls b/Completion/Unix/Type/_urls
index 5d4990442..f9cdd58cd 100644
--- a/Completion/Unix/Type/_urls
+++ b/Completion/Unix/Type/_urls
@@ -103,7 +103,7 @@ case "$scheme" in
   bookmark)
     if [[ -f "$urls/$scheme/${(Q)PREFIX}${(Q)SUFFIX}" &&
 	  -s "$urls/$scheme/${(Q)PREFIX}${(Q)SUFFIX}" ]]; then
-      _wanted -C bookmark bookmarks expl bookmarks \
+      _wanted -C bookmark bookmarks expl bookmark \
           compadd "$@" -U - \
               "$ipre$(<"$urls/$scheme/${(Q)PREFIX}${(Q)SUFFIX}")" && ret=0
     else
diff --git a/Completion/X/Command/_mozilla b/Completion/X/Command/_mozilla
index 64f4d9450..0be25b8d3 100644
--- a/Completion/X/Command/_mozilla
+++ b/Completion/X/Command/_mozilla
@@ -95,7 +95,7 @@ if [[ "$state" = "remote" ]]; then
     ;;
     *)
       compset -S '(|\\)\(*' || suf="${${QIPREFIX:+(}:-\(}"
-      _wanted commands expl 'remote commands' \
+      _wanted commands expl 'remote command' \
           compadd -qS "$suf" -M 'm:{a-zA-Z}={A-Za-z}' -a \
                   remote_commands && ret=0
     ;;
diff --git a/Completion/X/Command/_mplayer b/Completion/X/Command/_mplayer
index a913960fe..1f99a1789 100644
--- a/Completion/X/Command/_mplayer
+++ b/Completion/X/Command/_mplayer
@@ -131,13 +131,13 @@ case "$state" in
   ;;
   audio-drivers)
     vals=( help ${${${(f)"$(_call_program audio-drivers mplayer -ao help 2>/dev/null)"}[(r)	*,-1]#?}/	/:} )
-    _describe -t audio-drivers 'audio drivers' vals && ret=0
+    _describe -t audio-drivers 'audio driver' vals && ret=0
   ;;
   audio-codec-families)
     compset -P '*,'
     compset -S ',*'
     vals=( help ${${${(f)"$(_call_program audio-codec-families mplayer -afm help 2>/dev/null)"}[(r) [^:]#,-1]## ##}/ ##/:} )
-    _describe -t audio-codec-families 'audio drivers' vals && ret=0
+    _describe -t audio-codec-families 'audio driver' vals && ret=0
   ;;
   audio-plugins)
     _values -s : 'audio output plugin' \
@@ -154,7 +154,7 @@ case "$state" in
   ;;
   video-drivers)
     vals=( help ${${${(f)"$(_call_program video-drivers mplayer -vo help 2>/dev/null)"}[(r)	*,-1]#?}/	/:} )
-    _describe -t video-drivers 'video drivers' vals && ret=0
+    _describe -t video-drivers 'video driver' vals && ret=0
   ;;
   video-output-plugins)
     vals=( help ${${${${(f)"$(_call_program video-output-plugins mplayer -vop help 2>/dev/null)"}[(r)	*,-1]}/	/}/ #: /:} )
diff --git a/Completion/X/Command/_netscape b/Completion/X/Command/_netscape
index e1d02ae90..78b2da649 100644
--- a/Completion/X/Command/_netscape
+++ b/Completion/X/Command/_netscape
@@ -52,7 +52,7 @@ if [[ "$state" = "remote" ]]; then
     ;;
     *)
       compset -S '(|\\)\(*' || suf="${${QIPREFIX:+(}:-\(}"
-      _wanted commands expl 'remote commands' \
+      _wanted commands expl 'remote command' \
           compadd -qS "$suf" -M 'm:{a-zA-Z}={A-Za-z}' -a \
                   remote_commands && ret=0
     ;;
diff --git a/Completion/X/Command/_pdftk b/Completion/X/Command/_pdftk
index b8c43f754..1ac3223f7 100644
--- a/Completion/X/Command/_pdftk
+++ b/Completion/X/Command/_pdftk
@@ -24,7 +24,7 @@ case $words[CURRENT-1] in
     (allow)
 	#_description permissions expl "permission"
 	#compadd $expl \
-	_values -s , permissions \
+	_values -s , permission \
 	    Printing DegradedPrinting ModifyContents Assembly CopyContents \
 	    ScreenReaders ModifyAnnotations FillIn AllFeatures
 	;;
@@ -34,12 +34,12 @@ case $words[CURRENT-1] in
 	;;
 
     (fill_form)
-	_description files expl 'FDF and XFDF files'
+	_description files expl 'FDF and XFDF file'
 	_files "$@" $expl -g '(#i)*.(fdf|xfdf)'
 	;;
 
     ((multibackground|background|stamp|multistamp|output))
-	_description files expl 'PDF files'
+	_description files expl 'PDF file'
 	_files "$@" $expl -g '(#i)*.pdf'
 	;;
 
@@ -53,11 +53,11 @@ case $words[CURRENT-1] in
 esac && return 0
 
 if [[ -n $words[(r)(${(j:|:)operations})] ]]; then
-    _description options expl "options"
+    _description options expl "option"
     compadd $@ $expl $opts
 else
     _tags files operations
     _alternative \
-	'files:PDF files:_pdfwithhandle' \
-	"operations:operations:($operations)"
+	'files:PDF file:_pdfwithhandle' \
+	"operations:operation:($operations)"
 fi
diff --git a/Completion/X/Command/_vnc b/Completion/X/Command/_vnc
index d60616f21..9263ab930 100644
--- a/Completion/X/Command/_vnc
+++ b/Completion/X/Command/_vnc
@@ -86,7 +86,7 @@ case $service in
   ;;
   *vncviewer) 
     _xt_arguments -shared -viewonly -fullscreen -bgr233 -owncmap -truecolour \
-      '-encodings:encodings:_values -s " " encoding copyrect hextile corre rre raw' \
+      '-encodings: :_values -s " " encoding copyrect hextile corre rre raw' \
       '-depth:depth' \
       '-passwd:file:_files' \
       '(1)-listen:display number' \
diff --git a/Completion/X/Command/_xauth b/Completion/X/Command/_xauth
index 14dfc8400..22ebffecd 100644
--- a/Completion/X/Command/_xauth
+++ b/Completion/X/Command/_xauth
@@ -41,7 +41,7 @@ while [[ -n "$state" ]]; do
 	  group) _message -e ids 'group-id';;
 	  data) _message -e values 'hexdata';;
 	  *) 
-	    _wanted options expl 'xauth generate options' \
+	    _wanted options expl 'xauth generate option' \
 	      compadd trusted untrusted timeout group data && ret=0
 	    ;;
 	  esac
diff --git a/Completion/X/Command/_xournal b/Completion/X/Command/_xournal
index 066ef55f5..c36210c26 100644
--- a/Completion/X/Command/_xournal
+++ b/Completion/X/Command/_xournal
@@ -2,5 +2,5 @@
 
 local expl
 
-_description files expl 'PDF and Xournal files'
+_description files expl 'PDF or Xournal file'
 _files "$@" "$expl[@]" -g '*.(#i){xoj,pdf}(-.)'
diff --git a/Completion/Zsh/Command/_bindkey b/Completion/Zsh/Command/_bindkey
index 81ae69974..df9c8f225 100644
--- a/Completion/Zsh/Command/_bindkey
+++ b/Completion/Zsh/Command/_bindkey
@@ -27,7 +27,7 @@ _arguments -C -s -S \
   '(-l -L -d -D -A -N -m -p -r *)-s[bind each in-string to each out-string]:*:key string' \
   '(-e -v -a -M -l -L -d -D -A -N -m -p)-R[interpret in-strings as ranges]' \
   '(-l -L -d -A -N -m -p -r -s):in-string' \
-  '(-l -L -d -A -N -m -p -r -s)*::widgets:_widgets' && ret=0
+  '(-l -L -d -A -N -m -p -r -s)*::widget:_widgets' && ret=0
 
 case $state in
   keymap)
diff --git a/Completion/Zsh/Command/_disable b/Completion/Zsh/Command/_disable
index 52b82a6e9..da3803039 100644
--- a/Completion/Zsh/Command/_disable
+++ b/Completion/Zsh/Command/_disable
@@ -7,10 +7,10 @@ sali_arr=(${(k)saliases})
 func_arr=(${(k)functions})
 
 _arguments -C -s -A "-*" -S \
-  "(-f -r -s -p)-a[act on regular or global aliases]:*:regular or global aliases:compadd -k ali_arr" \
-  "(-a -r -s -p)-f[act on functions]:*:functions:compadd -k func_arr" \
-  "(-a -f -s -p)-r[act on reserved words]:*:reserved-words:compadd -k reswords" \
-  "(-a -f -r -p)-s[act on suffix aliases]:*:suffix aliases:compadd -k sali_arr" \
-  "(-a -f -r -s)-p[act on pattern characters]:*:pattern characters:compadd -k patchars" \
+  "(-f -r -s -p)-a[act on regular or global aliases]:*:regular or global alias:compadd -k ali_arr" \
+  "(-a -r -s -p)-f[act on functions]:*:function:compadd -k func_arr" \
+  "(-a -f -s -p)-r[act on reserved words]:*:reserved-word:compadd -k reswords" \
+  "(-a -f -r -p)-s[act on suffix aliases]:*:suffix alias:compadd -k sali_arr" \
+  "(-a -f -r -s)-p[act on pattern characters]:*:pattern character:compadd -k patchars" \
   '-m[treat arguments as patterns]' \
   "*:builtin command:(${(k)builtins})"
diff --git a/Completion/Zsh/Command/_enable b/Completion/Zsh/Command/_enable
index 9410651b7..b62619d89 100644
--- a/Completion/Zsh/Command/_enable
+++ b/Completion/Zsh/Command/_enable
@@ -7,10 +7,10 @@ sali_arr=(${(k)dis_saliases})
 func_arr=(${(k)dis_functions})
 
 _arguments -C -s -A "-*" -S \
-  "(-f -r -s -p)-a[act on regular or global aliases]:*:aliases:compadd -k ali_arr" \
-  "(-a -r -s -p)-f[act on functions]:*:functions:compadd -k func_arr" \
-  "(-a -f -s -p)-r[act on reserved words]:*:reserved-words:compadd -k dis_reswords" \
-  "(-a -f -r -p)-s[act on suffix aliases]:*:suffix aliases:compadd -k sali_arr" \
-  "(-a -f -r -s)-p[act on pattern characters]:*:pattern characters:compadd -k dis_patchars" \
+  "(-f -r -s -p)-a[act on regular or global aliases]:*:alias:compadd -k ali_arr" \
+  "(-a -r -s -p)-f[act on functions]:*:function:compadd -k func_arr" \
+  "(-a -f -s -p)-r[act on reserved words]:*:reserved-word:compadd -k dis_reswords" \
+  "(-a -f -r -p)-s[act on suffix aliases]:*:suffix alias:compadd -k sali_arr" \
+  "(-a -f -r -s)-p[act on pattern characters]:*:pattern character:compadd -k dis_patchars" \
   '-m[treat arguments as patterns]' \
   "*:builtin command:(${(k)dis_builtins})"
diff --git a/Completion/Zsh/Command/_sched b/Completion/Zsh/Command/_sched
index e8ff5ab87..888708684 100644
--- a/Completion/Zsh/Command/_sched
+++ b/Completion/Zsh/Command/_sched
@@ -10,7 +10,7 @@ if [[ CURRENT -eq 2 ]]; then
     else
       disp=()
     fi
-    [[ -z $lines ]] || _wanted jobs expl 'scheduled jobs' \
+    [[ -z $lines ]] || _wanted jobs expl 'scheduled job' \
                            compadd "$disp[@]" - {1..$#lines}
     return
   else
diff --git a/Completion/Zsh/Command/_typeset b/Completion/Zsh/Command/_typeset
index ae33ae539..aecacb112 100644
--- a/Completion/Zsh/Command/_typeset
+++ b/Completion/Zsh/Command/_typeset
@@ -127,7 +127,7 @@ if [[ "$state" = vars_eq ]]; then
 	[[ $PREFIX != [_.]* ]]; then
 	args=(${args:#_*})
       fi
-      _wanted functions expl 'shell functions' compadd -a args
+      _wanted functions expl 'shell function' compadd -a args
     else
       _functions
     fi
diff --git a/Completion/Zsh/Command/_zmodload b/Completion/Zsh/Command/_zmodload
index 3416d50c6..f3e38c0f6 100644
--- a/Completion/Zsh/Command/_zmodload
+++ b/Completion/Zsh/Command/_zmodload
@@ -23,7 +23,7 @@ _arguments -n -C -S -s \
   '(-e -u)-L[output in the form of calls to zmodload]' \
   '(-b -c -d -I -f -F -P -l -m -A -R)-p[autoload module for parameters]' \
   '(-u -b -c -d -p -f -A -R)-P[array param for features]:array name:_parameters' \
-  '(-)*:params:->params' && ret=0
+  '(-)*:param:->params' && ret=0
 
 [[ $state = params ]] || return ret
 
@@ -66,7 +66,7 @@ else
   while _tags; do
     _requested builtins expl 'builtin command' \
       compadd "$@" -k builtins && ret=0
-    _requested loadedmodules expl 'loaded modules' \
+    _requested loadedmodules expl 'loaded module' \
       compadd -k 'modules[(R)loaded]' && ret=0
     _requested files expl 'module file' \
       _files -W module_path -g '*.(dll|s[ol]|bundle)(:r)' && ret=0
diff --git a/Completion/Zsh/Command/_zstyle b/Completion/Zsh/Command/_zstyle
index 9d06076e4..0c81c2f2e 100644
--- a/Completion/Zsh/Command/_zstyle
+++ b/Completion/Zsh/Command/_zstyle
@@ -491,7 +491,7 @@ while (( $#state )); do
       elif compset -P '*:'; then
         _message -e tags tag
       else
-        _message -e patterns 'glob patterns'
+        _message -e patterns 'glob pattern'
       fi
       ;;
 
diff --git a/Completion/Zsh/Context/_subscript b/Completion/Zsh/Context/_subscript
index 0d9632864..25cedd193 100644
--- a/Completion/Zsh/Context/_subscript
+++ b/Completion/Zsh/Context/_subscript
@@ -80,7 +80,7 @@ elif compset -P '\('; then
     );;
   esac
 
-  _values -s '' 'subscript flags' $flags
+  _values -s '' 'subscript flag' $flags
 elif [[ ${(Pt)${compstate[parameter]}} = assoc* ]]; then
   local suf MATCH MBEGIN MEND
   local -a keys
diff --git a/Completion/Zsh/Context/_zcalc_line b/Completion/Zsh/Context/_zcalc_line
index 50fb8c17c..ab8e42df9 100644
--- a/Completion/Zsh/Context/_zcalc_line
+++ b/Completion/Zsh/Context/_zcalc_line
@@ -16,7 +16,7 @@ _zcalc_line_escapes() {
     "function:define math function (also \:func or \:f)"
   )
   cmds=("\:"${^cmds})
-  _describe -t command-escapes "command escapes" cmds -Q
+  _describe -t command-escapes "command escape" cmds -Q
 }
 
 _zcalc_line() {
diff --git a/Completion/Zsh/Function/_add-zsh-hook b/Completion/Zsh/Function/_add-zsh-hook
index 4d8a96dab..5b1ff0e42 100644
--- a/Completion/Zsh/Function/_add-zsh-hook
+++ b/Completion/Zsh/Function/_add-zsh-hook
@@ -3,7 +3,7 @@
 _add-zsh-hook_hooks() {
   local expl
   if (( $+opt_args[-d] )); then
-    _wanted functions expl "installed hooks" compadd -a - "$line[1]_functions" && return 0
+    _wanted functions expl "installed hook" compadd -a - "$line[1]_functions" && return 0
   else
     _functions && return 0
   fi
diff --git a/Completion/openSUSE/Command/_hwinfo b/Completion/openSUSE/Command/_hwinfo
index aac0a05ad..7dff82805 100644
--- a/Completion/openSUSE/Command/_hwinfo
+++ b/Completion/openSUSE/Command/_hwinfo
@@ -5,7 +5,7 @@ _arguments \
   '--version[show libhd version]' \
   '--short[just a short listing]' \
   '--log[write info to logfile]:logfile:_files' \
-  '--debug[set debuglevel]:debuglevels:(1 2 3 4 5 6 7 8 9)' \
+  '--debug[set debuglevel]:debug level:(1 2 3 4 5 6 7 8 9)' \
   '--dump-db[dump hardware data base, 0: external, 1: internal]:dumpdb:(0 1)' \
   '--bios' \
   '--block' \
diff --git a/Completion/openSUSE/Command/_zypper b/Completion/openSUSE/Command/_zypper
index 25a32c3f1..3f3402bd9 100644
--- a/Completion/openSUSE/Command/_zypper
+++ b/Completion/openSUSE/Command/_zypper
@@ -65,17 +65,17 @@ _zypper() {
 _all_repos() {
     local -a repos
     repos=( $(zypper -q lr | tail -n +3 | cut -d'|' -f 2) )
-    _describe -t repos 'Available repositories' repos && return
+    _describe -t repos 'available repository' repos && return
 }
 
 _enabled_repos() {
     repos=( $(zypper -x lr | grep 'enabled="1"' | cut -d\" -f 2) )
-    _describe -t repos 'Available repositories' repos && return
+    _describe -t repos 'available repository' repos && return
 }
 
 _disabled_repos() {
     repos=( $(zypper -x lr | grep 'enabled="0"' | cut -d\" -f 2) )
-    _describe -t repos 'Available repositories' repos && return
+    _describe -t repos 'available repository' repos && return
 }
 
 _zypper_cmd_do() {
@@ -107,7 +107,7 @@ _zypper_cmd_do() {
         case ${words[CURRENT - 1]} in
             --from)
                 repos=( $(zypper -x lr | grep 'enabled="1"' | cut -d\" -f 2) )
-                _describe -t repos 'Available repositories' repos && return
+                _describe -t repos 'available repository' repos && return
                ;;
             (--enable|-e)
                 case $cmd in
@@ -128,7 +128,7 @@ _zypper_cmd_do() {
                 case $cmd in
                     (if|info|se|search|in|install) 
                         types=( pattern srcpackage package patch )
-                        _describe -t types 'Package types' types && return
+                        _describe -t types 'package type' types && return
                     ;;
                 esac
                 ;;
@@ -143,7 +143,7 @@ _zypper_cmd_do() {
                 ;;
             (in|install)
                 local expl
-                _description files expl 'RPM files' 
+                _description files expl 'RPM file'
                 _files "$expl[@]" -g '*.(#i)rpm(.)'
                 ;;
         esac


^ permalink raw reply	[relevance 1%]

* Re: read -r flag not working on 5.8.1
  @ 2021-08-08 14:04  5%     ` Stephane Chazelas
  0 siblings, 0 replies; 200+ results
From: Stephane Chazelas @ 2021-08-08 14:04 UTC (permalink / raw)
  To: Mikael Magnusson; +Cc: David Milum, zsh-workers

2021-08-08 07:59:20 +0200, Mikael Magnusson:
[...]
> >> Hello, seems like the -r (raw mode) flag which should prevent it from
> >> interpreting backslashes is not working? My understanding is the
> >> following
> >> example shouldn't clear the "CLEAR" part. I can also demonstrate with new
> >> lines.
> >>
> >> $ read -r TEST
> >> asd\c CLEAR
> >> $ echo $TEST
> >> asd
> >> $ zsh --version
> >> zsh 5.8 (x86_64-pc-linux-gnu)
> 
> Your problem is not read, but echo. Try the above with echo -E $TEST
> instead and you will see the read command is fine.
[...]

More precisely, to print the contents of a scalar variable
verbatim followed by a newline character in zsh:

echo -E - $var # zsh only
print -r - $var # zsh
print -r -- $var # zsh
print -r - "$var" # zsh/ksh
printf '%s\n' "$var" # POSIX
echo -En "$var"$'\n' # zsh/bash and a few other echo
		     # implementations (but for bash, not if
		     # both the xpg_echo and posix options are
		     # enabled).
cat << EOF  # Bourne/POSIX
$var
EOF
cat <<< "$var" # zsh and a few other shells

See also

zmodload zsh/system
syswrite -- "$var"$'\n' ||
  syserror -p failed: $ERRNO

for a raw interface to the write() system call.

And btw, to read a line into a variable, the syntax is

IFS= read -r var

(in zsh or any other POSIX shell, though only zsh can read lines
containing NUL bytes).

See

https://unix.stackexchange.com/questions/65803/why-is-printf-better-than-echo
https://unix.stackexchange.com/questions/209123/understanding-ifs-read-r-line

-- 
Stephane


^ permalink raw reply	[relevance 5%]

* Re: bug: nested for loop body is executed once!
  @ 2021-08-13  3:50  3% ` Lawrence Velázquez
  0 siblings, 0 replies; 200+ results
From: Lawrence Velázquez @ 2021-08-13  3:50 UTC (permalink / raw)
  To: Daniil Iaitskov; +Cc: zsh-workers

On Thu, Aug 12, 2021, at 11:13 PM, Daniil Iaitskov wrote:
> I just spot a following bug on Big Sur zsh 5.8 (x86_64-apple-darwin20.0)

It's not a bug.

> > $ K="1 2 3"
> > $ for i in $(for j in $K; do echo "ddd/$j" ; done) ; do echo  "$i" ; done
> > ddd/1
> > 2
> > 3
> 
> I would expect following output
> > ddd/1
> > ddd/2
> > ddd/3

By default, zsh does not word-split unquoted parameter expansions;
this behavior differs from most Bourne-adjacent shells.  Observe
that your "inner" loop actually only loops once, with $j taking on
the entire value of $K:

    % K="1 2 3"
    % for j in $K; do echo "<ddd/$j>"; done
    <ddd/1 2 3>

However, zsh *does* word-split unquoted command substitutions, so
the output of $(for j in $K; do echo "ddd/$j" ; done) is split into
'ddd/1', '2', and '3', and $i takes on each value in turn.

> > $ for i in $(for j in $(echo 1 2 3); do echo "ddd/$j" ; done) ; do echo  "$i" ; done
> 
> produce expected output:
> > ddd/1
> > ddd/2
> > ddd/3

In this example, $(echo 1 2 3) is word-split because it is a command
substitution.  Thus, $j takes on the values '1', '2', and '3', as
you expected.

> I don't know if this is a feature due to some legacy optimizations.
> I mostly use BASH and this behavior differs from BASH.
> BASH behaves exactly as I expect.

Actually, many zsh users consider the word-splitting of unquoted
parameter expansions to be a misfeature, which zsh's default behavior
remedies.  In any case, it's very much intentional.  You can obtain
word-splitting behavior with the ${=foo} form:

    % K="1 2 3"
    % for j in ${=K}; do echo "<ddd/$j>"; done
    <ddd/1>
    <ddd/2>
    <ddd/3>

You can also set SH_WORD_SPLIT, or rewrite the code to use an array.
If you're running code that relies on word-splitting (a POSIX script,
perhaps), you can run it under sh emulation.

> Wow! Are you still using just a mailing list for bug tracking?!

Yes.

-- 
vq


^ permalink raw reply	[relevance 3%]

* [BUG] ignored trap and subshell
@ 2021-08-24 16:23  3% Vincent Lefevre
  2021-08-24 17:29  0% ` Bart Schaefer
  2021-08-25 10:10  0% ` Peter Stephenson
  0 siblings, 2 replies; 200+ results
From: Vincent Lefevre @ 2021-08-24 16:23 UTC (permalink / raw)
  To: zsh-workers

The zshmisc(1) man page says:

    ( list )
        Execute list in a subshell.  Traps set by the trap builtin are
        reset to their default values while executing list.

However, with "emulate sh", ignored traps should still be ignored
in the subshell according to POSIX, and zsh 5.8 fails do conform:

$ zsh -c 'emulate sh; trap "" INT; trap; echo A; ( trap; echo B; sleep 3; ); echo $?'
trap -- '' INT
A
B
^C130

where Ctrl-C immediately interrupts the sleep.

Compare to sh:

$ sh -c 'trap "" INT; trap; echo A; ( trap; echo B; sleep 3; ); echo $?'
trap -- '' INT
A
trap -- '' INT
B
^C0

where the sleep isn't interrupted by Ctrl-C.

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


^ permalink raw reply	[relevance 3%]

* Re: [BUG] ignored trap and subshell
  2021-08-24 16:23  3% [BUG] ignored trap and subshell Vincent Lefevre
@ 2021-08-24 17:29  0% ` Bart Schaefer
  2021-08-24 17:33  0%   ` Bart Schaefer
  2021-08-25 10:10  0% ` Peter Stephenson
  1 sibling, 1 reply; 200+ results
From: Bart Schaefer @ 2021-08-24 17:29 UTC (permalink / raw)
  To: Zsh hackers list

On Tue, Aug 24, 2021 at 9:24 AM Vincent Lefevre <vincent@vinc17.net> wrote:
>
> However, with "emulate sh", ignored traps should still be ignored
> in the subshell according to POSIX, and zsh 5.8 fails do conform:

"emulate sh" is NOT the same as "ARGV0=sh", and is never going to be.
We make no representation that "emulate sh" will enable all the same
standards behaviors as using "sh" as the command name.

That said, it might be possible to add control of this behavior to the
POSIX_TRAPS option, in which case it would be covered by "emulate sh".


^ permalink raw reply	[relevance 0%]

* Re: [BUG] ignored trap and subshell
  2021-08-24 17:29  0% ` Bart Schaefer
@ 2021-08-24 17:33  0%   ` Bart Schaefer
  0 siblings, 0 replies; 200+ results
From: Bart Schaefer @ 2021-08-24 17:33 UTC (permalink / raw)
  To: Zsh hackers list

On Tue, Aug 24, 2021 at 10:29 AM Bart Schaefer
<schaefer@brasslantern.com> wrote:
>
> On Tue, Aug 24, 2021 at 9:24 AM Vincent Lefevre <vincent@vinc17.net> wrote:
> >
> > However, with "emulate sh", ignored traps should still be ignored
> > in the subshell according to POSIX, and zsh 5.8 fails do conform:
>
> "emulate sh" is NOT the same as "ARGV0=sh", and is never going to be.

However, it appears this behavior isn't covered in regular sh emulation either:

% ARGV0=sh Src/zsh -c 'trap "" INT; trap; echo A; ( trap; echo B;
sleep 3; ); echo $?'
trap -- '' INT
A
B
^C130

So we should look into this.


^ permalink raw reply	[relevance 0%]

* Re: [BUG] ignored trap and subshell
  2021-08-24 16:23  3% [BUG] ignored trap and subshell Vincent Lefevre
  2021-08-24 17:29  0% ` Bart Schaefer
@ 2021-08-25 10:10  0% ` Peter Stephenson
  2021-08-25 10:47  0%   ` Peter Stephenson
  1 sibling, 1 reply; 200+ results
From: Peter Stephenson @ 2021-08-25 10:10 UTC (permalink / raw)
  To: zsh-workers

> On 24 August 2021 at 17:23 Vincent Lefevre <vincent@vinc17.net> wrote:
> The zshmisc(1) man page says:
> 
>     ( list )
>         Execute list in a subshell.  Traps set by the trap builtin are
>         reset to their default values while executing list.
> 
> However, with "emulate sh", ignored traps should still be ignored
> in the subshell according to POSIX, and zsh 5.8 fails do conform:

I think this is straightforward.  POSIXTRAPS is clearly the option for the job.

pws

diff --git a/Src/exec.c b/Src/exec.c
index 49ff88b80..79d8064b6 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -1033,7 +1033,8 @@ entersubsh(int flags, struct entersubsh_ret *retp)
 
     if (!(flags & ESUB_KEEPTRAP))
 	for (sig = 0; sig < SIGCOUNT; sig++)
-	    if (!(sigtrapped[sig] & ZSIG_FUNC))
+	    if (!(sigtrapped[sig] & ZSIG_FUNC) &&
+		!(isset(POSIXTRAPS) && (sigtrapped[sig] & ZSIG_IGNORED)))
 		unsettrap(sig);
     monitor = isset(MONITOR);
     job_control_ok = monitor && (flags & ESUB_JOB_CONTROL) && isset(POSIXJOBS);


^ permalink raw reply	[relevance 0%]

* Re: [BUG] ignored trap and subshell
  2021-08-25 10:10  0% ` Peter Stephenson
@ 2021-08-25 10:47  0%   ` Peter Stephenson
  0 siblings, 0 replies; 200+ results
From: Peter Stephenson @ 2021-08-25 10:47 UTC (permalink / raw)
  To: zsh-workers


> On 25 August 2021 at 11:10 Peter Stephenson <p.w.stephenson@ntlworld.com> wrote:
> > On 24 August 2021 at 17:23 Vincent Lefevre <vincent@vinc17.net> wrote:
> > The zshmisc(1) man page says:
> > 
> >     ( list )
> >         Execute list in a subshell.  Traps set by the trap builtin are
> >         reset to their default values while executing list.
> > 
> > However, with "emulate sh", ignored traps should still be ignored
> > in the subshell according to POSIX, and zsh 5.8 fails do conform:
> 
> I think this is straightforward.  POSIXTRAPS is clearly the option for the job.

And some documentation; the place Vincent mentioned looks like the obvious one
(we have at least one piece of evidence it gets read...)

diff --git a/Doc/Zsh/grammar.yo b/Doc/Zsh/grammar.yo
index 2eb2018d2..f8f4ada86 100644
--- a/Doc/Zsh/grammar.yo
+++ b/Doc/Zsh/grammar.yo
@@ -288,7 +288,9 @@ for each selection until a break or end-of-file is encountered.
 cindex(subshell)
 item(tt(LPAR()) var(list) tt(RPAR()))(
 Execute var(list) in a subshell.  Traps set by the tt(trap) builtin
-are reset to their default values while executing var(list).
+are reset to their default values while executing var(list); an
+exception is that ignored signals will continue to be ignored
+if the option tt(POSIXTRAPS) is set.
 )
 item(tt({) var(list) tt(}))(
 Execute var(list).
diff --git a/Src/exec.c b/Src/exec.c
index 49ff88b80..79d8064b6 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -1033,7 +1033,8 @@ entersubsh(int flags, struct entersubsh_ret *retp)
 
     if (!(flags & ESUB_KEEPTRAP))
 	for (sig = 0; sig < SIGCOUNT; sig++)
-	    if (!(sigtrapped[sig] & ZSIG_FUNC))
+	    if (!(sigtrapped[sig] & ZSIG_FUNC) &&
+		!(isset(POSIXTRAPS) && (sigtrapped[sig] & ZSIG_IGNORED)))
 		unsettrap(sig);
     monitor = isset(MONITOR);
     job_control_ok = monitor && (flags & ESUB_JOB_CONTROL) && isset(POSIXJOBS);


^ permalink raw reply	[relevance 0%]

* PATCH: completion options update
@ 2021-08-27 12:43  1% Oliver Kiddle
  0 siblings, 0 replies; 200+ results
From: Oliver Kiddle @ 2021-08-27 12:43 UTC (permalink / raw)
  To: Zsh workers

This patch is an update based on help output diffs. There's more than
usual because I've not updated these for a little while. Lots of files
changed but I've tried to keep this to files that only need relatively
few updates. Sorry if this isn't the easest form for reviews.

Lastest checked versions for affected commands are:

  abcde 2.9.3
  ansible 2.11.1
  attr 2.4.48
  binutils 2.36.1
  btrfs 5.13.1
  cpupower 5.14
  cryptsetup 2.3.6
  dict 1.13.0
  dig 9.16.19
  dkms 2.6.1
  elfutils 0.185
  entr 4.9
  ethtool 5.13
  gem 3.1.6
  getfacl 2.3.1
  gnutls 3.7.2
  gprof 2.36.1
  java - incomplete from version 8
  less 590
  mtr 0.94
  networkmanager 1.30.0
  patchutils 0.4.2
  pigz 2.6
  procps 3.3.17 (pidof/pgrep/pkill)
  ri 6.3.1
  rpm 4.15.1
  ruby 2.7.3p183
  sudo 1.9.7p2
  sysstat 12.4.3
  tmux 3.2a
  util-linux 2.36.2 (findmnt/script/scriptreplay/wipefs)
  unrar 602
  valgrind 3.16.0
  vim 8.2.3081
  w3m 0.5.3
  wget 1.21.1
  wiggle 1.3
  xrandr 1.5.1
  xmlsoft 10134
  xterm 353
  xxd 2020-02-04

Oliver

diff --git Completion/Linux/Command/_btrfs Completion/Linux/Command/_btrfs
index d560928ae..bb0f724e6 100644
--- Completion/Linux/Command/_btrfs
+++ Completion/Linux/Command/_btrfs
@@ -17,11 +17,14 @@ cmds_7=( get set list )
 cmds_8=( enable disable rescan help )
 cmds_9=( assign remove create destroy show limit help )
 cmds_10=( start status cancel help )
-cmds_11=( chunk-recover fix-device-size super-recover zero-log )
+cmds_11=( chunk-recover fix-device-size super-recover zero-log create-control-device )
 
 _arguments -C -A "-*" "$args[@]" \
   '(- *)--help[print help information]' \
   '(- *)--version[print version information]' \
+  '(-v --verbose -q --quiet --help --version)'{-v,--verbose}'[verbose output of operation]' \
+  '(-v --verbose -q --quiet --help --version)'{-q,--quiet}'[suppress all messages except errors]' \
+  '(--help --version)--format=[specify output format]:format:(text json)' \
   '(--version)1: :->groups' \
   '2: :->cmds' \
   '*:: :->args' && ret=0
@@ -60,6 +63,11 @@ while (( $#state )); do
       fi
       args=( '(-)--help[print help information]' )
       case ${cont} in
+        (balance|replace):start|device:(add|delete|remove)|filesystem:resize)
+          args+=(
+            "--enqueue[wait if there's another exclusive operation running, otherwise continue]"
+          )
+        ;|
         subvolume:create)
           args+=(
             '*-i[add the newly created subvolume to a qgroup]:qgroup'
@@ -67,11 +75,10 @@ while (( $#state )); do
           )
         ;;
         subvolume:delete)
-          args+=(
+          args+=( '!-v' '!--verbose'
             '(-c --commit-after -C --commit-each)'{-c,--commit-after}'[wait for transaction commit at the end of the operation]'
             '(-c --commit-after -C --commit-each)'{-C,--commit-each}'[wait for transaction commit after deleting each subvolume]'
             '(-i --subvolid)'{-i+,--subvolid=}'[specify id of subvolume to be removed]:subvolume id'
-            '(-v --verbose)'{-v,--verbose}'[verbose output of operations]'
             '1:subvolume:_files -/'
           )
         ;;
@@ -113,7 +120,7 @@ while (( $#state )); do
         ;|
         subvolume:sync) args+=( '-s[sleep between checks]:delay (seconds) [1]' );;
         subvolume:find-new) args+=( '1:subvol:_files -/' '2:lastgen: _message "last gen"' );;
-        (device|filesystem|qgroup|subvolume):(df|du|show|usage))
+        (device|filesystem|qgroup|subvolume):(df|du|show|usage)|scrub:status)
           args+=(
             '--iec[use 1024 as a base]'
             '--si[use 1000 as a base]'
@@ -130,7 +137,7 @@ while (( $#state )); do
             '(-t --tbytes)'{-t,--tbytes}'[show sizes in TiB, or TB with --si]'
           )
         ;|
-        (filesystem|qgroup):(du|show))
+        (filesystem|qgroup|scrub):(du|show|status))
           args+=(
             '--raw[output raw numbers in bytes]'
             '--human-readable[output human friendly numbers, base 1024]'
@@ -142,8 +149,7 @@ while (( $#state )); do
         ;|
         filesystem:resize) args+=( '1:size:_guard "(|+|-)[0-9]#[GKM]"' '2:path:->mounts' );;
         filesystem:defragment)
-          args+=(
-            '-v[verbose]'
+          args+=( '!-v'
             '-r[defragment files recursively]'
             '-c+[compress files while defragmenting]::compression algorithm:(zlib lzo zstd)'
             '-r[defragment files recursively]'
@@ -193,10 +199,9 @@ while (( $#state )); do
         ;;
         device:ready) args+=( '1:device: _files -g "*(-%)"' );;
         scrub:(start|resume))
-          args+=(
+          args+=( '!-q'
             "-B[don't background and print statistics at end]"
             '-d[print separate statistics for each device]'
-            '-q[omit error message and statistics]'
             '-r[read only mode]'
             '-R[raw print mode]'
             '-c[set ioprio class]:class:(( 0\:none 1\:realtime 2\:best-effort 3\:idle))'
@@ -216,18 +221,17 @@ while (( $#state )); do
           )
         ;;
         balance:start)
-          args+=(
+          args+=( '!-v' '!--verbose'
             '(-m -s)-d+[act on data chunks]:filter:->filters'
             '(-d -s)-m+[act on metadata chunks]:filter:->filters'
             '(-d -m)-s+[act on system chunks (only under -f)]:filters:->filters'
-	    '(-v --verbose)'{-v,--verbose}'[verbose mode]'
             '-f[force a reduction of metadata integrity]'
             "--full-balance[don't print warning and don't delay start]"
             '(--background --bg)'{--background,--bg}'[run balance operation asynchronously in the background]'
             '1:path:_files -/'
           )
         ;;
-        balance:status) args+=( '(-v --verbose)'{-v,--verbose}'[verbose mode]' '1:path:_files -/' );;
+        balance:status) args+=( '!-v' '!--verbose' '1:path:_files -/' );;
         balance:(pause|cancel|resume)) args+=( '1:path:_files -/' );;
         property:set) args+=( '3:value' );&
         property:get) args+=( '2:property:(ro label compression)' );&
@@ -304,6 +308,8 @@ while (( $#state )); do
 	    '!(--dfs)--bfs'
 	    '--dfs[depth-first traversal of the trees]'
             '--hide-names[hide filenames/subvolume/xattrs and other name references]'
+            '--csum-headers[print node checksums stored in headers (metadata)]'
+            '--csum-items[print checksums stored in checksum items (data)]'
           )
         ;;
         inspect*:dump-super)
@@ -315,11 +321,10 @@ while (( $#state )); do
             '--bytenr[specify alternate superblock offset]:offset'
           )
         ;;
-        inspect*:inode*) args+=( '-v[verbose mode]' '1:inode:_files' '2:path:_files -/' );;
-        inspect*:subvol*) args+=( '-v[verbose mode]' '1:subvolid:_guard "[0-9]#" subvolume id' '2:path:_files -/' );;
+        inspect*:inode*) args+=( '!-v' '1:inode:_files' '2:path:_files -/' );;
+        inspect*:subvol*) args+=( '!-v' '1:subvolid:_guard "[0-9]#" subvolume id' '2:path:_files -/' );;
         inspect*:logical*)
-          args+=(
-            '-v[verbose mode]'
+          args+=( '!-v'
             '-P[skip the path resolving and print the inodes instead]'
             '-o[ignore offsets when matching references]'
             '-s[specify buffer size]:buffer size [4096]'
@@ -331,9 +336,8 @@ while (( $#state )); do
         inspect*:rootid) args+=( '1:path:_files -/' );;
         inspect*:tree*) args+=( '-b[print raw numbers in bytes]' );;
         rescue:(chunk|super)-recover)
-          args+=(
+          args+=( '!-v'
             '-y[assume yes to every question]'
-            '-v[verbose mode]'
             '1:device:_files'
           )
           [[ ${${(P)group}[cmd]} == chunk-recover ]] && args+=('(-)-h[display help]')
@@ -361,12 +365,11 @@ while (( $#state )); do
           )
         ;;
         restore)
-          args+=(
+          args+=( '!-v' '!--verbose'
             '(-s --snapshots)'{-s,--snapshots}'[get snapshots]'
             '(-x --xattr)'{-x,--xattr}'[restore extended attributes]'
             '(-m --metadata)'{-m,--metadata}'[restore owner, mode and times]'
             '(-S --symlink)'{-S,--symlink}'[restore symbolic links]'
-            '(-v --verbose)'{-v,--verbose}'[be verbose and output what is restored]'
             '(-i --ignore-errors)'{-i,--ignore-errors}'[ignore errors]'
             '(-o --overwrite)'{-o,--overwrite}'[overwrite directories and files]'
             '-t[specify tree location]:tree root'
@@ -383,23 +386,20 @@ while (( $#state )); do
           )
         ;;
         send|receive)
-          args+=( '(-q --quiet)'{-q,--quiet}'[suppress all messages except errors]' )
+          args+=( '!-q' '!--quiet' )
         ;|
         send)
-          args+=(
-            '*-v[verbose mode]'
+          args+=( '!-v'
             '-e[if sending multiple subvolumes at once, use the new format]'
             '-p[send incremental stream]:parent:_files -/'
             '*-c[use snapshot as clone source]:clone:_files -/'
             '-f[specify output file]:file:_files'
             '--no-data[send in NO_FILE_DATA mode]'
-            '(-v --verbose)'{-v,--verbose}'[enable verbose output]'
             '1:subvolume:_files -/'
           )
         ;;
         receive)
-          args+=(
-            '*-v[verbose mode]'
+          args+=( '!-v'
             '-f[input file]:file: _files'
             '-e[terminate after <end cmd>]'
             '(-C --chroot)'{-C,--chroot}'[confine the process to destination path using chroot(1)]'
diff --git Completion/Linux/Command/_cpupower Completion/Linux/Command/_cpupower
index ae1f1d3d1..6763bdd12 100644
--- Completion/Linux/Command/_cpupower
+++ Completion/Linux/Command/_cpupower
@@ -20,11 +20,12 @@ cmds=(
   'info:show global power parameters'
   'set:set global power parameters'
   'monitor:report frequency and idle statistics'
+  'powercap-info:show powercapping related kernel and hardware configurations'
   'help:print usage information'
 )
 case $state in
   cmds)
-    _describe command cmds && ret=0
+    _describe command cmds -M 'r:|-=* r:|=*' && ret=0
   ;;
   args)
     curcontext="${curcontext%:*}-$words[1]"
diff --git Completion/Linux/Command/_cryptsetup Completion/Linux/Command/_cryptsetup
index 45159d0be..f7149a76f 100644
--- Completion/Linux/Command/_cryptsetup
+++ Completion/Linux/Command/_cryptsetup
@@ -21,6 +21,7 @@ _arguments -s \
   '--new-keyfile-offset=[specify number of bytes to skip in newly added keyfile]:offset (bytes)' \
   '(-S --key-slot)'{-S+,--key-slot=}'[select key slot]:key slot' \
   '(-b --size)'{-b+,--size=}'[force device size]:sectors' \
+  '--device-size=[use only specified device size (ignore rest of device)]:size (bytes)' \
   '(-o --offset)'{-o+,--offset=}'[set start offset]:sectors' \
   '(-p --skip)'{-p+,--skip=}'[data to skip at beginning]:sectors' \
   '(-r --readonly)'{-r,--readonly}'[create a read-only mapping]' \
@@ -44,10 +45,12 @@ _arguments -s \
   '--veracrypt[scan also for VeraCrypt compatible device]' \
   '--veracrypt-pim=[specify personal iteration multiplier for VeraCrypt compatible device]:multiplier' \
   '--veracrypt-query-pim[query personal iteration multiplier for VeraCrypt compatible device]' \
-  '(-M --type)'{-M+,--type=}'[specify type of device metadata]:type:(luks plain loopaes tcrypt)' \
+  '(-M --type)'{-M+,--type=}'[specify type of device metadata]:type:(luks luks1 luks2 plain loopaes tcrypt bitlk)' \
   '--force-password[disable password quality check (if enabled)]' \
   '--perf-same_cpu_crypt[use dm-crypt same_cpu_crypt performance compatibility option]' \
   '--perf-submit_from_crypt_cpus[use dm-crypt submit_from_crypt_cpus performance compatibility option]' \
+  '--perf-no_read_workqueue[bypass dm-crypt workqueue and process read requests synchronously]' \
+  '--perf-no_write_workqueue[bypass dm-crypt workqueue and process write requests synchronously]' \
   '--deferred[device removal is deferred until the last user closes it]' \
   '--serialize-memory-hard-pbkdf[use global lock to serialize memory]' \
   '--pbkdf=[specify PBKDF algorithm for LUKS2]:algorithm:(argon2i argon2id pbkdf2)' \
@@ -60,14 +63,16 @@ _arguments -s \
   '(-I --integrity)'{-I+,--integrity=}'[specify data integrity algorithm (LUKS2 only)]:algorithm' \
   '--integrity-no-journal[disable journal for integrity device]' \
   "--integrity-no-wipe[don't wipe device after format]" \
+  '--integrity-legacy-padding[use inefficient legacy padding (old kernels)]' \
   "--token-only[don't ask for passphrase if activation by token fails]" \
   '--token-id=[specify token number]:number [any]' \
   '--key-description=[specify key description]:description' \
   '--sector-size=[specify encryption sector size]:size [512 bytes]' \
+  '--iv-large-sectors[use IV counted in sector size (not in 512 bytes)]' \
   '--persistent[set activation flags persistent for device]' \
   '--label=[set label for the LUKS2 device]:label' \
   '--subsystem=[set subsystem label for the LUKS2 device]:subsystem' \
-  '--unbound[create unbound (no assigned data segment) LUKS2 keyslot]' \
+  '--unbound[create or dump unbound (no assigned data segment) LUKS2 keyslot]' \
   '--json-file=[read or write token to json file]:json file:_files -g "*.json(-.)"' \
   '--luks2-metadata-size=[specify LUKS2 header metadata area size]:size (bytes)' \
   '--luks2-keyslots-size=[specify LUKS2 header keyslots area size]:size (bytes)' \
@@ -77,12 +82,13 @@ _arguments -s \
   '--encrypt[Encrypt LUKS2 device (in-place encryption)]' \
   '--decrypt[decrypt LUKS2 device (remove encryption)]' \
   '--init-only[initialize LUKS2 reencryption in metadata only]' \
+  '--resume-only[resume initialized LUKS2 reencryption only]' \
   '--reduce-device-size=[reduce data device size (move data offset)]:size (bytes)' \
   '--hotzone-size=[specify maximal reencryption hotzone size]:size (bytes)' \
   '--resilience=[specify reencryption hotzone resilience type]:resilience type:(checksum journal none)' \
   '--resilience-hash=[specify reencryption hotzone checksums hash]:string' \
   '--active-name=[override device autodetection of dm device to be reencrypted]:string' \
-  "${ign}(- : *)--version[show version information]" \
+  "${ign}(- : *)"{-V,--version}'[show version information]' \
   "${ign}(- : *)"{-\?,--help}'[display help information]' \
   "${ign}(- : *)--usage[display brief usage]" \
   ':action:->actions' \
@@ -111,6 +117,7 @@ case $state in
       'isLuks:check if device is a LUKS partition'
       'luksDump:dump header information'
       'tcryptDump:dump TCRYPT device information'
+      'bitlkDump:dump BITLK device information'
       'luksSuspend:suspend LUKS device and wipe key'
       'luksResume:resume suspended LUKS device'
       'luksHeaderBackup:store binary backup of headers'
diff --git Completion/Linux/Command/_dkms Completion/Linux/Command/_dkms
index a0a666e33..2a3c016c5 100644
--- Completion/Linux/Command/_dkms
+++ Completion/Linux/Command/_dkms
@@ -8,6 +8,7 @@ subcmds=(
   'add:add a module/version combination to the tree for builds and installs'
   'remove:remove a module from the tree'
   'build:compile a module for a kernel'
+  'unbuild:undoes the build of a module'
   "install:install a build module for it's corresponding kernel"
   'uninstall:uninstall a module for a kernel'
   'match:install every module that is installed for a template kernel for another kernel'
@@ -17,6 +18,7 @@ subcmds=(
   'mkrpm:create an RPM package for a module'
   'mkdeb:create a debian binary package for a module'
   'mkdsc:create a debian source package for a module'
+  'mkbmdeb:create a debian package containing just binary modules'
   'mkkmp:create a Kernel Module Package source RPM for a module'
   'status:display the current status of modules, versions and kernels within the tree'
   'autoinstall:try to install the latest revision of all modules that have been installed for other kernel revisions'
@@ -32,6 +34,7 @@ args=(
   '--installtree=:path:_directories'
   '--sourcetree=:path:_directories'
   '--dkmsframework=:path:_directories'
+  '--force-version-override'
   '1: : _describe -t commands command subcmds'
 )
 
@@ -44,7 +47,7 @@ else
     '(remove|build|install|uninstall|match|status|mk(^kmp))' 'k' \
     '(add|remove)' '-rpm_safe_upgrade' \
     'mk(driverdisk|kmp)' '-spec' \
-    'mk(deb|dsc|rpm)' '-legacy-postinst' \
+    'mk(deb|dsc|bmdeb|rpm)' '-legacy-postinst' \
     'mk(tarball|rpm|deb|dsc)' '-(source|binary)-only' \
     '(match|build|mkkmp)' '(k|-no-(prepare|clean)-kernel|-kernelsourcedir)' \
     '(|un)install' '-no-(depmod|initrd)' \
@@ -67,7 +70,7 @@ case $cmd in
   remove|build|install|uninstall|mk*|status)
     args+=( ': :->modules' )
   ;|
-  |remove|build|install|uninstall|match|status|mk(^kmp))
+  |remove|(un|)build|install|uninstall|match|status|mk(^kmp))
     args+=( '(--all)*-k[specify kernel version]:kernel:->kernels' )
   ;|
   |add|remove) args+=( "${ign}--rpm_safe_upgrade" ) ;|
@@ -77,7 +80,7 @@ case $cmd in
   |(mk|ld)tarball)
     args+=( "${ign}--archive=:tarball:_files -g '*.tar(-.)'" )
   ;|
-  |mk(deb|dsc|rpm))
+  |mk(deb|dsc|bmdeb|rpm))
     args+=( "${ign}--legacy-postinst=:value [1]:(0 1)" )
   ;|
   |mk(tarball|rpm|deb|dsc)) args+=( "${ign}(--source-only --binaries-only)--"{source,binaries}-only ) ;|
@@ -100,7 +103,7 @@ case $cmd in
       '-c[specify location of dkms.conf file]:location:_files'
     )
   ;|
-  |remove|build|install|status|mk(^kmp))
+  |remove|(un|)build|install|status|mk(^kmp))
     args+=( '(-a --arch -k)--all[specify all relevant kernels/arches]' )
   ;|
   |build)
diff --git Completion/Linux/Command/_ethtool Completion/Linux/Command/_ethtool
index dccda4684..95a8bbfb6 100644
--- Completion/Linux/Command/_ethtool
+++ Completion/Linux/Command/_ethtool
@@ -5,16 +5,21 @@ local -a state line expl cmds
 local -A opt_args
 
 _arguments -C \
+  '--debug[turn on debugging messages]:mask:((1\:parser\ information))' \
+  '--json[output results in JSON]' \
+  '(-I --include-statistics)'{-I,--include-statistics}'[include command-related statistics in the output]' \
+  '(cmds)'{-Q,--per-queue}'[apply per-queue command]: :(queue_mask):queue mask' \
   "1:interface:_net_interfaces" \
-  '*: :->args' \
+  '*:: :->args' \
+  + '(cmdc)' \
+  '(cmds)'{-c,--show-coalesce}'[query the specified ethernet device for coalescing information]' \
+  '(cmds)'{-C,--coalesce}'[change the coalescing settings of the specified ethernet device]' \
   + '(cmds)' \
   '(1)'{-h,--help}'[display help information]' \
   '(1)--version[display version information]' \
   {-s,--change}'[allow changing some or all settings of the specified ethernet device]' \
   {-a,--show-pause}'[query the specified ethernet device for pause parameter information]' \
   {-A,--pause}'[change the pause parameters of the specified ethernet device]' \
-  {-c,--show-coalesce}'[query the specified ethernet device for coalescing information]' \
-  {-C,--coalesce}'[change the coalescing settings of the specified ethernet device]' \
   {-g,--show-ring}'[query the specified ethernet device for RX/TX ring parameter information]' \
   {-G,--set-ring}'[change the RX/TX ring parameters of the specified ethernet device]' \
   {-k,--show-features,--show-offload}'[query the specified ethernet device for offload information]' \
@@ -46,10 +51,21 @@ _arguments -C \
   '--set-eee[set EEE settings]' \
   '--set-phy-tunable[set PHY tunable]' \
   '--get-phy-tunable[get PHY tunable]' \
+  '--get-tunable[get tunable parameters]' \
+  "--set-tunable[set driver's tunable parameters]" \
   '--reset[reset hardware components]' \
   '--show-fec[query device for forward error correction support]' \
   '--set-fec[configure forward error correction for device]' \
-  {-Q,--per-queue}'[apply per-queue command]' && return
+  '--cable-test[perform cable test and report the results]' \
+  '--cable-test-tdr[perform cable test and report Time Domain Reflectometer data]' \
+  '--show-tunnels[show tunnel-related device capabilities and state]' \
+  '--monitor[listen to netlink notifications and displays them]::command:(
+    --all -s --change -k --show-features --show-offload -K
+    --features --offload  --show-priv-flags --set-priv-flags -g --show-ring
+    -G --set-ring -l --show-channels -L --set-channels -c --show-coalesce
+    -C --coalesce -a --show-pause -A --pause --show-eee --set-eee
+    --cable-test --cable-test-tdr
+  )' && return
 
 if [[ -n $state ]]; then
   case $words[CURRENT-1] in
@@ -62,7 +78,8 @@ if [[ -n $state ]]; then
       _wanted onoff expl 'enabled' compadd off on
     fi
   ;;
-  autoneg|adaptive-[rt]x|raw|hex|sg|tso|ufo|gso|lro|eee|tx-lpi|downshift|fast-link-down)
+  autoneg|adaptive-[rt]x|raw|hex|sg|tso|ufo|gso|lro|eee|tx-lpi|downshift) ;&
+  fast-link-down|energy-detect-power-down|mode)
     _wanted onoff expl 'enabled' compadd off on
   ;;
   rx-usecs|rx-frames|rx-usecs-irq|rx-frames-irq|tx-usecs|tx-frames) ;&
@@ -71,6 +88,8 @@ if [[ -n $state ]]; then
   rx-frames-high|tx-usecs-high|tx-frames-high|sample-interval|dmac|rx-mini) ;&
   rx-jumbo|offset|length|magic|value|phyad|proto|tos|tclass|l4proto|src-port) ;&
   dst-port|spi|l4data|vlan-etype|vlan|user-def|action|vf|queue|loc) ;&
+  page|bank|i2c|first|last|step|pair|lanes) ;&
+  rx-copybreak|tx-copybreak|pfc-prevention-tout) ;&
   other|combined|tx-timer|count|msecs)
     _message -e numbers 'number'
   ;;
@@ -81,7 +100,10 @@ if [[ -n $state ]]; then
     _wanted duplex expl 'duplex mode' compadd half full
   ;;
   port)
-    _wanted port expl 'device port' compadd tp aui bnc mii fibre
+    _wanted port expl 'device port' compadd tp aui bnc mii fibre da
+  ;;
+  master-slave)
+    _wanted roles expl role compadd {preferred,forced}-{master,slave}
   ;;
   advertise)
     _values 'hexadecimal value (or a combination of the following)' \
@@ -93,7 +115,8 @@ if [[ -n $state ]]; then
       '0x020[1000 full]' \
       '0x8000[2500 full(not supported by IEEE standards)]' \
       '0x800[10000 full]' \
-      '0x03F[auto]'
+      '0x03F[auto]' \
+      'mode[set mode]'
   ;;
   xcvr)
     _wanted xcvr expl 'transceiver type' compadd internal external
@@ -144,7 +167,7 @@ if [[ -n $state ]]; then
     _message -e contexts 'RSS context'
   ;;
   *)
-    case $words[2] in
+    case ${${(Mk)opt_args:#cmd?*}[1]#cmd?-} in
     -A|--pause)
       _values -S ' ' -w 'pause parameter' \
         'autoneg[specify if pause autonegotiation is enabled]' \
@@ -192,6 +215,9 @@ if [[ -n $state ]]; then
     -p|--identify)
       (( CURRENT = 4 )) && _message -e length 'duration (seconds)'
     ;;
+    -S|--statistics)
+      _arguments '(-)--all-groups' '(-)--groups:eth-phy: :eth-mac: :eth-ctrl: :rmon'
+    ;;
     -t|--test)
       _values -S ' ' -w 'test mode' \
         '(online)offline:perform full set of tests possibly causing normal operation interruption (default)]' \
@@ -202,8 +228,10 @@ if [[ -n $state ]]; then
       if (( ! $words[(I)msglvl] )); then
         _values -S ' ' -w 'generic option' \
           'speed[set speed in Mb/s]' \
+          'lanes[set number of lanes]' \
           'duplex[set full or half duplex mode]' \
           'port[select device port]' \
+          'master-slave[configure interface role]' \
           'autoneg[specify if autonegotiation is enabled]' \
           'advertise[set the speed and duplex advertised by autonegotiation]' \
           'phyad[PHY address]' \
@@ -274,16 +302,23 @@ if [[ -n $state ]]; then
       fi
     ;;
     -m|--dump-module-eeprom|--module-info)
-      _wanted options expl option compadd -F line - raw hex offset length
+      _wanted options expl option compadd -F line - raw hex offset \
+          length page bank i2c
     ;;
     --set-eee)
       _wanted behaviours expl behaviour compadd -F line - eee advertise tx-lpi tx-timer
     ;;
     --set-phy-tunable)
-      _wanted options expl tunable compadd -F line - downshift count fast-link-down msecs
+      _wanted options expl tunable compadd -F line - downshift count \
+	  fast-link-down msecs energy-detect-power-down
     ;;
     --get-phy-tunable)
-      _wanted options expl tunable compadd downshift fast-link-down
+      _wanted options expl tunable compadd downshift fast-link-down \
+	  energy-detect-power-down
+    ;;
+    --[gs]et-tunable)
+      _wanted options expl tunable compadd rx-copybreak tx-copybreak \
+          pfc-prevention-tout
     ;;
     --reset)
       _wanted components expl component compadd flags dedicated all \
@@ -303,6 +338,9 @@ if [[ -n $state ]]; then
         _wanted options expl option compadd -c --show-coalescing -C --coalesce
       fi
     ;;
+    --cable-test-tdr)
+      _wanted options expl 'distance options' compadd first last step pair
+    ;;
     esac
   ;;
   esac
diff --git Completion/Linux/Command/_findmnt Completion/Linux/Command/_findmnt
index 9f13e695f..0c832364d 100644
--- Completion/Linux/Command/_findmnt
+++ Completion/Linux/Command/_findmnt
@@ -22,9 +22,12 @@ _arguments -s -C \
   '(H -M --mountpoint :)'{-M+,--mountpoint=}'[specify the mountpoint]: :->targets' \
   '(H -n --noheadings)'{-n,--noheadings}'[do not print a header line]' \
   '(H -O --options)'{-O+,--options=}'[only print the filesystems with the specified options]:list of options: ' \
-  '(H -o --output)'{-o+,--output=}'[specify output columns]: :->columns' \
+  '(H -o --output --output-all)'{-o+,--output=}'[specify output columns]: :->columns' \
+  '(H -o --output)--output-all[output all available columns]' \
   '(H -p --poll)'{-p+,--poll=}'[monitor changes in /proc/self/mountinfo]::action:(mount umount remount move)' \
+  '(H --real)--pseudo[print only pseudo-filesystems]' \
   '(H -R --submounts)'{-R,--submounts}'[print recursively all submounts]' \
+  '(H --pseudo)--real[print only real filesystems]' \
   '(H -S --source :)'{-S+,--source=}'[specify the mount source]: :->sources' \
   '(H -T --target :)'{-T+,--target=}'[specify the mount target]:target:_files' \
   '(H -t --types)'{-t+,--types=}'[specify the type of filesystems]:filesystem types:_sequence -s , _file_systems' \
@@ -39,7 +42,7 @@ _arguments -s -C \
   '(H)2:: :->targets' \
   + '(format)' \
   '(H)'{-D,--df}'[imitate the output of df command]' \
-  '(H)'{-J,--json}'[use JASON output format]' \
+  '(H)'{-J,--json}'[use JSON output format]' \
   '(H)'{-l,--list}'[use list output format]' \
   '(H)'{-P,--pairs}'[use key="value" output format]' \
   '(H)'{-r,--raw}'[use raw output format]' \
@@ -101,7 +104,7 @@ case $state in
 	'prefixes:prefix:compadd -S "" LABEL= UUID= PARTLABEL= PARTUUID='
       )
       [[ $state = sources_targets ]] &&
-	alts+=( 'mount-points:moutpoint:__findmnt_mountpoints' )
+	alts+=( 'mount-points:mountpoint:__findmnt_mountpoints' )
       _alternative $alts && ret=0
     fi
     ;;
diff --git Completion/Linux/Command/_networkmanager Completion/Linux/Command/_networkmanager
index c9b09d145..1e05252b2 100644
--- Completion/Linux/Command/_networkmanager
+++ Completion/Linux/Command/_networkmanager
@@ -244,7 +244,7 @@ _nm_device_wifi() {
   local curcontext="$curcontext" state line
 
   _arguments -C \
-    "1:command:(list connect hotspot rescan)" \
+    "1:command:(list connect hotspot rescan show-password)" \
     "*::arg:->args"
 
   case $line[1] in
@@ -252,6 +252,7 @@ _nm_device_wifi() {
     c*)  _nm_device_wifi_connect ;;
     ho*) _nm_device_wifi_hotspot ;;
     r*)  _nm_device_wifi_rescan ;;
+    s*)  _nm_device_wifi_show-password ;;
   esac
 }
 
@@ -362,6 +363,12 @@ _nm_device_wifi_rescan() {
     "4:ssid:_nm_device_wifi_ssids"
 }
 
+_nm_device_wifi_show-password() {
+  _arguments \
+    "1: :(ifname)" \
+    "2:interface:_nm_device_ifnames"
+}
+
 _nm_device_wifi_bssids() {
   local -a bssids
   bssids=(${(f)"$(_call_program nmcli nmcli -t -f bssid device wifi list)"})
diff --git Completion/Linux/Command/_pidof Completion/Linux/Command/_pidof
index 05fb23d45..dd0649ce9 100644
--- Completion/Linux/Command/_pidof
+++ Completion/Linux/Command/_pidof
@@ -9,6 +9,8 @@ _arguments -C -s -w \
   '(- *)'{-V,--version}'[print program version]' \
   "(-s --single-shot $exargs)"{-s,--single-shot}'[return one PID only]' \
   "(-c --check-root $exargs)"{-c,--check-root}'[omit processes with different root]' \
+  '-q[quiet mode, only set the exit code]' \
+  '(-w --with-workers)'{-w,--with-workers}'[show kernel workers too]' \
   "(-x $exargs)"-x'[include shells running named scripts]' \
   "($exargs)"\*{-o+,--omit-pid=}'[omit processes with PIDs]:pids:_sequence -s , _pids' \
   '(-S --separator)'{-S+,--separator=}'[specify separator put between PIDs]:separator' \
diff --git Completion/Linux/Command/_sysstat Completion/Linux/Command/_sysstat
index 4de855b69..eba99fc5a 100644
--- Completion/Linux/Command/_sysstat
+++ Completion/Linux/Command/_sysstat
@@ -11,6 +11,7 @@ _mpstat() {
     '--dec=-[specify the number of decimal places to use]:decimal places [2]:(0 1 2)' \
     '-o[display statistics in JSON]:format:(JSON)' \
     '(-A)-P[specify processor number]:processor: _values -s "," processor ALL {0..$(_call_program processors getconf _NPROCESSORS_ONLN)}' \
+    '-T[display topology elements in the CPU report]' \
     '-u[report CPU utilization]' \
     '(- 1 2)-V[display version information]' \
     '1: : _guard "^-*" interval' \
@@ -26,6 +27,7 @@ _cifsiostat() {
     '-t[print timestamp for each report]' \
     '(- 1 2)-V[print version number]' \
     '--human[print sizes in human readable format]' \
+    '--pretty[make the CIFS report easier to read by a human]' \
     '1: : _guard "^-*" interval' \
     '2: : _guard "^-*" count'
 }
@@ -49,7 +51,7 @@ _sadf() {
       '-H[display only the header of the report]' \
       '(-g -j -p -r -x)-h[print on a single line when used with -d]' \
       '-O[specify output options]: : _values -s , option
-        autoscale height\:value oneday packed showidle showinfo skipempty showhints' \
+        autoscale bwcol customcol height\:value oneday packed showidle showinfo showtoc skipempty hz\:value pcparchive\:name\:_files debug' \
       '-P[restrict processor dependant statistics]:processor number(zero indexed) or ALL:(ALL)' \
       '--dev=-[specify block devices for which statistics are to be displayed]:block device:_files -g "*(-%)"' \
       '--fs=-[specify filesystems for which statistics are to be displayed]:file system:_dir_list -s ,' \
@@ -66,6 +68,7 @@ _sadf() {
       '-d[output file in SQL format]' \
       '-g[print data in SVG format]' \
       '-j[output file in JSON]' \
+      '-l[export the contents of the data file to a PCP (Performance Co-Pilot) archive]' \
       '-p[print in format parsable by tools like awk]' \
       '-r[print raw contents of data file]' \
       '-x[output file in XML]' \
@@ -105,7 +108,7 @@ _sar() {
     '-o[save readings to file in binary form]:file:_files' \
     '-P[report per-processor statistics]:processor: _values -s "," processors ALL' \
     '-p[pretty-print device names]' \
-    '-q[report queue length and load averages]' \
+    '-q[report queue length and load averages]::keyword:(CPU IO LOAD MEM PSI ALL)' \
     '-R[report memory statistics]' \
     '-r[report memory utilization statistics]:: :(ALL)' \
     '-S[report swap space utilization]' \
diff --git Completion/Linux/Command/_valgrind Completion/Linux/Command/_valgrind
index 23a8cd734..b4bb3248e 100644
--- Completion/Linux/Command/_valgrind
+++ Completion/Linux/Command/_valgrind
@@ -205,6 +205,7 @@ _arguments -C ${(P)args} $cmd \
   '(--version)--tool=-[specify valgrind tool]:valgrind tool:->tools' \
   '(-h --help)'{-h,--help}'[show help information]' \
   '--help-debug[show help info including debugging options]' \
+  '--help-dyn-options[show the dynamically changeable options]' \
   '(-)--version[show version]' \
   '(-q --quiet)'{-q,--quiet}'[run silently; only print error msgs]' \
   '(-v --verbose)'{-v,--verbose}'[be more verbose]' \
diff --git Completion/Linux/Command/_wipefs Completion/Linux/Command/_wipefs
index 5142def8a..8642aab92 100644
--- Completion/Linux/Command/_wipefs
+++ Completion/Linux/Command/_wipefs
@@ -19,6 +19,7 @@ _arguments -s -S \
   '(H -p --parsable -i --no-headings -J --json)'{-p,--parsable}'[print out in parsable instead of printable format]' \
   '(H -q --quiet)'{-q,--quiet}'[suppress output messages]' \
   '(H -t --types)'{-t+,--types=}'[limit the set of filesystem, RAIDs or partition tables]:type:_file_systems' \
+  '(H)--lock=-[use exclusive device lock]::mode:(yes no nonblock)' \
   '(H)*:disk device:_files -g "*(-%)" -P / -W /' \
   + '(H)' \
   '(- *)'{-h,--help}'[display help information]' \
diff --git Completion/Redhat/Command/_rpm Completion/Redhat/Command/_rpm
index db7c1145d..d00f88429 100644
--- Completion/Redhat/Command/_rpm
+++ Completion/Redhat/Command/_rpm
@@ -129,6 +129,7 @@ _rpm () {
     '--scm=[select the SCM to use with %autosetup]:scm [patch]:(patch gendiff git quilt)'
     '*--buildpolicy=[set buildroot policy]:policy:->brp_policies'
     '!--sign'
+    '--trace[trace macro expansion]'
     "--nodebuginfo[don't generate debuginfo for this package]"
   )
 
diff --git Completion/Unix/Command/_abcde Completion/Unix/Command/_abcde
index 361b43091..3f748d373 100644
--- Completion/Unix/Command/_abcde
+++ Completion/Unix/Command/_abcde
@@ -1,50 +1,41 @@
 #compdef abcde
 
-(( $+functions[_abcde_fields] )) ||
-_abcde_fields(){
-  _values -s , field year genre
-}
-
-(( $+functions[_abcde_actions] )) ||
-_abcde_actions(){
-  _values -s , action cddb cue read getalbumart embedalbumart normalize encode tag move replaygain playlist clean
-}
-
-_arguments -s \
+_arguments -s -S -A "-*" \
   '(-t -T -p)-1[encode the whole CD in a single file]' \
-  '-a[comma-delimited list of actions to perform]:action:_abcde_actions' \
+  '-a[comma-delimited list of actions to perform]:action:_sequence compadd - cddb cue read getalbumart embedalbumart normalize encode tag move replaygain playlist clean' \
   '-b[enable batch mode normalization]' \
   '-B[enable automatic embedding of album art with certain containers]' \
-  '-c[specify an additional configuration file to parse]:config:_files' \
-  '-C[resume a session for discid when you no longer have the CD available]:discid' \
-  '-d[CD-ROM block device that contains audio tracks to be read]:cd-rom-file:_files' \
+  '-c+[specify an additional configuration file to parse]:config:_files' \
+  '-C+[resume a session when read was completed but CD is not present]:disc id:compadd abcde.*(N:e)' \
+  '-d+[specify CD device from which to read audio tracks]:CD device:_files -g "*(-%)" -P / -W /' \
   '-D[capture debugging information]' \
   '-e[erase information about encoded tracks from the internal status file]' \
   '-f[force the removal of the temporary ABCDETEMPDIR directory]' \
   "-g[enable lame's --nogap option]" \
   '-G[download album art using the getalbumart function]' \
   '(- :)-h[get help information]' \
-  '-j[start a specified number of encoder processes at once]:number' \
+  '-j+[start specified number of encoder processes at once]:number' \
   '-k[keep the wav files after encoding]' \
-  '-l[use the low-diskspace algorithm]' \
+  '-l[use the low disk space algorithm]' \
   '-L[use a local CDDB repository]' \
   '-m[create DOS-style playlists, modifying the resulting one by adding CRLF line endings those to work]' \
   "-n[don't query CDDB database]" \
   '-N[non interactive mode]' \
-  '-o[select output type]:outputtype:(vorbis ogg mp3 flac spx mpc m4a wav wv ape opus mka aiff)' \
+  '-o+[select output type]:output type [vorbis]:(vorbis ogg mp3 flac spx mpc m4a wav wv ape opus mka aiff)' \
   "-p[pads track numbers with 0's]" \
   '-P[use Unix PIPES to read and encode in one step]' \
-  '-r[remote encode on this comma-delimited list of machines using distmp3]:hosts:_sequence _hosts' \
-  '-s[fields to be shown in the CDDB parsed entries]:field:_abcde_fields' \
-  '-S[set the speed of the CD drive]:speed' \
-  '-t[start the numbering of the tracks at a given number]:track-number' \
-  '-T[start the numbering of the tracks at a given number and change internal tag numbering]:track-number' \
+  '-Q+[specify CD lookup methods]:lookup method [musicbrainz]:_sequence compadd - musicbrainz cddb cdtext' \
+  '-r+[remote encode on this comma-delimited list of machines using distmp3]:hosts:_sequence _hosts' \
+  '-s+[fields to be shown in the CDDB parsed entries]:field:_sequence compadd - year genre' \
+  '-S+[set the speed of the CD drive]:speed' \
+  '-t+[start the numbering of the tracks at a given number]:track-number' \
+  '-T+[start the numbering of the tracks at a given number and change internal tag numbering]:track-number' \
   '-U[set CDDBPROTO to version 5]' \
   '(- :)-v[show the version and exit]' \
   '-V[be more verbose]' \
   '-x[eject the CD when all tracks have been read]' \
-  '-X[use an alternative "cue2discid" implementation]:cue2discid' \
-  '-w[add a comment to the tracks ripped from the CD]:comment' \
-  "-W[concatenate CD's]:cd-number" \
+  '-X+[use an alternative "cue2discid" implementation]:cue2discid:_command_names -e' \
+  '-w+[add a comment to the tracks ripped from the CD]:comment' \
+  "-W+[concatenate CD's]:cd-number" \
   '-z[debug mode]' \
-  '*:tracks:'
+  '*: :_guard "^-*" "track list"'
diff --git Completion/Unix/Command/_ansible Completion/Unix/Command/_ansible
index 65cae148e..6ec7d0c2e 100644
--- Completion/Unix/Command/_ansible
+++ Completion/Unix/Command/_ansible
@@ -22,6 +22,8 @@ case $service in
     args+=(
       '(-K --ask-become-pass)'{-K,--ask-become-pass}'[ask for privilege escalation password]'
       '(-k --ask-pass)'{-k,--ask-pass}'[ask for connection password]'
+      '--list-hosts[output list of matching hosts]'
+      '(-l --limit)'{-l+,--limit=}'[further limit hosts to an additional pattern]:host subset:->hosts'
       '(-T --timeout)'{-T+,--timeout=}'[override the connection timeout]:timeout (seconds) [10]'
       '(-c --connection)'{-c+,--connection=}'[specify connection type]:connection type [smart]:->connect-types'
       '(-u --user)'{-u+,--user=}'[specify remote user for connection]:remote user:_users'
@@ -47,28 +49,14 @@ case $service in
   ansible|ansible-console|ansible-inventory|ansible-playbook|ansible-pull)
     args+=(
       --ask-vault-pass{,word}'[ask for vault password]'
+      '(-e --extra-vars)'{-e+,--extra-vars=}'[set additional variables]:key=value or YAML/JSON'
       '--vault-id=[specify vault identity to use]:vault identity'
       --vault-pass{,word}-file='[specify vault password file]:vault password file:_files'
-    )
-  ;|
-  ansible|ansible-console|ansible-inventory|ansible-playbook|ansible-pull)
-    args+=(
       \*{-i+,--inventory=}'[specify inventory host file or host list]: : _alternative "files\:inventory file\:_files"
 	"hosts\:host\: _sequence _hosts"'
       '!(-i --inventory)--inventory-file=:inventory file:_files'
     )
   ;|
-  ansible|ansible-console|ansible-playbook|ansible-pull)
-    args+=(
-      '--list-hosts[output list of matching hosts]'
-      '(-l --limit)'{-l+,--limit=}'[further limit hosts to an additional pattern]:host subset:->hosts'
-    )
-  ;|
-  ansible|ansible-playbook|ansible-pull)
-    args+=(
-      '(-e --extra-vars)'{-e+,--extra-vars=}'[set additional variables]:key=value or YAML/JSON'
-    )
-  ;|
   ansible|ansible-console|ansible-inventory)
     args+=(
       '--playbook-dir=[specify substitute playbook directory]:directory:_directories'
@@ -80,11 +68,16 @@ case $service in
       "--skip-tags[only run plays and tasks whose tags don't match]"
     )
   ;|
+  ansible|ansible-console)
+    args+=(
+      '--task-timeout[set the task timeout limit]:timeout (seconds)'
+    )
+  ;|
   ansible)
     args+=(
       '(-a --args)'{-a+,--args=}'[specify command or module arguments]:arguments:->args'
       '(-B --background)'{-B+,--background=}'[run asynchronously, failing after specified time]:fail timeout (seconds)'
-      '(-m --module-name)'{-m+,--module-name=}'[specify module]:module:->plugins'
+      '(-m --module-name)'{-m+,--module-name=}'[specify action to execute]: :->plugins'
       '(-o --one-line)'{-o,--one-line}'[condense output]'
       '(-P --poll)'{-P+,--poll=}'[specify the poll interval if using -B]:interval (seconds) [15]'
       '(-t --tree)'{-t+,--tree=}'[specify directory for log output]:directory:_directories'
@@ -111,11 +104,14 @@ case $service in
   ansible-doc)
     args+=(
       '!--metadata-dump' # "internal testing only"
-      '(-l --list -F --list_files -s --snippet)'{-j,--json}'[change output to json format]'
-      '(-l --list -F --list_files -s --snippet)'{-l,--list}'[list available plugins]'
-      '(-l --list -F --list_files -s --snippet)'{-F,--list_files}'[show plugin names and their source files without summaries]'
-      '(-l --list -F --list_files -s --snippet)'{-s,--snippet}'[show playbook snippet for specified plugins]'
-      '(-t --type)'{-t+,--type=}'[choose plugin type]:plugin type [module]:(become cache callback cliconf connection httpapi inventory lookup netconf shell module strategy vars)'
+      '(-l --list -F --list_files -s --snippet --metadata-dump -e --entry-point)'{-j,--json}'[change output to json format]'
+      '(-l --list -F --list_files -s --snippet --metadata-dump -e --entry-point)'{-l,--list}'[list available plugins]'
+      '(-l --list -F --list_files -s --snippet --metadata-dump -e --entry-point)'{-F,--list_files}'[show plugin names and their source files without summaries]'
+      '(-l --list -F --list_files -s --snippet --metadata-dump -e --entry-point)'{-s,--snippet}'[show playbook snippet for specified plugins]'
+      '(-l --list -F --list_files -s --snippet -e --entry-point)--metadata-dump[dump json metadata for all plugins]'
+      '(-l --list -F --list_files -s --snippet --metadata-dump -e --entry-point)'{-e+,--entry-point=}'[select the entry point for roles]:entry point'
+      '(-t --type)'{-t+,--type=}'[choose plugin type]:plugin type [module]:(become cache callback cliconf connection httpapi inventory lookup netconf shell vars module strategy role keyword)'
+      '(-r --roles-path)'{-r+,--roles-path=}'[specify directory containing roles]:directory:_directories'
       '*:plugin:->plugins'
     )
   ;;
@@ -389,6 +385,7 @@ case $state in
       encrypt_string)
 	args+=(
 	  '(-p --prompt)'{-p,--prompt}'[prompt for the string to encrypt]'
+          "--show-input[don't hide input when prompted for the string to encrypt]"
 	  '(-n --name)'{-n+,--name=}'[specify the variable name]:variable'
 	  '--stdin-name=[specify the variable name for stdin]:variable'
 	)
diff --git Completion/Unix/Command/_attr Completion/Unix/Command/_attr
index 121c0c539..efa7c5c4f 100644
--- Completion/Unix/Command/_attr
+++ Completion/Unix/Command/_attr
@@ -23,6 +23,7 @@ case $service in
       '(-e --encoding)'{-e+,--encoding=}'[encode values after retrieving them]:encoding:(text hex base64)' \
       '(-h --no-dereference)'{-h,--no-dereference}"[don't follow symbolic links]" \
       '(-m --match)'{-m+,--match=}'[only include attributes with names matching regex]:regular expression' \
+      '--one-file-system[skip files on different filesystems]' \
       "--absolute-names[don't strip leading slash characters]" \
       '--only-values[dump only attribute values]' \
       '(-R --recursive)'{-R,--recursive}'[list attributes of all files and directories recursively]' \
diff --git Completion/Unix/Command/_dict Completion/Unix/Command/_dict
index 202fc5bab..928728e06 100644
--- Completion/Unix/Command/_dict
+++ Completion/Unix/Command/_dict
@@ -21,6 +21,8 @@ _arguments -C -S \
   '(--key -k)'{--key=,-k+}'[specify key for authentication]:shared secret:' \
   '(-)'{--version,-V}'[display program version]' \
   '(-)'{--license,-L}'[display program license]' \
+  '(-6)-4[force use of IPv4 addresses only]' \
+  '(-4)-6[force use of IPv6 addresses only]' \
   '(-)--help[display usage info]' \
   '(--verbose -v)'{--verbose,-v}'[verbose output]' \
   '(--raw -r)'{--raw,-r}'[be very verbose]' \
diff --git Completion/Unix/Command/_dig Completion/Unix/Command/_dig
index 5245a2964..3081e2cfd 100644
--- Completion/Unix/Command/_dig
+++ Completion/Unix/Command/_dig
@@ -24,10 +24,12 @@ local -a alts args
   '*+'{no,}'ednsnegotiation[set EDNS version negotiation]'
   '*+ednsopt=[specify EDNS option]:code point'
   '*+noedns[clear EDNS options to be sent]'
+  '*+'{no,}'expandaaaa[expand AAAA records]'
   '*+'{no,}'expire[send an EDNS Expire option]'
   '*+'{no,}'header-only[send query without a question section]'
   '*+'{no,}'idnin[set processing of IDN domain names on input]'
   '*+'{no,}'idnout[set conversion of IDN puny code on output]'
+  '*+'{no,}'keepalive[request EDNS TCP keepalive]'
   '*+'{no,}'keepopen[keep TCP socket open between queries]'
   '*+'{no,}'mapped[allow mapped IPv4 over IPv6 to be used]'
   '*+'{no,}'recurse[set the RD (recursion desired) bit in the query]'
@@ -40,12 +42,15 @@ local -a alts args
   '*+'{no,}'identify[print IP and port of responder]'
   '*+'{no,}'comments[print comment lines in output]'
   '*+'{no,}'stats[print statistics]'
+  '*+padding[set padding block size]:size [0]'
   '*+'{no,}'qr[print query as it was sent]'
   '*+'{no,}'question[print question section of a query]'
+  '*+'{no,}'raflag[set RA flag in the query]'
   '*+'{no,}'answer[print answer section of a reply]'
   '*+'{no,}'authority[print authority section of a reply]'
   '*+'{no,}'all[set all print/display flags]'
   '*+'{no,}'subnet[send EDNS client subnet option]:addr/prefix-length'
+  '*+'{no,}'tcflag[set TC flag in the query]'
   '*+timeout=[set query timeout]:timeout (seconds) [5]'
   '*+tries=[specify number of UDP query attempts]:tries'
   '*+retry=[specify number of UDP query retries]:retries'
@@ -57,13 +62,12 @@ local -a alts args
   '*+'{no,}"fail[don't try next server on SERVFAIL]"
   '*+'{no,}'besteffort[try to parse even malformed messages]'
   '*+'{no,}'dnssec[request DNSSEC records]'
-  '*+'{no,}'sigchase[chase DNSSEC signature chains]'
-  '*+trusted-key=[specify file containing trusted keys]:file:_files'
-  '*+'{no,}'topdown[do DNSSEC validation in top down mode]'
   '*+'{no,}'nsid[include EDNS name server ID request in query]'
   '*+'{no,}'ttlid[display the TTL whening printing the record]'
   '*+'{no,}'ttlunits[display the TTL in human-readable units]'
+  '*+'{no,}'unexpected[print replies from unexpected sources]'
   '*+'{no,}'unknownformat[print RDATA in RFC 3597 "unknown" format]'
+  '*+'{no,}'yaml[present the results as YAML]'
   '*+'{no,}'zflag[set Z flag in query]'
 )
 _arguments -s -C $args \
diff --git Completion/Unix/Command/_entr Completion/Unix/Command/_entr
index 3e2261a18..438ab179a 100644
--- Completion/Unix/Command/_entr
+++ Completion/Unix/Command/_entr
@@ -11,6 +11,7 @@ _arguments -s -S \
   '-p[postpone first execution of the utility]' \
   '(-a)-r[reload a persistent child process]' \
   '(*)-s[evaluate the first argument using interpreter specified by $SHELL]' \
+  '-z[exit after the utility completes]' \
   '(-): :->command' \
   '*::arguments:_normal' && ret=0
 
diff --git Completion/Unix/Command/_gem Completion/Unix/Command/_gem
index 53adfb89c..7e244ccad 100644
--- Completion/Unix/Command/_gem
+++ Completion/Unix/Command/_gem
@@ -196,7 +196,7 @@ if [[ $state = command ]]; then
       )
     ;;
     environment)
-      args+=( '1:information:(packageversion gemdir gempath version remotesources platform)' )
+      args+=( '1:information:(gemdir gempath version remotesources platform)' )
     ;;
     fetch)
       def=( both \! local \! remote \! )
@@ -299,6 +299,9 @@ if [[ $state = command ]]; then
         '*:file:_files'
       )
     ;;
+    yank)
+      args+=( '--otp=[specify code for multifactor authentication]:code' )
+    ;;
   esac
   _arguments -C ${args:-'*: :_default'} \
     '(-)'{-h,--help}'[display usage information]' \
diff --git Completion/Unix/Command/_getfacl Completion/Unix/Command/_getfacl
index 15be06a1c..27b5ee1c8 100644
--- Completion/Unix/Command/_getfacl
+++ Completion/Unix/Command/_getfacl
@@ -22,6 +22,7 @@ _arguments -s -S \
   '(-P --physical)'{-P,--physical}"[physical walk, don't follow symbolic links]" \
   '(-t --tabular)'{-t,--tabular}'[use tabular output format]' \
   '(-n --numeric)'{-n,--numeric}'[print numeric user/group identifiers]' \
+  '--one-file-system[skip files on different filesystems]' \
   '(-p --absolute-names)'{-p,--absolute-names}"[don't strip leading '/' in pathnames]" \
   '(- *)'{-v,--version}'[display version information]' \
   '(- *)'{-h,--help}'[display help information]' \
diff --git Completion/Unix/Command/_gnutls Completion/Unix/Command/_gnutls
index 6c9956b10..b9f91264d 100644
--- Completion/Unix/Command/_gnutls
+++ Completion/Unix/Command/_gnutls
@@ -37,6 +37,8 @@ case "$service" in
       '--x509crlfile=[specify CRL file to use]:file:_files'
       '*--x509keyfile=[specify X.509 key file to use]:file:_files'
       '*--x509certfile=[specify X.509 certificate file to use]:file:_files'
+      '*--rawpkkeyfile=[specify private key file or URL to use]:file:_files'
+      '*--rawpkfile=[specify raw public-key file to use]:file:_files'
       '(-l --list -p --port)'{-l,--list}'[print list of the supported algorithms/modes]'
       '--keymatexport=[specify label used for exporting keying material]:label'
       '--keymatexportsize=[specify size of the exported keying material]:size'
@@ -70,7 +72,8 @@ case "$service" in
       '--fastopen[enable TCP Fast Open]'
       "--print-cert[print peer's certificate in PEM format]"
       "--save-cert=[save peer's certificate chain in the specified file in PEM format]:file:_files"
-      "--save-ocsp=[save peer's OCSP status response in the provided file]:file:_files"
+      "(--save-ocsp-multi)--save-ocsp=[save peer's OCSP status response in the provided file]:file:_files"
+      "(--save-ocsp)--save-ocsp-multi=[save all peer's OCSP responses in the provided file]:file:_files"
       '--save-server-trace=[save the server-side TLS message trace in the provided file]:file:_files'
       '--save-client-trace=[save the client-side TLS message trace in the provided file]:file:_files'
       '--dh-bits=[specify minimum number of bits allowed for DH]:bits'
@@ -93,6 +96,8 @@ case "$service" in
       '--inline-commands-prefix=[change delimiter used for inline commands]:delimiter [^]'
       '--fips140-mode[report status of FIPS140-2 mode in gnutls library]'
       '--logfile=[redirect informational messages to a specific file]:file:_files'
+      '--waitresumption[block waiting for the resumption data under TLS1.3]'
+      '--ca-auto-retrieve[enable automatic retrieval of missing CA certificates]'
     )
   ;;
 
@@ -109,6 +114,7 @@ case "$service" in
       "--nodb[don't use a resumption database]"
       '--http[act as an HTTP server]'
       '--echo[act as an Echo server]'
+      "--crlf[don't replace CRLF by LF in Echo server mode]"
       '(-a --disable-client-cert -r --require-client-cert)'{-a,--disable-client-cert}"[don't request a client certificate]"
       '(-a --disable-client-cert -r --require-client-cert)'{-r,--require-client-cert}'[require a client certificate]'
       '--verify-client-cert[if a client certificate is sent then verify it]'
@@ -144,7 +150,8 @@ case "$service" in
       '--verify-crl[verify a CRL]'
       '(--verify-email)--verify-hostname=[specify hostname to be used for certificate chain verification]:hostname:_hosts'
       '(--verify-hostname)--verify-email=[specify email to be used for certificate chain verification]:email:_email_addresses'
-      '--verify-purpose=[specify a purpose OID to be used for certificate chain verification]'
+      '--verify-purpose=[specify a purpose OID to be used for certificate chain verification]:purpose'
+      '--verify-profile=[specify a security level profile to be used for verification]:profile'
       '--p7-sign[sign using a PKCS #7 structure]'
       '--p7-detached-sign[sign using a detached PKCS #7 structure]'
       "--no-p7-include-cert[don't include signer's certificate will in the cert list]"
diff --git Completion/Unix/Command/_gprof Completion/Unix/Command/_gprof
index 3bb7a5765..a7e602fd5 100644
--- Completion/Unix/Command/_gprof
+++ Completion/Unix/Command/_gprof
@@ -3,8 +3,8 @@
 local curcontext="$curcontext" state line ret=1
 typeset -A opt_args
 
-_arguments -C -s -{a,b,c,D,h,i,l,L,s,T,v,w,x,y,z} \
-           -{A,C,e,E,f,F,J,n,N,O,p,P,q,Q,Z}:'function name:->funcs' \
+_arguments -C -s -{a,b,c,D,h,i,l,L,r,s,T,v,w,x,y,z} \
+           -{A,C,e,E,f,F,J,n,N,O,p,P,q,Q,R,S,t,Z}:'function name:->funcs' \
 	   '-I:directory:_dir_list' \
 	   '-d-:debug level:' '-k:function names:->pair' \
 	   '-m:minimum execution count:' \
diff --git Completion/Unix/Command/_gzip Completion/Unix/Command/_gzip
index 42d4ae705..8354b34d4 100644
--- Completion/Unix/Command/_gzip
+++ Completion/Unix/Command/_gzip
@@ -9,10 +9,14 @@ files=( '*:files:->files' )
 case "$service" in
 unpigz|pigz)
   pigz=(
-    '(-K --zip)'{-K,--zip}'[compress to PKWare zip format]'
+    '(-A --alias)'{-A+,--alias=}'[specify filename to use in zip entry for stdin]:filename'
+    '(-C --comment)'{-C+,--comment=}'[put specified comment in the gzip or zip header]'
+    '(-H --huffman -U --rle)'{-H,--huffman}'[use only Huffman coding for compression]'
+    '(-U --rle -H --huffman)'{-U,--rle}'[use run-length encoding for compression]'
+    '(-K --zip -z --zlib)'{-K,--zip}'[compress to PKWare zip format]'
     '(-b --blocksize)'{-b+,--blocksize}'[set compression block size]:size (KiB)'
     '(-p --processes)'{-p,--processes}'[specify number of processes to use]'
-    '(-z --zlib)'{-z,--zlib}'[compress to zlib (.zz) format]'
+    '(-z --zlib -K --zip)'{-z,--zlib}'[compress to zlib (.zz) format]'
     '(-m --no-time)'{-m,--no-time}"[don't store/restore modification time in/from header]"
     '(-M --time)'{-M,--time}"[store/restore modification time in/from header]"
     '(--synchronous)-Y[force output file write to permanent storage]'
diff --git Completion/Unix/Command/_iostat Completion/Unix/Command/_iostat
index f5291a19b..1152b0d8b 100644
--- Completion/Unix/Command/_iostat
+++ Completion/Unix/Command/_iostat
@@ -128,10 +128,13 @@ case $OSTYPE:l in
       '-c[display CPU utilization report]'
       '-d[display device utilization report]'
       '--dec=-[specify the number of decimal places to use]:decimal places [2]:(0 1 2)'
+      '-f[specify alternative directory to read device statistics from]:directory:_directories'
+      '+f[specify additional directory to read device statistics from]:directory:_directories'
       '*-g[display statistics for a group of devices]:group name'
       '-H[only display global statistics for group]'
       '(--human)-h[human readable device utilization report]'
       '--human[print sizes in human readable format]'
+      '--pretty[make report easier to read by a human]'
       '-j[display persistent device name]:name type:(ID LABEL PATH UUID)'
       '(-m)-k[display statistics in kB/s]'
       '(-k)-m[display statistics in MB/s]'
diff --git Completion/Unix/Command/_java Completion/Unix/Command/_java
index ee0441d97..ff6e82645 100644
--- Completion/Unix/Command/_java
+++ Completion/Unix/Command/_java
@@ -24,18 +24,24 @@ javac)
     '(-cp -classpath)'{-cp,-classpath}'[specify where to find user class files]:class path:->classpath' \
     '-sourcepath[specify where to find input source files]:source path:->sourcepath' \
     '-bootclasspath[override location of bootstrap class files]:bootstrap class path:->bootstrapclasspath' \
+    '-endorseddirs[override location of endorsed standards path]:path:->extdirs' \
     '-extdirs[override location of installed extensions]:extensions directories:->extdirs' \
     '-d[specify where to place generated class files]:directory:_files -/' \
     '-encoding[specify character encoding used by source files]:encoding:->encoding' \
     '-proc\:-[control annotation processing]:annotation processing:(none only)' \
     '-processor[specify annotation processors to run]:class:_files' \
     '-processorpath[specify where to find annotation processors]:directory:_directories' \
+    '-parameters[generate metadata for reflection on method parameters]' \
     '-s[specify directory for generated source files]:directory:_directories' \
+    '-h[specify where to place generated native header files]:directory:_directories' \
     '-source[provide source compatibility with specified release]:release:(1.{2..8} {5..8})' \
     '-target[specify VM version]:release:(1.{1..5})' \
+    '-profile[check that API used is available in the specified profile]:profile' \
     '(-)-help[print a synopsis of standard options]' \
     '(-)-version[print version information]' \
     '(-)-X[display information about non-standard options]' \
+    '-J-[pass flag directly to the runtime system]:flag' \
+    '-Werror[terminate compilation if warnings occur]' \
     '*:java source file:_files -g \*.java\(-.\)' && return 0
   ;;
 
@@ -75,6 +81,7 @@ java)
     '(- 1)-'{\?,help}'[print help message]' \
     '(- 1)-X-[non-standard java option]:option' \
     '(- 1)-jar[specify a program encapsulated as jar]:jar:_files -g \*.jar\(-.\)' \
+    '-splash\:-[show splash screen with specified image]:image:_files' \
     '(-):class:_java_class -m main ${(kv)opt_args[(i)(-classpath|-cp)]}' \
     '*::args:= _normal' \
      && return 0
@@ -90,15 +97,20 @@ javadoc)
     '-help[print help message]' \
     '-doclet[specify a doclet]:doclet:_java_class -t doclet ${(kv)opt_args[(i)-classpath]}' \
     '-docletpath[specify a path to search doclet]:doclet path:->docletpath' \
-    '-1.1[Javadoc 1.1 compatible output]' \
     '-sourcepath[specify path for source files]:source path:->sourcepath' \
-    '-classpath[specify path for user class files]:class path:->classpath' \
+    {-cp,-classpath}'[specify path for user class files]:class path:->classpath' \
+    '-exclude[specify a list of packages to exclude]:package list' \
+    '-subpackages[specify subpackages to recursively load]:subpackage list' \
+    '-breakiterator[compute first sentence with BreakIterator]' \
     '-bootclasspath[specify path for bootstrap class files]:bootstrap class path:->bootstrapclasspath' \
+    '-source[provide source compatibility with specified release]:release' \
     '-extdirs[specify directories for extensions]:extensions directories:->extdirs' \
     '-verbose[print verbose messages]' \
     '-locale[specify locale]:language_country_variant:' \
     '-encoding[specify character encoding for source files]:encoding:->encoding' \
+    "-quiet[don't display status messages]" \
     '-J-[specify java option]:java option:' \
+    '-X[print a synopsis of nonstandard options and exit]' \
     '-d[specify destination directory]:destination directory:_files -/' \
     '-use[display pages for use]' \
     '-version[include @version text]' \
@@ -111,15 +123,27 @@ javadoc)
     '-bottom[specify bottom text]:bottom text:' \
     '-link[generate a link to external reference classes]:document URL:' \
     '-linkoffline[generate a link for external reference class names]:document URL::package list URL:' \
+    '-excludedocfilessubdir[exclude any doc-files subdirectories with given name]:name:_directories' \
     '-group[generate tables for each group]:group heading::package patterns:' \
-    '-nodeprecated[do not document deprecated API]' \
-    '-nodeprecatedlist[do not generate deprecated API list]' \
-    '-notree[do not generate class and interface hierarchy]' \
-    '-noindex[do not generate index]' \
-    '-nohelp[do not generate help link]' \
-    '-nonavbar[do not generate navigation bar]' \
+    "-nodeprecated[don't include @deprecated information]" \
+    '-noqualifier[exclude the list of qualifiers from the output]:qualifier list' \
+    "-nosince[don't include @since information]" \
+    "-notimestamp[don't include hidden time stamp]" \
+    "-nodeprecatedlist[don't generate deprecated API list]" \
+    "-notree[don't generate class and interface hierarchy]" \
+    "-noindex[don't generate index]" \
+    "-nohelp[don't generate help link]" \
+    "-nonavbar[don't generate navigation bar]" \
+    '-serialwarn[generate warning about @serial tag]' \
+    '*-tag[specify single argument custom tag]:tag' \
+    '-taglet[specify fully qualified name of Taglet to register]:taglet' \
+    '-tagletpath[specify path to Taglets]:path:_directories' \
+    '-charset[specify charset of generated documentation]:charset:->encoding' \
     '-helpfile[specify alternative help link]:helpfile path/filename:' \
-    '-stylesheet[specify alternative HTML style sheet]:stylesheet path/filename:' \
+    '-linksource[generate source in HTML]' \
+    '-sourcetab[specify the number of spaces each tab takes up in the source]:spaces' \
+    '-keywords[include HTML meta tags with package, class and member info]' \
+    '-stylesheetfile[specify alternative HTML style sheet]:stylesheet path/filename:_directories' \
     '-docencoding[specify character encoding for output HTML files]:encoding:->encoding' \
     '*:package name, source file or @list:->docsrc' && ret=0
   ;;
@@ -143,9 +167,11 @@ jar)
       'f[specify archive file]' \
       'v[verbose mode]' \
       '(e)m[specify manifest file]' \
+      'n[perform Pack200 normalization after creating a new archive]' \
       '(m)e[specify class of for application entry point]' \
       '0[store only without using ZIP compression]' \
-      'M[do not create manifest file]' \
+      "M[don't create manifest file]" \
+      "P[preserve leading / and .. components on file names]" \
       'i[generate index information for specified jar files]' && return
   else
     jar_cmd="${words[2]#-}"
@@ -171,7 +197,7 @@ javah|javah_g)
     '-help[print help message]' \
     '-version[print version]' \
     '-jni[JNI-style native method function prototypes]' \
-    '-classpath[specify path for user class files]:class path:->classpath' \
+    {-cp,-classpath}'[specify path for user class files]:class path:->classpath' \
     '-bootclasspath[specify path for bootstrap class files]:bootstrap class path:->bootstrapclasspath' \
     '-old[generate old JDK1.0-style header files]' \
     '-force[force output]' \
@@ -182,17 +208,19 @@ javah|javah_g)
 javap)
   _arguments -C \
     '-help[print help message]' \
+    '-version[print version information]' \
+    {-v,-verbose}'[print additional information]' \
     '-l[line and local variable tables]' \
-    '-b[backward compatible to JDK1.1]' \
-    '-public[only public classes and members]' \
-    '-protected[only protected and public classes and members]' \
-    '-package[only package, protected and public classes and members (default)]' \
-    '-private[all classes and members]' \
+    '(-protected -package -p -private)-public[show only public classes and members]' \
+    '(-public -package -p -private)-protected[show only protected/public classes and members]' \
+    '(-public -protected -p -private)-package[show only package/protected/public classes and members (default)]' \
+    '(-public -package -protected -p -private)'{-p,-private}'[show all classes and members]' \
     '-J-[specify java option]:java option:' \
-    '-s[internal type signatures]' \
     '-c[disassemble code]' \
-    '-verbose[stack size, number of locals and args for methods]' \
-    '-classpath[specify path for user class files]:class path:->classpath' \
+    '-s[print internal type signatures]' \
+    '-sysinfo[show system info (path, size, date, MD5 hash) of class being processed]' \
+    '-constants[show final constants]' \
+    {-cp,-classpath}'[specify path for user class files]:class path:->classpath' \
     '-bootclasspath[specify path for bootstrap class files]:bootstrap class path:->bootstrapclasspath' \
     '-extdirs[specify directories for extensions]:extensions directories:->extdirs' \
     '*:class:_java_class ${(kv)opt_args[(i)-classpath]}' && return 0
diff --git Completion/Unix/Command/_less Completion/Unix/Command/_less
index cb71314a6..0b474b991 100644
--- Completion/Unix/Command/_less
+++ Completion/Unix/Command/_less
@@ -1,7 +1,7 @@
 #compdef less -value-,LESS,-default- -value-,LESSCHARSET,-default-
 
-local curcontext="$curcontext" state line expl ret=1
-local -a files
+local curcontext="$curcontext" fgbg=foreground ret=1
+local -a state line expl files basic suf
 
 case $service in
   *LESSCHARSET*)
@@ -37,15 +37,15 @@ _arguments -S -s -A "[-+]*"  \
   '(-b --buffers)'{-b+,--buffers=}'[specify amount of buffer space used for each file]:buffer space (kilobytes)' \
   '(-B --auto-buffers)'{-B,--auto-buffers}"[don't automatically allocate buffers for pipes]" \
   '(-C --CLEAR-SCREEN -c --clear-screen)'{-c,--clear-screen}'[repaint screen instead of scrolling]' \
-  '(-c --clear-screen -C --CLEAR-SCREEN)'{-C,--CLEAR-SCREEN}'[clear screen before repaints]' \
+  '!(-c --clear-screen)'{-C,--CLEAR-SCREEN} \
   '(-d --dumb)'{-d,--dumb}'[suppress error message if terminal is dumb]' \
+  '*-D+[set screen colors]: :->colors' \
   '(-e -E --quit-at-eof --QUIT-AT-EOF)'{-e,--quit-at-eof}'[exit the second time end-of-file is reached]' \
   '(-e -E --quit-at-eof --QUIT-AT-EOF)'{-E,--QUIT-AT-EOF}'[exit when end-of-file is reached]' \
   '(-f --force)'{-f,--force}'[force opening of non-regular files]' \
   '(-F --quit-if-one-screen)'{-F,--quit-if-one-screen}'[exit if entire file fits on first screen]' \
   '(-G --HILITE-SEARCH -g --hilite-search)'{-g,--hilite-search}'[highlight only one match for searches]' \
   '(-g --hilite-search -G --HILITE-SEARCH)'{-G,--HILITE-SEARCH}'[disable highlighting of search matches]' \
-  '--old-bot[revert to the old bottom of screen behavior]' \
   '(-h --max-back-scroll)'{-h+,--max-back-scroll=}'[specify backward scroll limit]:backward scroll limit (lines)' \
   '(-I --IGNORE-CASE -i --ignore-case)'{-i,--ignore-case}'[ignore case in searches that lack uppercase]' \
   '(-i --ignore-case -I --IGNORE-CASE)'{-I,--IGNORE-CASE}'[ignore case in all searches]' \
@@ -83,18 +83,49 @@ _arguments -S -s -A "[-+]*"  \
   '(-\" --quotes)'{-\"+,--quotes=}'[change quoting character]:quoting characters' \
   '(-~ --tilde)'{-~,--tilde}"[don't display tildes after end of file]" \
   '(-\# --shift)'{-\#+,--shift=}"[specify amount to move when scrolling horizontally]:number" \
+  '--file-size[automatically determine the size of the input file]' \
+  '--incsearch[search file as each pattern character is typed in]' \
+  '--line-num-width=[set the width of line number field]:width [7]' \
   '--follow-name[the F command changes file if the input file is renamed]' \
   '--mouse[enable mouse input]' \
   '--no-histdups[remove duplicates from command history]' \
   '--rscroll=[set the character used to mark truncated lines]:character [>]' \
   '--save-marks[retain marks across invocations of less]' \
+  '--status-col-width=[set the width of the -J status column]:width [2]' \
   '--use-backslash[subsequent options use backslash as escape char]' \
+  '--use-color[enable colored text]' \
   '--wheel-lines=[specify lines to move for each click of the mouse wheel]:lines' \
   "$files[@]" && ret=0
 
 
 if [[ -n "$state" ]]; then
   case $state in
+    colors)
+      if compset -P 1 \?; then
+        [[ $IPREFIX[-1] != [a-z] ]] || compset -P 1 + || _describe 'color application' '( +:add\ to\ existing\ attribute )'
+        suf=( -S '' )
+        compset -P 1 '([a-zA-Z]|*.)' && fgbg=background && suf=()
+        basic=( B:blue C:cyan G:green K:black M:magenta R:red W:white Y:yellow )
+        _describe -t colors "$fgbg color" \
+            "( -:default ${(j. .)${(@)basic/:/:light\ }} ${(Lj. .)basic} )" "$suf[@]"  && ret=0
+      else
+        _describe 'text' '(
+          B:binary\ characters
+          C:control\ characters
+          E:errors\ and\ informational\ messages
+          M:mark\ letters\ in\ the\ status\ column
+          N:line\ numbers\ enabled\ via\ the\ -N\ option
+          P:prompts
+          R:the\ rscroll\ character
+          S:search\ results
+          W:the\ highlight\ enabled\ via\ the\ -w\ option
+          d:bold\ text
+          k:blinking\ text
+          s:standout\ text
+          u:underlined\ text
+        )' -S '' && ret=0
+      fi
+    ;;
     prompts)
       if compset -p 1; then
 	_message -e prompt
diff --git Completion/Unix/Command/_mtr Completion/Unix/Command/_mtr
index 806e344d1..9a73cfbd4 100644
--- Completion/Unix/Command/_mtr
+++ Completion/Unix/Command/_mtr
@@ -4,6 +4,7 @@ _arguments -s -S \
   '(H -F --filename)'{-F,--filename}'[read hostnames from a file]' \
   '(H -6)-4[use IPv4 only]' \
   '(H -4)-6[use IPv6 only]' \
+  '(H -I --interface)'{-I+,--interface=}'[use named network interface]: :_net_interfaces' \
   '(H -a --address)'{-a+,--address=}'[bind outgoing packets to specific interface]:source IP:_hosts' \
   '(H -f --first-ttl)'{-f+,--first-ttl=}'[specify TTL to start]:TTL [1]' \
   '(H -m --max-ttl)'{-m+,--max-ttl=}'[specify maximum number of hops to probe]:hops [30]' \
@@ -17,7 +18,6 @@ _arguments -s -S \
   '(H -Q --tos)'{-Q+,--tos=}'[specify type of service for IP header]:tos (0-255)' \
   '(H -e --mpls)'{-e,--mpls}'[display ICMP MPLS information]' \
   '(H -Z --timeout)'{-Z+,--timeout=}'[specify how long to keep probe sockets open before giving up on the connection]:timeout (seconds)' \
-  '(H -M --mark)'{-M+,--mark=}'[mark each sent packet]:mark' \
   '(H -r --report)'{-r,--report}'[report mode]' \
   '(H -w --report-wide)'{-w,--report-wide}"[wide report mode\: don't truncate hostnames]" \
   '(H -c --report-cycles)'{-c+,--report-cycles=}'[report cycles]:number of pings' \
diff --git Completion/Unix/Command/_nm Completion/Unix/Command/_nm
index 2f608c5fc..79f537ac6 100644
--- Completion/Unix/Command/_nm
+++ Completion/Unix/Command/_nm
@@ -62,7 +62,8 @@ if _pick_variant -r variant binutils=GNU elftoolchain=elftoolchain elfutils=elfu
         '!(--no-recurse-limit)--recurse-limit'
         '--no-recurse-limit[disable demangling recursion limit]'
 	'(-f --format -P)-f+[specify output format]:format:(bsd sysv posix)'
-	'(-C --no-demangle)--demangle=-[decode symbol names]::style:(auto gnu lucid arm hp edg gnu-v3 java gnat rust dlang)'
+	'(-C --no-demangle)--demangle=-[decode symbol names]::style [auto]:(auto gnu lucid arm hp edg gnu-v3 java gnat rust dlang)'
+        '--ifunc-chars=[specify characters to use for indirect function symbols]:characters for global/local indirect function symbols [ii]'
 	'--plugin[load specified plugin]:plugin'
 	'--special-syms[include special symbols in the output]'
 	'--synthetic[display synthetic symbols as well]'
diff --git Completion/Unix/Command/_objdump Completion/Unix/Command/_objdump
index 5152e6b6e..e2dde7e4c 100644
--- Completion/Unix/Command/_objdump
+++ Completion/Unix/Command/_objdump
@@ -67,7 +67,8 @@ case $variant in
       '(-z --disassemble-zeroes)'{-z,--disassemble-zeroes}"[don't skip blocks of zeroes when disassembling]"
 
       '--start-address=[only process data whose address is >= ADDR]:address'
-      '--stop-address=[only process data whose address is <= ADDR]:address'
+      '--stop-address=[only process data whose address is < ADDR]:address'
+      "--no-addresses[don't print address alongside disassembly]"
       '--prefix-addresses[print complete address alongside disassembly]'
       '(--show-raw-insn --no-show-raw-insn)'--{,no-}show-raw-insn'[display hex alongside symbolic disassembly]'
       '--insn-width=[display specified number of bytes on a single line with -d]:width (bytes)'
@@ -80,6 +81,7 @@ case $variant in
       '--dwarf-start=[display DIEs at specified or deeper depth]:depth'
       '--dwarf-check[perform additional dwarf internal consistency checks]'
       '--ctf-parent=[use specified section as the CTF parent]:section'
+      '--visualize-jumps=-[visualize jumps by drawing ASCII art lines]::color:(color extended-color off)'
     )
   ;;
   elfutils)
@@ -165,6 +167,7 @@ case "$state" in
     _values -s "" "dwarf section" \
         "l[rawline]" "L[decodedline]" "i[info]" "a[abbrev]" "p[pubnames]" \
         "r[aranges]" "m[macro]" "f[frames]" "F[frames-interp]" "s[str]" \
+        'O[str-offsets]' \
         "o[loc]" "R[ranges]" "t[pubtypes]" "U[trace_info]" "u[trace_abbrev]" \
         "T[trace_aranges]" "g[gdb_index]" "A[addr]" "c[cu_index]" "k[links]" \
         "K[follow-links]" && ret=0
@@ -172,7 +175,7 @@ case "$state" in
   dwarf-names)
     _sequence _wanted dwarf-sections expl "dwarf section" compadd - \
         rawline decodedline info abbrev pubnames aranges macro frames \
-        frames-interp str loc Ranges pubtypes gdb_index trace_info \
+        frames-interp str str-offsets loc Ranges pubtypes gdb_index trace_info \
         trace_abbrev trace_aranges addr cu_index links follow-links && ret=0
   ;;
   bfdnames)
diff --git Completion/Unix/Command/_patchutils Completion/Unix/Command/_patchutils
index 50ea3e4c4..a5f6441b1 100644
--- Completion/Unix/Command/_patchutils
+++ Completion/Unix/Command/_patchutils
@@ -85,6 +85,7 @@ case $service in
       '(-H --with-filename -h --no-filename)'{-h,--no-filename}"[don't print the name of the patch file containing each patch]"
       '(-f --file)'{-f+,--file=}'[read regular expressions from file]:file:_files'
       '--output-matching=[display the matching hunk- or file-level diffs]:level:(hunk file)'
+      '--only-match=[restrict regex to matching removals, additions or modifications]:limit:(rem removals add additions mod modifications all)'
     )
   ;;
   splitdiff)
diff --git Completion/Unix/Command/_pgrep Completion/Unix/Command/_pgrep
index 38b1aebd8..afd2fe54b 100644
--- Completion/Unix/Command/_pgrep
+++ Completion/Unix/Command/_pgrep
@@ -31,6 +31,7 @@ arguments=(
   '(-M)-N+[extract name list from specified system]:system file:_files'
   '(-o -n --oldest --newest)'{-n,--newest}'[match newest process]'
   '(-o -n --oldest --newest)'{-o,--oldest}'[match oldest process]'
+  '(-O --older)'{-O+,--older=}'[select where older than specified age]:age (seconds)'
   '(-P --parent)'{-P+,--parent=}'[match only on specified parent process IDs]: :->ppid'
   '(-l)-q[suppress normal output]'
   '(-r --runstates)'{-r+,--runstates}'[match runstates]:run state:compadd -S "" D I R S T t W X Z'
@@ -62,8 +63,8 @@ arguments=(
 case $OSTYPE in
   linux*)
     # Note: We deliberately exclude -v but not --inverse from pkill
-    pgopts=acdFfGghLlnoPrstUuVvwx-
-    pkopts=ceFfGghLnoPstUuVx-
+    pgopts=acdFfGghLlnoOPrstUuVvwx-
+    pkopts=ceFfGghLnoOPstUuVx-
     arguments=(
       ${arguments:#((#s)|*\))(\*|)-[acl]*}
       '(-c --count)'{-c,--count}'[display count of matching processes]'
diff --git Completion/Unix/Command/_rar Completion/Unix/Command/_rar
index 68982be60..d1d381974 100644
--- Completion/Unix/Command/_rar
+++ Completion/Unix/Command/_rar
@@ -4,6 +4,8 @@ local common expl
 
 common=(
   '-ad[append archive name to destination path]'
+  '-ad1[create a separate folder for files unpacked from each archive]'
+  "-ad2[like -ad1 but use archives' own folders]"
   '-ap[set path inside archive]'
   '-av\-[disable authenticity verification check]'
   '-c\-[disable comments show]'
@@ -13,6 +15,7 @@ common=(
   '-dh[open shared files]'
   '-ep[exclude paths from name]'
   '-f[freshen files]'
+  '-idn[hide archived names]'
   '-idp[disable percentage display]'
   '-ierr[send all messages to stderr]'
   '-inul[disable all messages]'
@@ -27,6 +30,7 @@ common=(
   '-tb+[process files modified before a date]:date (YYYYMMDDHHMMSS)'
   '-tn+[process files newer than a specified time]:time'
   '-to+[process files older than a specified time]:time'
+  '-ts-[save or restore time]:time:((m\:modification c\:change a\:access p\:preserve))'
   '-u[update files]'
   '-v[create volumes with size autodetection or list all volumes]'
   '-ver[file version control]'
diff --git Completion/Unix/Command/_readelf Completion/Unix/Command/_readelf
index edabc3da1..fc0fb7ce1 100644
--- Completion/Unix/Command/_readelf
+++ Completion/Unix/Command/_readelf
@@ -18,7 +18,7 @@ args=(
   '(-c --archive-index)'{-c,--archive-index}'[show symbol/file index in an archive]'
   \*{-x,--hex-dump=}"[dump contents of specified section as bytes]:section:($sections)"
   \*{-p,--string-dump=}"[dump contents of specified section as strings]:section:($sections)"
-  '-w+[show the contents of DWARF2 debug sections]::debug section:(l L i a p r m f F s o R t U u T g A c k K)'
+  '-w+[show the contents of DWARF2 debug sections]::debug section:(l L i a p r m f F s o O R t U u T g A c k K)'
   '--debug-dump=[show the contents of DWARF2 debug sections]::section:(rawline decodedline info abbrev pubnames aranges macro frames frames-interp str loc Ranges pubtypes gdb_index trace_info trace_abbrev trace_aranges addr cu_index links follow-links)'
   '(-I --histogram)'{-I,--histogram}'[show histogram of bucket list lengths]'
   '(-W --wide)'{-W,--wide}'[allow output width to exceed 80 characters]'
@@ -50,6 +50,12 @@ case $variant in
   ;|
   binutils)
     args+=(
+      '!(-C --demangle)--no-demangle'
+      '(--demangle)-C[decode symbol names]'
+      '(-C)--demangle=-[decode symbol names]::style [auto]:(auto gnu lucid arm hp edg gnu-v3 java gnat)'
+      '!(--no-recurse-limit)--recurse-limit'
+      '--no-recurse-limit[disable demangling recursion limit]'
+      '(-L --lint --enable-checks)'{-L,--lint,--enable-checks}'[display warning messages for possible problems]'
       \*{-R,--relocated-dump=}"[dump contents of specified section as relocated bytes]:section:($sections)"
       "--dwarf-depth=[don't show DIEs at greater than specified depth]:depth"
       '--dwarf-start=[show DIEs starting at specified depth or deeper]:depth'
@@ -57,6 +63,7 @@ case $variant in
       '--ctf-parent=[use specified section as the CTF parent]:section'
       '--ctf-symbols=[use specified section as the CTF external symbol table]:section'
       '--ctf-strings=[use specified section as the CTF external string table]:section'
+      '(-T --silent-truncation)'{-T,--silent-truncation}"[if a symbol name is truncated, don't add ... suffix]"
     )
   ;;
   elfutils)
diff --git Completion/Unix/Command/_ri Completion/Unix/Command/_ri
index 070f46ac2..4d5a72985 100644
--- Completion/Unix/Command/_ri
+++ Completion/Unix/Command/_ri
@@ -6,26 +6,29 @@ typeset -A opt_args
 _arguments -C \
   '(- *)'{-h,--help}'[print help information and exit]' \
   '(- *)'{-v,--version}'[display the version of ri]' \
-  '*'{-d,--doc-dir}'[directory to search for documentation]:ri doc directory:_files -/' \
-  '(-f --fmt --format)'{-f,--fmt,--format}'[format to use when displaying output]:output format:(ansi bs html plain simple)' \
+  '*'{-d+,--doc-dir=}'[directory to search for documentation]:ri doc directory:_directories' \
+  '(-f --format)'{-f+,--format=}'[format to use when displaying output]:output format [bs]:(ansi bs markdown rdoc)' \
   '(-T --no-pager)'{-T,--no-pager}'[send output directly to stdout]' \
-  '(-i, --interactive)'{-i,--interactive}'[interactive mode]' \
+  '(-i --interactive)'{-i,--interactive}'[interactive mode]' \
+  '(-a --all)'{-a,--all}'[show all documentation for a class or module]' \
+  '(-l --list)'{-l,--list}'[list classes ri knows about]' \
   '--list-doc-dirs[list the directories from which ri will source documentation]' \
-  '(-w --width)'{-w,--width}'[set the width of the output]:output width:' \
-  '--no-standard-docs[do not include documentation from the Ruby standard library, site_lib, installed gems, or ~/.rdoc]' \
-  '(--no-use-cache --use-cache)--'{no-,}'use-cache[whether or not to use ri'\''s cache]' \
-  '(--no-system --system)--'{no-,}'system[include documentation from Ruby'\''s standard library]' \
+  '(-w --width)'{-w+,--width=}'[set the width of the output]:output width [72]' \
+  '(-l --list)--server=-[run RDoc server on the given port]::port [8214]:_ports' \
+  "--no-standard-docs[don't include documentation from the Ruby standard library, site_lib, installed gems, or ~/.rdoc]" \
+  '(--no-use-cache --use-cache)--'{no-,}"use-cache[whether or not to use ri's cache]" \
+  '(--no-system --system)--'{no-,}"system[include documentation from Ruby's standard library]" \
   '(--no-site --site)--'{no-,}'site[include documentation from libraries installed in site_lib]' \
   '(--no-gems --gems)--'{no-,}'gems[include documentation from RubyGems]' \
   '(--no-home --home)--'{no-,}'home[include documentation stored in ~/.rdoc]' \
-  '*:ri name:->ri-name' && ret=0
+  '--profile[run with the Ruby profiler]' \
+  '--dump=[dump data from an ri cache or data file]:cache:_files' \
+  '*:ri name:->ri-name' && return
 
 if [[ "$state" = ri-name ]]; then
   local -a ri_dirs ri_ext ri_names ri_wants ri_names
   local class_dir esc_name dir curtag tag descr expl
 
-  ret=1
-
   if "ruby${words[1]#ri}" -rrdoc/ri/ri_options -e 1 >/dev/null 2>&1; then
     # Old-style Ruby 1.8.x RI
     ri_dirs=( ${(f)"$(_call_program ri-names "ruby${words[1]#ri}" -rrdoc/ri/ri_options -e '"o = RI::Options.instance; o.parse(ARGV); o.path.each { |p| puts p }"' -- ${(kv)opt_args[(I)-d|--doc-dir|--(system|site|gems|home)]})"} )
diff --git Completion/Unix/Command/_ruby Completion/Unix/Command/_ruby
index a57bffcda..0e1f5dbc0 100644
--- Completion/Unix/Command/_ruby
+++ Completion/Unix/Command/_ruby
@@ -15,7 +15,7 @@ all=(
 common=(
   '*-I+[specify $LOAD_PATH directory (may be used more than once)]:library directory:_files -/'
   '-w[turn warnings on for your script]'
-  '-W-[set warning level]:warning level:((0\:silent 1\:medium 2\:verbose))'
+  '-W-[set warning level]:warning level:((0\:silent 1\:medium 2\:verbose \\\:deprecated \\\:experimental))'
   '(-)1:ruby script:_files -g "*.rb(-.)"'
   '*::script argument:= ->normal'
 )
@@ -35,7 +35,7 @@ opts=(
   '(-n)-p[assume loop like -n but print line also like sed]'
   '-s[enable some switch parsing for switches after script name]'
   '-S[look for the script using PATH environment variable]'
-  '-T-[turn on tainting checks]::taint level [1]:((0\:strings\ from\ streams/environment/ARGV\ are\ tainted 1\:no\ dangerous\ operation\ by\ tainted\ value 2\:process/file\ operations\ prohibited 3\:all\ generated\ objects\ are\ tainted 4\:no\ global\ \(non-tainted\)\ variable\ modification/no\ direct\ output))'
+  '!-T-[turn on tainting checks]::taint level [1]:((0\:strings\ from\ streams/environment/ARGV\ are\ tainted 1\:no\ dangerous\ operation\ by\ tainted\ value 2\:process/file\ operations\ prohibited 3\:all\ generated\ objects\ are\ tainted 4\:no\ global\ \(non-tainted\)\ variable\ modification/no\ direct\ output))'
   '(--verbose)-v[print version number, then turn on verbose mode]'
   '(-v)--verbose[turn on verbose mode and disable script from stdin]'
   '-x-[strip off text before #!ruby line and perhaps cd to directory]:directory:_files -/'
@@ -49,11 +49,11 @@ opts=(
   '--jit[enable jit with default options]'
   '--jit-warnings[enable printing JIT warnings]'
   '--jit-debug[enable JIT debugging (very slow)]'
-  '--jit-wait[wait until JIT compilation is finished every time (for testing)]'
+  '--jit-wait[wait until JIT compilation finishes every time (for testing)]'
   '--jit-save-temps[save JIT temporary files]'
   '--jit-verbose=-[print JIT logs of level num or less to stderr]:maximum log level [0]'
-  '--jit-max-cache=-[specify max number of methods to be JIT-ed in a cache]:number [1000]'
-  '--jit-min-calls=-[specify number of calls to trigger JIT]:calls [5]'
+  '--jit-max-cache=-[specify max number of methods to be JIT-ed in a cache]:number [100]'
+  '--jit-min-calls=-[specify number of calls to trigger JIT]:calls [10000]'
 )
 
 irb=(
diff --git Completion/Unix/Command/_script Completion/Unix/Command/_script
index ac3bf3973..7a3960be0 100644
--- Completion/Unix/Command/_script
+++ Completion/Unix/Command/_script
@@ -4,14 +4,19 @@ local args hlp="-h --help -V --version"
 
 if [[ $service = scriptreplay ]]; then
   _arguments -S -s \
-    "(1 -t --timing $hlp)"{-t+,--timing=}'[specify file containing timing output]:timing file:_files' \
-    "(2 -s --typescript $hlp)"{-s+,--typescript=}'[specify file containing terminal output]:typescript file:_files' \
+    "(1 -t --timing -T --log-timing $hlp)"{-t+,-T+,--timing=,--log-timing=}'[specify file containing timing output]:timing file:_files' \
+    "(-I --log-in -B --log-io $hlp)"{-I+,--log-in=}'[specify file containing terminal input]:file:_files' \
+    "(2 -s --typescript -B --log-io $hlp)"{-s+,-O+,--typescript=,--log-out=}'[specify file containing terminal output]:typescript file:_files' \
+    "(-B --log-io -I --log-in -s -O --typescript --log-out $hlp)"{-B,--log-io}'[specify file containing terminal input and output]' \
+    "($hlp)--summary[display overview about recorded session and exit]" \
     "(3 -d --divisor $hlp)"{-d+,--divisor=}'[speed up replay]:factor' \
     "(-m --maxdelay $hlp)"{-m+,--maxdelay=}'[set maximum delay between updates]:delay (seconds)' \
+    "(-x --stream $hlp)"{-x+,--stream=}'[specify stream type]:name:(out in signal or info)' \
+    "(-c --cr-mode $hlp)"{-c+,--cr-mode=}'[specify CR char mode]:mode:(auto never always)' \
     '(- *)'{-h,--help}'[display help information]' \
     '(- *)'{-V,--version}'[display version information]' \
     "(-t --timing $hlp):timing file:_files" \
-    "(-s --typescript $hlp):typescript file:_files" \
+    "(-s --typescript -O --log-out $hlp):typescript file:_files" \
     "(-d --divisor $hlp): :_guard '[0-9.]#' 'timing divisor'"
   return
 fi
@@ -19,12 +24,18 @@ fi
 case $OSTYPE in
   linux*)
     args=( -S
-      "(-a --append $hlp)"{-a,--append}'[append output]'
+      "(-I --log-in $hlp)"{-I,--log-in}'[log stdin to file]:file:_files'
+      "(-O --log-out $hlp)"{-O,--log-out}'[log stdout to file]:file:_files'
+      "(-B --log-io $hlp)"{-B,--log-io}'[log stdin and stdout to file]:file:_files'
+      "(-T --log-timing -t --timing $hlp)"{-T+,--log-timing=}'[log timing information to file]:file:_files'
+      "(-m --logging-format $hlp)"{-m+,--logging-format=}'[specify log file format]:format:(classic advanced)'
+      "(-a --append $hlp)"{-a,--append}'[append to the log file]'
       "(-c --command $hlp)"{-c,--command=}'[run specified command instead of a shell]:command:_cmdstring'
       "(-e --return $hlp)"{-e,--return}'[return exit status of the child process]'
       "(-f --flush $hlp)"{-f,--flush}'[flush output after each write]'
+      "(-E --echo $hlp)"{-E+,--echo=}'[echo input]:when:(auto always never)'
       "($hlp)--force[use output file even when it is a link]"
-      '(-o --output-limit)'{-o+,--output-limit=}'[terminate if output files exceed specified size]:size (bytes)'
+      "(-o --output-limit $hlp)"{-o+,--output-limit=}'[terminate if output files exceed specified size]:size (bytes)'
       "(-q --quiet $hlp)"{-q,--quiet}'[be quiet]'
       "(-t --timing $hlp)"{-t-,--timing=-}'[output timing data]::timing file:_files'
       '(- 1)'{-h,--help}'[display help information]'
diff --git Completion/Unix/Command/_sqlite Completion/Unix/Command/_sqlite
index 0f03c61c1..7ef3c6daa 100644
--- Completion/Unix/Command/_sqlite
+++ Completion/Unix/Command/_sqlite
@@ -22,7 +22,7 @@ options+=(
 )
 
 output_modes=( column HTML line list )
-(( $+sqlite3 )) && output_modes+=( ascii csv quote )
+(( $+sqlite3 )) && output_modes+=( ascii box csv json markdown quote table tabs )
 exclusive=( $^dashes-${^output_modes:l} )
 for display_opt in $output_modes ; do
   # finagle the description to match the way SQLite's -help formats them
@@ -54,6 +54,7 @@ options+=(
   $^dashes'-memtrace[trace all memory allocations and deallocations]'
   $^dashes'-mmap[set default mmap size]:size'
   $^dashes'-newline[set output row separator]:separator [\n]'
+  $^dashes'-nofollow[refuse to open symbolic links to database files]'
   $^dashes'-pagecache[specify size and number of slots for page cache memory]:size (bytes): :slots'
   $^dashes'-readonly[open the database read-only]'
   $^dashes'-stats[print memory stats before each finalize]'
diff --git Completion/Unix/Command/_strip Completion/Unix/Command/_strip
index e7f3418d7..3e1a6b698 100644
--- Completion/Unix/Command/_strip
+++ Completion/Unix/Command/_strip
@@ -32,6 +32,7 @@ if _pick_variant gnu=GNU solaris --version; then
     "--no-merge-notes[don't attempt to remove redundant notes]"
     '*'{-K+,--keep-symbol=}'[keep given symbol]:symbol name'
     '*'{-N+,--strip-symbol=}'[strip given symbol]:symbol name'
+    "*--keep-section=[don't strip given section]:section"
     '(*)-o+[output file]:output file:_files'
     '(-p --preserve-dates)'{-p,--preserve-dates}'[preserve access and modification dates]'
     '(-w --wildcard)'{-w,--wildcard}'[permit wildcards in symbol names]'
diff --git Completion/Unix/Command/_sudo Completion/Unix/Command/_sudo
index e3d12d72f..29e5e6d75 100644
--- Completion/Unix/Command/_sudo
+++ Completion/Unix/Command/_sudo
@@ -14,7 +14,9 @@ done
 
 args=(
   '(-A --askpass)'{-A,--askpass}'[use a helper program for password prompting]'
+  '(-B --bell)'{-B,--bell}'[ring bell when prompting]'
   '(-C --close-from)'{-C+,--close-from=}'[close file descriptors]:lowest fd to close'
+  '(-D --chdir)'{-D+,--chdir=}'[change the working directory before running command]:directory:_directories'
   '(-g --group)'{-g+,--group=}'[run command as the specified group name or ID]:group:_groups'
   '(-)'{-h,--help}'[display help message and exit]'
   '(-h --host)'{-h+,--host=}'[run command on host]:host:_hosts'
@@ -23,6 +25,7 @@ args=(
   \*{-l,--list}"[list user's privileges or check a specific command]"
   '(-n --non-interactive)'{-n,--non-interactive}'[non-interactive mode, no prompts are used]'
   '(-p --prompt)'{-p+,--prompt=}'[use the specified password prompt]:prompt'
+  '(-R --chroot)'{-R+,--chroot=}'[change the root directory before running command]:directory:_directories'
   '(-r --role)'{-r+,--role=}'[create SELinux security context with specified role]: :_selinux_roles'
   '(-S --stdin)'{-S,--stdin}'[read password from standard input]'
   '(-t --type)'{-t+,--type=}'[create SELinux security context with specified type]: :_selinux_types'
diff --git Completion/Unix/Command/_tiff Completion/Unix/Command/_tiff
index da55b541c..ef12777de 100644
--- Completion/Unix/Command/_tiff
+++ Completion/Unix/Command/_tiff
@@ -59,6 +59,7 @@ tiff2pdf)
     '-s+[set document subject, overrides image image description default]:subject' \
     '-k+[set document keywords]:keywords' \
     '-b[set PDF "Interpolate" user preference]' \
+    '-m+[set memory allocation limit]:limit (MiB)' \
     '(- :)-h[display usage information]' \
     ':input file:_files -g "*.(#i)tif(|f)(-.)"'
   ;;
@@ -83,6 +84,7 @@ tiff2ps)
     '-i+[enable/disable (Nz/0) pixel interpolation]:state [enabled]:((0\:disable 1\:enable))' \
     '-l+[set the left margin]:margin (inches)' \
     '-m[use "imagemask" operator instead of "image"]' \
+    '-M+[set memory allocation limit]:limit (MiB)' \
     '-o+[set initial TIFF directory (file offset)]:file offset (bytes)' \
     '(-e)-p[generate non-Encapsulated PostScript]' \
     '-O+[specify output file]:output file:_files -g "*.(#i)(|e)ps(-.)"' \
@@ -121,6 +123,7 @@ tiffcp)
     '-i[ignore read errors]' \
     '-b+[specify bias (dark) monochrome image to be subtracted from all others]:file:_files' \
     '-,=-[specify substitute character for image indices]:character [,]' \
+    '-m+[set memory allocation limit]:limit (MiB)' \
     '-r+[specify rows per strip]:rows per strip' \
     '-w+[specify output tile width]:output tile width' \
     '-l+[specify output tile length]:output tile length' \
diff --git Completion/Unix/Command/_tmux Completion/Unix/Command/_tmux
index 284a325e5..844af58fc 100644
--- Completion/Unix/Command/_tmux
+++ Completion/Unix/Command/_tmux
@@ -127,6 +127,7 @@ _tmux_aliasmap=(
     confirm     confirm-before
     menu        display-menu
     display     display-message
+    popup       display-popup
 
     # buffers
     clearhist   clear-history
@@ -168,6 +169,7 @@ _tmux-attach-session() {
   _arguments -s \
     '-c+[specify working directory for the session]:directory:_directories' \
     '-d[detach other clients attached to target session]' \
+    '-f+[set client flags]: :_tmux_client_flags' \
     '-r[put the client into read-only mode]' \
     '-t+[specify target session]:target session: __tmux-sessions-separately' \
     "-E[don't apply update-environment option]" \
@@ -188,6 +190,8 @@ _tmux-bind-key() {
 _tmux-break-pane() {
   [[ -n ${tmux_describe} ]] && print "break a pane from an existing into a new window" && return
   _arguments -s \
+    '(-b)-a[move window to next index after]' \
+    '(-a)-b[move window to next index before]' \
     "-d[don't make the new window become the active one]" \
     '-F+[specify output format]:format:__tmux-formats' \
     '-P[print information of new window after it has been created]' \
@@ -221,6 +225,7 @@ _tmux-choose-buffer() {
     '-r[reverse sort order]' \
     '-F+[specify format for each list item]:format:__tmux-formats' \
     '-f+[filter items]:filter format:__tmux-formats' \
+    '-K+[specify format for each shortcut key]:format:__tmux-formats' \
     '-O+[initial sort order]:order:(time name size)' \
     '-t+[specify target window]:session:__tmux-windows' \
     '*:::template:= _tmux'
@@ -234,6 +239,7 @@ _tmux-choose-client() {
     '-r[reverse sort order]' \
     '-F+[specify format for each list item]:format:__tmux-formats' \
     '-f+[filter items]:filter format:__tmux-formats' \
+    '-K+[specify format for each shortcut key]:format:__tmux-formats' \
     '-O+[initial sort order]:order:(time name size)' \
     '-t+[specify target window]:session:__tmux-windows' \
     '*:::template:= _tmux'
@@ -248,6 +254,7 @@ _tmux-choose-tree() {
     '-r[reverse sort order]' \
     '-F+[specify format for each list item]:format:__tmux-formats' \
     '-f+[filter items]:filter format:__tmux-formats' \
+    '-K+[specify format for each shortcut key]:format:__tmux-formats' \
     '-O+[initial sort order]:order:(time name size)' \
     '-s[choose among sessions]' \
     '-t+[specify target window]:session:__tmux-windows' \
@@ -275,6 +282,8 @@ _tmux-command-prompt() {
     '-I+[specify list of initial inputs]:initial-text (comma-separated list)' \
     '-p+[specify list of prompts]:prompts (comma-separated list)' \
     '-t+[specify target client]:client:__tmux-clients' \
+    '(-W)-T[prompt is for a target - tab complete as appropriate]' \
+    '(-T)-W[prompt is for a window - tab complete as appropriate]' \
     '*:::template:= _tmux'
 }
 
@@ -289,6 +298,7 @@ _tmux-confirm-before() {
 _tmux-copy-mode() {
   [[ -n ${tmux_describe} ]] && print "enter copy mode" && return
   _arguments -s \
+    '-s+[specify source pane]:pane:__tmux-panes' \
     '-t+[specify target pane]:pane:__tmux-panes' \
     '-e[scrolling to the bottom should exit copy mode]' \
     '-H[hide the position indicator in the top right]' \
@@ -297,6 +307,16 @@ _tmux-copy-mode() {
     '-M[begin a mouse drag]'
 }
 
+_tmux-customize-mode() {
+  [[ -n ${tmux_describe} ]] && print "enter customize mode" && return
+  _arguments -s \
+    '-F+[specify format for each item in the tree]:format:__tmux-formats' \
+    '-f+[specify initial filter]:filter:__tmux-formats' \
+    '-N[start without the option information]' \
+    '-t+[specify target pane]:pane:__tmux-panes' \
+    '-Z[zoom the pane]'
+}
+
 _tmux-delete-buffer() {
   [[ -n ${tmux_describe} ]] && print "delete a paste buffer" && return
   _arguments '-b+[specify target buffer name]:buffer:__tmux-buffers'
@@ -318,6 +338,7 @@ _tmux-display-menu() {
   local -a state line expl
   _arguments -C -s -S -A "-*" \
     '-c+[specify target client]:client:__tmux-clients' \
+    "-O[don't close menu if mouse is released without making a selection]" \
     '-t+[specify target pane]:pane:__tmux-panes' \
     '-T+[specify title]:title' \
     '-x+[specify horizontal position]: : _alternative "columns\: \:_guard \[0-9\]\# column" "positions\:position\:((R\:right P\:bottom M\:mouse W\:window))"' \
@@ -326,7 +347,7 @@ _tmux-display-menu() {
 
   if [[ -n $state ]]; then
     case $(( CURRENT % 3 )) in
-      1) _message -e options 'menu option' ;;
+      1) _message -e menu-options 'menu option' ;;
       2) _message -e keys 'shortcut key' ;;
       0)
 	compset -q
@@ -345,7 +366,9 @@ _tmux-display-message() {
   _arguments -s -S -A "-*" \
     '(-p -F :)-a[list the format variables and their values]' \
     '-I[forward any input read from stdin to the target pane]' \
+    '-N[ignore key presses and only close after the delay]' \
     '-c+[specify target client]:client:__tmux-clients' \
+    '-d+[time to display message]:delay (milliseconds)' \
     '(-a)-p[print message to stdout]' \
     '-t+[specify target pane]:pane:__tmux-panes' \
     '(-a)-F+[specify output format]:format:__tmux-formats' \
@@ -362,9 +385,25 @@ _tmux-display-panes() {
     '*:::command:= _tmux'
 }
 
+_tmux-display-popup() {
+  [[ -n ${tmux_describe} ]] && print "display a popup box over a pane" && return
+  _arguments -s \
+    '-C[close any popup on the client]' \
+    '-c+[specify target client]:client:__tmux-clients' \
+    '-d+[specify working directory for the command]:directory:_directories' \
+    '-E[close the popup when the command exits]' \
+    '-w+[specify width]:width' \
+    '-h+[specify height]:height' \
+    '-t+[specify target pane]:pane:__tmux-panes' \
+    '-x+[specify horizontal position]:position' \
+    '-y+[specify vertical position]:position' \
+    ':shell command:_cmdstring'
+}
+
 _tmux-find-window() {
   [[ -n ${tmux_describe} ]] && print "search for a pattern in windows" && return
   _arguments -s \
+    '-i[ignore case]' \
     '-r[use regular expression matching]' \
     '-C[match visible contents]' \
     '-N[match window name]' \
@@ -454,6 +493,8 @@ _tmux-last-window() {
 _tmux-link-window() {
   [[ -n ${tmux_describe} ]] && print "link a window to another" && return
   _arguments -s \
+    '(-b)-a[move window to next index after destination window]' \
+    '(-a)-b[move window to next index before destination window]' \
     "-d[don't make the new window become the active one]" \
     '-k[kill the target window if it exists]' \
     '-s+[specify source window]:window:__tmux-windows' \
@@ -462,7 +503,9 @@ _tmux-link-window() {
 
 _tmux-list-buffers() {
   [[ -n ${tmux_describe} ]] && print "list paste buffers of a session" && return
-  _arguments '-F+[specify output format]:format:__tmux-formats'
+  _arguments \
+    '-F+[specify output format]:format:__tmux-formats' \
+    '-f+[filter items]:filter format:__tmux-formats'
 }
 
 _tmux-list-clients() {
@@ -498,12 +541,15 @@ _tmux-list-panes() {
   _arguments -s $args \
     '-a[list all panes the server possesses]' \
     '-F+[specify output format]:format:__tmux-formats' \
+    '-f+[filter items]:filter format:__tmux-formats' \
     '-s[if specified, -t chooses a session]'
 }
 
 _tmux-list-sessions() {
   [[ -n ${tmux_describe} ]] && print "list sessions managed by server" && return
-  _arguments '-F+[specify output format]:format:__tmux-formats'
+  _arguments \
+    '-F+[specify output format]:format:__tmux-formats' \
+    '-f+[filter items]:filter format:__tmux-formats'
 }
 
 _tmux-list-windows() {
@@ -511,6 +557,7 @@ _tmux-list-windows() {
   _arguments -s \
     '-a[list all windows the tmux server possesses]' \
     '-F[specify output format]:format:__tmux-formats' \
+    '-f+[filter items]:filter format:__tmux-formats' \
     '-t+[specify session]:session:__tmux-sessions'
 }
 
@@ -518,6 +565,8 @@ _tmux-load-buffer() {
   [[ -n ${tmux_describe} ]] && print "load a file into a paste buffer" && return
   _arguments -A "-*" -S \
     '-b+[specify target buffer name]:buffer:__tmux-buffers' \
+    '-t+[specify target client]:client:__tmux-clients' \
+    '-w[also send the buffer to the clipboard using the xterm escape sequence]' \
     '1:file:_files'
 }
 
@@ -537,21 +586,14 @@ _tmux-lock-session() {
 }
 
 _tmux-move-pane() {
-  [[ -n ${tmux_describe} ]] && print "move a pane into a new space" && return
-  _arguments -s \
-    '-b[join source pane left of or above target pane]' \
-    "-d[don't make the new window become the active one]" \
-    '-h[split horizontally]' \
-    '-v[split vertically]' \
-    "-l+[define new pane's size]:numeric value" \
-    "-p+[define new pane's size in percent]:numeric value" \
-    '-s+[specify source pane]:pane:__tmux-panes' \
-    '-t+[specify target pane]:pane:__tmux-panes'
+ _tmux-join-pane "$@"
 }
 
 _tmux-move-window() {
   [[ -n ${tmux_describe} ]] && print "move a window to another" && return
   _arguments -s \
+    '(-b)-a[move window to next index after destination window]' \
+    '(-a)-b[move window to next index before destination window]' \
     "-d[don't make the new window become the active one]" \
     '-k[kill the target window if it exists]' \
     '-s+[specify source window]:window:__tmux-windows' \
@@ -567,7 +609,9 @@ _tmux-new-session() {
     "-d[don't attach new session to current terminal]" \
     "-D[with -A, detach other clients attached to session]" \
     "-E[don't apply update-environment option]" \
+    '*-e[specify environment variable]:environment variable:_parameters -g "*export*" -qS=' \
     '-F+[specify output format]:format:__tmux-formats' \
+    '-f+[specify client flags]: :_tmux_client_flags' \
     '-n+[specify initial window name]:window name' \
     '-P[print information about new session after it is created]' \
     '-s+[name the session]:session name:__tmux-sessions' \
@@ -581,14 +625,16 @@ _tmux-new-session() {
 _tmux-new-window() {
   [[ -n ${tmux_describe} ]] && print "create a new window" && return
   _arguments -s -A "-*" -S \
-    '-a[insert new window at next free index from -t]' \
+    '(-b)-a[insert new window at next index after target]' \
+    '(-a)-b[insert new window at next index before target]' \
     '-c+[specify working directory for the session]:directory:_directories' \
     '*-e[specify environment variable]:environment variable:_parameters -g "*export*" -qS=' \
-    "-d[don't make the new window become the active one]" \
+    "(-S)-d[don't make the new window become the active one]" \
     '-F+[specify output format]:format:__tmux-formats' \
     '-k[destroy it if the specified window exists]' \
     '-n+[specify a window name]:window name' \
     '-P[print information about new window after it is created]' \
+    '(-d)-S[select window if name already exists]' \
     '-t+[specify target window]:window:__tmux-windows' \
     '*:: :_cmdambivalent'
 }
@@ -640,11 +686,13 @@ _tmux-previous-window() {
 
 _tmux-refresh-client() {
   [[ -n ${tmux_describe} ]] && print "refresh a client" && return
-  _arguments -s -S -A "-*" \
+  _arguments -s -A "-*" -S \
+    '-B+[set a subscription to a format for a control mode client]:subscription' \
+    '-A+[allow a control mode client to trigger actions on a pane]:pane:__tmux-panes -P% -S\:' \
     '-C+[set the width and height of a control client]:width,height' \
     '-c[reset so that the position follows the cursor]' \
     '-D[move visible portion of window down]' \
-    '-F+[specify flags]:flag:(no-output)' \
+    '-f+[set client flags]:flag:_tmux_client_flags' \
     '-L[move visible portion of window left]' \
     '-l[request clipboard from the client and store it in a new paste buf using xterm(1) escape sequence]' \
     "-S[only update the client's status bar]" \
@@ -677,6 +725,7 @@ _tmux-resize-pane() {
     '-R[resize to the right]' \
     '-U[resize upward]' \
     '-t+[specify target pane]:pane:__tmux-panes' \
+    '-T[trim lines below the cursor position and moves lines out of the history to replace them]' \
     '-x+[specify width]:width' \
     '-y+[specify height]:height' \
     '-Z[toggle zoom of pane]' \
@@ -729,10 +778,22 @@ _tmux-rotate-window() {
 
 _tmux-run-shell() {
   [[ -n ${tmux_describe} ]] && print "execute a command without creating a new window" && return
-  _arguments -s -A "-*" -S \
-    '-b[run shell command in background]' \
+  local curcontext="$curcontext" ret=1
+  local -a state line expl
+  _arguments -C -s -A "-*" -S \
+    '-b[run command in background]' \
+    '(1)-C[run a tmux command]' \
+    '-d+[specify delay before starting the command]:delay (seconds)' \
     '-t+[specify target pane]:pane:__tmux-panes' \
-    ':command:_cmdstring'
+    '(2)1:command:_cmdstring' \
+    '2:tmux command:->tmux-commands' && ret=0
+
+  if [[ -n $state ]]; then
+    compset -q
+    words=( run "$words[@]" )
+    (( CURRENT++ ))
+    _tmux && ret=0
+  fi
 }
 
 _tmux-save-buffer() {
@@ -815,6 +876,8 @@ _tmux-set-buffer() {
     '-a[append to rather than overwriting target buffer]' \
     '-b+[specify target buffer index]:pane:__tmux-buffers' \
     '-n+[specify new buffer name]:buffer-name' \
+    '-t+[specify target client]:client:__tmux-clients' \
+    '-w[also send the buffer to the clipboard using the xterm escape sequence]' \
     ':data'
 }
 
@@ -824,7 +887,9 @@ _tmux-set-environment() {
   local curcontext="$curcontext" state line ret=1
   typeset -A opt_args
   _arguments -C -s -A "-*" -S : \
+    '-F[expand value as a format]' \
     '(-t)-g[modify global environment]' \
+    '-h[mark the variable as hidden]' \
     '(-u)-r[remove variable before starting new processes]' \
     '(-r)-u[unset a variable]' \
     '(-g)-t[specify target session]:target session:__tmux-sessions' \
@@ -861,6 +926,7 @@ _tmux-set-option() {
     '-o[prevent setting of an option that is already set]' \
     '-q[suppress errors about unknown or ambiguous options]' \
     '-u[unset a non-global option]' \
+    '-U[unset a pane option across all panes in the window]' \
     '(-w -s)-p[change pane (no session) options]' \
     '(-p -s)-w[change window (not session) options]' \
     '(-p -w)-s[change server (not session) options]' \
@@ -899,6 +965,8 @@ _tmux-set-hook() {
     '-a[append to hook]' \
     '(-R)-g[add hook to global list]' \
     '(-g -u)-R[run hook immediately]' \
+    '(-w)-p[set pane hooks]' \
+    '(-p)-w[set window hooks]' \
     '(-R)-u[unset a hook]' \
     '-t+[specify target session]:session:__tmux-sessions' \
     ':hook name:_tmux_hooks' \
@@ -909,6 +977,8 @@ _tmux-show-hooks() {
   [[ -n ${tmux_describe} ]] && print "show the global list of hooks" && return
   _arguments -s -S -A "-*" \
     '-g[show global list of hooks]' \
+    '(-w)-p[show pane hooks]' \
+    '(-p)-w[show window hooks]' \
     '-t+[specify target session]:session:__tmux-sessions' \
 }
 
@@ -924,6 +994,7 @@ _tmux-show-environment() {
   typeset -A opt_args
   _arguments -C -A "-*" -s : \
     '(-t)-g[show global environment]' \
+    '-h[show hidden variables]' \
     '-s[format output as Bourne shell commands]' \
     '(-g)-t+[specify target session]:target session:__tmux-sessions' \
     '1:: :->name' && ret=0
@@ -986,6 +1057,7 @@ _tmux-show-window-options() {
 _tmux-source-file() {
   [[ -n ${tmux_describe} ]] && print "execute tmux commands from a file" && return
   _arguments \
+    '-F[expand path as a format]' \
     '-n[file is parsed but no commands are executed]' \
     "-q[don't report error if path doesn't exist]" \
     '-v[show parsed commands and line numbers if possible]' \
@@ -1006,6 +1078,7 @@ _tmux-split-window() {
     "(-p)-l[define new pane's size]:size" \
     "!(-f -l)-p+:size (percentage)" \
     '-t+[specify target pane]:pane:__tmux-panes' \
+    '-Z[zoom the pane]' \
     '(:)-I[create empty pane and forward stdin to it]' \
     ':command:_cmdambivalent'
   # Yes, __tmux-panes is correct here. The behaviour was changed
@@ -1065,6 +1138,7 @@ _tmux-unbind-key() {
   _arguments -C -s \
     '-a[remove all key bindings]' \
     '-n[remove a non-prefix binding]' \
+    '-q[prevent errors being returned]' \
     '-T[specify key table]:key table' \
     '*:: :->boundkeys'
 
@@ -1383,6 +1457,11 @@ _tmux_hooks() {
     'post-hooks:command post-hook:compadd - after-${_tmux_aliasmap}'
 }
 
+_tmux_client_flags() {
+  _values -s , flag active-pane ignore-size no-output \
+      'pause-after:time (seconds)' read-only wait-exit
+}
+
 function __tmux-get-optarg() {
     local opt="$1"
     local -i i
@@ -1607,16 +1686,11 @@ function __tmux-options-complete() {
 }
 
 function __tmux-panes() {
-    local expl line
+    local expl line orig="$IPREFIX"
     local -i num
     local -a panes opts
 
-    compset -P '*.'
-    if [[ -n ${IPREFIX} ]]; then
-        opts=( -t "${IPREFIX%.}" )
-    else
-        opts=( )
-    fi
+    compset -P '*.' && opts=( -t "${${IPREFIX%.}#$orig}" )
     num=0
     command tmux 2> /dev/null list-panes "${opts[@]}" | while IFS= read -r line; do
         panes+=( $(( num++ )):${line//:/} )
@@ -1761,10 +1835,13 @@ _tmux() {
     '-2[force using 256 colours]' \
     '-c[execute a shell command]:command name:_command_names' \
     '-C[start tmux in control mode. -CC disables echo]' \
+    "-D[don't start the tmux server as a daemon]" \
     '-f[specify configuration file]:tmux config file:_files -g "*(-.)"' \
     '-l[behave like a login shell]' \
     '-L[specify socket name]:socket name:__tmux-socket-name' \
+    "-N[don't start the server even if the command would normally do so]" \
     '-S[specify socket path]:server socket:_path_files -g "*(=,/)"' \
+    '-T+[set terminal features for the client]: : _values -s , 256 clipboard ccolour cstyle extkeys focus margins mouse overline rectfill RGB strikethrough sync title usstyle' \
     '-u[force using UTF-8]' \
     '-v[request verbose logging]' \
     '-V[report tmux version]' \
diff --git Completion/Unix/Command/_vim Completion/Unix/Command/_vim
index d9dc1a5b3..5c6054e70 100644
--- Completion/Unix/Command/_vim
+++ Completion/Unix/Command/_vim
@@ -27,9 +27,8 @@ arguments=(
   '-D[debugging mode]'
   '-n[no swap file (memory only)]'
   {-r,-L}'[list swap files and exit or recover from a swap file]::swap file:_vim_files -g "*.sw?(-.)"'
-  '(   -H -F)-A[start in Arabic mode]'
-  '(-A    -F)-H[start in Hebrew mode]'
-  '(-A -H   )-F[start in Farsi mode]'
+  '(-H)-A[start in Arabic mode]'
+  '(-A)-H[start in Hebrew mode]'
   '-u[use given vimrc file instead of default .vimrc]:config:->config'
   "--noplugin[don't load plugin scripts]"
   '-o-[number of windows to open (default: one for each file)]::window count: '
@@ -99,8 +98,11 @@ fi
 [[ $service != *view ]] && arguments+='-R[readonly mode]'
 [[ $service = *g* ]] || (( ${words[(I)-g]} )) && arguments+=(
   '(--nofork -f)'{--nofork,-f}'[do not detach the GUI version from the shell]'
+  '(-background -bg)'{-background,-bg}'[use specified color for the background]:color:_x_color'
+  '(-foreground -fg)'{-foreground,-fg}'[use specified color for normal text]:color:_x_color'
   '-font:font:_xft_fonts'
   '-geometry:geometry:_x_geometry'
+  '-iconic[start vim iconified]'
   '(-rv -reverse)'{-rv,-reverse}'[use reverse video]'
   '-display:display:_x_display'
   '--role[set unique role to identify main window]:role'
diff --git Completion/Unix/Command/_w3m Completion/Unix/Command/_w3m
index eff9901ca..de425cfb1 100644
--- Completion/Unix/Command/_w3m
+++ Completion/Unix/Command/_w3m
@@ -1,7 +1,5 @@
 #compdef w3m
 
-# w3m version w3m/0.5.1
-
 local curcontext="$curcontext" state line expl ret=1
 typeset -A opt_args
 
@@ -21,7 +19,7 @@ _arguments -C \
   '(-B *)-v[visual startup mode]' \
   '-M[monochrome display]' \
   '-N[open URL of command line on each new tab]' \
-  '-F[automatically render frame]' \
+  '-F[automatically render frames]' \
   '-cols[specify column width (used with -dump)]:column width' \
   '-ppc[specify the number of pixels per character (4.0...32.0)]:number of pixels (4.0...32.0):' \
   '-ppl[specify the number of pixels per line (4.0...64.0)]:number of pixels (4.0...64.0):' \
@@ -34,17 +32,17 @@ _arguments -C \
   '-header[insert string as a header]:header:' \
   '+-[goto specified line]:line number:_guard "[0-9]#" "line number"' \
   '-num[show line number]' \
+  '-session[use specified session]:id' \
   "-no-proxy[don't use proxy]" \
   '(-6)-4[IPv4 only (-o dns_order=4)]' \
   '(-4)-6[IPv6 only (-o dns_order=6)]' \
   "-no-mouse[don't use mouse]" \
   '(-no-cookie)-cookie[use cookie]' \
   "(-cookie)-no-cookie[don't use cookie]" \
-  '-pauth[proxy authentication]:user\:pass:->pauth' \
-  '(-no-graph)-graph[use graphic character]' \
-  "(-graph)-no-graph[don't use graphic character]" \
+  '(-no-graph)-graph[use DEC special graphics for border of table and menu]' \
+  '(-graph)-no-graph[use ASCII character for border of table and menu]' \
   '-S[squeeze multiple blank lines]' \
-  '-W[toggle wrap search mode]' \
+  '-W[toggle search wrap mode]' \
   "-X[don't use termcap init/deinit]" \
   '-title=[set buffer name to terminal title string]:terminal:_terminals' \
   '*-o[assign value to config option]:option=value:->option' \
@@ -97,14 +95,6 @@ case "$state" in
       _describe -t options 'option' options "$suf[@]" && ret=0
     fi
   ;;
-  pauth)
-    if compset -P 1 '*:'; then
-      _message -e passwords 'password'
-    else
-      compset -S ':*' || suf=( -S ':' )
-      _users "$suf[@]" && ret=0
-    fi
-  ;;
 esac
 
 return ret
diff --git Completion/Unix/Command/_wget Completion/Unix/Command/_wget
index d061fcd06..50fd7791a 100644
--- Completion/Unix/Command/_wget
+++ Completion/Unix/Command/_wget
@@ -34,6 +34,8 @@ _arguments -C -s \
   '(--server-response -S)'{--server-response,-S}'[print server response]' \
   "--spider[don't download anything]" \
   '(--timeout -T)'{--timeout=,-T+}'[set all timeout values]:timeout (seconds)' \
+  '--dns-servers=[specify DNS servers to query]:DNS server:_sequence _hosts' \
+  '--bind-dns-address=[bind DNS resolver to specified address]:hostname or IP on local host' \
   '(--timeout -T)--dns-timeout=[set the DNS lookup timeout]:DNS lookup timeout (seconds)' \
   '(--timeout -T)--connect-timeout=[set the connect timeout]:connect timeout (seconds)' \
   '(--timeout -T)--read-timeout=[set the read timeout]:read timeout (seconds)' \
@@ -107,7 +109,7 @@ _arguments -C -s \
   "--ca-directory=[specify dir where hash list of CA's are stored]:directory:_directories" \
   '--crl-file=[specify file with bundle of CRLs]:file:_files' \
   '--pinnedpubkey=:file:_files' \
-  '!--random-file=:file:_files' \
+  '--random-file[specify file with random data for seeding generator]:file:_files' \
   '--egd-file=[specify filename of EGD socket]:file:_files' \
   '--ciphers=[set the priority string (GnuTLS) or cipher list string (OpenSSL) directly]:string' \
   '--no-hsts[disable HSTS]' \
diff --git Completion/Unix/Command/_wiggle Completion/Unix/Command/_wiggle
index 0a2f0c0cb..1d747a479 100644
--- Completion/Unix/Command/_wiggle
+++ Completion/Unix/Command/_wiggle
@@ -1,15 +1,17 @@
 #compdef wiggle
 
-local fns='-m --merge -d --diff -x --extract'
+local fns='-m --merge -d --diff -x --extract -B --browse'
 
 _arguments \
   "($fns -1 -2 -3)"{-m,--merge}'[select the merge function]' \
   "($fns -3 3)"{-d,--diff}'[display differences between files]' \
   "($fns 2 3)"{-x,--extract}'[extract one branch of a patch or merge file]' \
   '(-w --words -l --lines)'{-w,--words}'[make operations and display word based]' \
-  '(-l --lines -w --words)'{-l,--lines}'[make operations and display line based]' \
+  '(-l --lines -w --words --non-space)'{-l,--lines}'[make operations and display line based]' \
+  '(-l --lines)--non-space[words are separated by spaces]' \
   '(-p --patch)'{-p,--patch}'[treat last named file as a patch]' \
   '(-r --replace)'{-r,--replace}'[replace original file with merged output]' \
+  '--no-backup[never save original file (as name.porig)]' \
   '(-R --reverse -x --extract)'{-R,--reverse}'[swap the files or revert changes]' \
   '(-2 -3 -m --merge)-1[select branch]' \
   '(-1 -3 -m --merge)-2[select branch]' \
diff --git Completion/Unix/Command/_xmlsoft Completion/Unix/Command/_xmlsoft
index 9f1206988..08b123e54 100644
--- Completion/Unix/Command/_xmlsoft
+++ Completion/Unix/Command/_xmlsoft
@@ -80,6 +80,7 @@ case $service in
       '(--dtdvalid --relaxng --schema)--postvalid[do a posteriori validation, i.e after parsing]' \
       '(--postvalid --relaxng --schema --dtdvalidfpi)--dtdvalid[do a posteriori validation against a given DTD]:DTD:_webbrowser' \
       '(--postvalid --relaxng --schema --dtdvalid)--dtdvalidfpi[as --dtdvalid but specify DTD with public identifier]:DTD identifier' \
+      '--quiet[be quiet when successful]' \
       '--timing[print some timings]' \
       '(--noout --output -o)'{--output,-o}'[save to a given file]:output file:_files' \
       '--repeat[repeat 100 times, for timing or profiling]' \
diff --git Completion/Unix/Command/_xxd Completion/Unix/Command/_xxd
index 3a8efd664..31d26ab64 100644
--- Completion/Unix/Command/_xxd
+++ Completion/Unix/Command/_xxd
@@ -39,6 +39,7 @@ arguments=(
   {-g+,-groupsize}'[specify the number of octets per group]: :_guard "[0-9]#" "number of octets per group"'
   {-l+,-len}'[specify number of octets to output]: :_guard "[0-9]#" "number of octets to output"'
   {-o+,-offset}'[add specified offset to displayed file position]:offset'
+  '-d[show offset in decimal instead of hex]'
   {-s,-skip,-seek}'[specify file offset to dump from]: :_guard "[0-9]#" "file offset to dump from (absolute or relative)"'
 
   ': :_files'
diff --git Completion/X/Command/_xrandr Completion/X/Command/_xrandr
index 6143054aa..2551e1958 100644
--- Completion/X/Command/_xrandr
+++ Completion/X/Command/_xrandr
@@ -36,6 +36,7 @@ _arguments -C \
   '*--set:property:(Backlight scaling\ mode):value:->value' \
   '*--scale:output scaling:' \
   '*--transform:transformation matrix:' \
+  '*--filter:mode:(nearest bilinear)' \
   '*--off[disable the output]' \
   '*--crtc:crtc to use:' \
   '*--panning:panning:' \
diff --git Completion/X/Command/_xterm Completion/X/Command/_xterm
index 6d98985e7..180c2eb21 100644
--- Completion/X/Command/_xterm
+++ Completion/X/Command/_xterm
@@ -3,7 +3,7 @@
 _xt_arguments \
   -+{132,ah,ai,aw,bc,bdc,cb,cjk_width,cm,cn,cu,dc,fbb,fbx,fullscreen,hf,hm,hold,ie,im,itc,j,k8,l,lc,ls,maximized,mb,mesg,mk_width,nul,pc,pob,rvc,rw,s,samename,sb,sf,si,sk,sm,sp,t,u8,uc,ulc,ulit,ut,vb,wc,wf} \
   -{version,help,leftbar,rightbar,C} \
-  '-report-'{charclass,colors,fonts} \
+  '-report-'{charclass,colors,fonts,icons,xres} \
   '-T:title' \
   '-b:inner border size:' \
   '-baudrate:rate [38400]' \


^ permalink raw reply	[relevance 1%]

* Re: tr [:lower:]
  @ 2021-08-31  1:39  3% ` Phil Pennock
  2021-09-01 14:53  0%   ` Shineru
  0 siblings, 1 reply; 200+ results
From: Phil Pennock @ 2021-08-31  1:39 UTC (permalink / raw)
  To: Shineru; +Cc: zsh-workers

On 2021-08-31 at 11:04 +1000, Shineru wrote:
> zsh 5.8.1. Arch GNU/Linux
> 
> zsh: echo "hello" | tr [:lower:] [:upper:]
> zsh: no matches found: [:lower:]

setopt nonomatch
or:  unsetopt nomatch
but: both of these are dangerous, because there's a real quoting issue
here.

% touch l p
% echo "hello" | tr [:lower:] [:upper:]
heppo
bash$ echo "hello" | tr [:lower:] [:upper:]
heppo

Without quoting,
  [:lower:] matches any of: l o w e r :
  [:upper:] matches any of: u p e r :
so the globbing turns the pipeline into:
  echo "hello" | tr "l" "p"

By default, zsh complains about unmatched patterns, rather than letting
them fall through silently.  Falling through leads to this sort of
"foot-gun" construct, where shells encourage you to do something which
"only works as long as X is not true", instead of having reliable code.

So you want, for safety, in any shell which resembles POSIX at all:

  echo 'hello' | tr '[:lower:]' '[:upper:]'

(This probably belongs on zsh-users.)

-Phil


^ permalink raw reply	[relevance 3%]

* Re: tr [:lower:]
  2021-08-31  1:39  3% ` Phil Pennock
@ 2021-09-01 14:53  0%   ` Shineru
  0 siblings, 0 replies; 200+ results
From: Shineru @ 2021-09-01 14:53 UTC (permalink / raw)
  To: Shineru, zsh-workers

[-- Attachment #1: Type: text/plain, Size: 1195 bytes --]

Thanks!

вт, 31 авг. 2021 г. в 11:39, Phil Pennock <
zsh-workers+phil.pennock@spodhuis.org>:

> On 2021-08-31 at 11:04 +1000, Shineru wrote:
> > zsh 5.8.1. Arch GNU/Linux
> >
> > zsh: echo "hello" | tr [:lower:] [:upper:]
> > zsh: no matches found: [:lower:]
>
> setopt nonomatch
> or:  unsetopt nomatch
> but: both of these are dangerous, because there's a real quoting issue
> here.
>
> % touch l p
> % echo "hello" | tr [:lower:] [:upper:]
> heppo
> bash$ echo "hello" | tr [:lower:] [:upper:]
> heppo
>
> Without quoting,
>   [:lower:] matches any of: l o w e r :
>   [:upper:] matches any of: u p e r :
> so the globbing turns the pipeline into:
>   echo "hello" | tr "l" "p"
>
> By default, zsh complains about unmatched patterns, rather than letting
> them fall through silently.  Falling through leads to this sort of
> "foot-gun" construct, where shells encourage you to do something which
> "only works as long as X is not true", instead of having reliable code.
>
> So you want, for safety, in any shell which resembles POSIX at all:
>
>   echo 'hello' | tr '[:lower:]' '[:upper:]'
>
> (This probably belongs on zsh-users.)
>
> -Phil
>

[-- Attachment #2: Type: text/html, Size: 1694 bytes --]

^ permalink raw reply	[relevance 0%]

* Dump of backlogged commits coming
@ 2021-09-06 21:55  3% Bart Schaefer
  0 siblings, 0 replies; 200+ results
From: Bart Schaefer @ 2021-09-06 21:55 UTC (permalink / raw)
  To: Zsh hackers list

I finally had several daylight hours with nothing else to do, so here
come 12 commits for patches that I either wrote or indicated that I
would commit on behalf of others (plus a 13th from Marlon that just
came in today).

Here's the ChangeLog entry:

2021-09-06  Bart Schaefer  <schaefer@zsh.org>

        * Stephane Chazelas: 45180: Doc/Zsh/contrib.yo,
        Functions/Example/zpgrep, Functions/Misc/regexp-replace: clarify
        doc for POSIX EREs, fix an issue with PCRE when the replacement
        was empty or generated more than one element

        * zeurkous: 49154: Doc/Zsh/exec.yo: clarify status on exec failure

        * Marlon Richert: 49378: Src/parse.c: skip check for collision
        of aliases and functions when NO_EXEC

        * Marlon Richert: 49292: Src/Zle/complist.c: turn off colors
        before clearing to end of line

        * 49282: set $0 correctly when calling functions from hooks

        * 49266: fix segfault on metacharacters in long job texts

        * Marlon Richert: 49218: Functions/Misc/run-help,
        Functions/Misc/run-help-btrfs, Functions/Misc/run-help-git,
        Functions/Misc/run-help-ip, Functions/Misc/run-help-p4,
        Functions/Misc/run-help-svk, Functions/Misc/run-help-svn:
        run-help filters cmd_args before calling run-help-<command>

        * unposted (cf. 49202 and 49217): Src/Zle/zle_hist.c: insertlastword
        ignores blank/missing history entries when repeating

        * 49196: Src/Modules/db_gdbm.c: gdbm keys not present in the
        database appear unset in tied hashes

        * Marlon Richert: 48969: fix for "zle -N" completion

        * 48888: Doc/Zsh/mod_system.yo, Doc/Zsh/params.yo, Test/E03posix.ztst:
        improve doc for $$ and $PPID, add fail test for PPID readonly-ness

        * 48832: Completion/Unix/Type/_urls: try _gnu_generic first


^ permalink raw reply	[relevance 3%]

* [PATCH 1/4] docs: Clean up some subsection references.
@ 2021-09-26  8:43  3% Daniel Shahaf
  0 siblings, 0 replies; 200+ results
From: Daniel Shahaf @ 2021-09-26  8:43 UTC (permalink / raw)
  To: zsh-workers

---
 Doc/Zsh/calsys.yo      | 2 +-
 Doc/Zsh/contrib.yo     | 6 +++---
 Doc/Zsh/expn.yo        | 2 +-
 Doc/Zsh/intro.yo       | 2 +-
 Doc/Zsh/jobs.yo        | 2 +-
 Doc/Zsh/mod_newuser.yo | 2 +-
 Doc/Zsh/options.yo     | 4 ++--
 Doc/Zsh/params.yo      | 2 +-
 Doc/Zsh/roadmap.yo     | 2 +-
 Doc/Zsh/zle.yo         | 2 +-
 10 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/Doc/Zsh/calsys.yo b/Doc/Zsh/calsys.yo
index c20c87e61..a8fd876a5 100644
--- a/Doc/Zsh/calsys.yo
+++ b/Doc/Zsh/calsys.yo
@@ -478,7 +478,7 @@ item(tt(calendar_add) [ tt(-BL) ] var(event) ...)(
 Adds a single event to the calendar in the appropriate location.
 The event can contain multiple lines, as described in
 ifnzman(noderef(Calendar File and Date Formats))\
-ifzman(the section Calendar File Format above).
+ifzman(the section `Calendar File Format' above).
 Using this function ensures that the calendar file is sorted in date
 and time order.  It also makes special arrangements for locking
 the file while it is altered.  The old calendar is left in a file
diff --git a/Doc/Zsh/contrib.yo b/Doc/Zsh/contrib.yo
index 94059eff6..0781c7eb3 100644
--- a/Doc/Zsh/contrib.yo
+++ b/Doc/Zsh/contrib.yo
@@ -2341,7 +2341,7 @@ directly.
 )
 tindex(bracketed-paste-magic)
 item(tt(bracketed-paste-magic))(
-The tt(bracketed-paste) widget (see ifzman(subsection Miscellaneous in
+The tt(bracketed-paste) widget (see ifzman(the subsection `Miscellaneous' in
 zmanref(zshzle))ifnzman(noderef(Miscellaneous) in noderef(Zle Widgets)))
 inserts pasted text literally into the editor buffer rather than interpret
 it as keystrokes.  This disables some common usages where the self-insert
@@ -3190,7 +3190,7 @@ investigate the command word found.  The default is tt(whence -c).
 tindex(zcalc-auto-insert)
 item(tt(zcalc-auto-insert))(
 This function is useful together with the tt(zcalc) function described in
-ifzman(the section Mathematical Functions)\
+ifzman(the section `Mathematical Functions')\
 ifnzman(noderef(Mathematical Functions)).
 It should be bound to a key representing a binary operator such
 as `tt(PLUS())', `tt(-)', `tt(*)' or `tt(/)'.  When running in zcalc,
@@ -3664,7 +3664,7 @@ types even if they are executable.  As this example shows, the complete
 file name is matched against the pattern, regardless of how the file
 was passed to the handler.  The file is resolved to a full path using
 the tt(:P) modifier described in
-ifzman(the subsection Modifiers in zmanref(zshexpn))\
+ifzman(the subsection `Modifiers' in zmanref(zshexpn))\
 ifnzman(noderef(Modifiers));
 this means that symbolic links are resolved where possible, so that
 links into other file systems behave in the correct fashion.
diff --git a/Doc/Zsh/expn.yo b/Doc/Zsh/expn.yo
index c218ded05..50f70c9af 100644
--- a/Doc/Zsh/expn.yo
+++ b/Doc/Zsh/expn.yo
@@ -1854,7 +1854,7 @@ has similar effects.
 
 To combine brace expansion with array expansion, see the
 tt(${^)var(spec)tt(}) form described
-ifzman(in the section Parameter Expansion)\
+ifzman(in the section `Parameter Expansion')\
 ifnzman(in noderef(Parameter Expansion))
 above.
 
diff --git a/Doc/Zsh/intro.yo b/Doc/Zsh/intro.yo
index 75d25ce27..474e537c2 100644
--- a/Doc/Zsh/intro.yo
+++ b/Doc/Zsh/intro.yo
@@ -45,7 +45,7 @@ zsh most closely resembles bf(ksh) but includes many enhancements.  It
 does not provide compatibility with POSIX or other shells in its
 default operating mode:  see
 ifnzman(the section noderef(Compatibility))\
-ifzman(the section Compatibility below).
+ifzman(the section `Compatibility' below).
 
 Zsh has command line editing, builtin spelling correction, programmable
 command completion, shell functions (with autoloading), a history
diff --git a/Doc/Zsh/jobs.yo b/Doc/Zsh/jobs.yo
index 331b91d8d..3ab0698ae 100644
--- a/Doc/Zsh/jobs.yo
+++ b/Doc/Zsh/jobs.yo
@@ -135,4 +135,4 @@ ifzman(the section PROCESS SUBSTITUTION in the zmanref(zshexpn) manual page)\
 ifnzman(noderef(Process Substitution)), and the handler processes for
 multios, see
 ifzman(the section MULTIOS in the zmanref(zshmisc) manual page)\
-ifnzman(the section Multios in noderef(Redirection)).
+ifnzman(the section em(Multios) in noderef(Redirection)).
diff --git a/Doc/Zsh/mod_newuser.yo b/Doc/Zsh/mod_newuser.yo
index 92a64a013..7937e43c3 100644
--- a/Doc/Zsh/mod_newuser.yo
+++ b/Doc/Zsh/mod_newuser.yo
@@ -44,4 +44,4 @@ even if the tt(zsh/newuser) module is disabled.  Note, however, that
 if the module is not installed the function will not be installed either.
 The function is documented in
 ifnzman(noderef(User Configuration Functions))\
-ifzman(the section User Configuration Functions in zmanref(zshcontrib)).
+ifzman(the section `User Configuration Functions' in zmanref(zshcontrib)).
diff --git a/Doc/Zsh/options.yo b/Doc/Zsh/options.yo
index 4a8b85e08..cf4600769 100644
--- a/Doc/Zsh/options.yo
+++ b/Doc/Zsh/options.yo
@@ -602,7 +602,7 @@ Substitutions using the tt(:s) and tt(:&) history modifiers are performed
 with pattern matching instead of string matching.  This occurs wherever
 history modifiers are valid, including glob qualifiers and parameters.
 See
-ifzman(the section Modifiers in zmanref(zshexpn))\
+ifzman(the section `Modifiers' in zmanref(zshexpn))\
 ifnzman(noderef(Modifiers)).
 )
 pindex(IGNORE_BRACES)
@@ -1483,7 +1483,7 @@ The check is omitted if the commands run from the previous command line
 included a `tt(jobs)' command, since it is assumed the user is aware that
 there are background or suspended jobs.  A `tt(jobs)' command run from one
 of the hook functions defined in
-ifnzman(the section Special Functions in noderef(Functions))\
+ifnzman(the section `Special Functions' in noderef(Functions))\
 ifzman(the section SPECIAL FUNCTIONS in zmanref(zshmisc))
 is not counted for this purpose.
 )
diff --git a/Doc/Zsh/params.yo b/Doc/Zsh/params.yo
index b514eb072..583755dc7 100644
--- a/Doc/Zsh/params.yo
+++ b/Doc/Zsh/params.yo
@@ -106,7 +106,7 @@ may be in any order.  Note that this syntax is strict: tt([) and tt(]=) must
 not be quoted, and var(key) may not consist of the unquoted string
 tt(]=), but is otherwise treated as a simple string.  The enhanced forms
 of subscript expression that may be used when directly subscripting a
-variable name, described in the section Array Subscripts below, are not
+variable name, described in the section `Array Subscripts' below, are not
 available.
 
 The syntaxes with and without the explicit key may be mixed.  An implicit
diff --git a/Doc/Zsh/roadmap.yo b/Doc/Zsh/roadmap.yo
index 3f9a122af..2db90889b 100644
--- a/Doc/Zsh/roadmap.yo
+++ b/Doc/Zsh/roadmap.yo
@@ -20,7 +20,7 @@ The function is designed to be self-explanatory.  You can run it by hand
 with `tt(autoload -Uz zsh-newuser-install; zsh-newuser-install -f)'.
 See also
 ifnzman(noderef(User Configuration Functions))\
-ifzman(the section User Configuration Functions in zmanref(zshcontrib)).
+ifzman(the section `User Configuration Functions' in zmanref(zshcontrib)).
 
 
 sect(Interactive Use)
diff --git a/Doc/Zsh/zle.yo b/Doc/Zsh/zle.yo
index 6d517b81b..70dfec333 100644
--- a/Doc/Zsh/zle.yo
+++ b/Doc/Zsh/zle.yo
@@ -50,7 +50,7 @@ argument causes the next command entered to be repeated the specified
 number of times, unless otherwise noted below; this is implemented
 by the tt(digit-argument) widget. See also
 ifzman(the em(Arguments) subsection of the em(Widgets) section )\
-ifnzman(noderef(Arguments) )\
+ifnzman(noderef(Arguments))\
 for some other ways the numeric argument can be modified.
 
 startmenu()


^ permalink raw reply	[relevance 3%]

* Question on unintuitive behaviour for function execution and parameter assignment
@ 2021-10-12  8:20  3% Jett Husher
  2021-10-12  8:31  3% ` Peter Stephenson
  0 siblings, 1 reply; 200+ results
From: Jett Husher @ 2021-10-12  8:20 UTC (permalink / raw)
  To: zsh-workers

Good day!

Does a function `assign-hello` treat parameter assignment on simple command as local parameter in the following code snipped?

```
HELLO=WORLD

function assign-hello() HELLO=$1

assign-hello THERE
echo $HELLO # Prints 'THERE', as expected

# This part trips me up
HELLO= assign-hello WHY
echo $HELLO # Why does it still print 'THERE'?
```

POSIX spec says that parameter assignment with function execution will alter the current shell environment and that it's not specified what's going to happen with this parameter at the end of the execution. `zshmisc(1)` in FUNCTIONS states that functions are called on a parent process, so my intuition was that this sort of code should not work for them. Unfortunately, I could not find any more information about this in the manuals or FAQs.

Can manuals be updated to cover this behaviour, please?

Thank you for your time.
- Jett


^ permalink raw reply	[relevance 3%]

* Re: Question on unintuitive behaviour for function execution and parameter assignment
  2021-10-12  8:20  3% Question on unintuitive behaviour for function execution and parameter assignment Jett Husher
@ 2021-10-12  8:31  3% ` Peter Stephenson
  2021-10-13  8:42  3%   ` Jett Husher
  0 siblings, 1 reply; 200+ results
From: Peter Stephenson @ 2021-10-12  8:31 UTC (permalink / raw)
  To: Jett Husher, zsh-workers


> On 12 October 2021 at 09:20 Jett Husher <jetthusher@pm.me> wrote:
> 
> 
> Good day!
> 
> Does a function `assign-hello` treat parameter assignment on simple command as local parameter in the following code snipped?
> 
> ```
> HELLO=WORLD
> 
> function assign-hello() HELLO=$1
> 
> assign-hello THERE
> echo $HELLO # Prints 'THERE', as expected
> 
> # This part trips me up
> HELLO= assign-hello WHY
> echo $HELLO # Why does it still print 'THERE'?
> ```

This is covered by the POSIX_BUILTINS option.  Generally, the POSIX_* options are
the place to look for this sort of think --- granted that can be a bit of hunt.

Usually an easy test to see if zsh does have the POSIX behaviour available is
to start a new shell as

ARGV0=sh zsh

and see what behaviour that gives you.  That should be maximally compatible,
although it doesn't help you find which option controls  the behaviour.

POSIX_BUILTINS <K> <S>
    When this option is set the command builtin can be used  to  execute  shell
    builtin  commands.   Parameter assignments specified before shell functions
    and special builtins are kept after the command completes unless  the  spe‐
    cial builtin is prefixed with the command builtin.  Special builtins are .,
    :, break, continue, declare, eval, exit, export, integer, local,  readonly,
    return, set, shift, source, times, trap and unset.

pws


^ permalink raw reply	[relevance 3%]

* Re: Question on unintuitive behaviour for function execution and parameter assignment
  2021-10-12  8:31  3% ` Peter Stephenson
@ 2021-10-13  8:42  3%   ` Jett Husher
  2021-10-13  9:10  4%     ` Peter Stephenson
  0 siblings, 1 reply; 200+ results
From: Jett Husher @ 2021-10-13  8:42 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: zsh-workers

On Tuesday, October 12th, 2021 at 10:31, Peter Stephenson <p.w.stephenson@ntlworld.com> wrote:
> This is covered by the POSIX_BUILTINS option. Generally, the POSIX_* options are
>
> the place to look for this sort of think --- granted that can be a bit of hunt.

I wouldn't even think to look at POSIX_* variables because POSIX-2017
explicitly tells that it's unspecified "Whether or not the variable assignments persist after
the completion of the function", so, naturally, I though that this behaviour was compliant.

> Usually an easy test to see if zsh does have the POSIX behaviour available is
>
> to start a new shell as
>
> ARGV0=sh zsh
>
> and see what behaviour that gives you. That should be maximally compatible,
>
> although it doesn't help you find which option controls the behaviour.

I would keep that in mind next time. I used to compare the executions in bash, since I thought
it's more compliant, but I guess it's not the best option since GNU also states that it
takes the standards as a recommendation and not a rule.

I still believe this needs to be mentioned in FUNCTIONS or SIMPLE COMMANDS & PIPELINES of zshmisc(1).
Or zshparam(1) perhaps? I would love to suggest my help with updating man pages but I'm not sure
if you accept commits the side. Or even how the development is done around here :shrug:

Either way, a world of thanks for the help, Peter.
- Jett


^ permalink raw reply	[relevance 3%]

* Re: Question on unintuitive behaviour for function execution and parameter assignment
  2021-10-13  8:42  3%   ` Jett Husher
@ 2021-10-13  9:10  4%     ` Peter Stephenson
  0 siblings, 0 replies; 200+ results
From: Peter Stephenson @ 2021-10-13  9:10 UTC (permalink / raw)
  To: zsh-workers


> On 13 October 2021 at 09:42 Jett Husher <jetthusher@pm.me> wrote:
> On Tuesday, October 12th, 2021 at 10:31, Peter Stephenson <p.w.stephenson@ntlworld.com> wrote:
> > This is covered by the POSIX_BUILTINS option. Generally, the POSIX_* options are
> >
> > the place to look for this sort of think --- granted that can be a bit of hunt.
> 
> I wouldn't even think to look at POSIX_* variables because POSIX-2017
> explicitly tells that it's unspecified "Whether or not the variable assignments persist after
> the completion of the function", so, naturally, I though that this behaviour was compliant.

It's always worth (everyone) bearing in mind that zsh is not a POSIX shell by default.

In fact, it's not *completely* POSIX even in sh emulation, as this has been gradually
retrofitted, and not everything can be done within the current constraints.

cheers
pws


^ permalink raw reply	[relevance 4%]

* Re: Unexpected stdin-behavior
  @ 2021-10-22 14:24  3%       ` Tycho Kirchner
  0 siblings, 0 replies; 200+ results
From: Tycho Kirchner @ 2021-10-22 14:24 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: Zsh hackers list



I also sent an email to the dash-developers regarding the same issue, 
you may be interested in Chet's response:


On 10/22/21 7:11 AM, Tycho Kirchner wrote:
 > Dear DASH developers,
 > I think stdin should be consumed line by line in order to make 
passing to
 > other commands possible. Please consider the following difference 
between
 > the stdin "consumption" between bash and dash

If you're curious, POSIX specifies the bash behavior. From

https://pubs.opengroup.org/onlinepubs/9699919799/utilities/sh.html#tag_20_117

"When the shell is using standard input and it invokes a command that also
uses standard input, the shell shall ensure that the standard input file
pointer points directly after the command it has read when the command
begins execution. It shall not read ahead in such a manner that any
characters intended to be read by the invoked command are consumed by the
shell (whether interpreted by the shell or not) or that characters that are
not read by the invoked command are not seen by the shell."

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
		 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/



^ permalink raw reply	[relevance 3%]

* Re: [BUG] _less incorrectly completes -" and -#
  @ 2021-10-23  0:26  3%   ` Oliver Kiddle
  0 siblings, 0 replies; 200+ results
From: Oliver Kiddle @ 2021-10-23  0:26 UTC (permalink / raw)
  To: Roman Perepelitsa, Zsh hackers list

This is digging up another fairly old _arguments issue that I meant to
deal with before:

On 2 Oct 2020, I wrote:
> Roman Perepelitsa wrote:
> > Completing `less -` offers `-"` as a candidate. Accepting it literally
> > inserts `-"`. I think it should offer `-\"` and insert the same.

> The real problem is that from inside _arguments, the -Q option gets
> passed to compadd. Removing it is a fairly easy change. But I wish I
> knew why it was used in the first place. Maybe we should just do that
> and worry later about fixing any problems it creates afterwards.

The following patch does exactly this. _arguments has quite a few lines
that do compadd -Q - "${PREFIX}${SUFFIX}" which I've left alone. They
seem to be special case handling, possibly for _arguments' -w option.
It'd be nice to establish test cases that exercise them but the only
path I could contrive to use one of them did not result in what I'd take
to be intended behaviour (_arguments -s '-a=-' and -a<tab> giving a
space suffix).

Otherwise, this simple approach appears to work well in my testing.

One issue that isn't new is that completion after '- doesn't list
options for a completion that lacks rest-arguments. The _arguments C
code seems to have to deal with the command-line in quoted form. There
used to be a layer of unquoting in the _arguments C code that got
removed in 27218 but restoring it doesn't help anyway.

Most of the patch is completion functions that hard-coded now
superfluous quotes on options. The use of quotes within exclusion lists
was never useful.

Oliver

diff --git a/Completion/Base/Utility/_arguments b/Completion/Base/Utility/_arguments
index 3f1b39304..69e7ab235 100644
--- a/Completion/Base/Utility/_arguments
+++ b/Completion/Base/Utility/_arguments
@@ -513,8 +513,8 @@ if (( $# )) && comparguments -i "$autod" "$singopt[@]" "$@"; then
 	    tmp2=( "${PREFIX}${(@M)^${(@)${(@)tmp1%%:*}#[-+]}:#?}" )
 
             _describe -O option \
-                      tmp1 tmp2 -Q -S '' -- \
-		      tmp3 -Q
+                      tmp1 tmp2 -S '' -- \
+                      tmp3
 
             [[ -n "$optarg" && "$single" = next && nm -eq $compstate[nmatches] ]] &&
                 _all_labels options expl option \
@@ -525,9 +525,9 @@ if (( $# )) && comparguments -i "$autod" "$singopt[@]" "$@"; then
         else
           next+=( "$odirect[@]" )
           _describe -O option \
-                    next -Q -M "$matcher" -- \
-                    direct -QS '' -M "$matcher" -- \
-                    equal -QqS= -M "$matcher"
+                    next -M "$matcher" -- \
+                    direct -S '' -M "$matcher" -- \
+                    equal -qS= -M "$matcher"
         fi
 	PREFIX="$prevpre"
 	IPREFIX="$previpre"
diff --git a/Completion/Darwin/Command/_qtplay b/Completion/Darwin/Command/_qtplay
index 39a7c6de2..839efee83 100644
--- a/Completion/Darwin/Command/_qtplay
+++ b/Completion/Darwin/Command/_qtplay
@@ -15,6 +15,6 @@ _arguments -S \
   '-t[specify update time]:update time (seconds)' \
   '-T[kill time]:ticks' \
   '-V[volume]:percentage of normal volume' \
-  '(-)'{-?,--help,-h}'[display help information]' \
+  '(-)'{-\?,--help,-h}'[display help information]' \
   '(-)*:quicktime file:_files'
 
diff --git a/Completion/Unix/Command/_less b/Completion/Unix/Command/_less
index 0b474b991..ae912a633 100644
--- a/Completion/Unix/Command/_less
+++ b/Completion/Unix/Command/_less
@@ -80,9 +80,9 @@ _arguments -S -s -A "[-+]*"  \
   '--no-keypad[disable use of keypad terminal init string]' \
   '(-y --max-forw-scroll)'{-y,--max-forw-scroll}'[specify forward scroll limit]' \
   '(-z --window)'{-z+,--window=}'[specify scrolling window size]:lines' \
-  '(-\" --quotes)'{-\"+,--quotes=}'[change quoting character]:quoting characters' \
+  '(-" --quotes)'{-\"+,--quotes=}'[change quoting character]:quoting characters' \
   '(-~ --tilde)'{-~,--tilde}"[don't display tildes after end of file]" \
-  '(-\# --shift)'{-\#+,--shift=}"[specify amount to move when scrolling horizontally]:number" \
+  '(-# --shift)'{-\#+,--shift=}"[specify amount to move when scrolling horizontally]:number" \
   '--file-size[automatically determine the size of the input file]' \
   '--incsearch[search file as each pattern character is typed in]' \
   '--line-num-width=[set the width of line number field]:width [7]' \
diff --git a/Completion/Unix/Command/_nm b/Completion/Unix/Command/_nm
index 79f537ac6..888f1ef87 100644
--- a/Completion/Unix/Command/_nm
+++ b/Completion/Unix/Command/_nm
@@ -53,7 +53,7 @@ if _pick_variant -r variant binutils=GNU elftoolchain=elftoolchain elfutils=elfu
 	'(-C)--demangle[decode symbol names]'
 	'(--format -P)-f+[specify output format]:format:(bsd sysv posix)'
 	'(- *)--usage[give a short usage message]'
-	'(- *)-\\?[display help information]'
+	'(- *)-?[display help information]'
       )
     ;;
     binutils)
diff --git a/Completion/Unix/Command/_php b/Completion/Unix/Command/_php
index c4c4ab3e2..9a8f519b1 100644
--- a/Completion/Unix/Command/_php
+++ b/Completion/Unix/Command/_php
@@ -93,7 +93,7 @@ _php() {
     + '(hv)' # Help/version options; kept separate by convention
     '(- 1 *)'{-h,--help}'[display help information]'
     '(- 1 *)'{-v,--version}'[display version information]'
-    '!(- 1 *)'{-\?,-\\\?,--usage}
+    '!(- 1 *)'{-\?,--usage}
 
     + '(im)' # Info/module options (exclusive with everything but -c/-n)
     '(fi mc pb pf rf rn sc sv *)'{-i,--info}'[display configuration information (phpinfo())]'
diff --git a/Completion/Unix/Command/_strings b/Completion/Unix/Command/_strings
index af95af52f..685daa286 100644
--- a/Completion/Unix/Command/_strings
+++ b/Completion/Unix/Command/_strings
@@ -45,7 +45,7 @@ if _pick_variant -r variant binutils=GNU elftoolchain=elftoolchain elfutils=elfu
     elfutils)
       args+=(
 	'(- *)--usage[display a short usage message]'
-	'(- *)-\\?[display help information]'
+	'(- *)-?[display help information]'
       )
     ;;
   esac
diff --git a/Completion/Unix/Command/_zip b/Completion/Unix/Command/_zip
index bc9aab1a5..cfa51be36 100644
--- a/Completion/Unix/Command/_zip
+++ b/Completion/Unix/Command/_zip
@@ -115,7 +115,7 @@ case $service in
       '(-U)-UU[ignore any Unicode fields]' \
       '-W[modify pattern matching so only ** matches /]' \
       '-\:[allow extraction outside of extraction base directory]' \
-      '-\\\^[allow control characters in extracted entries]' \
+      '-^[allow control characters in extracted entries]' \
       '-i[include the following names]:*-*:pattern' \
       '-x[exclude the following names]:*-*:pattern' \
       "(-p -f -u -l -t -z -n -o -j -C -X -q -qq -a -aa -v -L -M)1:zip file:_files -g '(#i)*.(zip|xpi|[ejw]ar)(-.)'" \
diff --git a/Completion/X/Command/_gnome-gv b/Completion/X/Command/_gnome-gv
index 25de6fadf..b1b66e2a4 100644
--- a/Completion/X/Command/_gnome-gv
+++ b/Completion/X/Command/_gnome-gv
@@ -1,6 +1,6 @@
 #compdef gnome-gv ggv
 
 _arguments \
-  '(--help)-\\?[help]' \
+  '(--help)-?[help]' \
   '(--windows)-w[number of empty windows]:number:' \
   '*:file: _pspdf -z' --


^ permalink raw reply	[relevance 3%]

* [BUG] POSIX arith: inf, nan should be variables
@ 2021-11-15 17:40  9% Martijn Dekker
  2021-11-16  9:06  5% ` Oliver Kiddle
  2021-11-16 12:55  5% ` Vincent Lefevre
  0 siblings, 2 replies; 200+ results
From: Martijn Dekker @ 2021-11-15 17:40 UTC (permalink / raw)
  To: Zsh hackers list

$ zsh --emulate sh -c 'inf=1; nan=2; echo $((inf)) $((nan))'
Inf NaN

Expected: 1 2

This is a POSIX compliance issue that ksh93 also has (I've just fixed in 
ksh 93u+m). I can see why this is needed for full floating point 
arithmetic support, but in POSIX sh, all case variants of inf and nan 
are perfectly legitimate variables that portable scripts should be able 
to use, including in arithmetic evaluation. Their recognition should be 
turned off for sh emulation, but not for ksh emulation as ksh93's native 
mode also supports floating point arithmetic.

So, what shell option to tie that to? That's a bit difficult. It needs 
to be an option that is on for sh, but off for ksh (or vice versa). A 
comparison of 'set -o' output between sh and ksh modes shows that the 
options are limited to the following:

bsdecho
ignorebraces
kshglob
kshoptionprint
localoptions
localtraps
octalzeroes
promptbang
sharehistory
singlelinezle

The only one of those that has anything to do with an arithmetic context 
is octalzeroes, so that one may be the least bad one to choose. The 
preliminary patch below does that.

Perhaps octalzeroes could be renamed to something like posixmath, so 
that it becomes legitimate to attach this and any other POSIX arithmetic 
quirks to this option without further crowding the shell option space.

Thoughts/opinions?

--- a/Src/math.c
+++ b/Src/math.c
@@ -863,7 +863,7 @@ zzlex(void)

  		p = ptr;
  		ptr = ie;
-		if (ie - p == 3) {
+		if (ie - p == 3 && !isset(OCTALZEROES)) {
  		    if ((p[0] == 'N' || p[0] == 'n') &&
  			(p[1] == 'A' || p[1] == 'a') &&
  			(p[2] == 'N' || p[2] == 'n')) {

-- 
||	modernish -- harness the shell
||	https://github.com/modernish/modernish
||
||	KornShell lives!
||	https://github.com/ksh93/ksh


^ permalink raw reply	[relevance 9%]

* Re: [BUG] POSIX arith: inf, nan should be variables
  2021-11-15 17:40  9% [BUG] POSIX arith: inf, nan should be variables Martijn Dekker
@ 2021-11-16  9:06  5% ` Oliver Kiddle
  2021-11-16 12:55  5% ` Vincent Lefevre
  1 sibling, 0 replies; 200+ results
From: Oliver Kiddle @ 2021-11-16  9:06 UTC (permalink / raw)
  To: Martijn Dekker; +Cc: Zsh hackers list

Martijn Dekker wrote:
> $ zsh --emulate sh -c 'inf=1; nan=2; echo $((inf)) $((nan))'
> Inf NaN
>
> Expected: 1 2

> So, what shell option to tie that to? That's a bit difficult. It needs 

The closest comparable feature is the decision in params.c as to whether
it should setup other special variables that aren't in the standard.

That seems to only check something like !EMULATION(EMULATE_SH) rather
than an actual option. Much of that has to run before zsh has got as far
as sourcing dot files that might setup options so it likely never made
sense to create an option for it. Most uses of directly checking
emulation state seem to be in initialisation code.

I wouldn't rename an option for compatibility. And while OCTAL_ZEROES is
similar in controlling interpretation of numbers in math mode it differs
in that it enables a potentially problematic standard feature while
Inf/NaN are a zsh extension. So I wouldn't view preferences on them as
being intrinsically linked.

Oliver


^ permalink raw reply	[relevance 5%]

* Re: [BUG] POSIX arith: inf, nan should be variables
  2021-11-15 17:40  9% [BUG] POSIX arith: inf, nan should be variables Martijn Dekker
  2021-11-16  9:06  5% ` Oliver Kiddle
@ 2021-11-16 12:55  5% ` Vincent Lefevre
  2021-11-28 20:34  5%   ` Oliver Kiddle
  1 sibling, 1 reply; 200+ results
From: Vincent Lefevre @ 2021-11-16 12:55 UTC (permalink / raw)
  To: zsh-workers

On 2021-11-15 18:40:17 +0100, Martijn Dekker wrote:
> $ zsh --emulate sh -c 'inf=1; nan=2; echo $((inf)) $((nan))'
> Inf NaN
> 
> Expected: 1 2

FYI, this had already been discussed in April in this subthread:

  https://www.zsh.org/mla/workers/2021/msg00717.html

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


^ permalink raw reply	[relevance 5%]

* [PATCH] Do not define _POSIX_C_SOURCE when checking for sigset_t on Solaris
@ 2021-11-23  6:46  3% Claes Nästén
  0 siblings, 0 replies; 200+ results
From: Claes Nästén @ 2021-11-23  6:46 UTC (permalink / raw)
  To: zsh-workers

Trying to compile zsh on Solaris 10 fails for me right after
configuration due to misleading information in config.h

The check for sigset_t fails, due to:

configure:8654: checking for sigset_t
configure:8673: gcc -c  -Wall -Wmissing-prototypes -O2  conftest.c >&5
In file included from /usr/include/sys/types.h:17,
                 from conftest.c:85:
/usr/pkg/gcc8/lib/gcc/sparc64-sun-solaris2.10/8.4.0/include-fixed/sys/feature_tee
sts.h:346:2: error: #error "Compiler or options invalid for pre-UNIX 03 X/Open aa
pplications     and pre-2001 POSIX applications"
 #error "Compiler or options invalid for pre-UNIX 03 X/Open applications \
  ^~~~~
conftest.c: In function 'main':
conftest.c:90:10: warning: unused variable 'tempsigset' [-Wunused-variable]
 sigset_t tempsigset;
          ^~~~~~~~~~
configure:8673: $? = 1

Looking at the git history it seems _POSIX_C_SOURCE is defined to ensure
configure works with systems using musl libc so the patch should not cause
any issues as it's Linux only.

Tried configuring on Solaris 11 as well and it still detects sigset_t.

diff --git a/configure.ac b/configure.ac
index 297a7482f..7494b3529 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1135,7 +1135,9 @@ dnl Check for sigset_t.  Currently I'm looking in
 dnl <sys/types.h> and <signal.h>.  Others might need
 dnl to be added.
 AC_CACHE_CHECK(for sigset_t, zsh_cv_type_sigset_t,
-[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#define _POSIX_C_SOURCE 200809L
+[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#ifndef __sun
+  #define _POSIX_C_SOURCE 200809L
+#endif
 #include <sys/types.h>
 #include <signal.h>]], [[sigset_t tempsigset;]])],[zsh_cv_type_sigset_t=yes],[zsh_cv_type_sigset_t=no])])
 AH_TEMPLATE([sigset_t],



^ permalink raw reply	[relevance 3%]

* Re: [BUG] POSIX arith: inf, nan should be variables
  2021-11-16 12:55  5% ` Vincent Lefevre
@ 2021-11-28 20:34  5%   ` Oliver Kiddle
  2021-12-01  3:31  5%     ` Daniel Shahaf
  0 siblings, 1 reply; 200+ results
From: Oliver Kiddle @ 2021-11-28 20:34 UTC (permalink / raw)
  To: zsh-workers

On 16 Nov, Vincent Lefevre wrote:
> On 2021-11-15 18:40:17 +0100, Martijn Dekker wrote:
> > $ zsh --emulate sh -c 'inf=1; nan=2; echo $((inf)) $((nan))'
> > Inf NaN
> > 
> > Expected: 1 2
>
> FYI, this had already been discussed in April in this subthread:

And it'll probably come up again if we don't do anything. Unless anyone
has better ideas, I'm inclined to go with the following variant of
Martijn's patch.

Oliver

diff --git a/Src/math.c b/Src/math.c
index 4f24361a4..777ad9c31 100644
--- a/Src/math.c
+++ b/Src/math.c
@@ -863,7 +863,7 @@ zzlex(void)
 
 		p = ptr;
 		ptr = ie;
-		if (ie - p == 3) {
+		if (ie - p == 3 && !EMULATION(EMULATE_SH)) {
 		    if ((p[0] == 'N' || p[0] == 'n') &&
 			(p[1] == 'A' || p[1] == 'a') &&
 			(p[2] == 'N' || p[2] == 'n')) {


^ permalink raw reply	[relevance 5%]

* Re: [BUG] POSIX arith: inf, nan should be variables
  2021-11-28 20:34  5%   ` Oliver Kiddle
@ 2021-12-01  3:31  5%     ` Daniel Shahaf
  2021-12-01  3:37  9%       ` Bart Schaefer
  0 siblings, 1 reply; 200+ results
From: Daniel Shahaf @ 2021-12-01  3:31 UTC (permalink / raw)
  To: zsh-workers

Oliver Kiddle wrote on Sun, Nov 28, 2021 at 21:34:41 +0100:
> On 16 Nov, Vincent Lefevre wrote:
> > On 2021-11-15 18:40:17 +0100, Martijn Dekker wrote:
> > > $ zsh --emulate sh -c 'inf=1; nan=2; echo $((inf)) $((nan))'
> > > Inf NaN
> > > 
> > > Expected: 1 2
> >
> > FYI, this had already been discussed in April in this subthread:
> 
> And it'll probably come up again if we don't do anything. Unless anyone
> has better ideas, I'm inclined to go with the following variant of
> Martijn's patch.

Maybe add a test based on the above code snippet?

Cheers,

Daniel


> 
> diff --git a/Src/math.c b/Src/math.c
> index 4f24361a4..777ad9c31 100644
> --- a/Src/math.c
> +++ b/Src/math.c
> @@ -863,7 +863,7 @@ zzlex(void)
>  
>  		p = ptr;
>  		ptr = ie;
> -		if (ie - p == 3) {
> +		if (ie - p == 3 && !EMULATION(EMULATE_SH)) {
>  		    if ((p[0] == 'N' || p[0] == 'n') &&
>  			(p[1] == 'A' || p[1] == 'a') &&
>  			(p[2] == 'N' || p[2] == 'n')) {
> 


^ permalink raw reply	[relevance 5%]

* Re: [BUG] POSIX arith: inf, nan should be variables
  2021-12-01  3:31  5%     ` Daniel Shahaf
@ 2021-12-01  3:37  9%       ` Bart Schaefer
  2021-12-01  4:27  4%         ` Writing XFail tests (was: Re: [BUG] POSIX arith: inf, nan should be variables) Daniel Shahaf
  0 siblings, 1 reply; 200+ results
From: Bart Schaefer @ 2021-12-01  3:37 UTC (permalink / raw)
  To: Daniel Shahaf; +Cc: Zsh hackers list

On Tue, Nov 30, 2021 at 7:36 PM Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
>
> Maybe add a test based on the above code snippet?

There's already an xfail test:

Test ./E03posix.ztst was expected to fail, but passed.
Was testing: All identifiers are variable references in POSIX arithmetic

Just need to flip the state on that one.


^ permalink raw reply	[relevance 9%]

* Writing XFail tests (was: Re: [BUG] POSIX arith: inf, nan should be variables)
  2021-12-01  3:37  9%       ` Bart Schaefer
@ 2021-12-01  4:27  4%         ` Daniel Shahaf
  0 siblings, 0 replies; 200+ results
From: Daniel Shahaf @ 2021-12-01  4:27 UTC (permalink / raw)
  To: zsh-workers

Bart Schaefer wrote on Wed, 01 Dec 2021 03:37 +00:00:
> On Tue, Nov 30, 2021 at 7:36 PM Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
>>
>> Maybe add a test based on the above code snippet?
>
> There's already an xfail test:
>
> Test ./E03posix.ztst was expected to fail, but passed.
> Was testing: All identifiers are variable references in POSIX arithmetic
>
> Just need to flip the state on that one.

I've taken the liberty of doing so.

Incidentally, when writing xfail tests I like to write them with minimal
expectations, so that the test will trigger as soon as zsh's behaviour
changes:
.
     what-is-2-plus-2
    -fD:Unit test for a future builtin
    *>[0-9]

Here, the test looks for something on stdout and is xfail, so it expects
no specific exit code and no specific stderr.  This way, the test will
flip as soon as stdout becomes correct, regardless of whether the exit
code and stderr are at that time also what the they are expected to be
in the end (usually 0 and empty, respectively).

The test also uses a pattern on stdout, so that the test will pass even if
there are, say, whitespace differences between the predicted output (at
the time the xfail test is written) and the actual output (later, when
the bug is fixed).  See workers/48916 for an example of this.

Once the bug is fixed, the test's expectations (all three of them:
stdout, stderr, exit code) can be changed to their permanent form:
.
     what-is-2-plus-2
    0:Unit test for what-is-2-plus-2
    >4

That is: I'd suggest to use «f» flag in conjunction with two of the
three flags [-dD].

Cheers,

Daniel


^ permalink raw reply	[relevance 4%]

* PATCH: update zfs completion
@ 2021-12-27 21:37  1% Oliver Kiddle
  0 siblings, 0 replies; 200+ results
From: Oliver Kiddle @ 2021-12-27 21:37 UTC (permalink / raw)
  To: Zsh workers

This brings the zfs completion up-to-date.

I've been using openzfs 2.1 on Linux, FreeBSD 13.0 and two year-old
Solaris 11 as my reference points.

We need to complete dataset properties for zpool so rather than retain
that duplication, I moved all of _zpool into _zfs. This also allows
_zfs_keysource_props (which was Solaris specific anyway) to be brought
into _zfs. I've reindented the function because very little is otherwise
unchanged anyway.

_zfs_dataset and _zfs_pool do need to be separated because they are
called from other functions. They should have been given plural names.
Any views on perhaps renaming them?

Otherwise, _zfs_dataset is fixed to work with the awk on Solaris, to
preserve descriptions and to handle the new bookmarks feature of
openzfs.

Many of the items marked with TODO in comments have been addressed but
some still remain. Completion of vdevs for, e.g zpool create is a lot
better but could be further improved as some combinations are not
possible. user/group quota is also much improved.

Oliver

diff --git a/Completion/Unix/Command/_zfs b/Completion/Unix/Command/_zfs
index 51da9170b..be4a64b33 100644
--- a/Completion/Unix/Command/_zfs
+++ b/Completion/Unix/Command/_zfs
@@ -1,561 +1,1350 @@
-#compdef zfs
-# Synced with the S11U1 man page
+#compdef zfs zdb zpool
 
-_zfs() {
-	local context state line expl implementation
-	typeset -A opt_args
-	local -a subcmds rw_properties rw_propnames ro_properties create_properties
-	local -a share_nfs_ro_properties share_nfs_rw_properties
-	local -a share_smb_ro_properties share_smb_rw_properties
-	local -a share_ro_properties share_rw_properties
-	local -a difffields delegatable_perms
+local curcontext="$curcontext" implementation nm="$compstate[nmatches]"
+local -a state curstate line state_descr expl alts args
+typeset -A opt_args val_args
+local MATCH MBEGIN MEND
+local -a subcmds
+local -a share_nfs_ro_properties share_nfs_rw_properties
+local -a share_smb_ro_properties share_smb_rw_properties
+local -a share_ro_properties share_rw_properties
+local -a difffields delegatable_perms key_properties
+local -a ds_types sum_algorithms comp_algorithms dedup_algorithms
 
-	_pick_variant -r implementation -c 'zpool upgrade -v' openzfs='This system supports ZFS pool feature flags' solaris
+local -a ds_propnames ro_ds_props rw_ds_props ci_ds_props # dataset properties
+local -a po_propnames ro_po_props rw_po_props ci_po_props # pool properties
 
-	subcmds=(
-		"create" "destroy" "clone" "promote" "rename" "snapshot"
-		"rollback" "list" "set" "get" "inherit" "mount" "unmount"
-		"share" "unshare" "send" "receive" "allow" "unallow"
-		"upgrade" "userspace" "groupspace" "hold" "holds" "release"
-		"diff" "key" "help"
-	)
+_pick_variant -r implementation -c 'zpool upgrade -v' openzfs='This system supports ZFS pool feature flags' solaris
 
-  [[ $OSTYPE == freebsd<7->.* ]] && subcmds+=(jail unjail)
+ds_types=( filesystem snapshot volume all )
+sum_algorithms=( on off fletcher2 fletcher4 sha256 )
+comp_algorithms=( on off lzjb lz4 gzip gzip-{1..9} zle )
+dedup_algorithms=( on off verify sha256 sha256,verify )
 
-	share_nfs_ro_properties=(
-		"share.nfs.all"
-	)
+ro_po_props=( # readonly
+  'all[all properties]'
+  'allocated[space allocated]'
+  'capacity[space used (percentage)]'
+  'dedupratio[deduplication ratio]'
+  'free[space unallocated]'
+  'health[health status]'
+  'size[total size]'
+)
+ci_po_props=( # only set at create or import
+  'altroot[alternate root directory]:path:_directories'
+  'guid[unique identifier]:identifier'
+  'readonly[whether the pool can be modified]:value:(on off)'
+)
+rw_po_props=(
+  'autoexpand[automatic pool expansion]:value:(on off)'
+  'autoreplace[automatic device replacement]:value:(on off)'
+  'bootfs[default bootable dataset]:dataset:_zfs_dataset'
+  'cachefile[pool configuration cache file location]:value'
+  'dedupditto[threshold for number of copies]:value [0]'
+  'delegation[delegated administration]:value:(on off)'
+  'failmode[failure-mode behavior]:value:(wait continue panic)'
+  "listshares[show shares in 'zfs list']:value:(on off)"
+  "listsnaps[show snapshots in 'zfs list']:value:(on off)"
+  'version[pool version]:version'
+)
 
-	share_nfs_rw_properties=(
-		"share.nfs:value:(on off)"
-		"share.nfs.aclok:value:(on off)"
-		"share.nfs.acflfab:value:(on off)"
-		"share.nfs.anon:uid:"
-		"share.nfs.charset.euc-cn:access-list:"
-		"share.nfs.charset.euc-jpms:access-list:"
-		"share.nfs.charset.euc-kr:access-list:"
-		"share.nfs.charset.euc-tw:access-list:"
-		"share.nfs.charset.iso8859-1:access-list:"
-		"share.nfs.charset.iso8859-2:access-list:"
-		"share.nfs.charset.iso8859-5:access-list:"
-		"share.nfs.charset.iso8859-6:access-list:"
-		"share.nfs.charset.iso8859-7:access-list:"
-		"share.nfs.charset.iso8859-8:access-list:"
-		"share.nfs.charset.iso8859-9:access-list:"
-		"share.nfs.charset.iso8859-13:access-list:"
-		"share.nfs.charset.iso8859-15:access-list:"
-		"share.nfs.charset.koi8-r:access-list:"
-		"share.nfs.index:file:_files"
-		"share.nfs.log:nfslog.conf tag:"
-		"share.nfs.nosub:value:(on off)"
-		"share.nfs.nosuid:value:(on off)"
-		"share.nfs.public:value:(on off)"
-		"share.nfs.sec:security-mode-list:"
-		"share.nfs.sec.default.none:access-list:"
-		"share.nfs.sec.default.ro:access-list:"
-		"share.nfs.sec.default.root:access-list:"
-		"share.nfs.sec.default.root_mapping:uid:"
-		"share.nfs.sec.default.rw:access-list:"
-		"share.nfs.sec.default.window:seconds"
-		"share.nfs.sec.dh.none:access-list:"
-		"share.nfs.sec.dh.ro:access-list:"
-		"share.nfs.sec.dh.root:access-list:"
-		"share.nfs.sec.dh.root_mapping:uid:"
-		"share.nfs.sec.dh.rw:access-list:"
-		"share.nfs.sec.dh.window:seconds"
-		"share.nfs.sec.krb5.none:access-list:"
-		"share.nfs.sec.krb5.ro:access-list:"
-		"share.nfs.sec.krb5.root:access-list:"
-		"share.nfs.sec.krb5.root_mapping:uid:"
-		"share.nfs.sec.krb5.rw:access-list:"
-		"share.nfs.sec.krb5.window:seconds"
-		"share.nfs.sec.krb5i.none:access-list:"
-		"share.nfs.sec.krb5i.ro:access-list:"
-		"share.nfs.sec.krb5i.root:access-list:"
-		"share.nfs.sec.krb5i.root_mapping:uid:"
-		"share.nfs.sec.krb5i.rw:access-list:"
-		"share.nfs.sec.krb5i.window:seconds"
-		"share.nfs.sec.krb5p.none:access-list:"
-		"share.nfs.sec.krb5p.ro:access-list:"
-		"share.nfs.sec.krb5p.root:access-list:"
-		"share.nfs.sec.krb5p.root_mapping:uid:"
-		"share.nfs.sec.krb5p.rw:access-list:"
-		"share.nfs.sec.krb5p.window:seconds"
-		"share.nfs.sec.none.none:access-list:"
-		"share.nfs.sec.none.ro:access-list:"
-		"share.nfs.sec.none.root:access-list:"
-		"share.nfs.sec.none.root_mapping:uid:"
-		"share.nfs.sec.none.rw:access-list:"
-		"share.nfs.sec.none.window:seconds"
-		"share.nfs.sec.sys.none:access-list:"
-		"share.nfs.sec.sys.ro:access-list:"
-		"share.nfs.sec.sys.root:access-list:"
-		"share.nfs.sec.sys.root_mapping:uid:"
-		"share.nfs.sec.sys.rw:access-list:"
-		"share.nfs.sec.sys.window:seconds"
-	)
+# TODO: userused@ and groupused@ could have more extensive handling
+ro_ds_props=(
+  name type creation space used available referenced compressratio mounted
+  origin usedbychildren usedbydataset usedbyrefreservation usedbysnapshots
+  defer_destroy userused@ userrefs groupused@ keystatus
+)
+ci_ds_props=(
+  'casesensitivity:value:(sensitive insensitive mixed)'
+  'normalization:value:(none formC formD formKC formKD)'
+  'utf8only:value:(on off)'
+)
+rw_ds_props=(
+  'aclinherit:value:(discard noallow restricted passthrough passthrough-x)'
+  'atime:value:(on off)'
+  'canmount:value:(on off noauto)'
+  "checksum:value:($sum_algorithms)"
+  "compression:value:($comp_algorithms)"
+  'copies:value:(1 2 3)'
+  "dedup:value:($dedup_algorithms)"
+  'devices:value:(on off)'
+  'encryption:value:(off on aes128-ccm aes-192-ccm aes-256-ccm aes-128-gcm aes-192-gcm aes-256-gcm)'
+  'exec:value:(on off)'
+  'groupquota@'
+  'logbias:value:(latency throughput)'
+  "mountpoint: : _alternative \
+      'properties:property:(none legacy)' \
+      'paths:mountpoint:_directories -W / -P /'"
+  'multilevel:value:(on off)'
+  'nbmand:value:(on off)'
+  'primarycache:value:(all none metadata)'
+  'quota: :->quotas'
+  'readonly:value:(on off)'
+  'recordsize:value:(512 1K 2K 4K 8K 16K 32K 64K 128K 256K 512K 1M)'
+  'refquota: :->quotas'
+  "refreservation: : _alternative \
+      'sizes: :_numbers -M \"m:{a-zA-Z}={A-Za-z}\" -u bytes size :B {k,M,G,T,P,E,Z}{,B}' \
+      'properties:property:(auto none)'"
+  'reservation: :->quotas'
+  'rstchown:value:(on off)'
+  'secondarycache:value:(all none metadata)'
+  'setuid:value:(on off)'
+  'shadow:value' # TODO: complete URI|none
+  'share:share properties'
+  'snapdir:value:(hidden visible)'
+  'sync:value:(standard always disabled)'
+  'userquota@'
+  'version:value'
+  'volsize:size:_numbers -M "m:{a-zA-Z}={A-Za-z}" -u bytes size :B {k,M,G,T,P,E,Z}{,B}'
+)
 
-	share_smb_ro_properties=(
-		"share.smb.all"
-	)
+case $service:$implementation in
+  *:openzfs)
+    ds_types+=( bookmark )
+    sum_algorithms+=( noparity sha512 skein edonr )
+    comp_algorithms+=( zstd zstd-{1..19} zstd-fast zstd-fast-{{1..9}{,0},100,500,1000} )
+    dedup_algorithms+=( {sha512,skein}{,\,verify} edonr,verify )
+    share_rw_properties=( sharesmb:option sharenfs:option )
+    ro_po_props+=(
+      'expandsize[uninitialized space within the pool]'
+      'fragmentation[amount of fragmentation in the pool]'
+      'freeing[amount of space remaining to be reclaimed]'
+      'used[amount of storage space used within the pool]'
+      'load_guid[unique identifier generated when pool is loaded]'
+    )
+    ci_po_props+=(
+      'ashift[pool sector size exponent]:exponent:((9\:512 10\:1024 11\:2048 12\:4096 13\:8192 14\:16384 15\:32768 16\:65536))'
+    )
+    rw_po_props+=(
+      'autotrim[periodically trim recently freed space]:value:(on off)'
+      'comment[text string that is available even if the pool becomes faulted]:value'
+      'multihost[perform pool activity check during import]:value:(on off)'
+    )
+    rw_ds_props+=(
+      'aclmode:value:(discard groupmask passthrough restricted)'
+      'acltype:value:(off noacl nfsv4 posix posixacl)'
+      'mlslabel:value:(none)' # TODO: list sensitivity labels
+      'redundant_metadata:value:(all most)'
+      'vscan:value:(on off)'
+      'xattr:value:(on off dir sa)'
+      "filesystem_limit: :{if [[ -prefix [0-9]## ]]; then _message -e 'number'; elif [[ -prefix n ]]; then compadd none; else _message -e limits 'number or none'; fi}"
+      "snapshot_limit: :{if [[ -prefix [0-9]## ]]; then _message -e 'number'; elif [[ -prefix n ]]; then compadd none; else _message -e limits 'number or none'; fi}"
+      'volmode:mode:((
+        default\:use\ system-wide\ tunable
+        full\:expose\ as\ block\ devices
+        geom\:expose\ as\ block\ devices
+        dev\:hide\ partitions
+        none\:not\ exposed\ outside\ zfs
+      ))'
+    )
+    ro_ds_props+=(
+      createtxg clones filesystem_count guid logicalreferenced logicalused
+      receive_resume_token refcompressratio snapshot_count volblocksize written
+    )
+    delegatable_perms=(
+      bookmark load-key change-key userobjquota userobjused groupobjquota
+      groupobjused projectused projectquota projectobjused projectobjquota
+    )
+  ;|
+  *:solaris)
+    ds_types+=( share )
+    sum_algorithms+=( sha256+mac )
+    share_nfs_ro_properties=( share.nfs.all )
+    share_nfs_rw_properties=(
+      'share.nfs:value:(on off)'
+      'share.nfs.aclok:value:(on off)'
+      'share.nfs.aclfab:value:(on off)'
+      'share.nfs.anon:uid'
+      'share.nfs.charset.'{cp932,euc-{cn,jpns,kr,tw},iso8859-{1,2,5,6,7,8,9,13,15},koi8-r,shift_jis}':access-list'
+      'share.nfs.index:file:_files'
+      'share.nfs.labeled:value:(on off)'
+      'share.nfs.noaclfab:value:(on off)'
+      'share.nfs.log:nfslog.conf tag'
+      'share.nfs.nosub:value:(on off)'
+      'share.nfs.nosuid:value:(on off)'
+      'share.nfs.public:value:(on off)'
+      'share.nfs.sec:security-mode-list'
+      'share.nfs.sec.'{default,dh,krb5{,i,p},none,sys}.{ro,root,rw}':access-list'
+      'share.nfs.sec.'{default,dh,krb5{,i,p},none,sys}.root_mapping':uid'
+      'share.nfs.sec.'{default,dh,krb5{,i,p},none,sys}.window':credential lifetime (seconds)'
+      'share.nfs.sec.sys.resvport:value:(on off)'
+    )
+    share_smb_ro_properties=( share.smb.all )
+    share_smb_rw_properties=(
+      'share.smb:value:(on off)'
+      'share.smb.abe'
+      'share.smb.ad-container'
+      'share.smb.catia:value:(on off)'
+      'share.smb.csc:value:(disabled manual auto vdo)'
+      'share.smb.dfsroot:value:(on off)'
+      'share.smb.encrypt:value:(on off)'
+      'share.smb.guestok:value:(on off)'
+      'share.smb.oplocks:value:(disabled enabled)'
+      'share.smb.cont_avail:value:(on off)'
+      'share.smb.'{none,ro,rw}':access-list'
+    )
+    share_ro_properties=(
+      share.all share.fs share.name share.point share.protocols share.state
+      $share_nfs_ro_properties $share_smb_ro_properties
+    )
+    share_rw_properties=(
+      'share.desc:description'
+      'share.auto:value:(on off)'
+      'share.autoname:value'
+      'share.nfs.cksum:value'
+      'share.path:path'
+      $share_nfs_rw_properties $share_smb_rw_properties
+    )
+    ro_po_props+=(
+      'lastscrub[start time of the last successful scrub]'
+    )
+    rw_po_props+=(
+      'clustered[pool is imported as a global pool in Oracle Solaris Cluster]:value:(on off)'
+      'scrubinternal[time interval between scheduled scrubs]:interval'
+    )
+    ro_ds_props+=( keychangedate rekeydate effective{read,write}limit )
+    rw_ds_props+=(
+      'aclmode:value:(discard mask passthrough)'
+      "defaultreadlimit: : _alternative \
+          'sizes: :_guard \[0-9\]\#\(\|\[BKMGTPEZ\]\) size\ \(bytes\ per\ second\)' \
+          'properties:property:(none)'"
+      "defaultwritelimit: : _alternative \
+          'sizes: :_guard \[0-9\]\#\(\|\[BKMGTPEZ\]\) size\ \(bytes\ per\ second\)' \
+          'properties:property:(none)'"
+      'defaultuserquota:->quotas'
+      'defaultgroupquota: :->quotas'
+      'keysource:value:->keysources'
+    )
+    ci_ds_props+=(
+      'volblocksize:value:compadd -o nosort 512 1K 2K 4K 8K 16K 32K 64K 128K 256K 512K 1M'
+    )
+    difffields=(
+      object parent size links linkschange name oldname user group
+      ctime mtime atime crtime mountpoint dataset_name
+    )
+    delegatable_perms=( key keychange )
+  ;|
+  zfs:openzfs)
+    subcmds+=(
+      bookmark change-key load-key program project projectspace redact
+      unload-key wait
+    )
+  ;|
+  zpool:openzfs)
+    subcmds+=(
+      checkpoint events labelclear initialize reopen resilver sync trim wait
+      version
+    )
+  ;|
+  zfs:solaris)
+    subcmds+=( key help )
+  ;|
+  zpool:solaris)
+    subcmds+=( help label monitor )
+  ;|
 
-	share_smb_rw_properties=(
-		"share.smb:value:(on off)"
-		"share.smb.ad-container"
-		"share.smb.abe"
-		"share.smb.csc:value:(disabled manual auto vdo)"
-		"share.smb.catia:value:(on off)"
-		"share.smb.dfsroot:value:(on off)"
-		"share.smb.guestok:value:(on off)"
-		"share.smb.ro:access-list:"
-		"share.smb.rw:access-list:"
-		"share.smb.none:access-list:"
-	)
+  zfs:*)
+    subcmds+=(
+      create destroy clone promote rename snapshot rollback list set get
+      inherit mount unmount share unshare send receive allow unallow upgrade
+      userspace groupspace hold holds release diff
+    )
+    [[ $OSTYPE = freebsd<7->.* ]] && subcmds+=( jail unjail )
+  ;;
+  zpool:*)
+    subcmds+=(
+      add attach clear create destroy detach export get history import iostat
+      list offline online reguid remove replace scrub set split status upgrade
+    )
+  ;;
+esac
 
-	share_ro_properties=(
-		"share.all"
-		"share.fs"
-		"share.name"
-		"share.point"
-		"share.protocols"
-		"share.state"
-		$share_nfs_ro_properties
-		$share_smb_ro_properties
-	)
+case $OSTYPE in
+  solaris*)
+    rw_ds_props+=( 'zoned:value:(on off)' )
+  ;;
+  freebsd*)
+    [[ $OSTYPE = freebsd<-12>.* ]] && subcmds+=( remap )
+    rw_ds_props+=( 'jailed:value:(on off)' )
+  ;;
+  linux-gnu)
+    rw_ds_props+=( 'relatime:value:(on off)' )
+    ci_ds_props+=(
+      {,fs,def,root}'context:SELinux context:_selinux_contexts'
+    )
+  ;;
+esac
 
-	share_rw_properties=(
-		"share.desc:description:"
-		"share.noauto:value:(on off)"
-		"share.path:path:"
-		$share_nfs_rw_properties
-		$share_smb_rw_properties
-	)
+delegatable_perms+=(
+  allow clone create destroy diff hold key keychange mount promote receive
+  release rename rollback send share snapshot groupquota groupused userprop
+  userused ${ci_ds_props%%:*}
+)
 
-	# TODO: userused@ and groupused@ could have more extensive handling
-	ro_properties=(
-		"name" "type" "creation" "space" "used" "available" "referenced"
-		"compressratio" "mounted" "origin" "usedbychildren"
-		"usedbydataset" "usedbyrefreservation" "usedbysnapshots"
-		"defer_destroy" "userused@" "userrefs" "groupused@"
-		"keychangedate" "keystatus" "rekeydate"
-		$share_ro_properties
-	)
+key_properties=(
+  'keylocation:location [prompt]:_files -P file\:// -W /'
+  'keyformat:format:(raw hex passphrase)'
+  'pbkdf2iters:iterations [350000]'
+)
 
-	# TODO: Be cleverer about what values can be set.  Is there any way to
-	# set the sorting for *size properties to false by default?
-	rw_properties=(
-		"aclinherit:value:(discard noallow restricted passthrough passthrough-x)"
-		"atime:value:(on off)"
-		"canmount:value:(on off noauto)"
-		"checksum:value:(on off fletcher2 fletcher4 sha256 sha256+mac)"
-		"compression:value:(on off lzjb lz4 gzip gzip-{1..9} zle)"
-		"copies:value:(1 2 3)"
-		"dedup:value:(on off verify sha256 sha256,verify)"
-		"devices:value:(on off)"
-		"encryption:value:(off on aes128-ccm aes-192-ccm aes-256-ccm aes-128-gcm aes-192-gcm aes-256-gcm)"
-		"exec:value:(on off)"
-		"groupquota@:value:" # TODO: complete group=size|none
-		"keysource:value:_zfs_keysource_props"
-		"logbias:value:(latency throughput)"
-		"mlslabel:value:(none)" # TODO: list sensitivity labels
-		"mountpoint:path, 'legacy', or 'none':{if [[ -prefix /* ]]; then _path_files -/; else _wanted mountpoints expl 'mountpoint (type \"/\" to start completing paths)' compadd legacy none; fi}"
-		"multilevel:value:(on off)"
-		"nbmand:value:(on off)"
-		"primarycache:value:(all none metadata)"
-		"quota: : _alternative \
-				'sizes: :_numbers -M "m\:{a-zA-Z}={A-Za-z}" -u bytes size :B {k,M,G,T,P,E,Z}{,B}' \
-				'properties:property:(none)'"
-		"readonly:value:(on off)"
-		"recordsize:value:(512 1K 2K 4K 8K 16K 32K 64K 128K 256K 512K 1M)"
-		"refquota: : _alternative \
-				'sizes: :_numbers -M "m\:{a-zA-Z}={A-Za-z}" -u bytes size :B {k,M,G,T,P,E,Z}{,B}' \
-				'properties:property:(none)'"
-		"refreservation: : _alternative \
-				'sizes: :_numbers -M "m\:{a-zA-Z}={A-Za-z}" -u bytes size :B {k,M,G,T,P,E,Z}{,B}' \
-				'properties:property:(auto none)'"
-		"reservation: : _alternative \
-				'sizes: :_numbers -M "m\:{a-zA-Z}={A-Za-z}" -u bytes size :B {k,M,G,T,P,E,Z}{,B}' \
-				'properties:property:(none)'"
-		"rstchown:value:(on off)"
-		"secondarycache:value:(all none metadata)"
-		"setuid:value:(on off)"
-		"shadow:value:" # TODO: complete URI|none
-		"share:share properties:"
-		"snapdir:value:(hidden visible)"
-		"sync:value:(standard always disabled)"
-		"userquota@:value:" # TODO: complete user=size|none
-		"version:value:(1 2 3 4 current)"
-		"volsize:value:" # <size>
-		"vscan:value:(on off)"
-		"xattr:value:(on off)"
-		"zoned:value:(on off)"
-		$share_rw_properties
-	)
+ro_ds_props+=( $share_ro_properties )
+rw_ds_props+=( $share_rw_properties )
+ci_ds_props+=( $rw_ds_props )
 
-		if [[ "$OSTYPE" == "linux-gnu" ]]; then
-			rw_properties+=("acltype:value:(off noacl posixacl)")
-		elif [[ "$implementation" == "solaris" ]]; then
-			rw_properties+=("aclmode:value:(discard mask passthrough)")
-		else
-			rw_properties+=("aclmode:value:(discard groupmask passthrough restricted)")
-		fi
+ds_propnames=( ${rw_ds_props%%:*} )
+po_propnames=( ${ro_po_props%%:*} ${ci_po_props%%:*} ${rw_po_props%%:*} )
 
 
-	create_properties=(
-		$rw_properties
-		"casesensitivity:value:(sensitive insensitive mixed)"
-		"normalization:value:(none formC formD formKC formKD)"
-		"utf8only:value:(on off)"
-		"volblocksize:value:(512 1K 2K 4K 8K 16K 32K 64K 128K 256K 512K 1M)"
-	)
+case $service in
+  zfs|zpool)
+    _arguments -C -A "-*" \
+      '-?[display usage information]' \
+      '*::command:->subcmd' && return 0
 
-	delegatable_perms=(
-		"allow" "clone" "create" "destroy" "diff" "hold" "key"
-		"keychange" "mount" "promote" "receive" "release" "rename"
-		"rollback" "send" "share" "snapshot"
-		"groupused" "userused" "userprop"
-		${create_properties%%:*}
-	)
+    if (( CURRENT == 1 )); then
+      _wanted commands expl "subcommand" compadd -a subcmds
+      return
+    fi
+    curcontext="${curcontext%:*}-$words[1]:"
+  ;;
+  zdb)
+    if [[ $implementation = openzfs ]]; then
+      args=(
+        '-mm[also display free space histogram associated with each metaslab]'
+        {-mmm,-MM}'[display more free space information]'
+        {-mmmm,-MMM}'[display every spacemap record]'
+        '-DD[display a histogram of deduplication statistics]'
+        '-DDD[display deduplication statistics independently for each table]'
+        '-DDDD[dump the contents of the deduplication tables describing duplicate blocks]'
+        '-DDDDD[also dump the contents of the deduplication tables describing unique blocks]'
+        '-E+[decode and display block from a given embedded block pointer]:word'
+        '(-l)-ll+[like -l but display L2ARC log blocks]:device:_files'
+        '(-l -ll)-lll+[like -l but display every configuration, unique or not]:device:_files'
+        "-q[don't print labels (with -l)]"
+        '-k[examine the checkpointed state of the pool]'
+        '-M[display the offset, spacemap, and free space of each metaslab]' \
+        '-O+[look up the specified path inside of the dataset]:dataset:_zfs_dataset:path:_files'
+        '-o+[set the given global libzpool variable]:variable'
+        '-r+[copy the specified path inside of the dataset to the specified destination]:dataset:_zfs_dataset:path:_files:destination:_files'
+        '-x+[copy all blocks accessed to files in the specified directory]:directory:_directories'
+        '-V[attempt verbatim import]'
+        '-Y[attempt all possible combinations when reconstructing indirect split blocks]'
+        '-y[perform validation for livelists that are being deleted]'
+      )
+    else
+      args=(
+        '-?[display usage information]'
+        '-M+[dump MOS contents]:contents: _values -s , raw_config all objset dir pool_props metaslab sync_bplist dtl config spares l2cache history errlog_scrub errlog_last bpmap-vdev bpmap_defer_obj dtl-scan ddt2'
+        '-r[dump datasets recursively]'
+        '-z[report zombies only]'
+        '-V[verify DDT xtree block data]'
+        "-a[don't import l2arc cache data]"
+        '-f[attempt to force import (with -e)]'
+        '-w+[specify directory to save shadow copy of all accessed disk locations]: :_directories'
+        '-x+[set kernel tunable]:tunable'
+        '-G[dump the contents of the zfs_dbgmsg buffer before exiting]'
+        '-I[limit the number of outstanding checksum I/Os to the specified value]'
+      )
+    fi
+    _arguments -A "-*" -S $args \
+      '(-C)-b[display block statistics]' \
+      '(-C)*-c[verify checksum of metadata blocks]' \
+      '(-b -c -d)-C[display configuration information]' \
+      '(-C)*-d[display dataset information]' \
+      '-h[display pool history]' \
+      '-i[display intent log (ZIL) information]' \
+      '-l+[read the vdev labels from the specified device]:device:_files' \
+      '-m[display the offset, spacemap, and free space of each metaslab]' \
+      '-s[report statistics on zdb I/O]' \
+      '*-u[also display the uberblocks on the device (with -l)]' \
+      '*-v[enable verbose output]' \
+      '-D[display deduplication statistics]' \
+      '-S[simulate the effects of deduplication, displaying constructed DDT as with -DD]' \
+      '-L[disable leak detection and the loading of space maps]' \
+      '-R+[read and display a block from the specified device]:device' \
+      "-A[don't abort should any assertion fail]" \
+      "-AA[enable panic recovery]" \
+      '-F[try progressively older transactions until pool is readable]' \
+      '-U+[specify cache file to use]:cache file [/etc/zfs/zpool.cache]:_files' \
+      '-X[attempt "extreme" transaction rewind]' \
+      '-e[operate on an exported pool]' \
+      '-p[specify path under which to search for devices (with -e)]:path:_files' \
+      '-P[use exact (parsable) numeric output]' \
+      '-t+[specify the highest transaction to use when searching for uberblocks]:transaction' \
+      '1:pool:_zfs_pool'
+    return
+  ;;
+esac
 
-	rw_propnames=( ${rw_properties%%:*} )
+case $service:$words[1] in
+  zfs:create)
+    [[ $implementation = openzfs ]] && args=(
+      '-P[print machine-parsable verbose information about the created dataset]'
+      '-n[do a dry-run, no dataset will be created]'
+      '-v[print verbose information about the created dataset]'
+    )
+    _arguments -C -A "-*" -S $args \
+      '-p[create parent datasets]' \
+      '*-o+[set initial propertyvalue]:property:->create-properties' \
+      - set1 \
+      ':filesystem:_zfs_dataset -t fs -e "parent dataset"' \
+      - set2 \
+      '-s[create sparse volume]' \
+      '-b+[set volblocksize]: :_numbers -M "m\:{a-zA-Z}={A-Za-z}" -u bytes blocksize \:B {k,M,G,T,P,E,Z}{,B}' \
+      '-V+[set size]: :_numbers -M "m\:{a-zA-Z}={A-Za-z}" -u bytes size \:B {k,M,G,T,P,E,Z}{,B}' \
+      ':volume:_zfs_dataset -t fs -e "parent dataset"'
+  ;;
 
-	difffields=(
-		object parent size links linkschange name oldname user group
-		ctime mtime atime crtime
-	)
+  zfs:destroy)
+    if [[ $implementation = openzfs ]]; then
+      args=(
+        '-n[do a dry-run, no data will be deleted]'
+        '-p[print machine-parsable verbose information about the deleted data]'
+        '-v[print verbose information about the deleted data]'
+      )
+    else
+      args=( '-s[destroy snapshots synchronously - only return when blocks freed]' )
+    fi
+    _arguments -A "-*" -S $args \
+      '-r[recursively destroy all children]' \
+      '-R[recursively destroy all dependents]' \
+      '(-f)-d[delete or mark deferred]' \
+      '(-d)-f[force unmounts]' \
+      ':dataset:_zfs_dataset -t fs -t vol ${=${opt_args[(i)-f]:--t snap}:/-f/} ${=${opt_args[(i)-*]:--t bookmark}:/-?/}'
+  ;;
 
-	if [[ $service == "zfs" ]]; then
-		_arguments -C -A "-*" \
-			'-\?[Help]' \
-			'*::command:->subcmd' && return 0
+  zfs:snap(|shot))
+    _arguments -C -A "-*" -S \
+      '-r[recursively snapshot all descendant datasets]' \
+      '*-o+[set property]:property:->create-properties' \
+      ':filesystem/volume:_zfs_dataset -t fs -t vol -S@'
+  ;;
 
-		if (( CURRENT == 1 )); then
-			_wanted commands expl "zfs subcommand" compadd -a subcmds
-			return
-		fi
-		service="$words[1]"
-		curcontext="${curcontext%:*}=$service:"
-	fi
+  zfs:rollback)
+    _arguments -A "-*" -S \
+      '-r[recursively destroy more recent snapshots]' \
+      '-R[recursively destroy more recent snapshots and clones]' \
+      '-f[force unmounts]' \
+      ':snapshot:_zfs_dataset -t snap'
+  ;;
 
-	case $service in
-	("create")
-		_arguments -A "-*" \
-			'-p[Create parent datasets]' \
-			'*-o[Set initial properties]:property:_values -s , "property" $create_properties' \
-			- set1 \
-			':filesystem:_zfs_dataset -t fs -e "parent dataset"' \
-			- set2 \
-			'-s[Create sparse volume]' \
-			'-b+[set volblocksize]: :_numbers -M "m\:{a-zA-Z}={A-Za-z}" -u bytes blocksize :B {k,M,G,T,P,E,Z}{,B}' \
-			'-V+[set size]: :_numbers -M "m\:{a-zA-Z}={A-Za-z}" -u bytes size :B {k,M,G,T,P,E,Z}{,B}' \
-			':volume:_zfs_dataset -t fs -e "parent dataset"'
-		;;
+  zfs:clone)
+    [[ $implementation = solaris ]] && args+=(
+    '-K[create encryption key]'
+  )
+  _arguments -C -A "-*" -S $args \
+    '-p[create parent datasets]' \
+    '*-o+[set property]:property:->create-properties' \
+    ':snapshot:_zfs_dataset -t snap' \
+    ':filesystem/volume:_zfs_dataset -t fs -e "parent dataset"'
+  ;;
 
-	("destroy")
-		_arguments -A "-*" \
-			'-r[Recursively destroy all children]' \
-			'-R[Recursively destroy all dependents]' \
-			- set1 \
-			'-d[delete or mark deferred]' \
-			':snapshot:_zfs_dataset -t snap' \
-			- set2 \
-			'-f[Force unmounts]' \
-			':filesystem/volume/snapshot:_zfs_dataset -t fs -t vol'
-		;;
+  zfs:promote)
+    _arguments \
+      ':filesystem:_zfs_dataset -t clone' \
+  ;;
 
-	(snap(|shot))
-		_arguments -A "-*" \
-			'-r[Recursively snapshot all descendant datasets]' \
-			'*-o[Set property]:property:_values -s , "property" $create_properties' \
-			':filesystem/volume:_zfs_dataset -t fs -t vol -S@'
-		;;
+  zfs:rename)
+    [[ $implementation = openzfs ]] && args=(
+      '(-r -u)-f[force unmount any filesystems]'
+      "(-r -f)-u[don't remount file systems during rename]"
+    )
+    _arguments -A "-*" -S $args \
+      '(-r)-p[create parent datasets]' \
+      '(-p -u -f)-r[recursively rename snapshots of all descendent datasets]' \
+      ':dataset:_zfs_dataset -r1' \
+      ':dataset:_zfs_dataset -r2'
+  ;;
 
-	("rollback")
-		_arguments -A "-*" \
-			'-r[Recursively destroy more recent snapshots]' \
-			'-R[Recursively destroy more recent snapshots and clones]' \
-			'-f[Force unmounts]' \
-			':snapshot:_zfs_dataset -t snap'
-		;;
+  zfs:bookmark)
+    _arguments \
+      ':snapshot or bookmark:_zfs_dataset -t snap -t bookmark' \
+      ':bookmark'
+  ;;
 
-	("clone")
-		# XXX needs to bail if there are no snapshots
-		_arguments -A "-*" \
-			'-p[Create parent datasets]' \
-			'-K[Create encryption key]' \
-			'*-o[Set property]:property:_values -s , "property" $create_properties' \
-			':snapshot:_zfs_dataset -t snap' \
-			':filesystem/volume:_zfs_dataset -t fs -e "parent dataset"'
-		;;
+  zfs:program)
+    _arguments -A "-*" -S \
+      '-j[display channel program output in JSON format]' \
+      '-n[execute a read-only channel program]' \
+      '-t+[limit the number of Lua instructions to execute]:instruction limit' \
+      '-m+[specify memory limit]:memory limit (bytes) [10MB]' \
+      ':pool:_zfs_pool' \
+      ':script:_files' \
+      '*: :_default'
+  ;;
 
-	("promote")
-		_arguments \
-			':filesystem:_zfs_dataset -t clone' \
-		;;
+  zfs:list)
+    if [[ $implementation = solaris ]]; then
+      args=( '-I+[specify dataset states to display instead of normal datasets]:dataset state:_sequence compadd - receiving resumable hidden all' )
+    else
+      args=( '-p[use exact (parsable) numeric output]' )
+    fi
+    _arguments -A "-*" -S $args \
+      '(-d)-r[recursively display children]' \
+      '-H[suppress printing of headers]' \
+      '(-r)-d+[depth]:value' \
+      '-o+[specify properties to list]: :_values -s , "property" $ro_ds_props $ds_propnames' \
+      '*-s+[specify sort key (ascending)]: :_values "property" $ro_ds_props $ds_propnames' \
+      '*-S+[specify sort key (descending)]: :_values "property" $ro_ds_props $ds_propnames' \
+      '-t+[specify dataset types to list]: :_values -s , "dataset type" $ds_types' \
+      '*:filesystem/volume/snapshot/path:_zfs_dataset -p'
+  ;;
 
-	("rename")
-		_arguments -A "-*" \
-			'(-r)-p[Create parent datasets]' \
-			'(-p)-r[Recursively rename snapshots of all descendent datasets]' \
-			':dataset:_zfs_dataset -r1' \
-			':dataset:_zfs_dataset -r2'
-		;;
+  zfs:set)
+    [[ $implementation = solaris ]] && args=(
+      '-r[recursively apply value]' \
+    )
+    _arguments -C -A "-*" -S $args \
+      ':property:->set-properties' \
+      '*:filesystem/volume:_zfs_dataset -t fs -t vol'
+  ;;
 
-	("list")
-		_arguments -A "-*" \
-			'-r[Recursively display children]' \
-			'-H[Scripting mode]' \
-			'-d[Depth]:value:' \
-			'-o[Properties to list]:property:_values -s , "property" $ro_properties $rw_propnames' \
-			'*-s[Sort key (ascending)]:property:_values "property" $ro_properties $rw_propnames' \
-			'*-S[Sort key (descending)]:property:_values "property" $ro_properties $rw_propnames' \
-			'-t[Dataset types to list]:dataset type:_values -s , "dataset type" all filesystem snapshot volume' \
-			'*:filesystem/volume/snapshot/path:_zfs_dataset -p'
-		;;
+  zfs:get)
+    if [[ $implementation == openzfs ]]; then
+      args=( '-t+[specify dataset types to display]: :_values -s , "dataset type" $ds_types' )
+    else
+      args=( '-e[expand property sublists to any depth]' )
+    fi
+    _arguments -A "-*" -S $args \
+      "(-d)-r[recursively display children's properties]" \
+      '(-r)-d+[depth]:value' \
+      '-H[suppress printing of headers]' \
+      '-p[use exact (parsable) numeric output]' \
+      '-s+[specify sources]: :_values -s , "source" local default inherited received temporary none' \
+      '-o+[specify fields]: :_values -s , "field" name property received value source' \
+      ':property:_values -s , "property" $ro_ds_props $ds_propnames all' \
+      '*:filesystem/volume/snapshot:_zfs_dataset'
+  ;;
 
-	("set")
-		_arguments \
-			'-r[Recursively apply value]' \
-			':property:_values -s , "property" $rw_properties' \
-			'*:filesystem/volume:_zfs_dataset -t fs -t vol'
-		;;
+  zfs:inherit)
+    _arguments -C -A "-*" -S \
+      '-r[recursively inherit property for all children]' \
+      '-S[revert to received property value]' \
+      ':property:_values "property" $ro_ds_props ${rw_ds_props%%:*}' \
+      '*:filesystem/volume:_zfs_dataset -t fs -t vol'
+  ;;
 
-	("get")
-		_arguments -A "-*" \
-			"-r[Recursively display children's properties]" \
-			'-d[Depth]:value:' \
-			'-H[Scripting mode]' \
-			'-p[Display numbers exactly]' \
-			'-s[Specify sources]:source:_values -s , "source" local default inherited temporary none' \
-			'-o[Specify fields]:field:_values -s , "field" name property value source' \
-			':property:_values -s , "property" $ro_properties $rw_propnames all' \
-			'*:filesystem/volume/snapshot:_zfs_dataset'
-		;;
+  zfs:remap)
+    _arguments \
+      ':filesystem or volume:_zfs_dataset -t fs -t vol'
+  ;;
 
-	("inherit")
-		_arguments -A "-*" \
-			'-r[Recursively inherit property for all children]' \
-			'-S[Revert to received property value]' \
-			':property:_values -s , "property" $ro_properties $rw_properties' \
-			'*:filesystem/volume:_zfs_dataset -t fs -t vol'
-		;;
+  zfs:upgrade)
+    _arguments -A "-*" -S \
+      '(- :)-v[display supported ZFS versions]' \
+      '(-v :)-a[upgrade all filesystems on all pools]' \
+      '(-v)-r[upgrade descendent filesystems, too]' \
+      '(-v)-V+[upgrade to specified version]:version' \
+      '(-a -v):filesystem:_zfs_dataset -t fs'
+  ;;
 
-	("userspace"|"groupspace")
-		_arguments -A "-*" \
-			'-n[Print numeric ID]' \
-			'-i[Translate SID to POSIX ID]' \
-			'-H[Tab-delimited output with no headers]' \
-			'-p[Parseable mode]' \
-			'-o[Properties to list]:property:_values -s , "property" type name used quota' \
-			'*-s[Sort key (ascending)]:property:_values "property" type name used quota' \
-			'*-S[Sort key (descending)]:property:_values "property" type name used quota' \
-			'-t[Types to list]:type:_values -s , "type" all posixuser smbuser posixgroup smbgroup' \
-			'*:filesystem/volume/snapshot:_zfs_dataset'
-		;;
+  zfs:(user|group)space)
+    args=(
+      '-n[print numeric ID]'
+      '-i[translate SID to POSIX ID]'
+    )
+  ;& # fall-through
+  zfs:projectspace)
+    [[ $implementation = solaris ]] && args+=(
+      '(- *)'{-h,--help}'[display usage information]'
+    )
+    _arguments -A "-*" -S $args \
+      '-H[suppress printing of headers, tab-delimit columns]' \
+      '-p[use exact (parsable) numeric output]' \
+      '-o+[specify properties to list]:property:_values -s , "property" type name used quota' \
+      '*-s+[specify sort key (ascending)]: :_values "property" type name used quota' \
+      '*-S+[specify sort key (descending)]: :_values "property" type name used quota' \
+      '-t+[specify types to list]:type:_values -s , "type" all posixuser smbuser posixgroup smbgroup' \
+      '*:filesystem/volume/snapshot:_zfs_dataset'
+  ;;
 
-	("mount")
-		_arguments -A "-*" \
-			'-o[Mount options]:mount options:_values -s , "option" {,no}{devices,exec,setuid} ro rw' \
-			'-O[Overlay mount]' \
-			'-v[Report mount progress]' \
-			- set1 \
-			':filesystem:_zfs_dataset -t fs' \
-			- set2 \
-			'-a[Mount all available ZFS filesystems]'
-		;;
+  zfs:project)
+    _arguments -A "-*" -S \
+      '(-r -C -k -p -s)-d[act on the directory project ID and inherit flag, not its children]' \
+      '(-d)-r[act on subdirectories recursively]' \
+      '(-0 -c -d -s)-C[clear project inherit flag and/or ID on the file(s) or directories]' \
+      '(-0 -c -d -p -s)-k[keep the project ID unchanged]' \
+      '(-k -C -s)-c[check project ID and inherit flag on the file(s) or directories]' \
+      '(-k -C -s)-0[print file name with a trailing NUL instead of newline]' \
+      '(-k)-p+[specify project ID]:project ID' \
+      '(-0 -c -k -C)-s[set project inherit flag on the given file(s) or directories]' \
+      '*:file:_files'
+  ;;
 
-	("unmount")
-		_arguments -A "-*" \
-			- set1 \
-			'-f[Force unmount]' \
-			':filesystem:_zfs_dataset -t fs -t mtpt' \
-			- set2 \
-			'-a[Unmount all ZFS filesystems]'
-		;;
+  zfs:mount)
+    [[ $OSTYPE != freebsd* ]] && args=( '-O[overlay mount]' )
+    [[ $implementation = openzfs ]] && args+=(
+    '-l[load keys for encrypted filesystems as they are being mounted]'
+    )
+    _arguments -A "-*" -S $args \
+      '-o+[specify temporary file system options]: :_values -s , "option" {,no}{atime,dev,exec,relatime,suid,xattr} ro rw' \
+      '-v[report mount progress]' \
+      '-f[force mount]' \
+      '(:)-a[mount all available ZFS filesystems]' \
+      '(-a):filesystem:_zfs_dataset -t fs'
+  ;;
 
-	("share")
-		_arguments -A "-*" \
-			- set1 \
-			'-a[Share all available ZFS filesystems]' \
-			- set2 \
-			'-r[Share filesystems recursively]' \
-			':filesystem:_zfs_dataset -t fs' \
-			- set3 \
-			'*-o[Create a share with these properties]:property:_values -w "share properties" $share_rw_properties' \
-			'-u[Create a share without sharing it]' \
-			':filesystem:_zfs_dataset -t fs' \
-			- set4 \
-			':filesystem:_zfs_dataset -t fs -t mtpt -t share'
-		;;
+  zfs:u(|n)mount)
+    [[ $implementation = openzfs ]] && args+=(
+      '-u[unload keys for any unmounted encryption roots]'
+    )
+    _arguments -A "-*" -S $args \
+      '-f[force unmount]' \
+      '(:)-a[unmount all ZFS filesystems]' \
+      '(-a):dataset or mountpoint:_zfs_dataset -t fs -t mtpt'
+  ;;
 
-	("unshare")
-		_arguments -A "-*" \
-			- set1 \
-			'-a[Unshare all shared ZFS filesystems]' \
-			- set2 \
-			'-r[Unshare filesystems recursively]' \
-			':filesystem:_zfs_dataset -t fs' \
-			- set3 \
-			':filesystem:_zfs_dataset -t fs -t mtpt -t share'
-		;;
+  zfs:share)
+    [[ $implementation = solaris ]] && args=(
+      - set2 \
+      '-r[share filesystems recursively]' \
+      ':dataset:_zfs_dataset -t fs' \
+      - set3 \
+      '*-o+[create a share with specified properties]: :_values -w "share properties" $share_rw_properties' \
+      '-u[create a share without sharing it]' \
+      ':dataset:_zfs_dataset -t fs' \
+    )
+    _arguments -A "-*" -S \
+      - set1 \
+      '-a[share all available ZFS filesystems]' \
+      $args \
+      - set4 \
+      ':dataset or mountpoint:_zfs_dataset -t fs -t mtpt -t share'
+  ;;
 
-	("send")
-		_arguments -A "-*" \
-			'-b' \
-			'-i[Generate an incremental stream]:snapshot:_zfs_dataset -t snap' \
-			'-D[Perform dedup processing]' \
-			'-p[Send properties]' \
-			'-v[Verbose]' \
-			- set1 \
-			'-I[Generate an incremental stream with intermediary snapshots]:snapshot:_zfs_dataset -t snap' \
-			'-R[Generate a replication stream package]' \
-			':snapshot:_zfs_dataset -t snap' \
-			- set2 \
-			'-c[Create a self-contained stream]' \
-			'-r[Generate a recursive stream package]' \
-			':snapshot:_zfs_dataset -t snap'
-		;;
+  zfs:unshare)
+    [[ $implementation = solaris ]] && args=(
+      - set2
+      '-r[unshare filesystems recursively]'
+      ':filesystem:_zfs_dataset -t fs'
+    )
+    _arguments -A "-*" -S $args \
+      - set1 \
+      '-a[unshare all shared ZFS filesystems]' \
+      - set3 \
+      ':filesystem:_zfs_dataset -t fs -t mtpt -t share'
+  ;;
 
-	("receive")
-		_arguments -A "-*" \
-			'-v[Verbose]' \
-			'-n[Do not receive the stream]' \
-			'-F[Force a rollback if necessary]' \
-			'-u[Filesystem is not mounted]' \
-			'-o[Include property change in the stream]::' \
-			'-x[Exclude property change from the stream]:property:' \
-			- set1 \
-			':filesystem/volume/snapshot:_zfs_dataset' \
-			- set2 \
-			'(-e)-d[Set path prefix from stream, excluding only pool name]' \
-			'(-d)-e[Set path prefix from stream, using last path element]' \
-			'-:filesystem:_zfs_dataset -t fs'
-		;;
+  zfs:send)
+    if [[ $implementation = openzfs ]]; then
+      args=(
+        '(-L --large-block)'{-L,--large-block}'[generate a stream which may contain blocks larger than 128KB]'
+        '(-P --parsable)'{-P,--parsable}'[print machine-parsable verbose information about the stream generated]'
+        '(-e --embed)'{-e,--embed}'[more compact stream for blocks stored with the embedded_data feature]'
+        '(-c --compressed)'{-c,--compressed}'[more compact stream for compressed blocks]'
+        '(-h --holds)'{-h,--holds}'[send snapshot holds]'
+        '-V[set the process title to a per-second report of how much data has been send]'
+        '-t[create a send stream that resumes an interrupted receive]:resume token'
+        '(-w --raw)'{-w,--raw}'[keep encrypted data exactly as it exists on disk]'
+        - redact
+        '(-h -V -t -w --raw)--redact[generate a redacted send stream]'
+        - saved
+        '(-S --saved)'{-S,--saved}'[generate stream from partially received dataset]'
+      )
+    else
+      args=(
+        '-w+[send compressed filesystem blocks as compressed in the stream]:compression:(compress none)'
+        '-m+[limit amount of memory used by deduplication processing]: :_numbers -u bytes "memory size" K M G'
+        '-s+[set stream options]:token:(streamsize check nocheck memsize)'
+        '-C[read a receive checkpoint from stdin]'
+        '-c[create a self-contained stream]'
+        '(-R)-r[generate a recursive stream package]'
+      )
+    fi
+    _arguments -A "-*" -S \
+      '-b[send only received property values]' \
+      '(-I)-i[generate an incremental stream]:snapshot:_zfs_dataset -t snap' \
+      '-D[perform dedup processing]' \
+      "-n[don't send the stream]" \
+      '-p[send properties]' \
+      '-v[verbose]' \
+      '(-i)-I[generate an incremental stream with intermediary snapshots]:snapshot:_zfs_dataset -t snap' \
+      '(-r)-R[generate a replication stream package]' \
+      ':snapshot:_zfs_dataset -t snap -t bookmark' \
+      $args
+  ;;
 
-	("allow")
-		_arguments -A "-*" \
-			'(1 -g -e -c -s)-u[delegate to user]:user:_users' \
-			'(1 -u -e -c -s)-g[delegate to group]:group:_groups' \
-			'(1 -g -u -c -s)-e[delegate to everyone]' \
-			'(1 -u -g -e -l -d -s)-c[set permissions for newly-created descendant filesystems]' \
-			'(1 -u -g -e -l -d -c)-s[define or modify permission sets]:permission set' \
-			'(1 -c -s)-l[allow for named dataset]' \
-			'(1 -c -s)-d[allow for descendent datasets]' \
-			'1::filesystem/volume:_zfs_dataset -t fs -t vol' \
-			':permissions or sets:_values -s , "permission or set" $delegatable_perms' \
-			':filesystem/volume:_zfs_dataset -t fs -t vol' \
-		;;
+  zfs:redact)
+    _arguments \
+      ':snapshot:_zfs_dataset -t snap' \
+      ':bookmark:_zfs_dataset -t bookmark' \
+      ':redaction snapshot:_zfs_dataset -t snap'
+  ;;
 
-	("unallow")
-		_arguments -A "-*" \
-			'-r[Recursive removal]' \
-			- set1 \
-			'-s[Remove permissions from or delete a permission set]:permission set:' \
-			':permissions or sets:_values -s , "permission or set" $delegatable_perms' \
-			':filesystem/volume:_zfs_dataset -t fs -t vol' \
-			- set2 \
-			'(-g)-u[User]:user:_users' \
-			'(-u)-g[Group]:group:_groups' \
-			'-l[Allow for named dataset]' \
-			'-d[Allow for descendent datasets]' \
-			':permissions or sets:_values -s , "permission or set" $delegatable_perms' \
-			':filesystem/volume:_zfs_dataset -t fs -t vol' \
-			- set3 \
-			'-e[Everyone]' \
-			'-l[Allow for named dataset]' \
-			'-d[Allow for descendent datasets]' \
-			':permissions or sets:_values -s , "permission or set" $delegatable_perms' \
-			':filesystem/volume:_zfs_dataset -t fs -t vol' \
-			- set4 \
-			'-c[Create-time permissions]' \
-			':permissions or sets:_values -s , "permission or set" $delegatable_perms' \
-			':filesystem/volume:_zfs_dataset -t fs -t vol'
-		;;
+  zfs:(receive|recv))
+    if [[ $implementation = openzfs ]]; then
+      args=(
+        '-h[skip the receive of holds]'
+        '-s[if the receive is interrupted, save the partially received state]'
+        '(- set2)-A[abort an interrupted zfs recv -s, deleting its saved partially received state]'
+      )
+      [[ $OSTYPE != linux* ]] && args+=(
+        '-M[force an unmount of the file system while receiving a snapshot]'
+      )
+    else
+      args=( '(-)-C[write a receive checkpoint to stdout]' )
+    fi
+    _arguments -A "-*" -S $args \
+      '-v[verbose]' \
+      "-n[don't receive the stream]" \
+      '-F[force a rollback if necessary]' \
+      '-u[filesystem is not mounted]' \
+      '-o[include property change in the stream]:property' \
+      '-x[exclude property change from the stream]:property' \
+      - set1 \
+      ':filesystem/volume/snapshot:_zfs_dataset' \
+      - set2 \
+      '(-e)-d[set path prefix from stream, excluding only pool name]' \
+      '(-d)-e[set path prefix from stream, using last path element]' \
+      ':filesystem:_zfs_dataset -t fs'
+  ;;
 
-	("upgrade")
-		_arguments -A "-*" \
-			- set1 \
-			'-v[Verbose]' \
-			- set2 \
-			'-a[Upgrade all filesystems on all pools]' \
-			'-r[Upgrade descendent filesystems, too]' \
-			'-V[Upgrade to specified version]:version:(1 2)' \
-			- set3 \
-			'-r[Upgrade descendent filesystems, too]' \
-			'-V[Upgrade to specified version]:version:(1 2)' \
-			':filesystem:_zfs_dataset -t fs'
-		;;
+  zfs:allow)
+    _arguments -C -A "-*" -S \
+      '(-g -e -c -s)-u[delegate to user]' \
+      '(-u -e -c -s)-g[delegate to group]' \
+      '(1 -g -u -c -s)-e[delegate to everyone]' \
+      '(1 -u -g -e -l -d -s)-c[set permissions for newly-created descendant filesystems]' \
+      '(-u -g -e -l -d -c)-s[define or modify permission sets]:permission set' \
+      '(-c -s)-l[allow for named dataset]' \
+      '(-c -s)-d[allow for descendent datasets]' \
+      '1: :->first' \
+      ':permission list:_values -s , "permission or set" $delegatable_perms' \
+      ':filesystem/volume:_zfs_dataset -t fs -t vol'
 
-	("hold")
-		_arguments -A "-*" \
-			'-r[Apply hold recursively]' \
-			':tag:' \
-			':snapshot:_zfs_dataset -t snap'
-		;;
+    if [[ -n $state ]]; then
+      case $opt_args[(I)-[ugs]] in
+        ^-[ug]) alts+=( 'permission-sets: :_guard "(|@*)" "permission set"' ) ;|
+        ^-[gs]) alts+=( 'users:user:_users' ) ;|
+        ^-[us]) alts+=( 'groups:group:_groups' ) ;|
+        '')
+          alts+=(
+            'all:everyone:(everyone)'
+            'filesystems:filesystem/volume:_zfs_dataset -t fs -t vol'
+          )
+        ;;
+      esac
+      _alternative $alts
+    fi
+  ;;
 
-	("holds")
-		_arguments -A "-*" \
-			'-r[List holds recursively]' \
-			':snapshot:_zfs_dataset -t snap'
-		;;
+  zfs:unallow)
+    _arguments -A "-*" -S \
+      '-r[recursive removal]' \
+      '(-e -g -s -c)-u[user]' \
+      '(-e -u -s -c)-g[group]' \
+      '(1 -g -u -s -c)-e[everyone]' \
+      '(1 -u -g -e -s -l -d)-c[create-time permissions]' \
+      '(-e -u -g -c)-s[remove permissions from or delete a permission set]:permission set' \
+      '(-c -s)-l[allow for named dataset]' \
+      '(-c -s)-d[allow for descendent datasets]' \
+      '1: :->first' \
+      '::permissions or sets:_values -s , "permission or set" $delegatable_perms' \
+      ':filesystem/volume:_zfs_dataset -t fs -t vol'
 
-	("release")
-		_arguments -A "-*" \
-			'-r[Release holds recursively]' \
-			':tag:' \
-			':snapshot:_zfs_dataset -t snap'
-		;;
+    if [[ -n $state ]]; then
+      case $opt_args[(I)-[ugs]] in
+        ^-[ug]) alts+=( 'permission-sets: :_guard "(|@*)" "permission set"' ) ;|
+        ^-[gs]) alts+=( 'users:user:_users' ) ;|
+        ^-[us]) alts+=( 'groups:group:_groups' ) ;|
+        '') alts+=( 'all:everyone:(everyone)' ) ;;
+      esac
+      _alternative $alts
+    fi
+  ;;
 
-	("diff")
-		_arguments -A "-*" \
-			'-F[Add column for filetype character]' \
-			'-H[Parseable output]' \
-			'-e[Only show new and changed files]' \
-			'*-o[Show fields]:field:_values "field" $difffields' \
-			'-t[Add column for ctime]' \
-			- set1 \
-			':snapshot:_zfs_dataset -t snap' \
-			':snapshot or filesystem:_zfs_dataset -t snap -t fs' \
-			- set2 \
-			'-E[Show difference from empty]' \
-			':snapshot or filesystem:_zfs_dataset -t snap -t fs'
-		;;
+  zfs:hold)
+    _arguments -A "-*" -S \
+      '-r[apply hold recursively]' \
+      ':tag' \
+      ':snapshot:_zfs_dataset -t snap'
+  ;;
 
-	("key")
-		_arguments -A "-*" \
-			- set1 \
-			'-a[Apply to all datasets in all pools]' \
-			'(-u -K -f)-l[Load the encryption key]' \
-			'(-l -K)-u[Unload the encryption key]' \
-			'(-l -u -f)-K[Create a new data encryption key]' \
-			'(-l -K)-f[Unmount the dataset before unloading the encryption key]' \
-			'-r[Apply recursively]' \
-			':filesystem or volume:_zfs_dataset -t fs -t vol' \
-			- set2 \
-			'-c[Change the encryption key]' \
-			'-o[Change a property]:property:_zfs_keysource_props' \
-			':filesystem or volume:_zfs_dataset -t fs -t vol'
-		;;
+  zfs:holds)
+    [[ $implementation = openzfs ]] && args=(
+      '-H[suppress printing of headers, tab-delimit columns]'
+    )
+    [[ $OSTYPE = freebsd<-12>.* ]] && args+=(
+      # features were lost with the openzfs rebase
+      '-p[use exact (parsable) numeric output]'
+      '(-r)-d+[depth]:value'
+    )
+    _arguments -A "-*" -S $args \
+      '(-d)-r[list holds recursively]' \
+      ':snapshot:_zfs_dataset -t snap'
+  ;;
 
-	("jail"|"unjail")
-		_arguments \
-			'1: : _jails' \
-			'2:filesystem:_zfs_dataset -t fs'
-		;;
+  zfs:release)
+    _arguments -A "-*" -S \
+      '-r[release holds recursively]' \
+      ':tag' \
+      ':snapshot:_zfs_dataset -t snap'
+  ;;
 
-	("help")
-		_arguments -A "-*" \
-			- set1 \
-			':command:($subcmds $delegatable_perms $ro_properties ${rw_properties%%:*} properties)' \
-			- set2 \
-			'-l[Display property information]' \
-			': :(properties)'
-		;;
+  zfs:diff)
+    [[ $implementation = solaris ]] && args=(
+      '(-E)-e[only show new and changed files, no deleted]'
+      '*-o+[show specified fields]:field:_values "field" $difffields'
+      '-q[silence warnings for missing snapshots on recursive datasets]'
+      '-N[enumerate new child datasets (with -r)]'
+      '(1 -e)-E[show difference from empty]'
+    )
+    _arguments -A "-*" -S $args \
+      '-F[add column for filetype character, similar to ls(1)]' \
+      '-H[suppress printing of headers and arrows, tab-delimit columns]' \
+      '-t[add column for ctime]' \
+      '(-E)1:snapshot:_zfs_dataset -t snap' \
+      '2:snapshot or filesystem:_zfs_dataset -t snap -t fs'
+  ;;
 
-	(*)
-		_message "unknown zfs subcommand: $service"
-		;;
-	esac
-}
+  zfs:wait)
+    _arguments -A "-*" -S \
+      '-t[specify background activity]:activity:(deleteq)' \
+      ':filesystem:_zfs_dataset'
+  ;;
 
-_zfs "$@"
+  zfs:key)
+    _arguments -C -A "-*" -S \
+      '-t+[only apply to given dataset type]: :_values -s , "dataset type" $ds_types' \
+      '(-u -c -K -f -o)-l[load the encryption key]' \
+      "(-u -c -K -f -o)-M[don't mount file systems after loading their keys]" \
+      "(-u -c -K -f -o)-S[don't share file systems after loading their keys]" \
+      '(-l -c -K -o -M -S)-u[unload the encryption key]' \
+      '(-l -c -K -o -M -S)-f[force unmount the dataset before unloading the encryption key]' \
+      '(-l -u -K -f -M -S)-c[change the encryption key]' \
+      '(-l -u -K -f -M -S)-o+[change a property]:property:->keysources' \
+      '(-l -c -u -f -o -M -S)-K[create a new data encryption key]' \
+      '(1 -r)-a[apply to all datasets in all pools]' \
+      '(-a)-r[apply recursively]' \
+      ':filesystem or volume:_zfs_dataset -t fs -t vol'
+  ;;
+
+  zfs:load-key)
+    _arguments -A "-*" -S \
+      "-L+[specify location of user's encryption key]:key location [prompt]:_files -P file\:// -W /" \
+      '(:)-a[load keys for all encryption roots in all imported pools]' \
+      '-n[do a dry-run, simply check that the provided key is correct]' \
+      '-r[load keys for datasets recursively]' \
+      '(-a):filesystem or volume:_zfs_dataset -t fs -t vol'
+  ;;
+
+  zfs:unload-key)
+    _arguments -A "-*" -S \
+      '(:)-a[unload keys for all encryption roots in all imported pools]' \
+      '-r[unload keys for datasets recursively]' \
+      '(-a):filesystem or volume:_zfs_dataset -t fs -t vol'
+  ;;
+
+  zfs:change-key)
+    _arguments -A "-*" -S \
+      '(-o)-i[make filesystem inherit key from its parent]' \
+      '-l[ensure key is loaded before attempting to change it]' \
+      '(-i)*-o+[change encryption key property]: :_values -s , "property" $key_properties' \
+      ':filesystem or volume:_zfs_dataset -t fs -t vol'
+  ;;
+
+  zfs:jail|zfs:unjail)
+    _arguments \
+      '1: : _jails' \
+      '2:filesystem:_zfs_dataset -t fs'
+  ;;
+
+  zfs:help)
+    _arguments -A "-*" -S \
+      - set1 \
+      ':command:($subcmds $delegatable_perms $ro_ds_props ${rw_ds_props%%:*} properties)' \
+      - set2 \
+      '(2)-l[display property information]' \
+      ':help topic:(property)' \
+      ':property:($delegatable_perms $ro_ds_props ${rw_ds_props%%:*})'
+  ;;
+
+  zpool:help)
+    _arguments -A "-*" -S \
+      - commands \
+      ':command:($subcmds)' \
+      - properties \
+      '(2)-l[display property information]' \
+      ':help topic:(property)' \
+      ':property:(${po_propnames%%\[*})'
+  ;;
+
+  zpool:add)
+    if [[ $implementation = openzfs ]]; then
+      args=(
+        '-g[display vdev, GUIDs instead of the normal device names]'
+        '-L[display real paths for vdevs resolving all symbolic links]'
+        '-o+[set given pool properties]: :_values -s , "property" "${(@M)ci_po_props\:#ashift*}"' \
+        '-P[display real paths for vdevs instead of only the last component of the path]'
+      )
+    elif [[ $implementation = solaris ]]; then
+      args=( '-l[display configuration in /dev/chassis location form]' )
+    fi
+    _arguments -A "-*" -S $args \
+      '-f[force use of in-use devices]' \
+      '-n[display configuration without modifying pool]' \
+      ':pool:_zfs_pool' \
+      '*:virtual device:->virtual-devices'
+  ;;
+
+  zpool:attach)
+    if [[ $implementation = openzfs ]]; then
+      args=(
+        '-w[wait until new device has finished resilvering before returning]'
+        '-s[reconstruct sequentially to restore redundancy as quickly as possible]'
+        '-o+[set given pool properties]: :_values -s , "property" "${(@M)ci_po_props\:#ashift*}"'
+      )
+    fi
+    _arguments -A "-*" -S $args \
+      '-f[force attach, even if in use]' \
+      ':pool:_zfs_pool' \
+      ':virtual device:->pool-devices' \
+      ':virtual device:->disk-devices'
+  ;;
+
+  zpool:checkpoint)
+    _arguments -A "-*" -S \
+      '(-d --discard)'{-d,--discard}'[discard an existing checkpoint from the pool]' \
+      '(-w --wait)'{-w,--wait}'[wait until the checkpoint has finished being discarded before returning]' \
+      ':pool:_zfs_pool'
+  ;;
+
+  zpool:clear)
+    [[ $implementation = solaris ]] && args=(
+      '-f[ignore fmadm acquit and fmadm repair failures]'
+    )
+    _arguments -C -A "-*" -S $args \
+      '-F[discard transactions to allow pool opening]' \
+      '-n[with -F, check if discarding transactions would work]' \
+      '-X[(undocumented) extreme rewind of transactions]' \
+      ':pool:_zfs_pool' \
+      '*:virtual device:->pool-devices'
+  ;;
+
+  zpool:create)
+    if [[ $implementation = openzfs ]]; then
+      args=(
+        "-d[don't enable any features on the new pool]"
+      )
+    else
+      args=(
+        '-B[create EFI boot partition on whole disks]'
+        '-l[display configuration in /dev/chassis location form]'
+        "-N[create pool but don't mount or share]"
+      )
+    fi
+    _arguments -C -A "-*" -S $args \
+      '-o+[set pool property at creation time]:property:->newpool-properties' \
+      '-O+[set dataset property at creation time]:property:->create-properties' \
+      '-f[force use of in-use devices]' \
+      '-n[display configuration without creating pool]' \
+      '-R+[use alternate root]:alternate root:_directories' \
+      '-m+[set mountpoint for root dataset]:mountpoint' \
+      '-t+[use a temporary pool name]:pool name' \
+      ':pool :_guard "^-*" "pool name"' \
+      '*: :->virtual-devices'
+  ;;
+
+  zpool:destroy)
+    _arguments -A "-*" -S \
+      '-f[force active datasets to be unmounted]' \
+      ':pool:_zfs_pool'
+  ;;
+
+  zpool:detach)
+    _arguments -C \
+      ':pool:_zfs_pool' \
+      ':virtual device:->pool-devices'
+  ;;
+
+  zpool:events)
+    _arguments -A "-*" -S \
+      '(- 1)-c[clear all previous events]' \
+      '-f[follow mode - continue running, showing new events]' \
+      '-H[suppress headers and tab-delimit fields]' \
+      '-v[print the entire payload for each event]' \
+      '(-c)1:pool:_zfs_pool'
+  ;;
+
+  zpool:export)
+    [[ $implementation = openzfs ]] && args=( '(*)-a[export all pools]' )
+    _arguments -A "-*" -S $args \
+      '-f[forcefully unmount all datasets]' \
+      '*:pool:_zfs_pool'
+  ;;
+
+  zpool:get)
+    [[ $implementation = solaris ]] && args=(
+      '-s+[specify sources to display]: :_values -s "source" local default none'
+    )
+    _arguments -A "-*" -S $args \
+      '-H[suppress headers and tab-delimit fields]' \
+      '-p[display numbers in parseable (exact) values]' \
+      '-o+[specify fields to display]: : _values -s , field name property value source' \
+      ':property:_values -s , "property" $po_propnames' \
+      '*:pool:_zfs_pool'
+  ;;
+
+  zpool:history)
+    _arguments -A "-*" -S \
+      '-i[display internal events]' \
+      '-l[long format]' \
+      '*:pool:_zfs_pool'
+  ;;
+
+  zpool:import)
+    # TODO: -o should complete mount options, too
+    if [[ $implementation = openzfs ]]; then
+      args=(
+        '-t[new pool name is temporary]'
+        '-l[request encryption keys for all encrypted datasets]'
+        '--rewind-to-checkpoint[rewind pool to the checkpointed state]'
+        '-s[scan using the default search path]'
+        '(-F -X)-T[specify the txg to use for rollback]'
+      )
+    else
+      args=(
+        '(-a)-t+[use a temporary pool name]:pool name'
+        '-l[display configuration in /dev/chassis location form]'
+      )
+    fi
+    _arguments -C -A "-*" -S $args \
+      '(1 2 -t)-a[search for and import all pools found]' \
+      '-D[destroyed pools only]' \
+      '(-d)*-c+[use cache file]:cache file:_files' \
+      '(-c -D)*-d+[search for devices or files in directory]:directory:_files -/' \
+      '-F[recovery mode: discard transactions if required]' \
+      '-X[(undocumented) extreme rewind of transactions]' \
+      '!-V' \
+      '-f[force import]' \
+      '-m[ignore missing log devices]' \
+      '-N[import pool without mounting any filesystems]' \
+      "-n[with -F; don't perform input]" \
+      '-R+[specify alternate root]:alternate root:_files -/' \
+      '-o+[set pool or dataset property]:property:->import-properties' \
+      '1:pool name or id:_zfs_pool' \
+      '2::new pool name'
+  ;;
+
+  zpool:initialize)
+    _arguments -A "-*" -S \
+      '(-s --suspend -c --cancel)'{-c,--cancel}'[cancel initializing on specified devices]' \
+      '(-s --suspend -c --cancel)'{-s,--suspend}'[suspend initializing on specified devices]' \
+      '(-w --wait)'{-w,--wait}'[wait until devices have finished initializing before returning]' \
+      ':pool:_zfs_pool' \
+      '*:device:pool-devices'
+  ;;
+
+  zpool:iostat)
+    if [[ $implementation = openzfs ]]; then
+      args=(
+        '-c[run scripts on each vdev]:script:_files -W "($ZPOOL_SCRIPTS_PATH /etc/zfs/zpool.d ~/.zpool.d)"'
+        '-g[display vdev GUIDs instead of normal device names]'
+        '-H[suppress headers and tab-delimit fields]'
+        '-L[display real paths for vdevs resolving all symbolic links]'
+        '-n[print headers only once]'
+        '-p[display numbers in parsable (exact) values and times in nanoseconds]'
+        '-P[display full paths for vdevs instead of only the last component of the path]'
+        "-r[print request size histograms for the leaf vdev's IO]"
+        '-y[omit statistics since boot]'
+        '-w[display latency histograms]'
+        '-l[include average latency statistics]'
+        '-q[include active queue statistics]'
+      )
+    else
+      args=( '-l[display configuration in /dev/chassis location form]' )
+    fi
+    _arguments -A "-*" -S $args \
+      '-T+[display a timestamp]:format:((d\:standard u\:internal))' \
+      '-v[verbose statistics]' \
+      '*::pool:_zfs_pool' \
+      '::interval' \
+      '::count'
+  ;;
+
+  zpool:label)
+    _arguments -C -A "-*" -S \
+      '(-c)*-d+[specify path in which to search for devices or files]:path:_directories' \
+      '(-d)-c+[read configuration from specified cache file]:cache file:_files' \
+      '(-R)-C[clear ZFS metadata on an inactive pool or device]' \
+      '(-C)-R[recover ZFS metadata for a pool]' \
+      '1::pool:_zfs_pool' \
+      '2:device:->pool-devices'
+  ;;
+
+  zpool:labelclear)
+    _arguments -A "-*" -S \
+      '-f[treat exported or foreign devices as inactive]' \
+      '*:virtual device:_files'
+  ;;
+
+  zpool:list)
+    [[ $implementation = openzfs ]] && args=(
+      '-g[display vdev GUIDs instead of normal device names]'
+      '-L[display real paths for vdevs resolving all symbolic links]'
+      '-p[display numbers in parsable (exact) values]'
+      '-P[display full paths for vdevs instead of only the last component of the path]'
+      '-v[report usage statistics for individual vdevs within the pool]'
+    )
+    _arguments -A "-*" -S $args \
+      '-H[suppress headers and tab-delimit fields]' \
+      '-T+[display a timestamp]:format:((d\:standard u\:internal))' \
+      '-o+[specify fields to list]: :_values -s , "field" $po_propnames' \
+      '::pool:_zfs_pool'
+  ;;
+
+  zpool:monitor)
+    _arguments -A "-*" -S \
+      '-t+[specify provider]:provider:(send receive scrub resilver ddtmigrate destroy)' \
+      '-o+[specify fields]: :_values -s , field done other pctdone pool provider speed starttime tag timeleft timestmp total' \
+      '-T+[display a timestamp]:format:((d\:standard u\:internal))' \
+      '-p[use machine-parseable output format]' \
+      '1:pool:_zfs_pool' \
+      '2:interval' \
+      '3:count'
+  ;;
+
+  zpool:offline)
+    [[ $implementation = openzfs ]] && args=(
+      '-f[force disk into faulted state]'
+    )
+    _arguments -C -A "-*" -S $args \
+      '-t[offline until next reboot]' \
+      ':pool:_zfs_pool' \
+      '*:virtual device:->pool-devices'
+  ;;
+
+  zpool:online)
+    _arguments -C -A "-*" -S \
+      '-e[expand device to use all available space]' \
+      ':pool:_zfs_pool' \
+      '*:virtual device:->pool-devices'
+  ;;
+
+  zpool:reopen)
+    _arguments -A "-*" -S \
+      "-n[don't restart an in-progress scrub operation]" \
+      '1:pool:_zfs_pool'
+  ;;
+
+  zpool:reguid)
+    _zfs_pool
+  ;;
+
+  zpool:remove)
+    [[ $implementation = openzfs ]] && args=(
+      '(-s)-w[wait until removal has completed before returning]'
+    )
+    _arguments -C -A "-*" -S $args \
+      "(-s)-n[don't perform the removal, display mapping table memory use]" \
+      '(-s)-p[with -n, display numbers in parseable (exact) values]' \
+      '(- *)-s[stop and cancel an in-progress removal]' \
+      '1:pool:_zfs_pool' \
+      '*:device:->pool-devices'
+  ;;
+
+  zpool:replace)
+    [[ $implementation = openzfs ]] && args=(
+      '-w[wait until replacement has completed before returning]'
+      '-s[reconstruct sequentially to restore redundancy as quickly as possible]'
+      '-o+[set given pool properties]: :_values -s , "property" "${(@M)ci_po_props\:#ashift*}"'
+    )
+    _arguments -A "-*" -S $args \
+      '-f[force attach, even if in use]' \
+      ':pool:_zfs_pool' \
+      ':virtual device:_files' \
+      '::virtual device:_files'
+  ;;
+
+  zpool:(resilver|sync))
+    _arguments \
+      '*:pool:_zfs_pool'
+  ;;
+
+  zpool:scrub)
+    [[ $implementation = openzfs ]] && args=(
+      '(-s)-p[pause scrubbing]'
+      '-w[wait until scrub has completed before returning]'
+    )
+    _arguments -A "-*" -S $args \
+      '(-p)-s[stop scrubbing]' \
+      '*:pool:_zfs_pool'
+  ;;
+
+  zpool:set)
+    _arguments -C -A "-*" -S \
+      ':property:->set-pool-properties' \
+      '*:pool:_zfs_pool'
+  ;;
+
+  zpool:split)
+    if [[ $implementation = solaris ]]; then
+      args=( '-l[display configuration in /dev/chassis location form]' )
+    else
+      args=(
+        '-g[display vdev GUIDs instead of normal device names]'
+        '-L[display real paths for vdevs resolving all symbolic links]'
+        '-l[request encryption keys for encrypted datasets]'
+        '-P[display full paths for vdevs instead of only the last component of the path]'
+      )
+    fi
+    _arguments -C -A "-*" -S $args \
+      '-R+[specify alternate root]:alternate root:_files -/' \
+      '-n[display configuration without splitting]' \
+      '-o+[set pool or dataset property]:property:->import-properties' \
+      ':pool name or id:_zfs_pool' \
+      ':new pool name' \
+      '*:virtual device:->pool-devices'
+  ;;
+
+  zpool:status)
+    if [[ $implementation = openzfs ]]; then
+      args=(
+        '-D[display a histogram of deduplication statistics]'
+        '-c[run scripts on each vdev]:script:_files -W "($ZPOOL_SCRIPTS_PATH /etc/zfs/zpool.d ~/.zpool.d)"'
+        '-i[display vdev initialization status]'
+        '-g[display vdev GUIDs instead of the normal device names]'
+        '-L[display real paths for vdevs resolving all symbolic links]'
+        '-p[display numbers in parsable (exact) values and times in nanoseconds]'
+        '-P[display full paths for vdevs instead of only the last component of the path]'
+        '-s[display the number of leaf VDEV slow IOs]'
+        '-t[display vdev TRIM status]'
+      )
+    else
+      args=( '-l[display configuration in /dev/chassis location form]' )
+    fi
+    _arguments -A "-*" -S $args\
+      '-v[verbose information]' \
+      '-x[show only unhealthy pools]' \
+      '-T+[display a timestamp]:format:((d\:standard u\:internal))' \
+      '*::pool:_zfs_pool' \
+      ':: :_guard "[0-9]#" interval' \
+      ':: :_guard "[0-9]#" count'
+  ;;
+
+  zpool:trim)
+    _arguments -C -A "-*" -S \
+      '(-d --secure)'{-d,--secure}'[initiate a secure TRIM]' \
+      '(-r --rate)'{-r,--rate}'[set rate at which the TRIM operation progresses]:rate (bytes per second)' \
+      '(-c --cancel)'{-c,--cancel}'[cancel trimming]' \
+      '(-s --suspend)'{-s,--suspend}'[suspend trimming]' \
+      '(-w --wait)'{-w,--wait}'[wait until devices are done being trimmed]' \
+      '1:pool:_zfs_pool' \
+      '*:device:->pool-devices'
+  ;;
+
+  zpool:upgrade)
+    _arguments -A "-*" -S \
+      '(- *)-v[display ZFS versions and descriptions]'
+      "(-v)-V+[upgrade to given version]:version" \
+      '(-v *)-a[upgrade all pools]' \
+      '(-a -v)*:pool:_zfs_pool'
+  ;;
+
+  zpool:wait)
+    _arguments -A "-*" -S \
+      '-H[suppress printing of headers, tab-delimit columns]' \
+      '-P[use exact (parsable) numeric output]' \
+      '-t+[specify background activity]: : _values -s , activity discard free initialize replace remove resilver scrub trim' \
+      '-T+[display a timestamp]:format:((d\:standard u\:internal))' \
+      ':pool:_zfs_pool' \
+      ':interval'
+  ;;
+
+  *)
+    _default
+  ;;
+esac
+
+while (( $#state )); do
+  curstate=$state
+  state=()
+  case $curstate in
+    virtual-devices)
+      local -a vdevtypes
+      vdevtypes=( mirror raidz{,1,2,3} spare log cache )
+      if [[ $implementation = openzfs ]]; then
+        vdevtypes+=( draid{,1,2,3} dedup special )
+      else
+        vdevtypes+=( meta )
+      fi
+      # cache can't be a mirror
+      [[ $words[CURRENT-1] != cache ]] && alts=(
+        'vdev-types:vdev type:compadd -a vdevtypes'
+      )
+      [[ -prefix / ]] || alts+=(
+        'disk-vdevs:disk vdev:_files -g "*(-%)" -W /dev'
+      )
+      _alternative $alts 'file-vdevs:file vdev:_files -W / -P /'
+    ;;
+
+    pool-devices)
+      local -a devices
+      devices=( ${${${(M)${(f)"$(_call_program devices zpool status $line[1])"}:#$'\t' *}##[[:blank:]]#}%%[[:blank:]]*} )
+      if (( $#devices )); then
+        _description devices expl "$state_descr"
+        compadd "$expl[@]" -a devices
+        break
+      fi
+    ;& # fall-through if we found none
+
+    disk-devices)
+      [[ -prefix / ]] || alts=(
+        'disk-vdevs:disk vdev:_files -g "*(-%)" -W /dev'
+      )
+      _alternative $alts 'file-vdevs:file vdev:_files -W / -P /'
+    ;;
+
+    keysources)
+      local -a suf
+
+      compset -S ",*" || suf=(-S ,)
+      if compset -P 1 "*,"; then
+        _alternative \
+          'zfs-keylocator-prompt:"prompt" locator:(prompt)' \
+          'zfs-keylocator-file:file locator:_files' \
+          'zfs-keylocator-pkcs11: : _message -e zfs-keylocator-pkcs11 "PKCS#11 locator"' \
+          'zfs-keylocator-https: : _message -e zfs-keylocator-https "HTTPS URL locator"'
+      else
+        _description keysource-formats expl "keysource format"
+        compadd $suf -q "$expl[@]" "$@" raw hex passphrase
+      fi
+    ;;
+
+    quotas)
+      _alternative \
+        'sizes: :_numbers -M "m:{a-zA-Z}={A-Za-z}" -u bytes size :B {k,M,G,T,P,E,Z}{,B}' \
+        'properties:property:(none)'
+    ;;
+
+    import-properties) args=( $ci_ds_props $rw_ds_props $ci_po_props ) ;|
+    create-properties) args=( $ci_ds_props ) ;|
+    set-properties) args=( $rw_ds_props ) ;|
+    newpool-properties) args=( $rw_po_props $ci_po_props ) ;|
+    set-pool-properties) args=( $rw_po_props ) ;|
+
+    *-properties)
+      if compset -P 1 '(#m)*@'; then
+        if compset -P 1 '*='; then
+          case $MATCH in
+            *quota@) _alternative \
+              'sizes: :_numbers -M "m\:{a-zA-Z}={A-Za-z}" -u bytes size \:B {k,M,G,T,P,E,Z}{,B}' \
+              'properties:property:(none)'
+            ;;
+          esac
+        else
+          case $MATCH in
+            user*@) _users -S = ;;
+            group*@) _groups -S = ;;
+            project*@) _message -e projects project ;;
+          esac
+        fi
+      else
+        _wanted values expl "$state_descr" compadd -S@ ${${(M)args:#*@}%@}
+        _values -C "$state_descr" ${args:#*@}
+      fi
+    ;;
+  esac
+done
+
+[[ nm -ne "$compstate[nmatches]" ]]
diff --git a/Completion/Unix/Command/_zpool b/Completion/Unix/Command/_zpool
deleted file mode 100644
index d9c2caa52..000000000
--- a/Completion/Unix/Command/_zpool
+++ /dev/null
@@ -1,311 +0,0 @@
-#compdef zpool
-# Synced with the S11U1 man page
-
-_zpool() {
-	local context state line expl implementation
-	local -a subcmds fields ro_props rw_props versions create_properties_dataset
-
-	_pick_variant -r implementation -c 'zpool upgrade -v' openzfs='This system supports ZFS pool feature flags' solaris
-
-	subcmds=(
-		create destroy add remove list iostat status online
-		offline clear attach detach replace scrub import export
-		upgrade history get set split help
-	)
-
-	if [[ $implementation = openzfs ]] && [[ $OSTYPE != solaris* ]]; then
-		subcmds+=( labelclear initialize )
-	fi
-
-	versions=(
-		${${${(M)"${(f)$(_call_program versions zpool upgrade -v)}":#[[:space:]]#<->*}##[[:space:]]}%%[[:space:]]*}
-	)
-
-	ro_props=(
-		"all[All properties]"
-		"allocated[Space allocated]"
-		"capacity[Space used (percentage)]"
-		"dedupratio[Deduplication ratio]"
-		"free[Space unallocated]"
-		"guid[Unique identifier]"
-		"health[Health status]"
-		"size[Total size]"
-	)
-
-	rw_props=(
-		"altroot[Alternate root directory]:value:"
-		"autoexpand[Automatic pool expansion]:value:(on off)"
-		"autoreplace[Automatic device replacement]:value:(on off)"
-		"bootfs[Default bootable dataset]:value:"
-		"cachefile[Pool configuration cache file location]:value:"
-		"dedupditto[Threshold for number of copies]:value:"
-		"delegation[Delegated administration]:value:(on off)"
-		"failmode[Failure-mode behavior]:value:(wait continue panic)"
-		"listshares[Show shares in 'zfs list']:value:(on off)"
-		"listsnaps[Show snapshots in 'zfs list']:value:(on off)"
-		"readonly[Controls whether the pool can be modified]:value:(on off)"
-		"version[Pool version]:version:($versions)"
-	)
-
-	fields=( ${ro_props%%:*} ${rw_props%%:*} )
-
-	create_properties_dataset=(
-		"aclinherit:value:(discard noallow restricted passthrough passthrough-x)"
-		"aclmode:value:(discard mask passthrough)"
-		"atime:value:(on off)"
-		"canmount:value:(on off noauto)"
-		"checksum:value:(on off fletcher2 fletcher4 sha256 sha256+mac)"
-		"compression:value:(on off lzjb gzip gzip-{1..9} zle)"
-		"copies:value:(1 2 3)"
-		"dedup:value:(on off verify sha256 sha256,verify)"
-		"devices:value:(on off)"
-		"encryption:value:(off on aes128-ccm aes-192-ccm aes-256-ccm aes-128-gcm aes-192-gcm aes-256-gcm)"
-		"exec:value:(on off)"
-		"groupquota@:value:" # TODO: complete group=size|none
-		"keysource:value:_zfs_keysource_props"
-		"logbias:value:(latency throughput)"
-		"mlslabel:value:(none)" # TODO: list sensitivity labels
-		"mountpoint:path, 'legacy', or 'none':{if [[ -prefix /* ]]; then _path_files -/; else _wanted mountpoints expl 'mountpoint (type \"/\" to start completing paths)' compadd legacy none; fi}"
-		"nbmand:value:(on off)"
-		"primarycache:value:(all none metadata)"
-		"quota:number or 'none':{if [[ -prefix [0-9]## ]]; then _message -e 'number'; elif [[ $PREFIX == quota= ]]; then _wanted none expl 'number or none' compadd none; else _wanted none expl 'quota' compadd none; fi}"
-		"readonly:value:(on off)"
-		"recordsize:value:(512 1K 2K 4K 8K 16K 32K 64K 128K 256K 512K 1M)"
-		"refquota:number or 'none':{if [[ -prefix [0-9]## ]]; then _message -e 'number'; elif [[ $PREFIX == refquota= ]]; then _wanted none expl 'number or none' compadd none; else _wanted none expl 'refquota' compadd none; fi}"
-		"refreservation:number or 'none':{if [[ -prefix [0-9]## ]]; then _message -e 'number'; elif [[ $PREFIX == refreservation= ]]; then _wanted none expl 'number or none' compadd none; else _wanted none expl 'refreservation' compadd none; fi}"
-		"reservation:value:{if [[ -prefix [0-9]## ]]; then _message -e 'number'; elif [[ $PREFIX == reservation= ]]; then _wanted none expl 'number or none' compadd none; else _wanted none expl 'reservation' compadd none; fi}"
-		"rstchown:value:(on off)"
-		"secondarycache:value:(all none metadata)"
-		"setuid:value:(on off)"
-		"shadow:value:" # TODO: complete URI|none
-		"share:share properties:"
-		"sharenfs:value:(on off)"
-		"sharesmb:value:(on off)"
-		"snapdir:value:(hidden visible)"
-		"sync:value:(standard always disabled)"
-		"userquota@:value:" # TODO: complete user=size|none
-		"version:value:(1 2 3 4 current)"
-		"volsize:value:" # <size>
-		"vscan:value:(on off)"
-		"xattr:value:(on off)"
-		"zoned:value:(on off)"
-	)
-
-	if [[ $service == "zpool" ]]; then
-		_arguments -C \
-			'-\?[show help information]' \
-			'1:subcommand:compadd -a subcmds' \
-			'*:: :->subcmd' && return
-
-		service="$words[1]"
-		curcontext="${curcontext%:*}-$service:"
-	fi
-
-	case $service in
-	(help)
-		_arguments -A "-*" \
-			- set1 \
-			':command/property:($subcmds ${fields%%\[*} properties)' \
-			- set2 \
-			'-l[Display property information]' \
-			': :(properties)'
-		;;
-
-	(clear)
-		_arguments -A "-*" \
-			'-F[Discard transactions to allow pool opening]' \
-			'-f[Ignore fmadm acquit and fmadm repair failures]' \
-			'-n[With -F, check if discarding transactions would work]' \
-			':pool name:_zfs_pool' \
-			'*:virtual device:_files'
-		;;
-
-	(create)
-		# TODO: investigate better vdev handling
-		_arguments -A "-*" \
-			'-B[Create EFI boot partition on whole disks]' \
-			'-o[Set pool property at creation time]:property:_values -s , "property" $rw_props' \
-			'-O[Set dataset property at creation time]:property:_values -s , "property" $create_properties_dataset' \
-			'-f[Force use of in-use devices]' \
-			'-l[Display configuration in /dev/chassis location form]' \
-			'-n[Display configuration without creating pool]' \
-			'-R[Use alternate root]:alternate root:_files -/' \
-			'-m[Set mountpoint for root dataset]:mountpoint:' \
-			':pool name:' \
-			'*:virtual device:_files'
-		;;
-
-	(destroy)
-		_arguments -A "-*" \
-			'-f[Force active datasets to be unmounted]' \
-			':pool name:_zfs_pool'
-		;;
-
-	(add)
-		_arguments -A "-*" \
-			'-f[Force use of in-use devices]' \
-			'-l[Display configuration in /dev/chassis location form]' \
-			'-n[Display configuration without modifying pool]' \
-			':pool name:_zfs_pool' \
-			'*:virtual device:_files'
-		;;
-
-	(list)
-		_arguments \
-			'-H[Scripted mode]' \
-			'-T[timestamp]:value:(u d)' \
-			'-o[Fields to list]:field:_values -s , "field" $fields' \
-			'::pool name:_zfs_pool'
-		;;
-
-	(initialize)
-		_arguments -A "-*" \
-			'(-c --cancel)'{-c,--cancel}'[cancel initializing on specified devices]' \
-			'(-s --suspend)'{-s,--suspend}'[suspend initializing on specified devices]' \
-			':pool name:_zfs_pool' \
-			'*:device:_files'
-		;;
-
-	(iostat)
-		_arguments -A "-*" \
-			'-l[Display configuration in /dev/chassis location form]' \
-			'-T[timestamp]:value:(u d)' \
-			'-v[Verbose statistics]' \
-			'*::pool name:_zfs_pool' \
-			'::interval:' \
-			'::count:'
-		;;
-
-	(labelclear)
-		_arguments -A "-*" \
-			'-f[treat exported or foreign devices as inactive]' \
-			'*:virtual device:_files'
-		;;
-
-	(status)
-		_arguments -A "-*" \
-			'-l[Display configuration in /dev/chassis location form]' \
-			'-v[Verbose information]' \
-			'-x[Show only unhealthy pools]' \
-			'-T[timestamp]:value:(u d)' \
-			'*::pool name:_zfs_pool'
-		;;
-
-	(offline)
-		_arguments -A "-*" \
-			'-t[Offline until next reboot]' \
-			':pool name:_zfs_pool' \
-			'*:virtual device:_files'
-		;;
-
-	(online)
-		_arguments \
-			'-e[Expand device to use all available space]' \
-			':pool name:_zfs_pool' \
-			'*:virtual device:_files'
-		;;
-
-	(attach)
-		# TODO: first device should choose first from existing.
-		_arguments \
-			'-f[Force attach, even if in use]' \
-			':pool name:_zfs_pool' \
-			':virtual device:_files' \
-			':virtual device:_files'
-		;;
-
-	(detach)
-		_arguments \
-			':pool name:_zfs_pool' \
-			':virtual device:_files'
-		;;
-
-	(replace)
-		_arguments -A "-*" \
-			'-f[Force attach, even if in use]' \
-			':pool name:_zfs_pool' \
-			':virtual device:_files' \
-			'::virtual device:_files'
-		;;
-
-	(scrub)
-		_arguments -A "-*" \
-			'-s[Stop scrubbing]' \
-			'*:pool name:_zfs_pool'
-		;;
-
-	(export)
-		_arguments -A "-*" \
-			'-f[Forcefully unmount all datasets]' \
-			'*:pool name:_zfs_pool'
-		;;
-
-	(import)
-		# TODO: -o should complete mount options, too
-		_arguments -A "-*" \
-			'-D[Destroyed pools]' \
-			'(-d)*-c[Use cache file]:cache file:_files' \
-			'(-c -D)*-d[Search for devices or files in directory]:directory:_files -/' \
-			'-F[Recovery mode: discard transactions if required]' \
-			'-f[Force import]' \
-			'-l[Display configuration in /dev/chassis location form]' \
-			'-m[Ignore missing log devices]' \
-			'-N[Import pool without mounting any filesystems]' \
-			'-n[With -F; do not perform input]' \
-			'-R[Alternate root]:alternate root:_files -/' \
-			'-o[Set pool or dataset property]:property:_values -s , "property" $create_properties_dataset $rw_props' \
-			- set1 \
-			'*:pool name or id:_zfs_pool' \
-			'::new pool name:' \
-			- set2 \
-			'-N[Do not mount any filesystems]' \
-			'-a[All pools]'
-		;;
-
-	(get)
-		_arguments -A "-*" \
-			':property:_values -s , "property" $fields' \
-			'*:pool name:_zfs_pool'
-		;;
-
-	(set)
-		_arguments -A "-*" \
-			':property:_values -s , "property" $rw_props' \
-			'*:pool name:_zfs_pool'
-		;;
-
-	(split)
-		_arguments -A "-*" \
-			'-R[Alternate root]:alternate root:_files -/' \
-			'-l[Display configuration in /dev/chassis location form]' \
-			'-n[Display configuration without splitting]' \
-			'-o[Set pool or dataset property]:property:_values -s , "property" $create_properties_dataset $rw_props' \
-			':pool name or id:_zfs_pool' \
-			':new pool name:' \
-			'*::virtual device:_files -/'
-		;;
-
-	(upgrade)
-		_arguments -A "-*" \
-			- set1 \
-			'-v[Display ZFS versions and descriptions]' \
-			- set2 \
-			"-V[Upgrade to given version]:version:($versions)" \
-			'-a[Upgrade all pools]' \
-			'*:pool name:_zfs_pool'
-		;;
-
-	(history)
-		_arguments -A "-*" \
-			'-i[Display internal events]' \
-			'-l[Long format]' \
-			'*:pool name:_zfs_pool'
-		;;
-
-	(*)
-		_message "unknown zpool subcommand: $service"
-		;;
-	esac
-}
-
-_zpool "$@"
diff --git a/Completion/Unix/Type/_zfs_dataset b/Completion/Unix/Type/_zfs_dataset
index 63384afc6..7edcfd5d7 100644
--- a/Completion/Unix/Type/_zfs_dataset
+++ b/Completion/Unix/Type/_zfs_dataset
@@ -11,10 +11,12 @@ local expl_type
 # -t takes arguments (what kinds of datasets) and can appear multiple times
 zparseopts -D -E e:=expl_type_arr p=paths_allowed r1=rsrc r2=rdst t+:=type
 
-[[ -n $type[(r)fs] ]]    && typearg=( filesystem )
-[[ -n $type[(r)vol] ]]   && typearg=( $typearg volume )
-[[ -n $type[(r)snap] ]]  && typearg=( $typearg snapshot )
-[[ -n $type[(r)share] ]]  && typearg=( $typearg share )
+[[ -n $type[(r)fs] ]] && typearg=( filesystem )
+[[ -n $type[(r)vol] ]] && typearg+=( volume )
+[[ -n $type[(r)snap] ]] && typearg+=( snapshot )
+[[ -n $type[(r)share] && $implementation = solaris ]] && typearg+=( share )
+[[ -n $type[(r)bookmark] && $implementation = openzfs ]] &&
+    typearg+=( bookmark )
 if [[ -n $typearg ]]; then
 	typearg=( -t ${(j:,:)typearg} )
 # We know we're in zfs list if paths_allowed is non-empty.
@@ -58,7 +60,7 @@ if [[ ${#rdst} -gt 0 ]]; then
 fi
 
 if [[ -n $type[(r)clone] ]]; then
-	datasetlist=( ${(f)"$(zfs list -H -o name,origin -t filesystem 2>/dev/null | awk -F $'\t' "\$2 != \"-\" {print \$1}")":#no cloned filesystems available} )
+  datasetlist=( ${(f)"$(zfs list -H -o name,origin -t filesystem 2>/dev/null | awk -F$'\t' "\$2 != \"-\" {print \$1}")":#no cloned filesystems available} )
 else
 	datasetlist=( ${(f)"$(zfs list -H -o name $typearg 2>/dev/null)":#no datasets available} )
 fi
@@ -74,4 +76,5 @@ if [[ -n $expl_type_arr[2] ]]; then
 	expl_type=$expl_type_arr[2]
 fi
 
-_wanted dataset expl "$expl_type" _multi_parts "$@" -q / datasetlist
+_description datasets expl "$expl_type"
+_multi_parts "$@" "$expl[@]" -q / datasetlist
diff --git a/Completion/Unix/Type/_zfs_keysource_props b/Completion/Unix/Type/_zfs_keysource_props
deleted file mode 100644
index 01f63257a..000000000
--- a/Completion/Unix/Type/_zfs_keysource_props
+++ /dev/null
@@ -1,15 +0,0 @@
-#autoload
-
-local -a suf
-local expl
-
-compset -S ",*" || suf=(-S ,)
-if compset -P 1 "*,"; then
-	_alternative "zfs-keylocator-prompt:\"prompt\" locator:(prompt)" \
-		"zfs-keylocator-file:file locator:_path_files" \
-		"zfs-keylocator-pkcs11:PKCS#11 locator: " \
-		"zfs-keylocator-https:HTTPS URL locator: "
-else
-	_description format expl "keysource format"
-	compadd $suf -q "$expl[@]" "$@" raw hex passphrase
-fi


^ permalink raw reply	[relevance 1%]

* [PATCH] new completions for csplit, pr, ptx, truncate
@ 2022-01-31 14:32  3% Jun. T
  0 siblings, 0 replies; 200+ results
From: Jun. T @ 2022-01-31 14:32 UTC (permalink / raw)
  To: zsh-workers

These commands are in GNU coreutils, but there are non-GNU variants also.

pr accepts -2 -3 -4 ... for specifying number of columns.
The _pr below offers only -2 and -3, but I think it's enough.
pr also accepts +page_number to start printing from the specified page.
It is taken care of before calling _arguments.

csplit, pr and ptx accept a single '-' as a file name (to read from stdin).
For non-GNU variant (i.e., for BSD variant) we need to use
_argument -A '-?*'   (or -A '[-+]?*' for pr)
to stop completing options for 'csplit - -<TAB>'.



diff --git a/Completion/Unix/Command/_csplit b/Completion/Unix/Command/_csplit
new file mode 100644
index 000000000..5f72232bb
--- /dev/null
+++ b/Completion/Unix/Command/_csplit
@@ -0,0 +1,51 @@
+#compdef csplit
+
+local curcontext=$curcontext cnt_info ret=1
+local -a state state_descr line specs optA
+typeset -A opt_args
+
+# common specs
+specs=(
+  '(hv -f --prefix)'{-f+,--prefix=}'[specify prefix for output file names]:prefix [xx]: '
+  '(hv -n --digits -b --suffix-format)'{-n+,--digits=}'[specify number of digits in output file names]:number [2]: '
+  '(hv -k --keep-files)'{-k,--keep-files}'[do not remove output files on errors]'
+  '(hv -s --quiet --silent)'{-s,--quiet,--silent}'[do not print counts of output file sizes]'
+  '(hv)1: :_files'
+  '(hv)*: :->patterns'
+)
+
+if _pick_variant gnu=GNU unix --version; then
+  # GNU coreutils 8.32
+  specs+=(
+    '(hv -b --suffix-format -n --digits)'{-b+,--suffix-format=}'[specify format for numbers in output file names]:format [%%02d]: '
+    '(hv)--suppress-matched[suppress the lines matching the pattern]'
+    '(hv -z --elide-empty)'{-z,--elide-empty-files}'[remove empty output files]'
+    + hv
+    '(: * -)--help[display help and exit]'
+    '(: * -)--version[output version information and exit]'
+  )
+  cnt_info="(integer or '*')"
+else
+  # POSIX ({Free,Open}BSD, DragonFly, macOS)
+  specs=( ${specs:#(|*\))--*} )  # remove long options
+  optA=( -A '-?*' )  # a single '-' is a valid file name (stdin)
+fi
+
+_arguments -C -s -S $optA : $specs && ret=0
+
+case $state in
+  patterns)
+    if compset -P '(/?*/|%?*%)'; then
+      _message '[+|-]offset' && ret=0
+    elif compset -P '[/%]'; then
+      _message 'regex' && ret=0
+    elif compset -P '(|\\){'; then
+      _message "count $cnt_info" && ret=0
+    elif compset -P '[0-9]*'; then
+      _message 'line number' && ret=0
+    elif [[ ${words[CURRENT]} != -* ]] then
+      _message "line_number, '/regex/[offset]', '%%regex%%[offset]', or '{count}'" && ret=0
+    fi
+esac
+
+return ret
diff --git a/Completion/Unix/Command/_pr b/Completion/Unix/Command/_pr
new file mode 100644
index 000000000..2aeeb13b3
--- /dev/null
+++ b/Completion/Unix/Command/_pr
@@ -0,0 +1,103 @@
+#compdef pr
+
+local curcontext=$curcontext variant msg ret=1
+local -a state state_descr line specs optA
+typeset -A opt_args
+
+# take care of '+FIRST_PAGE[:LAST_PAGE]' (GNU) or '+FIRST_PAGE' (POSIX)
+if _pick_variant -r variant gnu=GNU $OSTYPE --version; then
+  msg='FIRST_PAGE[:LAST_PAGE]'
+else
+  msg='first page'
+fi
+
+if [[ $words[CURRENT] = +* ]]; then
+  _message "$msg" && return
+fi
+
+if (( ! ${words[(I)+[0-9]*]} )); then
+  # if +number is not on the command line
+  specs=( '(hv)--pages=[specify first and last page numbers]: : _message $msg' )
+fi
+
+# common specs
+specs+=(
+  '(hv -a --across)'{-a,--across}'[with multi-column output, print columns across rather than down]'
+  '(hv -d --double-space)'{-d,--double-space}'[double space the output]'
+  '(hv -e --expand-tabs)'{-e-,--expand-tabs=-}'[expand tab (or specified char) with specified number of spaces]::number of spaces [8]:->char_number'
+  '(hv -h --header -t --omit-header)'{-h+,--header=}'[specify text used in header]:header: '
+  '(hv -i --output-tabs)'{-i-,--output-tabs=-}'[replace specified number of spaces with tab (or specified char)]::number of spaces [8]:->char_number'
+  '(hv -l --length)'{-l+,--length=}'[specify the page length]:number of lines [66]: '
+  '(hv -m --merge)'{-m,--merge}'[print all files in parallel, one in each column]'
+  '(hv -n --number-lines)'{-n-,--number-lines=-}'[number lines with specified separator and width]::number of digits [5]:->char_number'
+  '(hv -o --indent)'{-o+,--indent=}'[specify left margin]:margin [0]: '
+  '(hv -r -no-file-warnings)'{-r,--no-file-warnings}'[omit warning when a file cannot be opened]'
+  '(hv -s --separator)'{-s-,--separator=-}'[specify column separator character]:character [tab]: '
+  '(hv -t --omit-header -h --header)'{-t,--omit-header}'[omit page headers and trailers]'
+  '(hv -w --width)'{-w+,--width=}'[specify page width for multi-column output]:number of characters [72]: '
+  '(hv)*: :_files'
+)
+# XXX: pr accepts -2 -3 -4 ... for specifying the number of columns.
+#      Here we offer only -2 and -3, and do so only if there is no
+#      -2 -3 -4 ... or --columns on the command line.
+if (( ! ${words[(I)-([0-9]##*|-columns*)]} )); then
+  specs+=( {-2,-3}'[specify number of columns]' )
+fi
+
+if [[ $variant = gnu ]]; then
+  # GNU coreutils 8.32
+  specs+=(
+    '(hv -c --show-control-chars)'{-c,--show-control-chars}'[use hat (^G) and octal backslash notation]'
+    '(hv -D --date-format)'{-D+,--date-format=}'[specify format for the header date]: :_date_formats'
+    '(hv -f -F --form-feed)'{-f,-F,--form-feed}'[use form feeds instead of newlines to separate pages]'
+    '(hv -J --join-lines)'{-J,--join-lines}'[merge full lines in multi-column output]'
+    '(hv -N --first-line-number)'{-N+,--first-line-number=}'[specify the line number of the 1st line]:number: '
+    '(hv -S --sep-string)'{-S-,--sep-string=-}'[specify column separator string]:string: '
+    '(hv -T --omit-pagination)'{-T,--omit-pagination}'[omit page headers and trailers, eliminate any pagination]'
+    '(hv -v --show-nonprinting)'{-v,--show-nonprinting}'[use octal backslash notation]'
+    '(hv -W --page-width)'{-W+,--page-width=}'[specify page width always]:number of characters [72]: '
+  )
+  if (( ! ${words[(I)-[0-9]##*]} )); then
+    # if -2 -3 -4 ... are not on the command line
+    specs+=(
+      '(hv)--columns=[specify number of columns]:number of columns: '
+      + hv
+      '(- *)--help[display help and exit]'
+      '(- *)--version[output version information and exit]'
+    )
+  fi
+else
+  specs=( ${specs:#(|*\))--*} )    # remove long options
+  case $variant in
+    freebsd*|dragonfly*|darwin*|netbsd*)
+      specs+=(
+	'(-f)-F[use form feeds instead of newlines to separate pages]'
+	'(-F)-f[same as -F but pause before the 1st page if stdout is terminal]'
+	'-p[pause before each page if stdout is terminal]'
+      )
+      ;|
+    freebsd*|dragonfly*|darwin*)
+      specs+=( '-L+[specify locale to use]: :_locales' )
+      ;;
+    openbsd*)
+      specs+=( '(-f -F)'{-f,-F}'[use form feeds instead of newlines to separate pages]' )
+      ;;
+  esac
+  optA=( -A '[-+]?*' )  # a single '-' is a valid file name (stdin)
+fi
+
+_arguments -C -s -S $optA : $specs && ret=0
+
+case $state in
+  char_number)
+    # argument for option -e (and -i, -n) can be -e. -e10 or -e.10
+    # where . is any non-digit character
+    if compset -p 1; then
+      _message "$state_descr" && ret=0
+    else
+      _message "a character [tab] (optional), and $state_descr" && ret=0
+    fi
+    ;;
+esac
+
+return ret
diff --git a/Completion/Unix/Command/_ptx b/Completion/Unix/Command/_ptx
new file mode 100644
index 000000000..12f1d2c9a
--- /dev/null
+++ b/Completion/Unix/Command/_ptx
@@ -0,0 +1,54 @@
+#compdef ptx
+
+local -a specs optA
+
+# common specs
+specs=(
+  '(hv -b --break-file)'{-b+,--break-file=}'[use characters in specified file as word separators]:break file:_files'
+  '(hv -f --ignore-case)'{-f,--ignore-case}'[fold lower case to upper case for sorting]'
+  '(hv -g --gap-size)'{-g+,--gap-size=}'[specify gap size between output fields]:number of chars [3]: '
+  '(hv -i --ignore-file)'{-i+,--ignore-file=}'[ignore keywords listed in specified file]:ignore file:_files'
+  '(hv -o --only-file)'{-o+,--only-file=}'[use only the keywords listed in specified file]:only file:_files'
+  '(hv -r --references)'{-r,--references}'[first field of each line is a reference]'
+  '(hv -w --width)'{-w+,--width=}'[specify page width, reference excluded]:number of characters [72]: '
+)
+
+if _pick_variant gnu=GNU unix --version; then
+  # GNU coreutils 8.32
+  specs+=(
+    '(hv -A --auto-reference)'{-A,--auto-reference}'[output automatically generated references]'
+    '(hv -G --traditional)'{-G,--traditional}"[behave more like System V 'ptx']"
+    '(hv -F --flag-truncation)'{-F+,--flag-truncation=}'[specify string for flagging line truncations]:string [/]: '
+    '(hv -M --macro-name)'{-M+,--macro-name=}"[specify macro name to use instead of 'xx']:macro name: "
+    '(hv)-O[generate output as roff directives]'
+    '(hv -R --right-side-refs)'{-R,--right-side-refs}'[put references at right, not counted in -w]'
+    '(hv -S --sentence-regexp)'{-S+,--sentence-regexp=}'[specify regexp for end of lines/sentences]:regexp: '
+    '(hv)-T[generate output as TeX directives]'
+    '(hv -W --word-regexp -b --break-file)'{-W+,--word-regexp=}'[specify regexp to match each keyword]:regexp: '
+    '(hv)--format=[specify the output format]:format:(roff tex)'
+    !{-t,--typeset-mode}'[not implemented]'
+    + hv
+    '(: * -)--help[display help and exit]'
+    '(: * -)--version[output version information and exit]'
+  )
+  if (( $words[(I)(-G|--traditional)] )); then
+    specs+=( + arg '1:input file:_files'  '2:output file:_files' )
+  else
+    specs+=( + arg '(-G --traditional)*:input file:_files' )
+  fi
+else
+  # The only non-GNU implementation I can find is the one in
+  # heirloom-doctools. FreeBSD has a package for this.
+  specs=( ${specs:#(|*\))--*} )    # remove long options
+  # remove '+' from -b+ -g+ -i+ -o+ -w+
+  local MATCH MBEGIN MEND
+  specs=( ${specs/(#m)-[bgiow]+/$MATCH[1,-2]} )
+  specs+=(
+    '-t[prepare output for typesetter]'
+    '1:input file:_files'
+    '2:output file:_files'
+  )
+  optA=( -A '-?*' )  # a single '-' is a valid file name (stdin)
+fi
+
+_arguments -s -S $optA : $specs
diff --git a/Completion/Unix/Command/_truncate b/Completion/Unix/Command/_truncate
new file mode 100644
index 000000000..117be9702
--- /dev/null
+++ b/Completion/Unix/Command/_truncate
@@ -0,0 +1,69 @@
+#compdef truncate
+
+local curcontext=$curcontext variant rs ret=1
+local -a state state_descr line specs optA
+typeset -A opt_args
+
+_pick_variant -r variant gnu=GNU $OSTYPE --version
+[[ $variant != gnu ]] && rs='-r -s' # -r/-s mutually exclusive
+
+# common specs
+specs=(
+  '(hv -c --no-create)'{-c,--no-create}'[do not create any files]'
+  "(hv $rs -r --reference)"{-r+,--reference=}'[base size on the specified file]:reference file:_files'
+  "(hv $rs -s --size)"{-s+,--size=}'[set or adjust the file size by specified bytes]:size:->size'
+  '(hv)*: :_files'
+)
+
+case $variant in
+  gnu) # GNU coreutils 8.32
+    specs+=(
+      '(hv -o --io-blocks)'{-o,--io-blocks}'[treat the specified size as number of IO blocks instead of bytes]'
+      + 'hv'
+      '(- *)--help[display help and exit]'
+      '(- *)--version[output version information and exit]'
+    )
+    ;;
+  *) # FreeBSD/DragonFly
+    specs=( ${specs:#(|*\))--*} )    # remove long options
+    optA=( -A '-*' )
+    ;;
+esac
+
+_arguments -C -s -S : $specs && ret=0
+
+case $state in
+  size)
+    local unit=bytes
+    (( ${#opt_args[(I)(-o|--io-blocks)]} )) && unit=blocks
+    local -a suffix=( K:1024 M G T )
+    local -a prefix=( '+:extend by' '-:reduce by' )
+    local prefix_char='[-+]'
+    case $variant in
+      gnu|freebsd*)
+	prefix+=( '/:round down to multiple of' '%:round up to multiple of' )
+	;|
+      gnu)
+	suffix=( K:1024 KB:1000 {M,G,T,P,E,Z,Y}{,B} )
+	prefix+=( '<:at most' '>:at least' )
+	prefix_char='([-+/%]|\\[<>])'
+	;;
+      freebsd*)
+	prefix_char='[-+/%]'
+	;;
+    esac
+    local -a numbers=( _numbers -u $unit size $suffix )
+
+    if compset -P "$prefix_char"; then
+      $numbers && ret=0
+    elif (( ${#opt_args[(I)(-r|--reference)]} )); then
+      # prefix is required if the reference file is given
+      _describe -t 'prefixes' 'prefix' prefix && ret=0
+    else
+      _alternative "prefixes:prefix:((${(@q)prefix}))" \
+      		   "sizes: :$numbers" && ret=0
+    fi
+  ;;
+esac
+
+return ret





^ permalink raw reply	[relevance 3%]

* can we have an option for cd to do a plain chdir()
@ 2022-02-06 17:44  2% Stephane Chazelas
  0 siblings, 0 replies; 200+ results
From: Stephane Chazelas @ 2022-02-06 17:44 UTC (permalink / raw)
  To: Zsh hackers list

I was surprised to see that after:

ln -s /proc/self/cwd/.. link; cd link

I ended up two directories up instead of one.

strace revealed:

$ strace -fe getcwd,readlink,chdir,fchdir zsh -c 'cd link'
readlink("/proc/self/fd/0", "/dev/pts/4", 4095) = 10
chdir("/home/chazelas/link")            = 0
chdir("/home/chazelas/link")            = 0
+++ exited with 0 +++

Not sure why the two chdir()s there.

That it prepends $PWD to the path is also a problem if the
current working directory has been renamed, but most shells do
that without -P.

It's better in that case with cd -P or with chaselinks:

$ strace -fe getcwd,readlink,chdir,fchdir zsh -c 'cd -P link'
readlink("/proc/self/fd/0", "/dev/pts/4", 4095) = 10
chdir("/home/chazelas/link")            = 0
readlink("/home", 0x7ffe6ba34f00, 4096) = -1 EINVAL (Invalid argument)
readlink("/home/chazelas", 0x7ffe6ba34f00, 4096) = -1 EINVAL (Invalid argument)
readlink("/home/chazelas/link", "/proc/self/cwd/..", 4096) = 17
readlink("/proc", 0x7ffe6ba2fe70, 4096) = -1 EINVAL (Invalid argument)
readlink("/proc/self", "1000438", 4096) = 7
readlink("/proc/1000438", 0x7ffe6ba2ade0, 4096) = -1 EINVAL (Invalid argument)
readlink("/proc/1000438/cwd", "/home", 4096) = 5
readlink("/home", 0x7ffe6ba2ade0, 4096) = -1 EINVAL (Invalid argument)
chdir("..")                             = 0
chdir("/home")                          = 0
+++ exited with 0 +++
~$ strace -fe getcwd,readlink,chdir,fchdir zsh -o chaselinks -c 'cd link'
readlink("/proc/self/fd/0", "/dev/pts/4", 4095) = 10
readlink("/home", 0x7ffdfc3e0f40, 4096) = -1 EINVAL (Invalid argument)
readlink("/home/chazelas", 0x7ffdfc3e0f40, 4096) = -1 EINVAL (Invalid argument)
chdir("/home/chazelas/link")            = 0
readlink("/home", 0x7ffdfc3df960, 4096) = -1 EINVAL (Invalid argument)
readlink("/home/chazelas", 0x7ffdfc3df960, 4096) = -1 EINVAL (Invalid argument)
readlink("/home/chazelas/link", "/proc/self/cwd/..", 4096) = 17
readlink("/proc", 0x7ffdfc3da8d0, 4096) = -1 EINVAL (Invalid argument)
readlink("/proc/self", "1002598", 4096) = 7
readlink("/proc/1002598", 0x7ffdfc3d5840, 4096) = -1 EINVAL (Invalid argument)
readlink("/proc/1002598/cwd", "/home", 4096) = 5
readlink("/home", 0x7ffdfc3d5840, 4096) = -1 EINVAL (Invalid argument)
chdir("..")                             = 0
chdir("/home")                          = 0
+++ exited with 0 +++

But that sounds a bit overkill and racy.

In scripts, you usually want your cd's to do plain chdir()s but
there are many things that get in the way:

- the need for -P to avoid the logical traversal
- the need to -- as usual for avoid problems with dirnames
  starting with -
- CDPATH (it is inherited from the environment but at least when
  not in POSIX mode, that doesn't take precedence over actual
  relative path).
- The "-" string that is taken as $OLDPWD
- Also in zsh, the -n +n ones.
- and then there's that special fancy chasing of symlinks

So, to do an actual chdir, we need something like:

chdir() {
  case $1 in
    (/*) cd -P "$1";;
    ('') print -u2 "not sure out to chdir to an empty string";;
    (*) cd -P "./$1";;
  esac
}

Which addresses the first 5 points, but not the 6th.

It would be nice if we could just do for instance cd -r -- $dir
which would just a do chdir($dir) and set $PWD to getcwd() if
successful.

(or have chdir (which atm exits as a builtin for tcsh junkies I
suppose) do that and not take any option).

What do you think?

-- 
Stephane


^ permalink raw reply	[relevance 2%]

* Regression with stdin handling in non-interactive mode between 5.8 and 5.8.1
@ 2022-03-02 22:38  4% Lyude Paul
  2022-03-03  9:39  5% ` Peter Stephenson
  0 siblings, 1 reply; 200+ results
From: Lyude Paul @ 2022-03-02 22:38 UTC (permalink / raw)
  To: zsh-workers

Hi! I'm reporting this here because after some discussion in #zsh, it was
determined this is likely both a regression, and also isn't POSIX compliant.
Keep in mind I don't have as clear of an understanding of what's happening
below the hood here as I'd like, so I'm not 100% the subject line here is
correct. I've got plenty of examples to clarify though :)

Basically, what seems to be happening is that since 5.8.1 zsh no longer seems
to correctly handle input from stdin unless the terminal is in interactive
mode.

Here's a simple example script that demonstrates what I mean:

   printf '%s\n' 'echo Shell is $$' sh 'echo Shell is $$' | zsh

Running on zsh 5.8 returns:

   Shell is 70
   Shell is 71

Running on zsh 5.8.1 however, returns:

   Shell is 86396
   Shell is 86396

This can end up being an issue when trying to do things like (assuming sudo is
configured on this system to not request a password, and zsh is the default
shell):

   ssh foo <<- _EOF_
   whoami
   sudo -s
   whoami
   _EOF_

While that's maybe not the best way of doing such things in shell, I have
quite a number of scripts that rely on this working and have for quite some
time. According to llua from #zsh as well, this is also likely not POSIX
compliant according to:

   https://pubs.opengroup.org/onlinepubs/9699919799/utilities/sh.html (see the
   section labeled "INPUT FILES")

llua suggested that this breakage may have come from
e5cd2dd980302f328d232d933f646c3dc02828bf ("49290: Replace stdio for buffered
shell input."), which I've confirmed to be true by bisecting this locally. 

For reference: I originally reproduced this on Fedora 35, although I have a
feeling that probably doesn't matter too much here. If there's any other
information I can provide that would help with getting this fixed, don't
hesistate to ask. And thank you ahead of time!
-- 
Cheers,
 Lyude Paul (she/her)
 Software Engineer at Red Hat



^ permalink raw reply	[relevance 4%]

* Re: Regression with stdin handling in non-interactive mode between 5.8 and 5.8.1
  2022-03-02 22:38  4% Regression with stdin handling in non-interactive mode between 5.8 and 5.8.1 Lyude Paul
@ 2022-03-03  9:39  5% ` Peter Stephenson
  2022-03-03 11:52  5%   ` Peter Stephenson
  0 siblings, 1 reply; 200+ results
From: Peter Stephenson @ 2022-03-03  9:39 UTC (permalink / raw)
  To: Lyude Paul, zsh-workers


> On 02 March 2022 at 22:38 Lyude Paul <lyude@redhat.com> wrote:
> 
> 
> Hi! I'm reporting this here because after some discussion in #zsh, it was
> determined this is likely both a regression, and also isn't POSIX compliant.
> Keep in mind I don't have as clear of an understanding of what's happening
> below the hood here as I'd like, so I'm not 100% the subject line here is
> correct. I've got plenty of examples to clarify though :)
> 
> Basically, what seems to be happening is that since 5.8.1 zsh no longer seems
> to correctly handle input from stdin unless the terminal is in interactive
> mode.
> 
> Here's a simple example script that demonstrates what I mean:
> 
>    printf '%s\n' 'echo Shell is $$' sh 'echo Shell is $$' | zsh
> 
> Running on zsh 5.8 returns:
> 
>    Shell is 70
>    Shell is 71
> 
> Running on zsh 5.8.1 however, returns:
> 
>    Shell is 86396
>    Shell is 86396

Thanks for the nice simple test --- I'll try and concoct something similar
but predictable for the shell tests.

I hope it's as simple as the following.  I can't think of any optimisation
or a case where line buffering would be wrong.

pws

diff --git a/Src/input.c b/Src/input.c
index caeaff0e3..50cd2cd78 100644
--- a/Src/input.c
+++ b/Src/input.c
@@ -223,13 +223,20 @@ shingetchar(void)
 	return STOUC(*shinbufptr++);
 
     shinbufreset();
-    do {
+    for (;;) {
 	errno = 0;
-	nread = read(SHIN, shinbuffer, SHINBUFSIZE);
-    } while (nread < 0 && errno == EINTR);
-    if (nread <= 0)
+	nread = read(SHIN, shinbufendptr, 1);
+	if (nread > 0) {
+	    /* Use line buffering (POSIX requirement) */
+	    if (*shinbufendptr++ == '\n')
+		break;
+	    if (shinbufendptr == shinbuffer + SHINBUFSIZE)
+		break;
+	} else if (nread == 0 || errno != EINTR)
+	    break;
+    }
+    if (shinbufendptr == shinbuffer)
 	return -1;
-    shinbufendptr = shinbuffer + nread;
     return STOUC(*shinbufptr++);
 }


^ permalink raw reply	[relevance 5%]

* Re: Regression with stdin handling in non-interactive mode between 5.8 and 5.8.1
  2022-03-03  9:39  5% ` Peter Stephenson
@ 2022-03-03 11:52  5%   ` Peter Stephenson
  2022-03-03 22:59  0%     ` Lyude Paul
  0 siblings, 1 reply; 200+ results
From: Peter Stephenson @ 2022-03-03 11:52 UTC (permalink / raw)
  To: Lyude Paul, zsh-workers

> On 03 March 2022 at 09:39 Peter Stephenson <p.w.stephenson@ntlworld.com> wrote> > On 02 March 2022 at 22:38 Lyude Paul <lyude@redhat.com> wrote:
> > Running on zsh 5.8 returns:
> > 
> >    Shell is 70
> >    Shell is 71
> > 
> > Running on zsh 5.8.1 however, returns:
> > 
> >    Shell is 86396
> >    Shell is 86396
> 
> Thanks for the nice simple test --- I'll try and concoct something similar
> but predictable for the shell tests.

Added to the patch; I've confirmed this succeeds or fails as expected.

pws

diff --git a/Src/input.c b/Src/input.c
index caeaff0e3..50cd2cd78 100644
--- a/Src/input.c
+++ b/Src/input.c
@@ -223,13 +223,20 @@ shingetchar(void)
 	return STOUC(*shinbufptr++);
 
     shinbufreset();
-    do {
+    for (;;) {
 	errno = 0;
-	nread = read(SHIN, shinbuffer, SHINBUFSIZE);
-    } while (nread < 0 && errno == EINTR);
-    if (nread <= 0)
+	nread = read(SHIN, shinbufendptr, 1);
+	if (nread > 0) {
+	    /* Use line buffering (POSIX requirement) */
+	    if (*shinbufendptr++ == '\n')
+		break;
+	    if (shinbufendptr == shinbuffer + SHINBUFSIZE)
+		break;
+	} else if (nread == 0 || errno != EINTR)
+	    break;
+    }
+    if (shinbufendptr == shinbuffer)
 	return -1;
-    shinbufendptr = shinbuffer + nread;
     return STOUC(*shinbufptr++);
 }
 
diff --git a/Test/A01grammar.ztst b/Test/A01grammar.ztst
index 4e39a8f3c..0312fe94e 100644
--- a/Test/A01grammar.ztst
+++ b/Test/A01grammar.ztst
@@ -961,3 +961,12 @@ F:Note that the behaviour of 'exit' inside try-list inside a function is unspeci
 F:This test was written to ensure the behaviour doesn't change silently.
 F:If this test fails during development, it *might* be appropriate to change
 F:its expectations.
+
+ (
+   export VALUE=first
+   print -l 'echo Value is $VALUE' 'VALUE=second sh' 'echo Value is $VALUE' |
+   $ZTST_testdir/../Src/zsh -f
+ )
+0:Non-interactive shell command input is line buffered
+>Value is first
+>Value is second


^ permalink raw reply	[relevance 5%]

* Re: Regression with stdin handling in non-interactive mode between 5.8 and 5.8.1
  2022-03-03 11:52  5%   ` Peter Stephenson
@ 2022-03-03 22:59  0%     ` Lyude Paul
  0 siblings, 0 replies; 200+ results
From: Lyude Paul @ 2022-03-03 22:59 UTC (permalink / raw)
  To: Peter Stephenson, zsh-workers

Woo - seems to fix the problem on my end! :)

Don't know if y'all use these, but feel free to consider this patch:

Tested-by: Lyude Paul <lyude@redhat.com>

On Thu, 2022-03-03 at 11:52 +0000, Peter Stephenson wrote:
> diff --git a/Src/input.c b/Src/input.c
> index caeaff0e3..50cd2cd78 100644
> --- a/Src/input.c
> +++ b/Src/input.c
> @@ -223,13 +223,20 @@ shingetchar(void)
>         return STOUC(*shinbufptr++);
>  
>      shinbufreset();
> -    do {
> +    for (;;) {
>         errno = 0;
> -       nread = read(SHIN, shinbuffer, SHINBUFSIZE);
> -    } while (nread < 0 && errno == EINTR);
> -    if (nread <= 0)
> +       nread = read(SHIN, shinbufendptr, 1);
> +       if (nread > 0) {
> +           /* Use line buffering (POSIX requirement) */
> +           if (*shinbufendptr++ == '\n')
> +               break;
> +           if (shinbufendptr == shinbuffer + SHINBUFSIZE)
> +               break;
> +       } else if (nread == 0 || errno != EINTR)
> +           break;
> +    }
> +    if (shinbufendptr == shinbuffer)
>         return -1;
> -    shinbufendptr = shinbuffer + nread;
>      return STOUC(*shinbufptr++);
>  }
>  
> diff --git a/Test/A01grammar.ztst b/Test/A01grammar.ztst
> index 4e39a8f3c..0312fe94e 100644
> --- a/Test/A01grammar.ztst
> +++ b/Test/A01grammar.ztst
> @@ -961,3 +961,12 @@ F:Note that the behaviour of 'exit' inside try-list
> inside a function is unspeci
>  F:This test was written to ensure the behaviour doesn't change silently.
>  F:If this test fails during development, it *might* be appropriate to
> change
>  F:its expectations.
> +
> + (
> +   export VALUE=first
> +   print -l 'echo Value is $VALUE' 'VALUE=second sh' 'echo Value is $VALUE'
> |
> +   $ZTST_testdir/../Src/zsh -f
> + )
> +0:Non-interactive shell command input is line buffered
> +>Value is first
> +>Value is second

-- 
Cheers,
 Lyude Paul (she/her)
 Software Engineer at Red Hat



^ permalink raw reply	[relevance 0%]

* Re: Test ./E03posix.ztst was expected to fail, but passed.
  @ 2022-03-16 15:30  7%   ` Jun. T
    0 siblings, 1 reply; 200+ results
From: Jun. T @ 2022-03-16 15:30 UTC (permalink / raw)
  To: zsh-workers


> 2022/03/16 1:53, Mikael Magnusson <mikachu@gmail.com> wrote:
> 
> On 3/15/22, Vincent Lefevre <vincent@vinc17.net> wrote:
>> 
>> Test ./E03posix.ztst was expected to fail, but passed.
>> Was testing: Width of %s is computed in bytes not characters
>> ./E03posix.ztst: test XPassed.
(snip)
>> I don't know the current status... Has this been discussed in the
>> austin-group list?
(snip)
> Noticed and discussed a bit on IRC the other week/month (sorry for
> unedited irc log)
(snip)
> 19:26 <Mikachu> but my LC_CTYPE is set to that, and LC_ALL is unset


Please try the following patch.

The patch for E03posix.ztst may not be necessary for fixing the
current problem, but I think it is always safer to use 'zsh -f'.


diff --git a/Test/E03posix.ztst b/Test/E03posix.ztst
index b191199ad..9695777f6 100644
--- a/Test/E03posix.ztst
+++ b/Test/E03posix.ztst
@@ -125,39 +125,39 @@
 F:POSIX requires a solitary "-" to be a plain argument
 >-
 
-  ARGV0=sh $ZTST_testdir/../Src/zsh -c 'foreach() { true; }'
+  ARGV0=sh $ZTST_testdir/../Src/zsh -fc 'foreach() { true; }'
 -f:"foreach" is not a reserved word
 
-  ARGV0=sh $ZTST_testdir/../Src/zsh -c 'end() { true; }
+  ARGV0=sh $ZTST_testdir/../Src/zsh -fc 'end() { true; }
 -f:"end" is not a reserved word
 
-  a='a:b:' ARGV0=sh $ZTST_testdir/../Src/zsh -c 'IFS=:; printf "<%s>\n" $a'
+  a='a:b:' ARGV0=sh $ZTST_testdir/../Src/zsh -fc 'IFS=:; printf "<%s>\n" $a'
 0f:IFS is a separator, not a delimiter
 ><a>
 ><b>
 
-  a=$'\ra\r\rb' ARGV0=sh $ZTST_testdir/../Src/zsh -c 'IFS=:; printf "<%s>\n" $a'
+  a=$'\ra\r\rb' ARGV0=sh $ZTST_testdir/../Src/zsh -fc 'IFS=:; printf "<%s>\n" $a'
 0f:All whitespace characters are "IFS whitespace"
 F:isspace('\r') is true so \r should behave like space, \t, \n
 F:This may also need to apply to multibyte whitespace
 ><a>
 ><b>
 
-  ARGV0=sh $ZTST_testdir/../Src/zsh -c 'IFS=2; printf "<%s>\n" $((11*11))'
+  ARGV0=sh $ZTST_testdir/../Src/zsh -fc 'IFS=2; printf "<%s>\n" $((11*11))'
 0f:IFS applies to math results (numbers treated as strings)
 ><1>
 ><1>
 
-  ARGV0=sh $ZTST_testdir/../Src/zsh -c 'inf=42; echo $((inf))'
+  ARGV0=sh $ZTST_testdir/../Src/zsh -fc 'inf=42; echo $((inf))'
 0:All identifiers are variable references in POSIX arithmetic
 F:POSIX has neither math functions nor floating point
 >42
 
-  ARGV0=sh $ZTST_testdir/../Src/zsh -c 'EUID=10; echo "$EUID"'
+  ARGV0=sh $ZTST_testdir/../Src/zsh -fc 'EUID=10; echo "$EUID"'
 -f:EUID is not a special variable
 >10
 
-  ARGV0=sh $ZTST_testdir/../Src/zsh -c "printf '<%10s>\n' St$'\M-C\M-)'phane"
+  ARGV0=sh $ZTST_testdir/../Src/zsh -fc "printf '<%10s>\n' St$'\M-C\M-)'phane"
 0f:Width of %s is computed in bytes not characters
 F:This is considered a bugfix in zsh
 ><  Stéphane>
diff --git a/Test/ztst.zsh b/Test/ztst.zsh
index a59c06dcf..43f8ed730 100755
--- a/Test/ztst.zsh
+++ b/Test/ztst.zsh
@@ -25,6 +25,7 @@ emulate -R zsh
 # Ensure the locale does not screw up sorting.  Don't supply a locale
 # unless there's one set, to minimise problems.
 [[ -n $LC_ALL ]] && LC_ALL=C
+[[ -n $LC_CTYPE ]] && LC_CTYPE=C
 [[ -n $LC_COLLATE ]] && LC_COLLATE=C
 [[ -n $LC_NUMERIC ]] && LC_NUMERIC=C
 [[ -n $LC_MESSAGES ]] && LC_MESSAGES=C






^ permalink raw reply	[relevance 7%]

* Re: Test ./E03posix.ztst was expected to fail, but passed.
  @ 2022-03-22 21:04  5%       ` Bart Schaefer
  2022-03-23  2:26  3%         ` Vincent Lefevre
  2022-03-23  7:14  4%         ` Jun T
  0 siblings, 2 replies; 200+ results
From: Bart Schaefer @ 2022-03-22 21:04 UTC (permalink / raw)
  To: Jun T; +Cc: Zsh hackers list

On Mon, Mar 21, 2022 at 8:33 PM Jun T <takimoto-j@kba.biglobe.ne.jp> wrote:
>
> [1] Does this patch solve the problem?

All tests pass for me on Ubuntu (which isn't a change from before the
patch, but is not a regression either)

> [2] Why is the test marked "expected to fail"?

POSIX printf counts bytes regardless of locale, zsh printf counts
characters in multibyte locales.  The test is expected to fail because
the sample output represents counting characters.  If the test
succeeds, zsh is not following POSIX printf requirements, and we need
to find out why.  Theoretically, if we've correctly implemented
POSIX_BUILTINS, we should not have to test in the C locale in order
for this test to "fail as expected" and if it succeeds (as not
expected) in any locale, something is wrong with the builtin.

Sorry for not following up on that sooner.  It may mean your patch is
actually masking a problem.

> What does 'F:This is considered a bugfix in zsh' mean?

# It is also possible to add lines in the redirection section beginning
# with `F:'.  The remaining text on all such lines will be concatenated
# (with newlines in between) and displayed in the event of an error.

Specifically in this instance, we consider it a POSIX bug that '%s'
always counts byte positions and that zsh has fixed this when it
counts character positions.

> If the test is expected to be run in C locale, then isn't
> < Stéphane>  (a single space before S)
> the "correct" result?

Yes it is, but it's also the expected result for POSIX_BUILTINS if run
in a different locale.


^ permalink raw reply	[relevance 5%]

* Re: Test ./E03posix.ztst was expected to fail, but passed.
  2022-03-22 21:04  5%       ` Bart Schaefer
@ 2022-03-23  2:26  3%         ` Vincent Lefevre
  2022-03-23 10:38  5%           ` Stephane Chazelas
  2022-03-23  7:14  4%         ` Jun T
  1 sibling, 1 reply; 200+ results
From: Vincent Lefevre @ 2022-03-23  2:26 UTC (permalink / raw)
  To: zsh-workers

On 2022-03-22 14:04:30 -0700, Bart Schaefer wrote:
> Specifically in this instance, we consider it a POSIX bug that '%s'
> always counts byte positions and that zsh has fixed this when it
> counts character positions.

But, AFAIK, on the POSIX side, it has never been regarded as a bug
(I haven't seen any bug report).

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


^ permalink raw reply	[relevance 3%]

* Re: Test ./E03posix.ztst was expected to fail, but passed.
  2022-03-22 21:04  5%       ` Bart Schaefer
  2022-03-23  2:26  3%         ` Vincent Lefevre
@ 2022-03-23  7:14  4%         ` Jun T
  2022-03-29  9:10 15%           ` Jun T
  1 sibling, 1 reply; 200+ results
From: Jun T @ 2022-03-23  7:14 UTC (permalink / raw)
  To: zsh-workers


> 2022/03/23 6:04, Bart Schaefer <schaefer@brasslantern.com> wrote:
> 
> On Mon, Mar 21, 2022 at 8:33 PM Jun T <takimoto-j@kba.biglobe.ne.jp> wrote:
> 
>> [2] Why is the test marked "expected to fail"?
> 
> POSIX printf counts bytes regardless of locale, zsh printf counts
> characters in multibyte locales.

>> What does 'F:This is considered a bugfix in zsh' mean?

> Specifically in this instance, we consider it a POSIX bug that '%s'
> always counts byte positions and that zsh has fixed this when it
> counts character positions.

Thanks for the explanation.

If the 'expected to fail' test exists for reminding us that we are
(intentionally?) contradicting with POSIX, the test need be run under
UTF-8 locale (in D07multibyte.ztst), with

>< Stéphane>      # single ' ' before 'S'

as the POSIX-conforming output. Am I right?



^ permalink raw reply	[relevance 4%]

* Re: Test ./E03posix.ztst was expected to fail, but passed.
  2022-03-23  2:26  3%         ` Vincent Lefevre
@ 2022-03-23 10:38  5%           ` Stephane Chazelas
  2022-03-23 16:17  0%             ` Vincent Lefevre
  0 siblings, 1 reply; 200+ results
From: Stephane Chazelas @ 2022-03-23 10:38 UTC (permalink / raw)
  To: zsh-workers

2022-03-23 03:26:44 +0100, Vincent Lefevre:
> On 2022-03-22 14:04:30 -0700, Bart Schaefer wrote:
> > Specifically in this instance, we consider it a POSIX bug that '%s'
> > always counts byte positions and that zsh has fixed this when it
> > counts character positions.
> 
> But, AFAIK, on the POSIX side, it has never been regarded as a bug
> (I haven't seen any bug report).
[...]

It's been raised several times on the POSIX mailing list, and
my understanding the opengroup doesn't consider it as a bug, and
they have made it clear that they would not address it. They may
consider specifying ksh93's %Ls (which pads based on display
width, not byte nor character count) if enough implementations
start to support it.

That's why I didn't bother raising it as a bug personally, but
to me, that position (where printf(1) is meant to be an
interface to printf(3) without decoding those bytes into
characters) does not make sense. printf is to print formatted
text, not doing padding of binary strings. printf(3) was
extended with wprintf(3) to handle wide characters, printf(1)
should have been enhanced to switch to that or equivalent just
like every other text utility is now specified to be able to
cope with wide characters.

printf(1) should need to decode arguments into text if only
because in the format or %b arguments, the "\" character (also
"%" in the format) is being interpreted specially. zsh doesn't
btw (which may be considered a bug, but then again those
non-UTF8 multibyte charsets are poorly supported throughout,
and to me it doesn't seem worth the effort given that hardly
anybody uses multibyte charsets other than UTF-8 these days):

$ LC_ALL=zh_HK SHELL=/bin/zsh luit
zsh$ locale charmap
BIG5-HKSCS
zsh$ printf 'αb' | hd
00000000  a3 08                                             |..|
00000002

(as α is encoded as 0xa3 0x5c in BIG5-HKSCS as used in that
locale, 0x5c being also \)

Yash is probably the only shell that does implement the POSIX
spec as POSIXly likely intends it to be:

~$ LC_ALL=zh_HK SHELL=yash luit
yash$ printf 'αb' | hd
00000000  a3 5c 62                                          |.\b|
00000003
yash$ printf %5s 'αb' | hd
00000000  20 20 a3 5c 62                                    |  .\b|
00000005
yash$ printf %5b 'αb' | hd
00000000  20 20 a3 5c 62                                    |  .\b|
00000005

That is bytes are decoded into characters for those backslashes
to be interpreted "correctly" (yash does decode everything, it's
not specific to printf¹), and then encoded back to behave as if
being passed to printf(3) as POSIX requires.

I've not verified it, but I've read somewhere the C standard was
considering enhancing printf("%.3s") so it doesn't break
characters in the middle (or maybe it's already the case?).
So printf '%.3s\n' Stéphane, where é is UTF-8 encoded in a
locale using UTF-8 would output "St" instead of "St<0xc3>".

My opinion would be:

- not change how %5s works in zsh. To me, zsh made an effort to
  fix that, I can't expect anyone relying on the POSIX
  behaviour which to me is a bug. One can always do

    printf() {
      set -o localoptions +o multibyte; builtin printf "$@"
    }

  if they want the POSIX behaviour.

- no need to fix the problems with backslashes in those
  messed-up multibyte encodings as I'd expect they're being
  phased out.

- maybe implement ksh93's %Ls (zsh does have a ${(ml[5])param}
  alternative though it does both padding and truncation).

---
¹ That approach is not tenable IMO as that means yash can't cope
with arbitrary file paths, arguments, or environment variables

-- 
Stephane


^ permalink raw reply	[relevance 5%]

* Re: Test ./E03posix.ztst was expected to fail, but passed.
  2022-03-23 10:38  5%           ` Stephane Chazelas
@ 2022-03-23 16:17  0%             ` Vincent Lefevre
  0 siblings, 0 replies; 200+ results
From: Vincent Lefevre @ 2022-03-23 16:17 UTC (permalink / raw)
  To: zsh-workers

On 2022-03-23 10:38:35 +0000, Stephane Chazelas wrote:
> It's been raised several times on the POSIX mailing list, and
> my understanding the opengroup doesn't consider it as a bug, and
> they have made it clear that they would not address it. They may
> consider specifying ksh93's %Ls (which pads based on display
> width, not byte nor character count) if enough implementations
> start to support it.
> 
> That's why I didn't bother raising it as a bug personally, but
> to me, that position (where printf(1) is meant to be an
> interface to printf(3) without decoding those bytes into
> characters) does not make sense. printf is to print formatted
> text, not doing padding of binary strings. printf(3) was
> extended with wprintf(3) to handle wide characters, printf(1)
> should have been enhanced to switch to that or equivalent just
> like every other text utility is now specified to be able to
> cope with wide characters.

Counting bytes seems useful, e.g. because file formats have fields
with some maximum length in *bytes*. Counting characters seems
less common. It would be more interesting to search for scripts
that use %s with a width and/or a precision, and see what they
expect.

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


^ permalink raw reply	[relevance 0%]

* [PATCH] Re: Parallel processing
       [not found]         ` <CAH+w=7ZRAQTVBfvw1XN=2xEGVNf2ShD6eck+_iv=fGLcEqBLBg@mail.gmail.com>
@ 2022-03-27 17:38  4%       ` Bart Schaefer
  0 siblings, 0 replies; 200+ results
From: Bart Schaefer @ 2022-03-27 17:38 UTC (permalink / raw)
  To: Zsh hackers list

[-- Attachment #1: Type: text/plain, Size: 1218 bytes --]

[Moving to -workers]

On Sat, Mar 26, 2022 at 3:19 PM Bart Schaefer <schaefer@brasslantern.com> wrote:
>
> > Anyways, zargs is not doing a stellar job currently with collecting
> > exit statuses from commands ran in parallel:
>
> There might be something more that could be done now, to
> pick up the status of the rest ... but I'm reluctant to mess with that
> while the segfault is unfixed.

I found a different reproducer for the segfault, and had an idea about
zargs, so ... I messed with it ...

> Hmm ... zargs uses
>   wait ${${jobstates[(R)running:*]/#*:/}/%=*/}

$jobstates can be avoided by collecting the values of $! in a local array.

> However, that "wait" returns the exit status of only one

As noted in the comments in (the current iteration of) zargs, "wait
$j1 $j2 $j3 ..." waits for all those jobs and returns the status of
whichever one exits last.  However, "wait" with no arguments places
all the exit status in the internal list of exited jobs, after which
the statuses may be collected individually by "wait $j1; wait $j2;
wait $j3".  It's not possible to wait for the same specific job more
than once, so it doesn't work to first wait for a list of jobs and
then wait again for each of them.

[-- Attachment #2: zargs_jobs.txt --]
[-- Type: text/plain, Size: 2461 bytes --]

diff --git a/Functions/Misc/zargs b/Functions/Misc/zargs
index ecd69f7e4..81916a3ac 100644
--- a/Functions/Misc/zargs
+++ b/Functions/Misc/zargs
@@ -43,14 +43,12 @@
 # than 127 for "command not found" so this function incorrectly returns
 # 123 in that case if used with zsh 4.0.x.
 #
-# With the --max-procs option, zargs may not correctly capture the exit
-# status of the backgrounded jobs, because of limitations of the "wait"
-# builtin.  If the zsh/parameter module is not available, the status is
-# NEVER correctly returned, otherwise the status of the longest-running
-# job in each batch is captured.
+# Because of "wait" limitations, --max-procs spawns max-procs jobs, then
+# waits for all of those, then spawns another batch, etc.
 #
-# Also because of "wait" limitations, --max-procs spawns max-procs jobs,
-# then waits for all of those, then spawns another batch, etc.
+# The maximum number of parallel jobs for which exit status is available
+# is determined by the sysconf CHILD_MAX parameter, which can't be read
+# or changed from within the shell.
 #
 # Differences from POSIX xargs:
 #
@@ -69,6 +67,9 @@
 #   -I/-L and implementations reportedly differ.)  In zargs, -i/-I have
 #   this behavior, as do -l/-L, but when -i/-I appear anywhere then -l/-L
 #   are ignored (forced to 1).
+#
+# * The use of SIGUSR1 and SIGUSR2 to change the number of parallel jobs
+#   is not supported.
 
 # First, capture the current setopts as "sticky emulation"
 if zmodload zsh/parameter
@@ -86,7 +87,7 @@ fi
 emulate -L zsh || return 1
 local -a opts eof n s l P i
 
-local ZARGS_VERSION="1.5"
+local ZARGS_VERSION="1.7"
 
 if zparseopts -a opts -D -- \
 	-eof::=eof e::=eof \
@@ -264,17 +265,19 @@ if (( P != 1 && ARGC > 1 ))
 then
     # These setopts are necessary for "wait" on multiple jobs to work.
     setopt nonotify nomonitor
-    bg='&'
-    if zmodload -i zsh/parameter 2>/dev/null
-    then
-	wait='wait ${${jobstates[(R)running:*]/#*:/}/%=*/}'
-    else
-	wait='wait'
-    fi
+    local -a _zajobs
+    local j
+    bg='& _zajobs+=( $! )'
+    wait='wait'
+    analyze='
+    for j in $_zajobs; do
+      wait $j
+      '"$analyze"'
+    done; _zajobs=()'
 fi
 
-# Everything has to be in a subshell just in case of backgrounding jobs,
-# so that we don't unintentionally "wait" for jobs of the parent shell.
+# Everything has to be in a subshell so that we don't "wait" for any
+# unrelated jobs of the parent shell.
 (
 
 while ((ARGC))

^ permalink raw reply	[relevance 4%]

* Re: Test ./E03posix.ztst was expected to fail, but passed.
  2022-03-23  7:14  4%         ` Jun T
@ 2022-03-29  9:10 15%           ` Jun T
  0 siblings, 0 replies; 200+ results
From: Jun T @ 2022-03-29  9:10 UTC (permalink / raw)
  To: zsh-workers


> 2022/03/23 16:14, I wrote:
> 
> If the 'expected to fail' test exists for reminding us that we are
> (intentionally?) contradicting with POSIX, the test need be run under
> UTF-8 locale (in D07multibyte.ztst), with
> 
>> < Stéphane>      # single ' ' before 'S'


In the following patch the test is moved to D07multibyte.ztst, and
another test (expected to fail) is added to indicate that the precision
(5 in '%7.5s') should also be computed in bytes.


diff --git a/Test/D07multibyte.ztst b/Test/D07multibyte.ztst
index 7f046525a..cbd802f23 100644
--- a/Test/D07multibyte.ztst
+++ b/Test/D07multibyte.ztst
@@ -347,6 +347,18 @@
 0:Multibyte characters in printf widths
 > főo
 
+# TODO?: POSIX requires that printf should always compute width and
+# precision of '%s' conversion in bytes, while zsh computes them in
+# characters if multi-byte locale is in use.
+  ARGV0=sh $ZTST_testdir/../Src/zsh -c "printf '<%10s>\n' St$'\M-C\M-)'phane"
+0f:POSIX: width in %s should be computed in bytes, not in characters
+F:This is considered a bugfix in zsh
+>< Stéphane>
+
+  ARGV0=sh $ZTST_testdir/../Src/zsh -c "printf '<%7.5s>\n' St$'\M-C\M-)'phane"
+0f:POSIX: precision should also be computed in bytes, not in characers
+><  Stép>
+
 # We ask for case-insensitive sorting here (and supply upper case
 # characters) so that we exercise the logic in the shell that lowers the
 # case of the string for case-insensitive sorting.
diff --git a/Test/E03posix.ztst b/Test/E03posix.ztst
index b191199ad..caab97ab6 100644
--- a/Test/E03posix.ztst
+++ b/Test/E03posix.ztst
@@ -157,10 +157,5 @@ F:POSIX has neither math functions nor floating point
 -f:EUID is not a special variable
 >10
 
-  ARGV0=sh $ZTST_testdir/../Src/zsh -c "printf '<%10s>\n' St$'\M-C\M-)'phane"
-0f:Width of %s is computed in bytes not characters
-F:This is considered a bugfix in zsh
-><  Stéphane>
-
   PPID=foo
 -f:PPID is not a readonly variable

^ permalink raw reply	[relevance 15%]

* Re: _time_zone gives me candidates other than timezones
  @ 2022-03-29 23:22  3% ` Bart Schaefer
  2022-03-30  0:12  5%   ` Aaron Schrab
  0 siblings, 1 reply; 200+ results
From: Bart Schaefer @ 2022-03-29 23:22 UTC (permalink / raw)
  To: Jordan Russell; +Cc: Zsh hackers list

On Thu, Mar 24, 2022 at 12:28 PM Jordan Russell
<jordan.likes.curry@gmail.com> wrote:
>
> I would like _time_zone to exclude these filenames that are not
> timezones [...]
>
> If I modify it to just exclude those files that begin with a lowercase
> letter then it gives me only proper timezone names.

That excludes the directories "posix" and "right" on my system (I have
no idea what the latter one means).

Is everyone OK with that?


^ permalink raw reply	[relevance 3%]

* Re: _time_zone gives me candidates other than timezones
  2022-03-29 23:22  3% ` Bart Schaefer
@ 2022-03-30  0:12  5%   ` Aaron Schrab
    0 siblings, 1 reply; 200+ results
From: Aaron Schrab @ 2022-03-30  0:12 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: Jordan Russell, Zsh hackers list

At 16:22 -0700 29 Mar 2022, Bart Schaefer <schaefer@brasslantern.com> wrote:
>On Thu, Mar 24, 2022 at 12:28 PM Jordan Russell
><jordan.likes.curry@gmail.com> wrote:
>>
>> I would like _time_zone to exclude these filenames that are not
>> timezones [...]
>>
>> If I modify it to just exclude those files that begin with a lowercase
>> letter then it gives me only proper timezone names.
>
>That excludes the directories "posix" and "right" on my system (I have
>no idea what the latter one means).

Quoting from https://www.ucolick.org/~sla/leapsecs/right+gps.html:

    The "right" files in the tz (zoneinfo) database have a subtle 
    difference from the POSIX standard. POSIX requires that the system 
    clock value of time_t represent the number of non-leap seconds since 
    1970-01-01. This is the same as requiring POSIX seconds to be mean 
    solar seconds of UT, not the atomic seconds that UTC has counted 
    since 1972-01-01.

   The "right" zoneinfo files assert that the system clock value of 
   time_t represent the actual number of seconds in the internationally 
   approved broadcast time scale since 1970-01-01. As a result the value 
   of time_t which is expected by the "right" zoneinfo files is greater 
   than the value of time_t specified by POSIX. The difference in the 
   values of time_t is the number of leap seconds which have been 
   inserted into the internationally approved broadcast time scale. As of 
   year 2011 the difference is 24 seconds. 

I'm a bit more puzzled about why the separate `posix` directory exists. 
At least for my local time zone it doesn't seem to matter if I use that 
or leave it out; while using the `right` one definitely makes a 
difference:

date; TZ=right/America/New_York date; TZ=posix/America/New_York date
2022-03-29T20:07:47 EDT
2022-03-29T20:07:20 EDT
2022-03-29T20:07:47 EDT

>Is everyone OK with that?

While I don't think I've ever really needed to use zoneinfo entries from 
those directories, I'd certainly prefer they be offered for completion.


^ permalink raw reply	[relevance 5%]

* PATCH: Add nonblock to sysopen
@ 2022-03-31  3:58  3% Matthew Martin
  0 siblings, 0 replies; 200+ results
From: Matthew Martin @ 2022-03-31  3:58 UTC (permalink / raw)
  To: zsh-workers

A while back CcxWrk on IRC noted sysopen doesn't support O_NONBLOCK.

The POSIX spec for open requires O_NONBLOCK; however, since the spec
also requires O_CLOEXEC, O_NOFOLLOW, and O_SYNC, I wrapped nonblock in
an ifdef as well.

While here, the name member of the struct ought to be const.


diff --git a/Doc/Zsh/mod_system.yo b/Doc/Zsh/mod_system.yo
index 399b6fe03..884c3e753 100644
--- a/Doc/Zsh/mod_system.yo
+++ b/Doc/Zsh/mod_system.yo
@@ -62,6 +62,9 @@ suppress updating of the file atime
 item(tt(nofollow))(
 fail if var(file) is a symbolic link
 )
+item(tt(nonblock))(
+the file is opened in nonblocking mode
+)
 item(tt(sync))(
 request that writes wait until data has been physically written
 )
diff --git a/Src/Modules/system.c b/Src/Modules/system.c
index ecd4e2546..71745548f 100644
--- a/Src/Modules/system.c
+++ b/Src/Modules/system.c
@@ -280,7 +280,7 @@ bin_syswrite(char *nam, char **args, Options ops, UNUSED(int func))
 }
 
 
-static struct { char *name; int oflag; } openopts[] = {
+static struct { const char *name; int oflag; } openopts[] = {
 #ifdef O_CLOEXEC
     { "cloexec", O_CLOEXEC },
 #else
@@ -296,6 +296,9 @@ static struct { char *name; int oflag; } openopts[] = {
 #endif
 #ifdef O_NOATIME
     { "noatime", O_NOATIME },
+#endif
+#ifdef O_NONBLOCK
+    { "nonblock", O_NONBLOCK},
 #endif
     { "excl", O_EXCL | O_CREAT },
     { "creat", O_CREAT },


^ permalink raw reply	[relevance 3%]

* [PATCH] Change documentation, dedication, loose ends
@ 2022-04-03  3:29  5% dana
  0 siblings, 0 replies; 200+ results
From: dana @ 2022-04-03  3:29 UTC (permalink / raw)
  To: Zsh hackers list

[-- Attachment #1: Type: text/plain, Size: 11382 bytes --]

I've gone through the history since 5.8 and updated the documentation
for all of the changes we missed before. Attaching the patch here just
to make sure i've correctly understood what they all do.

I've also attached a patch for the dedication we discussed off-list.

And, unposted here, i've added the new -s option to _fc.

Some other minor loose ends:

* In workers/47922 Daniel had suggested some changes to the documentation
  for the CASE_PATHS option Bart added; these changes were never merged or
  commented on. Are we satisfied with Bart's original documentation?

* The ${name:offset:length} expansion documentation was not updated with
  Jun's change from workers/49853. Does it need to be?

PS: Trying a different mail client, please let me know if it messes
the text up. Patches also included as attachments just in case

dana


From 200d3209e591839de391752d330575adb7ada8ea Mon Sep 17 00:00:00 2001
From: dana <dana@dana.is>
Date: Sat, 2 Apr 2022 22:19:04 -0500
Subject: [PATCH 1/2] NEWS/README: Add missing change documentation for 5.9

This covers the following changes:

users/24971: ${(-)var} sorts on signed integers

47704: POSIX export and readonly ignore "-p" when parameter names also appear

47913: implement CASE_PATHS option to make NO_CASE_GLOB more sensible

48073: Add fc -s as POSIX way of rerunning command without starting editor

49307 with doc update: POSIX_TRAPS fix.

49528: allow multiple -D options to compadd

49561: add zformat -F option, similar to -f but ternary expressions check for
existence instead of doing math evaluation

49597: add a helper for completing numbers with unit suffixes and separate out
defaults, ranges and units in completion descriptions

49611 based on 49590 (Martijn Dekker): disable Inf and NaN in math expressions
for sh emulation

49646: allow colors in WATCHFMT with %F/%K

49694 + doc: Allow using empty STTY= to freeze tty for a single command

49853 + 49882/49883: make "${arr[*]:off}" compatible with ksh/bash
---
 NEWS   | 72 ++++++++++++++++++++++++++++++++++++++++++----------------
 README | 33 +++++++++++++++++++--------
 2 files changed, 76 insertions(+), 29 deletions(-)

diff --git a/NEWS b/NEWS
index 8441610b0..61ee32ef1 100644
--- a/NEWS
+++ b/NEWS
@@ -4,25 +4,8 @@ CHANGES FROM PREVIOUS VERSIONS OF ZSH
 
 Note also the list of incompatibilities in the README file.
 
-Changes since 5.8
------------------
-
-CVE-2021-45444: Some prompt expansion sequences, such as %F, support
-'arguments' which are themselves expanded in case they contain colour
-values, etc. This additional expansion would trigger PROMPT_SUBST
-evaluation, if enabled. This could be abused to execute code the user
-didn't expect. e.g., given a certain prompt configuration, an attacker
-could trick a user into executing arbitrary code by having them check
-out a Git branch with a specially crafted name.
-
-This is fixed in the shell itself by no longer performing PROMPT_SUBST
-evaluation on these prompt-expansion arguments.
-
-Users who are concerned about an exploit but unable to update their
-binaries may apply the partial work-around described in the file
-Etc/CVE-2021-45444-VCS_Info-workaround.patch included with the shell
-source. [ Reported by RyotaK <security@ryotak.me>. Additional thanks to
-Marc Cornellà <hello@mcornella.com>. ]
+Changes since 5.8.1
+-------------------
 
 When unsetting a hash element, the string enclosed in square brackets is
 interpreted literally after any normal command-line-argument expansions.
@@ -54,6 +37,9 @@ fractional seconds.
 The option CLOBBER_EMPTY was added to enable the overwrite behaviour
 of CLOBBER for empty files only. It is disabled by default.
 
+A (-) expansion flag was added. It works like (n) but correctly sorts
+negative numbers.
+
 The compinit function learnt a -w option to explain why compdump runs.
 When run without the -i or -u options and compaudit discovers security
 issues, answering "y" to the "Ignore insecure ..." prompt removes the
@@ -69,11 +55,37 @@ widgets.  This corresponds to long-standing behavior of other user ZLE
 widgets.  Use the _complete_debug widget to capture XTRACE output, or
 use "functions -T" to enable tracing of specific completion functions.
 
+The fc builtin learnt an -s option which is a POSIX equivalent to the
+`fc -e-` method of re-executing a command without invoking an editor.
+
+The option CASE_PATHS was added to control how NO_CASE_GLOB behaves.
+NO_CASE_GLOB + NO_CASE_PATHS is equivalent to the current NO_CASE_GLOB
+behaviour. NO_CASE_GLOB + CASE_PATHS treats only path components that
+contain globbing characters as case-insensitive; this behaviour may
+yield more predictable results on case-sensitive file systems.
+NO_CASE_PATHS is the default.
+
 With the new TYPESET_TO_UNSET option set, "typeset foo" leaves foo unset,
 in contrast to the default behavior which assigns foo="".  Any parameter
 attributes such as numeric type, sorting, and padding are retained until
 the parameter is explicitly unset or a conflicting value is assigned.
-This is similar to default behavior of bash and ksh.
+This is similar to default behavior of bash and ksh.  This option is
+disabled by default.
+
+The compadd builtin's -D option can now be specified more than once.
+
+The zsh/zutil module's zformat builtin learnt an -F option which behaves
+like -f except that ternary expressions check for existence instead of
+doing math evaluation.
+
+A _numbers helper function has been added to help completion functions
+complete numbers with unit suffixes, etc.
+
+The WATCHFMT parameter now supports colours via the %F and %K escapes.
+
+The STTY parameter can now be set to an empty string before running a
+command to automatically restore terminal settings after the command
+finishes.
 
 The "jobs" command and "$jobstates" and related parameters can report on
 parent shell jobs even in subshells.  This is a snapshot of the parent
@@ -81,6 +93,26 @@ state, frozen at the point the subshell started.  However, if a subshell
 starts its own background jobs, the parent state is discarded in order
 to report on those new jobs.
 
+Changes from 5.8 to 5.8.1
+-------------------------
+
+CVE-2021-45444: Some prompt expansion sequences, such as %F, support
+'arguments' which are themselves expanded in case they contain colour
+values, etc. This additional expansion would trigger PROMPT_SUBST
+evaluation, if enabled. This could be abused to execute code the user
+didn't expect. e.g., given a certain prompt configuration, an attacker
+could trick a user into executing arbitrary code by having them check
+out a Git branch with a specially crafted name.
+
+This is fixed in the shell itself by no longer performing PROMPT_SUBST
+evaluation on these prompt-expansion arguments.
+
+Users who are concerned about an exploit but unable to update their
+binaries may apply the partial work-around described in the file
+Etc/CVE-2021-45444-VCS_Info-workaround.patch included with the shell
+source. [ Reported by RyotaK <security@ryotak.me>. Additional thanks to
+Marc Cornellà <hello@mcornella.com>. ]
+
 Changes from 5.7.1-test-3 to 5.8
 --------------------------------
 
diff --git a/README b/README
index c27d6881a..21142e17c 100644
--- a/README
+++ b/README
@@ -5,11 +5,12 @@ THE Z SHELL (ZSH)
 Version
 -------
 
-This is version 5.8.1 of the shell.  This is a security and bugfix release.
+This is version 5.9 of the shell.  This is a security and feature release.
+There are several visible improvements since 5.8.1, as well as bug fixes.
 All zsh installations are encouraged to upgrade as soon as possible.
 
 Note in particular the changes highlighted under "Incompatibilities since
-5.8" below.  See NEWS for more information.
+5.8.1" below.  See NEWS for more information.
 
 Installing Zsh
 --------------
@@ -30,16 +31,13 @@ Zsh is a shell with lots of features.  For a list of some of these, see the
 file FEATURES, and for the latest changes see NEWS.  For more
 details, see the documentation.
 
-Incompatibilities since 5.8
----------------------------
+Incompatibilities since 5.8.1
+-----------------------------
 
 compinit: A "y" response to the "Ignore ... and continue?" prompt removes
 insecure elements from the set of completion functions, where previously
 it ignored the compaudit result and included all elements.
 
-PROMPT_SUBST expansion is no longer performed on arguments to prompt-
-expansion sequences such as %F.
-
 Build-time change: The default value of the --enable-gdbm configure
 argument has changed from "yes" to "no".  Thus, the zsh/db/gdbm module will
 not be built unless --enable-gdbm is passed explicitly.
@@ -105,11 +103,25 @@ emulate sh: When zsh emulates sh, the final command in a pipeline is now run in
 a subshell.  This differs from the behavior in the native (zsh) mode, but is
 consistent with most other sh implementations.
 
+The export and readonly builtins now ignore the -p option when there are
+operands given and POSIX_BUILTINS is enabled. This more closely matches the
+behaviour of bash and ksh.
+
 getopts now calculates OPTIND in a similar manner to other shells when the
 POSIX_BUILTINS option is enabled.
 
-Incompatibilities between 5.7.1 and 5.8
----------------------------------------
+Ignored-signal traps are now inherited by subshells when the POSIX_TRAPS
+option is enabled.
+
+emulate sh: Inf and NaN are now treated as parameter names in arithmetic
+context when zsh is emulating sh.
+
+The ${name:offset:length} expansion syntax now behaves more similarly to
+other shells in that the offset and length are applied as array indices
+prior to scalar conversion in e.g. "${*:0:2}".
+
+Incompatibilities between 5.7.1 and 5.8.1
+-----------------------------------------
 
 The history expansion !:1:t2 used to be interpreted such that the 2
 was a separate character added after the history expansion.  Now
@@ -140,6 +152,9 @@ changes made in the course of fixing CVE-2019-20044.  Please report this
 to the zsh-workers mailing list if your system is affected.  See NEWS for
 more.
 
+PROMPT_SUBST expansion is no longer performed on arguments to prompt-
+expansion sequences such as %F.
+
 Incompatibilities between 5.6.2 and 5.7.1
 -----------------------------------------
 
-- 
2.34.1


From 1ffc4b86c4d76d91d18661bcf12d0b306deb472a Mon Sep 17 00:00:00 2001
From: dana <dana@dana.is>
Date: Sat, 2 Apr 2022 22:20:55 -0500
Subject: [PATCH 2/2] NEWS: Dedicate zsh 5.9 to Sven Guckes

---
 NEWS | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/NEWS b/NEWS
index 61ee32ef1..6c9112ad6 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,11 @@ Note also the list of incompatibilities in the README file.
 
 Changes since 5.8.1
 -------------------
+zsh 5.9 is dedicated in memory of Sven Guckes, who was, amongst other
+things, a long-time zsh advocate.
+
+  https://linuxnews.de/2022/02/sven-guckes-verstorben/
+  https://groups.google.com/g/vim_announce/c/MJBKVd-xrEE/m/joVNaDgAAgAJ
 
 When unsetting a hash element, the string enclosed in square brackets is
 interpreted literally after any normal command-line-argument expansions.
-- 
2.34.1

[-- Attachment #2: patch-1-changes.txt --]
[-- Type: text/plain, Size: 9412 bytes --]

From 200d3209e591839de391752d330575adb7ada8ea Mon Sep 17 00:00:00 2001
From: dana <dana@dana.is>
Date: Sat, 2 Apr 2022 22:19:04 -0500
Subject: [PATCH 1/2] NEWS/README: Add missing change documentation for 5.9

This covers the following changes:

users/24971: ${(-)var} sorts on signed integers

47704: POSIX export and readonly ignore "-p" when parameter names also appear

47913: implement CASE_PATHS option to make NO_CASE_GLOB more sensible

48073: Add fc -s as POSIX way of rerunning command without starting editor

49307 with doc update: POSIX_TRAPS fix.

49528: allow multiple -D options to compadd

49561: add zformat -F option, similar to -f but ternary expressions check for
existence instead of doing math evaluation

49597: add a helper for completing numbers with unit suffixes and separate out
defaults, ranges and units in completion descriptions

49611 based on 49590 (Martijn Dekker): disable Inf and NaN in math expressions
for sh emulation

49646: allow colors in WATCHFMT with %F/%K

49694 + doc: Allow using empty STTY= to freeze tty for a single command

49853 + 49882/49883: make "${arr[*]:off}" compatible with ksh/bash
---
 NEWS   | 72 ++++++++++++++++++++++++++++++++++++++++++----------------
 README | 33 +++++++++++++++++++--------
 2 files changed, 76 insertions(+), 29 deletions(-)

diff --git a/NEWS b/NEWS
index 8441610b0..61ee32ef1 100644
--- a/NEWS
+++ b/NEWS
@@ -4,25 +4,8 @@ CHANGES FROM PREVIOUS VERSIONS OF ZSH
 
 Note also the list of incompatibilities in the README file.
 
-Changes since 5.8
------------------
-
-CVE-2021-45444: Some prompt expansion sequences, such as %F, support
-'arguments' which are themselves expanded in case they contain colour
-values, etc. This additional expansion would trigger PROMPT_SUBST
-evaluation, if enabled. This could be abused to execute code the user
-didn't expect. e.g., given a certain prompt configuration, an attacker
-could trick a user into executing arbitrary code by having them check
-out a Git branch with a specially crafted name.
-
-This is fixed in the shell itself by no longer performing PROMPT_SUBST
-evaluation on these prompt-expansion arguments.
-
-Users who are concerned about an exploit but unable to update their
-binaries may apply the partial work-around described in the file
-Etc/CVE-2021-45444-VCS_Info-workaround.patch included with the shell
-source. [ Reported by RyotaK <security@ryotak.me>. Additional thanks to
-Marc Cornellà <hello@mcornella.com>. ]
+Changes since 5.8.1
+-------------------
 
 When unsetting a hash element, the string enclosed in square brackets is
 interpreted literally after any normal command-line-argument expansions.
@@ -54,6 +37,9 @@ fractional seconds.
 The option CLOBBER_EMPTY was added to enable the overwrite behaviour
 of CLOBBER for empty files only. It is disabled by default.
 
+A (-) expansion flag was added. It works like (n) but correctly sorts
+negative numbers.
+
 The compinit function learnt a -w option to explain why compdump runs.
 When run without the -i or -u options and compaudit discovers security
 issues, answering "y" to the "Ignore insecure ..." prompt removes the
@@ -69,11 +55,37 @@ widgets.  This corresponds to long-standing behavior of other user ZLE
 widgets.  Use the _complete_debug widget to capture XTRACE output, or
 use "functions -T" to enable tracing of specific completion functions.
 
+The fc builtin learnt an -s option which is a POSIX equivalent to the
+`fc -e-` method of re-executing a command without invoking an editor.
+
+The option CASE_PATHS was added to control how NO_CASE_GLOB behaves.
+NO_CASE_GLOB + NO_CASE_PATHS is equivalent to the current NO_CASE_GLOB
+behaviour. NO_CASE_GLOB + CASE_PATHS treats only path components that
+contain globbing characters as case-insensitive; this behaviour may
+yield more predictable results on case-sensitive file systems.
+NO_CASE_PATHS is the default.
+
 With the new TYPESET_TO_UNSET option set, "typeset foo" leaves foo unset,
 in contrast to the default behavior which assigns foo="".  Any parameter
 attributes such as numeric type, sorting, and padding are retained until
 the parameter is explicitly unset or a conflicting value is assigned.
-This is similar to default behavior of bash and ksh.
+This is similar to default behavior of bash and ksh.  This option is
+disabled by default.
+
+The compadd builtin's -D option can now be specified more than once.
+
+The zsh/zutil module's zformat builtin learnt an -F option which behaves
+like -f except that ternary expressions check for existence instead of
+doing math evaluation.
+
+A _numbers helper function has been added to help completion functions
+complete numbers with unit suffixes, etc.
+
+The WATCHFMT parameter now supports colours via the %F and %K escapes.
+
+The STTY parameter can now be set to an empty string before running a
+command to automatically restore terminal settings after the command
+finishes.
 
 The "jobs" command and "$jobstates" and related parameters can report on
 parent shell jobs even in subshells.  This is a snapshot of the parent
@@ -81,6 +93,26 @@ state, frozen at the point the subshell started.  However, if a subshell
 starts its own background jobs, the parent state is discarded in order
 to report on those new jobs.
 
+Changes from 5.8 to 5.8.1
+-------------------------
+
+CVE-2021-45444: Some prompt expansion sequences, such as %F, support
+'arguments' which are themselves expanded in case they contain colour
+values, etc. This additional expansion would trigger PROMPT_SUBST
+evaluation, if enabled. This could be abused to execute code the user
+didn't expect. e.g., given a certain prompt configuration, an attacker
+could trick a user into executing arbitrary code by having them check
+out a Git branch with a specially crafted name.
+
+This is fixed in the shell itself by no longer performing PROMPT_SUBST
+evaluation on these prompt-expansion arguments.
+
+Users who are concerned about an exploit but unable to update their
+binaries may apply the partial work-around described in the file
+Etc/CVE-2021-45444-VCS_Info-workaround.patch included with the shell
+source. [ Reported by RyotaK <security@ryotak.me>. Additional thanks to
+Marc Cornellà <hello@mcornella.com>. ]
+
 Changes from 5.7.1-test-3 to 5.8
 --------------------------------
 
diff --git a/README b/README
index c27d6881a..21142e17c 100644
--- a/README
+++ b/README
@@ -5,11 +5,12 @@ THE Z SHELL (ZSH)
 Version
 -------
 
-This is version 5.8.1 of the shell.  This is a security and bugfix release.
+This is version 5.9 of the shell.  This is a security and feature release.
+There are several visible improvements since 5.8.1, as well as bug fixes.
 All zsh installations are encouraged to upgrade as soon as possible.
 
 Note in particular the changes highlighted under "Incompatibilities since
-5.8" below.  See NEWS for more information.
+5.8.1" below.  See NEWS for more information.
 
 Installing Zsh
 --------------
@@ -30,16 +31,13 @@ Zsh is a shell with lots of features.  For a list of some of these, see the
 file FEATURES, and for the latest changes see NEWS.  For more
 details, see the documentation.
 
-Incompatibilities since 5.8
----------------------------
+Incompatibilities since 5.8.1
+-----------------------------
 
 compinit: A "y" response to the "Ignore ... and continue?" prompt removes
 insecure elements from the set of completion functions, where previously
 it ignored the compaudit result and included all elements.
 
-PROMPT_SUBST expansion is no longer performed on arguments to prompt-
-expansion sequences such as %F.
-
 Build-time change: The default value of the --enable-gdbm configure
 argument has changed from "yes" to "no".  Thus, the zsh/db/gdbm module will
 not be built unless --enable-gdbm is passed explicitly.
@@ -105,11 +103,25 @@ emulate sh: When zsh emulates sh, the final command in a pipeline is now run in
 a subshell.  This differs from the behavior in the native (zsh) mode, but is
 consistent with most other sh implementations.
 
+The export and readonly builtins now ignore the -p option when there are
+operands given and POSIX_BUILTINS is enabled. This more closely matches the
+behaviour of bash and ksh.
+
 getopts now calculates OPTIND in a similar manner to other shells when the
 POSIX_BUILTINS option is enabled.
 
-Incompatibilities between 5.7.1 and 5.8
----------------------------------------
+Ignored-signal traps are now inherited by subshells when the POSIX_TRAPS
+option is enabled.
+
+emulate sh: Inf and NaN are now treated as parameter names in arithmetic
+context when zsh is emulating sh.
+
+The ${name:offset:length} expansion syntax now behaves more similarly to
+other shells in that the offset and length are applied as array indices
+prior to scalar conversion in e.g. "${*:0:2}".
+
+Incompatibilities between 5.7.1 and 5.8.1
+-----------------------------------------
 
 The history expansion !:1:t2 used to be interpreted such that the 2
 was a separate character added after the history expansion.  Now
@@ -140,6 +152,9 @@ changes made in the course of fixing CVE-2019-20044.  Please report this
 to the zsh-workers mailing list if your system is affected.  See NEWS for
 more.
 
+PROMPT_SUBST expansion is no longer performed on arguments to prompt-
+expansion sequences such as %F.
+
 Incompatibilities between 5.6.2 and 5.7.1
 -----------------------------------------
 
-- 
2.34.1

[-- Attachment #3: patch-2-dedication.txt --]
[-- Type: text/plain, Size: 848 bytes --]

From 1ffc4b86c4d76d91d18661bcf12d0b306deb472a Mon Sep 17 00:00:00 2001
From: dana <dana@dana.is>
Date: Sat, 2 Apr 2022 22:20:55 -0500
Subject: [PATCH 2/2] NEWS: Dedicate zsh 5.9 to Sven Guckes

---
 NEWS | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/NEWS b/NEWS
index 61ee32ef1..6c9112ad6 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,11 @@ Note also the list of incompatibilities in the README file.
 
 Changes since 5.8.1
 -------------------
+zsh 5.9 is dedicated in memory of Sven Guckes, who was, amongst other
+things, a long-time zsh advocate.
+
+  https://linuxnews.de/2022/02/sven-guckes-verstorben/
+  https://groups.google.com/g/vim_announce/c/MJBKVd-xrEE/m/joVNaDgAAgAJ
 
 When unsetting a hash element, the string enclosed in square brackets is
 interpreted literally after any normal command-line-argument expansions.
-- 
2.34.1

^ permalink raw reply	[relevance 5%]

* Re: _time_zone gives me candidates other than timezones
  @ 2022-04-05 23:18  3%       ` Jordan Russell
  2022-04-06 20:11  0%         ` Bart Schaefer
  0 siblings, 1 reply; 200+ results
From: Jordan Russell @ 2022-04-05 23:18 UTC (permalink / raw)
  To: Jun. T; +Cc: zsh-workers

I like Jun's solution. I still have reservations about completing right/
and posix/ (they could be flags instead to the calling program). But the
difference isn't a really big one.

That said I did write a big email about it and I think I only sent it to
Aaron Schrab (sorry). So now I'm quoting it here and actually CC'ing the list

>I guess it comes down to whether you call _time_zone to find a zoneinfo
>/file/ or a timezone /name/.
>
>If you're just completing the name of a timezone then whether the name
>of the timezone refers to a `right` timezone or a `posix` timezone seems
>like it could be better handled by the programmer calling
>_time_zone. After all the names under right/ and posix/ are identical so
>the directory prefix only adds a bit of semantic information, which
>would probably be better handled as an argument somehwere beforehand
>rather than parsed out later.
>
>If you're calling _time_zone to complete zoneinfo files themselves then
>excluding posix/ and right/ is wrong since each directory houses
>different files and so their differences can't be easily accounted for
>otherwise. But if you're completing filenames you'd also need to recover
>the prefix which is lost when using -W as is used now.
>
>> I'm a bit more puzzled about why the separate `posix` directory exists. 
>> At least for my local time zone it doesn't seem to matter if I use that 
>> or leave it out; while using the `right` one definitely makes a 
>> difference:
>Yeah, I get the same behavior on my system.
>
>So, no I wasn't aware of the difference between right/ and posix/ but I
>also don't think their exclusion will matter since I think _time_zone is
>more for completing names by way of files and the files themselves are
>not relevant in this context.
>


"Jun. T" <takimoto-j@kba.biglobe.ne.jp> writes:

>> 2022/03/30 9:12, Aaron Schrab <aaron@schrab.com> wrote:
>> 
>> While I don't think I've ever really needed to use zoneinfo entries from those directories, I'd certainly prefer they be offered for completion.
>
> How about this?
>
> diff --git a/Completion/Unix/Type/_time_zone b/Completion/Unix/Type/_time_zone
> index cd924bbc7..c437252a8 100644
> --- a/Completion/Unix/Type/_time_zone
> +++ b/Completion/Unix/Type/_time_zone
> @@ -6,4 +6,4 @@ if (( ! $+_zoneinfo_dirs )); then
>    _zoneinfo_dirs=( /usr/{share,lib,share/lib}/{zoneinfo*,locale/TZ}(/) )
>  fi
>  
> -_wanted time-zones expl 'time zone' _files -W _zoneinfo_dirs "$@" -
> +_wanted time-zones expl 'time zone' _files -g '[A-Z]*' -W _zoneinfo_dirs "$@" -


^ permalink raw reply	[relevance 3%]

* Re: _time_zone gives me candidates other than timezones
  2022-04-05 23:18  3%       ` Jordan Russell
@ 2022-04-06 20:11  0%         ` Bart Schaefer
  0 siblings, 0 replies; 200+ results
From: Bart Schaefer @ 2022-04-06 20:11 UTC (permalink / raw)
  To: Jordan Russell; +Cc: Jun. T, Zsh hackers list

On Tue, Apr 5, 2022 at 4:19 PM Jordan Russell
<jordan.likes.curry@gmail.com> wrote:
>
> I like Jun's solution.

That's good, because it's already been added to the repository.
However, I did notice that if one explicitly attempts to start a
timezone name with "z" or "l", the lower case file names are in fact
offered (instead of, for example, correcting to Zulu).

> I still have reservations about completing right/
> and posix/ (they could be flags instead to the calling program).

Do you mean the calling program might use those as keywords (with no
leading hyphen[s])?  Or do you mean the caller of _time_zone should
[be able to] specify whether to include them?

> >I guess it comes down to whether you call _time_zone to find a zoneinfo
> >/file/ or a timezone /name/.
[...]
> > But if you're completing filenames you'd also need to recover
> >the prefix which is lost when using -W as is used now.

Further, if you start completing the tail of an absolute path, normal
file completion occurs.


^ permalink raw reply	[relevance 0%]

* Re: Test release: 5.8.1.2-test
    @ 2022-04-11  0:32  4% ` Axel Beckert
  2022-04-11  8:30  0%   ` Axel Beckert
  1 sibling, 1 reply; 200+ results
From: Axel Beckert @ 2022-04-11  0:32 UTC (permalink / raw)
  To: Zsh hackers list

Hi,

On Sat, Apr 09, 2022 at 03:07:05PM -0500, dana wrote:
> I've tagged 5.8.1.2-test (test release for the upcoming zsh 5.9) and
> uploaded the artefacts to:
> 
>   https://sourceforge.net/projects/zsh/files/zsh-test/5.8.1.2-test/
> 
> If you have the time, please test and report any issues found.

Builds fine on Debian Unstable locally and in a local, clean chroot,
but seems to fail to build in Debian's Gitlab CI due to one test
failure: https://salsa.debian.org/debian/zsh/-/jobs/2661258

The failure I noticed in the log:

7266 Running test: POSIX: width in %s should be computed in bytes, not in characters
7267 Test ../../Test/D07multibyte.ztst was expected to fail, but passed.
7268 Was testing: POSIX: width in %s should be computed in bytes, not in characters
7269 ../../Test/D07multibyte.ztst: test XPassed.
7270 The following may (or may not) help identifying the cause:
7271  This is considered a bugfix in zsh
7272 ../../Test/D08cmdsubst.ztst: starting.

And in the end:

8850 61 successful test scripts, 1 failure, 2 skipped

Hopefully that's the failure mentioned in the summary, because I found
no other.

I've uploaded it to Debian Experimental anyway to see if it builds
fine on the official build daemons. Will see later today.

BTW: I expected that scp tab completion fails with OpenSSH 9.0 as it
uses SFTP as backend now which needs less quoting. But to my surprise
it still seems to work.

		Kind regards, Axel
-- 
PGP: 2FF9CD59612616B5      /~\  Plain Text Ribbon Campaign, http://arc.pasp.de/
Mail: abe@deuxchevaux.org  \ /  Say No to HTML in E-Mail and Usenet
Mail+Jabber: abe@noone.org  X
https://axel.beckert.ch/   / \  I love long mails: https://email.is-not-s.ms/


^ permalink raw reply	[relevance 4%]

* Re: Test release: 5.8.1.2-test
  2022-04-11  0:32  4% ` Axel Beckert
@ 2022-04-11  8:30  0%   ` Axel Beckert
  0 siblings, 0 replies; 200+ results
From: Axel Beckert @ 2022-04-11  8:30 UTC (permalink / raw)
  To: zsh-workers

Hi,

On Mon, Apr 11, 2022 at 02:32:57AM +0200, Axel Beckert wrote:
> >   https://sourceforge.net/projects/zsh/files/zsh-test/5.8.1.2-test/
> > 
> > If you have the time, please test and report any issues found.
> 
> Builds fine on Debian Unstable locally and in a local, clean chroot,
> but seems to fail to build in Debian's Gitlab CI due to one test
> failure: https://salsa.debian.org/debian/zsh/-/jobs/2661258
> 
> The failure I noticed in the log:
> 
> 7266 Running test: POSIX: width in %s should be computed in bytes, not in characters
> 7267 Test ../../Test/D07multibyte.ztst was expected to fail, but passed.
> 7268 Was testing: POSIX: width in %s should be computed in bytes, not in characters
> 7269 ../../Test/D07multibyte.ztst: test XPassed.
> 7270 The following may (or may not) help identifying the cause:
> 7271  This is considered a bugfix in zsh
> 7272 ../../Test/D08cmdsubst.ztst: starting.
> 
> And in the end:
> 
> 8850 61 successful test scripts, 1 failure, 2 skipped
> 
> Hopefully that's the failure mentioned in the summary, because I found
> no other.
> 
> I've uploaded it to Debian Experimental anyway to see if it builds
> fine on the official build daemons. Will see later today.

Looks bad: Test suite failures on most architectures on the build daemons:

https://buildd.debian.org/status/package.php?p=zsh&suite=experimental

Those were the test suite didn't fail seem only 32-bit architectures
(although I'm not sure if all of them really are 32-bit architectures):

i386, hppa, hurd-i386, m68k (and "all" which is actually the
architecture-independent stuff like docs, etc. where the test suite
isn't running).

All other architectures have 1 test suite failure according to the
summary:

61 successful test scripts, 1 failure, 2 skipped

Haven't checked yet, if it always was the same issue (the one cited
above from the "git push" triggered CI), but I currently assume so.

		Kind regards, Axel
-- 
PGP: 2FF9CD59612616B5      /~\  Plain Text Ribbon Campaign, http://arc.pasp.de/
Mail: abe@deuxchevaux.org  \ /  Say No to HTML in E-Mail and Usenet
Mail+Jabber: abe@noone.org  X
https://axel.beckert.ch/   / \  I love long mails: https://email.is-not-s.ms/


^ permalink raw reply	[relevance 0%]

* [PATCH] Re: 5.8.1.2-test - test failures running as root
  @ 2022-04-11 22:38  5% ` Bart Schaefer
  0 siblings, 0 replies; 200+ results
From: Bart Schaefer @ 2022-04-11 22:38 UTC (permalink / raw)
  To: Zsh hackers list

On Mon, Apr 11, 2022 at 2:14 PM Bart Schaefer <schaefer@brasslantern.com> wrote:
>
> These are probably not new; found while experimenting with reproducing
> Axel's test fails.
>
> The first is obviously because of root's expanded privileges.  The
> second probably also so, just not immediately clear why.

Fixed the first by just skipping the test.  Fixed the second by
dropping privilege and then attempting to escalate again.

diff --git a/Test/D02glob.ztst b/Test/D02glob.ztst
index 72891a2a7..850a535e5 100644
--- a/Test/D02glob.ztst
+++ b/Test/D02glob.ztst
@@ -748,13 +748,21 @@
   touch glob.tmp/secret-d$1/dir/file
   chmod $1 glob.tmp/secret-d$1
  done
- print -raC 2 -- glob.tmp/secret-*/* glob.tmp/secret-*/file
+ if (( EUID == 0 )); then
+   ZTST_skip='Not testing unreadable directories (root reads anything)'
+ else
+   print -raC 2 -- glob.tmp/secret-*/* glob.tmp/secret-*/file
+ fi
 0:names inside unreadable directories can be globbed if searchable
 >glob.tmp/secret-d444/dir   glob.tmp/secret-d444/file
 >glob.tmp/secret-s444/dir   glob.tmp/secret-s444/file
 >glob.tmp/secret-d111/file  glob.tmp/secret-s111/file

- print -rC 2 -- glob.tmp/secret-*/dir/*
+ if (( EUID == 0 )); then
+   ZTST_skip='Not testing unreadable directories (root reads anything)'
+ else
+   print -rC 2 -- glob.tmp/secret-*/dir/*
+ fi
 0:glob files in readable directories inside unreadable directories
 >glob.tmp/secret-d111/dir/file  glob.tmp/secret-s111/dir/file

diff --git a/Test/E03posix.ztst b/Test/E03posix.ztst
index caab97ab6..6ac4d1732 100644
--- a/Test/E03posix.ztst
+++ b/Test/E03posix.ztst
@@ -153,7 +153,7 @@ F:This may also need to apply to multibyte whitespace
 F:POSIX has neither math functions nor floating point
 >42

-  ARGV0=sh $ZTST_testdir/../Src/zsh -c 'EUID=10; echo "$EUID"'
+  ARGV0=sh $ZTST_testdir/../Src/zsh -c 'EUID=1; EUID=10; echo $EUID'
 -f:EUID is not a special variable
 >10


^ permalink raw reply	[relevance 5%]

* Re: Test release: 5.8.1.2-test
  @ 2022-04-12  9:16  3%   ` Peter Stephenson
  0 siblings, 0 replies; 200+ results
From: Peter Stephenson @ 2022-04-12  9:16 UTC (permalink / raw)
  To: zsh-workers

> On 10 April 2022 at 21:07 Peter Stephenson <p.w.stephenson@ntlworld.com> wrote:
> On Sat, 2022-04-09 at 15:07 -0500, dana wrote:
> > I've tagged 5.8.1.2-test (test release for the upcoming zsh 5.9) and
> > uploaded the artefacts to:
> > 
> >   https://sourceforge.net/projects/zsh/files/zsh-test/5.8.1.2-test/
> > 
> > If you have the time, please test and report any issues found.
> 
> Thanks very much for this, fine on my Ubuntu system.  I'll be able to
> try out on RedHat and Cygwin tomorrow.

Seems entirely clean on Ubuntu 16.04 and 18.04 and RedHat EL7.

Compiles on Cygwin but the test system is a bit sick on my laptop ---
not actually that unusual.  Unlikely to have time to look at this.

A couple of fixes will remove compilation warnings; it looks like
POSIX systems are pretty safe about signed characters these days
so Cygwin is about the only place where they still cause issues.

pws

diff --git a/Src/exec.c b/Src/exec.c
index 27d49e005..47753da48 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -561,7 +561,7 @@ zexecve(char *pth, char **argv, char **newenvp)
                         isbinary = 1;
                         hasletter = 0;
                         for (ptr = execvebuf; ptr < ptr2; ptr++) {
-                            if (islower(*ptr) || *ptr == '$' || *ptr == '`')
+                            if (islower(STOUC(*ptr)) || *ptr == '$' || *ptr == '`')
                                 hasletter = 1;
                             if (hasletter && *ptr == '\n') {
                                 isbinary = 0;
diff --git a/Src/prompt.c b/Src/prompt.c
index 738c7fc7a..092de63a4 100644
--- a/Src/prompt.c
+++ b/Src/prompt.c
@@ -1666,7 +1666,7 @@ match_colour(const char **teststrp, int is_fg, int colour)
 	tc = TCBGCOLOUR;
     }
     if (teststrp) {
-	if (**teststrp == '#' && isxdigit((*teststrp)[1])) {
+	if (**teststrp == '#' && isxdigit(STOUC((*teststrp)[1]))) {
 	    struct color_rgb color;
 	    char *end;
 	    zlong col = zstrtol(*teststrp+1, &end, 16);


^ permalink raw reply	[relevance 3%]

* Re: ERRNO is unset until set
  @ 2022-04-29 17:02  3%         ` Bart Schaefer
  2022-04-29 17:08  0%           ` Daniel Shahaf
  0 siblings, 1 reply; 200+ results
From: Bart Schaefer @ 2022-04-29 17:02 UTC (permalink / raw)
  To: Mikael Magnusson; +Cc: Zsh hackers list

On Fri, Apr 29, 2022 at 3:00 AM Mikael Magnusson <mikachu@gmail.com> wrote:
>
> When is this good or useful?

I was wondering that myself.  The only thing I can think of is to make
${+ERRNO} show the "right" thing.

Archive search is still offline (and I'm not sure it would help
anyway) so I can't find the discussion that led up my patch from
32337, but it seems to me that was intended to be just a first step to
causing some of those variables to be non-special when zsh is started
in emulation mode.  The second step just never happened, or at least
not comprehensively.

I'm no longer even sure why ERRNO was included, there's no reference
to it in the POSIX shell specification.  Clash with some other shell?
But which one?


^ permalink raw reply	[relevance 3%]

* Re: ERRNO is unset until set
  2022-04-29 17:02  3%         ` Bart Schaefer
@ 2022-04-29 17:08  0%           ` Daniel Shahaf
  0 siblings, 0 replies; 200+ results
From: Daniel Shahaf @ 2022-04-29 17:08 UTC (permalink / raw)
  To: zsh-workers

Bart Schaefer wrote on Fri, 29 Apr 2022 17:02 +00:00:
> On Fri, Apr 29, 2022 at 3:00 AM Mikael Magnusson <mikachu@gmail.com> wrote:
>>
>> When is this good or useful?
>
> I was wondering that myself.  The only thing I can think of is to make
> ${+ERRNO} show the "right" thing.
>
> Archive search is still offline (and I'm not sure it would help
> anyway) so I can't find the discussion that led up my patch from
> 32337,

https://zsh.org/workers/32157?

> but it seems to me that was intended to be just a first step to
> causing some of those variables to be non-special when zsh is started
> in emulation mode.  The second step just never happened, or at least
> not comprehensively.
>
> I'm no longer even sure why ERRNO was included, there's no reference
> to it in the POSIX shell specification.  Clash with some other shell?
> But which one?


^ permalink raw reply	[relevance 0%]

* Re: E02 failing on Alpine / musl libc
  @ 2022-05-19  3:27  4%   ` dana
  0 siblings, 0 replies; 200+ results
From: dana @ 2022-05-19  3:27 UTC (permalink / raw)
  To: Jun T; +Cc: Zsh hackers list

On Mon 16 May 2022, at 21:33, Jun T wrote:
> So I think we need/should not "fix" this, because 0xfdXX (or \ufdXX) is the
> correct representation in their "special" C loale.

I think i see the argument for not trying to do any 'special' accounting
of this locale in the shell. As far as the tests, i guess we are
technically making assumptions about the wchar values of non-'portable'
characters that POSIX says we can't actually make, but not making those
assumptions seems annoying

For the E02 test in particular, as Peter says, it isn't a multi-byte test.
If there's not anything special about the code path for xtrace
preservation that's sensitive to weird function names maybe that aspect of
the test belongs in B13, C04, or D07...?


Here is some additional context/history behind these failing tests, in
case anyone's ever looking for it later. Don't read this, you probably
don't care:

The A03 and B03 tests that Jun mentioned here have been failing on musl
since at least zsh-5.5 — probably longer (despite workers/48578 indicating
that it'd only started 'recently'), since the """special""" (lol) locale
was introduced to musl in August 2015, and made its way into Alpine very
shortly afterwards

The LC_ALL=C in the failing E02 test was introduced by me and Jun in
workers/45537+45550 to fix a similar issue i was seeing with the way the
function name ヌ was being printed by `which` on macOS Mojave. I bet i was
having this problem because i had explicitly set LC_CTYPE to a UTF-8
locale, and Jun had not yet made the change in workers/49908 to have ztst
reset that back to C like it did with LANG and LC_ALL. It does now reset
it with the others so the LC_ALL=C is probably superfluous in that respect

However, if you don't have *any* LANG/LC_* variables set, on some systems,
including Alpine, where the 'implementation-defined default locale' is
UTF-8, you can get the same behaviour i was seeing where `which` just
prints ヌ back out without any escaping

I mention that because there are basically only two possibilities on a
typical musl system (either the 'special' POSIX locale or a UTF-8 one)
and both of them will cause the test to fail as written. And also because
there might be other systems that have a UTF-8 default locale where this
test and others could fail without an explicit LC_ALL=C because ztst only
resets the locale to C if we're *not* using the default one (which i don't
think i understand the reasoning for)


dana


^ permalink raw reply	[relevance 4%]

* Re: Bug in function in function
  @ 2022-05-20 17:12  3%   ` Klaus Ethgen
  2022-05-20 17:16  0%     ` Mikael Magnusson
  0 siblings, 1 reply; 200+ results
From: Klaus Ethgen @ 2022-05-20 17:12 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: Zsh hackers list

[-- Attachment #1: Type: text/plain, Size: 975 bytes --]

Am Fr den 20. Mai 2022 um 16:37 schrieb Bart Schaefer:
> On Thu, May 19, 2022 at 12:34 PM Klaus Ethgen <Klaus@ethgen.ch> wrote:
> >
> > Now I get an error in the `ls()` line. It is even more strange that I
> > don't get an error when compiling it as zwc file!
> 
> What's the error?

/home/klaus/.zsh/zshrc/30_aliases:471: parse error near `()'

This is the line `ls()`. the first function definition (`cd()`) does
work. And when compiling, both work as expected.

I have an alias `alias ls="LC_COLLATE=POSIX ls $_ls_opts"` before this
line but that should not interfere the function definition.

> > Is there any recent that has changed?
> 
> Quite a number of things, but you haven't told us enough yet to narrow it down.

What do you need?

Regards
   Klaus
-- 
Klaus Ethgen                                       http://www.ethgen.ch/
pub  4096R/4E20AF1C 2011-05-16            Klaus Ethgen <Klaus@Ethgen.ch>
Fingerprint: 85D4 CA42 952C 949B 1753  62B3 79D0 B06F 4E20 AF1C

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 688 bytes --]

^ permalink raw reply	[relevance 3%]

* Re: Bug in function in function
  2022-05-20 17:12  3%   ` Klaus Ethgen
@ 2022-05-20 17:16  0%     ` Mikael Magnusson
  2022-05-20 17:25  0%       ` Klaus Ethgen
  0 siblings, 1 reply; 200+ results
From: Mikael Magnusson @ 2022-05-20 17:16 UTC (permalink / raw)
  To: Klaus Ethgen; +Cc: Bart Schaefer, Zsh hackers list

On 5/20/22, Klaus Ethgen <Klaus@ethgen.ch> wrote:
> Am Fr den 20. Mai 2022 um 16:37 schrieb Bart Schaefer:
>> On Thu, May 19, 2022 at 12:34 PM Klaus Ethgen <Klaus@ethgen.ch> wrote:
>> >
>> > Now I get an error in the `ls()` line. It is even more strange that I
>> > don't get an error when compiling it as zwc file!
>>
>> What's the error?
>
> /home/klaus/.zsh/zshrc/30_aliases:471: parse error near `()'
>
> This is the line `ls()`. the first function definition (`cd()`) does
> work. And when compiling, both work as expected.
>
> I have an alias `alias ls="LC_COLLATE=POSIX ls $_ls_opts"` before this
> line but that should not interfere the function definition.

In fact it should, and it does. Change your function definition(s) to
the form "function ls".

-- 
Mikael Magnusson


^ permalink raw reply	[relevance 0%]

* Re: Bug in function in function
  2022-05-20 17:16  0%     ` Mikael Magnusson
@ 2022-05-20 17:25  0%       ` Klaus Ethgen
  2022-05-20 17:46  0%         ` Peter Stephenson
  0 siblings, 1 reply; 200+ results
From: Klaus Ethgen @ 2022-05-20 17:25 UTC (permalink / raw)
  To: Mikael Magnusson; +Cc: Bart Schaefer, Zsh hackers list

[-- Attachment #1: Type: text/plain, Size: 1206 bytes --]

Am Fr den 20. Mai 2022 um 18:16 schrieb Mikael Magnusson:
> On 5/20/22, Klaus Ethgen <Klaus@ethgen.ch> wrote:
> > Am Fr den 20. Mai 2022 um 16:37 schrieb Bart Schaefer:
> >> On Thu, May 19, 2022 at 12:34 PM Klaus Ethgen <Klaus@ethgen.ch> wrote:
> >> >
> >> > Now I get an error in the `ls()` line. It is even more strange that I
> >> > don't get an error when compiling it as zwc file!
> >>
> >> What's the error?
> >
> > /home/klaus/.zsh/zshrc/30_aliases:471: parse error near `()'
> >
> > This is the line `ls()`. the first function definition (`cd()`) does
> > work. And when compiling, both work as expected.
> >
> > I have an alias `alias ls="LC_COLLATE=POSIX ls $_ls_opts"` before this
> > line but that should not interfere the function definition.
> 
> In fact it should, and it does. Change your function definition(s) to
> the form "function ls".

Putting a `function` in front of `ls()` work.

However, I was thinking, `function` (in that context) is deprecated.

Regards
   Klaus
-- 
Klaus Ethgen                                       http://www.ethgen.ch/
pub  4096R/4E20AF1C 2011-05-16            Klaus Ethgen <Klaus@Ethgen.ch>
Fingerprint: 85D4 CA42 952C 949B 1753  62B3 79D0 B06F 4E20 AF1C

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 688 bytes --]

^ permalink raw reply	[relevance 0%]

* Re: Bug in function in function
  2022-05-20 17:25  0%       ` Klaus Ethgen
@ 2022-05-20 17:46  0%         ` Peter Stephenson
  0 siblings, 0 replies; 200+ results
From: Peter Stephenson @ 2022-05-20 17:46 UTC (permalink / raw)
  To: zsh-workers

On Fri, 2022-05-20 at 18:25 +0100, Klaus Ethgen wrote:
> Am Fr den 20. Mai 2022 um 18:16 schrieb Mikael Magnusson:
> > On 5/20/22, Klaus Ethgen <Klaus@ethgen.ch> wrote:
> > > I have an alias `alias ls="LC_COLLATE=POSIX ls $_ls_opts"` before this
> > > line but that should not interfere the function definition.
> > 
> > In fact it should, and it does. Change your function definition(s) to
> > the form "function ls".
> 
> Putting a `function` in front of `ls()` work.
> 
> However, I was thinking, `function` (in that context) is deprecated.

No, it's valid syntax and will remain so --- just avoid using both
function in front AND () afterwards.  This is indeed the recommended fix
for this case.  The point, in case it isn't already obvious, is that
alias expands everything in command position before it's even been
parsed --- so your "ls" has turned into something else on input before
the shell has even swallowed the ().  With the function keyword, the
following word is no longer in command position.

pws



^ permalink raw reply	[relevance 0%]

Results 1601-1800 of ~2400   |  | reverse | sort options + mbox downloads above
-- links below jump to the message on this page --
2018-01-09 16:22     [BUG] getopts OPTIND Francisco de Zuviría Allende
2018-01-09 22:48     ` dana
2021-04-13 23:28  2%   ` dana
2021-04-14 13:08  0%     ` Daniel Shahaf
2021-04-18  5:16  4%       ` dana
2019-12-16 21:10     regexp-replace and ^, word boundary or look-behind operators Stephane Chazelas
2019-12-16 21:27     ` Stephane Chazelas
2019-12-17  7:38       ` Stephane Chazelas
2019-12-17 11:11         ` [PATCH] " Stephane Chazelas
2019-12-18  0:22           ` Daniel Shahaf
2020-01-01 14:03             ` [PATCH v2] " Stephane Chazelas
2021-04-30  6:11 10%           ` Stephane Chazelas
2021-04-30 23:13                 ` Bart Schaefer
2021-05-05 11:45  7%               ` [PATCH v3] regexp-replace and ^, word boundary or look-behind operators (and more) Stephane Chazelas
2020-10-01 12:11     [BUG] _less incorrectly completes -" and -# Roman Perepelitsa
2020-10-02 14:47     ` Oliver Kiddle
2021-10-23  0:26  3%   ` Oliver Kiddle
2020-11-14  5:41     Bug with unset variables Roman Perepelitsa
2020-11-16 19:41     ` Felipe Contreras
2020-11-17 20:54       ` Bart Schaefer
2020-11-22  1:49         ` Felipe Contreras
2020-11-23  6:48           ` Bart Schaefer
2020-11-23  7:26             ` Felipe Contreras
2020-11-23 20:26               ` Bart Schaefer
2020-11-23 23:39                 ` Felipe Contreras
2020-11-24  0:52                   ` Bart Schaefer
2020-11-25  8:46                     ` Felipe Contreras
2020-11-27 15:44                       ` Daniel Shahaf
2020-11-27 20:49                         ` Felipe Contreras
2020-11-27 20:59                           ` Daniel Shahaf
2020-11-27 21:33                             ` Bart Schaefer
2020-11-27 23:37                               ` Daniel Shahaf
2020-11-28  0:24                                 ` Bart Schaefer
2020-11-28 12:05  4%                               ` Felipe Contreras
2020-11-25  7:02     More rabbit-holes " Bart Schaefer
2020-11-25 13:19     ` Stephane Chazelas
2020-11-25 22:17       ` Felipe Contreras
2020-11-26 20:41         ` Bart Schaefer
2020-11-26 21:20           ` Felipe Contreras
2020-11-26 22:41             ` Bart Schaefer
2020-11-26 23:45               ` Felipe Contreras
2020-11-27  0:09                 ` Bart Schaefer
2020-11-27  0:30                   ` Felipe Contreras
2020-11-27  0:51                     ` Bart Schaefer
2020-11-27  1:30                       ` Felipe Contreras
2020-11-27 20:54                         ` Bart Schaefer
2020-11-27 22:10  0%                       ` Felipe Contreras
2020-11-27 22:39                             ` Bart Schaefer
2020-11-28  0:00                               ` Felipe Contreras
2020-11-28  0:36                                 ` The emulation rabbit-hole RE typeset/unset Bart Schaefer
2020-11-28 11:35                                   ` Felipe Contreras
2020-11-28 16:56                                     ` Bart Schaefer
2020-12-01  8:49  3%                                   ` Felipe Contreras
2020-11-28 19:49     One possible answer to typeset vs. unset Bart Schaefer
2020-12-01  8:54     ` Felipe Contreras
2020-12-03 21:19       ` Bart Schaefer
2020-12-04 11:04  3%     ` Felipe Contreras
2020-12-05  0:51  3%       ` Bart Schaefer
2020-12-23 23:00  0%         ` Felipe Contreras
     [not found]     <CAH+w=7aYGZgF25Hypw=s31u5hfTT-Y+6pKzrCuD-1kB=1pShOg@mail.gmail.com>
2020-11-29 20:12  5% ` More typeset bugs: POSIX_BUILTINS Stephane Chazelas
2020-11-29 20:18  0%   ` Bart Schaefer
2020-11-30 17:14  4%     ` Stephane Chazelas
2020-12-01  9:13     [PATCH] First try of null typeset Felipe Contreras
2020-12-02 18:47     ` Bart Schaefer
2020-12-02 21:59       ` Felipe Contreras
2020-12-03  8:44         ` Roman Perepelitsa
2020-12-03  9:18  3%       ` Felipe Contreras
2020-12-23 23:47  4% [PATCH] declarednull: felipec's approach Felipe Contreras
2020-12-27 23:04  3% ` Another push on declarednull branch Bart Schaefer
2020-12-28 22:13     [PATCH] declarednull: rename DECLARED to NULL Felipe Contreras
2021-01-03  1:18     ` Bart Schaefer
2021-01-03  2:38       ` Felipe Contreras
2021-01-03 18:26  3%     ` Bart Schaefer
2021-01-04  6:17  0%       ` Daniel Shahaf
2021-01-04 21:57             ` Bart Schaefer
2021-01-06 16:02               ` Daniel Shahaf
2021-01-06 17:33                 ` Bart Schaefer
2021-03-27 19:24                   ` Lawrence Velázquez
2021-03-27 20:42                     ` Bart Schaefer
2021-03-29  0:44  3%                   ` Oliver Kiddle
2021-04-10 18:56  4%                     ` Bart Schaefer
2021-04-10 21:58  3%                       ` Oliver Kiddle
2021-01-04  0:22  3% [PATCH v3 0/1] Run pipeline command in subshell in sh mode brian m. carlson
2021-01-04  0:22  2% ` [PATCH v3 1/1] exec: run final pipeline command in a " brian m. carlson
2021-03-27 19:34  0%   ` Lawrence Velázquez
2021-04-03 15:49  0%     ` Lawrence Velázquez
2021-04-10 20:05  0%       ` Lawrence Velázquez
2021-01-12 22:42     [PATCH] Ignore EACCES when doing non-pure globbing Devin Hussey
2021-01-12 23:47  3% ` Lawrence Velázquez
2021-01-13  0:53  3%   ` Devin Hussey
2021-01-13  1:12  0%     ` Devin Hussey
2021-01-13  1:28  5%       ` Bart Schaefer
2021-01-13  1:26  3%     ` Mikael Magnusson
     [not found]           ` <CAEtFKsuDqhu3USSVCcrt-8rkvA_yAkHt=eU+FY6=pNu+gVogMw@mail.gmail.com>
2021-01-13  2:14  3%         ` Devin Hussey
2021-01-13  3:01  0%           ` Devin Hussey
2021-01-13  3:04  2% [PATCH] Allow globbing with unreadable parent directories Devin Hussey
2021-01-13 22:27  3% ` Bart Schaefer
2021-01-14  0:27  3%   ` Devin Hussey
2021-01-14  1:32         ` Lawrence Velázquez
2021-01-14  2:22  3%       ` Devin Hussey
2021-01-14  2:24  0%         ` Devin Hussey
2021-01-14  4:04  0%     ` Bart Schaefer
2021-01-18 15:32     Bug with assignments in some commands Patrick Reader
2021-01-18 16:34     ` Peter Stephenson
2021-01-18 17:40  3%   ` Bart Schaefer
2021-01-25  0:15     [PATCH] Tests for globbing below protected directories Bart Schaefer
2021-01-26 23:56     ` Daniel Shahaf
2021-02-02  2:45       ` Bart Schaefer
2021-02-03 11:22         ` Daniel Shahaf
2021-02-03 22:33           ` Bart Schaefer
2021-02-03 23:06             ` Bart Schaefer
2021-02-04 13:09               ` Daniel Shahaf
2021-02-04 21:34                 ` Bart Schaefer
2021-02-06 12:15  3%               ` Daniel Shahaf
2021-01-26  6:35  8% PATCH: Allow more scripts without #! Justine Tunney
2021-02-15 15:45  0% ` Daniel Shahaf
2021-01-28  7:36 16% [PATCH] _awk: support gawk ver. 5 Jun T
2021-02-06 20:03     Rewrite of zsh-newuser-install Marlon Richert
     [not found]     ` <0102017778f35f33-a962e4d3-83e9-4d3b-a0d7-45701bb40b11-000000@eu-west-1.amazonses.com>
2021-02-06 20:19       ` Marlon Richert
2021-02-06 20:33         ` Lawrence Velázquez
2021-02-07 13:41           ` Marlon Richert
2021-02-07 13:51             ` Roman Perepelitsa
2021-02-07 17:10               ` Marlon Richert
2021-02-07 21:06                 ` dana
2021-02-07 21:15                   ` Marlon Richert
2021-02-08 21:57                     ` Marlon Richert
2021-02-09  4:51                       ` dana
2021-02-09  6:00  3%                     ` Bart Schaefer
2021-02-09  7:30  0%                       ` dana
2021-02-10  6:05     Block comments ala Ray Bart Schaefer
2021-02-10  6:16     ` Roman Perepelitsa
2021-02-12  6:17       ` Bart Schaefer
2021-02-12  6:41         ` Roman Perepelitsa
2021-02-12  7:40  3%       ` Stephane Chazelas
2021-02-12 15:24  3%     ` Matthew Martin
2021-02-16 18:34  3% [PATCH] add 'fc -s' Martijn Dekker
2021-02-17 10:22  0% ` Peter Stephenson
2021-02-26  7:55     [PATCH 1/2] Introduce new completion for Linux task capabilities Arseny Maslennikov
2021-02-26 15:50     ` Daniel Shahaf
2021-02-26 17:01       ` Arseny Maslennikov
2021-02-27 12:03  3%     ` Oliver Kiddle
2021-03-21 12:54  5%       ` Arseny Maslennikov
2021-03-04  8:56     Bug + patch: `zstyle ':completion:*' menu select=long-list` fails to start menu selection Marlon Richert
2021-03-04 20:17     ` Daniel Shahaf
2021-03-04 22:26       ` Marlon Richert
2021-03-07 17:22         ` Daniel Shahaf
2021-03-09 17:01           ` Marlon Richert
2021-03-09 21:48             ` Bart Schaefer
2021-03-10  7:21               ` Marlon Richert
2021-03-10 18:50                 ` Bart Schaefer
2021-03-11  7:33                   ` Marlon Richert
2021-03-12 13:11                     ` Marlon Richert
2021-03-12 13:36                       ` Peter Stephenson
2021-03-12 14:14  3%                     ` Daniel Shahaf
2021-03-12 20:53  0%                       ` Mikael Magnusson
     [not found]                           ` <884654866.425858.1615560127191@mail2.virginmedia.com>
2021-03-13 13:40  0%                         ` Daniel Shahaf
2021-03-12  4:07  1% Improvements to the gcc completion script Jacob Gelbman
2021-03-19  3:51     ` Jun T
2021-03-22  2:28       ` Jacob Gelbman
2021-03-22  2:29  1%     ` Jacob Gelbman
2021-03-22 15:18         ` Jun. T
2021-03-31 12:31           ` Oliver Kiddle
2021-03-31 14:53  1%         ` Jun. T
2021-03-31 15:06  1%           ` Jun. T
2021-03-21 13:01  5% [PATCH v2 1/3] Introduce new completion for Linux task capabilities Arseny Maslennikov
2021-04-10 23:31 11% [PATCH] Document imperfections in POSIX/sh compatibility dana
2021-04-10 23:50  5% ` Bart Schaefer
2021-04-11  0:19 10%   ` dana
2021-04-11 16:54  5%     ` Bart Schaefer
2021-04-11 17:57 12%       ` sh emulation POSIX non-conformances (Was: [PATCH] Document imperfections in POSIX/sh compatibility) Stephane Chazelas
2021-04-11 18:13 10%         ` Bart Schaefer
2021-04-11 19:18 10%         ` sh emulation POSIX non-conformances (no word splitting upon arithmetic expansion) Stephane Chazelas
2021-04-22 15:03  5%           ` Vincent Lefevre
2021-04-22 18:27  5%             ` Bart Schaefer
2021-04-11 19:31  9%         ` sh emulation POSIX non-conformances ("inf"/"Inf" in arithmetic expressions) Stephane Chazelas
2021-04-12 20:41 10%           ` Bart Schaefer
2021-04-13  7:17  9%             ` Stephane Chazelas
2021-04-22 15:31  5%               ` Vincent Lefevre
2021-04-22 18:55  5%                 ` Bart Schaefer
2021-04-22 20:45  5%                   ` Daniel Shahaf
2021-04-22 21:25  8%                     ` Bart Schaefer
2021-04-23 16:45  5%                   ` Vincent Lefevre
2021-04-23 20:31  4%                     ` Bart Schaefer
2021-04-23 22:46  9%                       ` Oliver Kiddle
2021-04-23 23:34  5%                         ` Bart Schaefer
2021-04-24  2:10  5%                           ` Daniel Shahaf
2021-04-24  3:42  5%                             ` Bart Schaefer
2021-04-24  7:33  9%                               ` Stephane Chazelas
2021-04-24 16:04  5%                                 ` Bart Schaefer
2021-04-24 23:02  8%                         ` Vincent Lefevre
2021-04-25  2:18  5%                           ` Bart Schaefer
2021-04-25 20:17  5%                             ` Vincent Lefevre
2021-04-25 21:58  5%                               ` Bart Schaefer
2021-04-26 10:28  5%                                 ` Vincent Lefevre
2021-04-25 22:00  5%                               ` Bart Schaefer
2021-04-26 10:34  5%                                 ` Vincent Lefevre
2021-04-26 23:25  4%                                   ` Vincent Lefevre
2021-04-11 19:33  5%         ` sh emulation POSIX non-conformances (some of zsh's special variables) Stephane Chazelas
2021-04-11 19:42 10%         ` sh emulation POSIX non-conformances (printf %10s and bytes vs character) Stephane Chazelas
2021-04-13 15:57  5%           ` Daniel Shahaf
2021-04-13 18:03  5%             ` Stephane Chazelas
2021-04-13 21:09  5%               ` Bart Schaefer
2021-04-22 13:59  5%           ` Vincent Lefevre
2021-04-22 14:28  8%             ` Vincent Lefevre
2021-04-22 19:22  5%             ` Bart Schaefer
2021-04-23 16:53  5%               ` Vincent Lefevre
2021-04-23 23:01  9%                 ` Oliver Kiddle
2021-04-24 21:41  5%                   ` Vincent Lefevre
2021-04-24 21:46  5%                   ` Vincent Lefevre
2021-04-24  7:09  9%                 ` Stephane Chazelas
2021-04-24 21:52  5%                   ` Vincent Lefevre
2021-04-24 22:28  5%                     ` Bart Schaefer
2021-04-24 23:18  5%                       ` Vincent Lefevre
2021-04-25  2:20  5%                         ` Bart Schaefer
2021-04-25 11:07  5%                           ` Vincent Lefevre
2021-04-11 23:04  9%       ` [PATCH] Document imperfections in POSIX/sh compatibility dana
2021-04-13 16:01  5% ` Daniel Shahaf
2021-04-13 16:12  9%   ` Peter Stephenson
2021-04-13 20:28 10%   ` Oliver Kiddle
2021-04-13 21:40 11%     ` dana
2021-04-13 22:02  5%       ` Bart Schaefer
2021-04-14 12:38  5%       ` Daniel Shahaf
2021-04-18  4:50  5%         ` dana
2021-04-20 21:26  5%           ` Daniel Shahaf
2021-05-03 23:42  5%             ` dana
2021-04-14  5:52  8% [PATCH] TYPESET_TO_UNSET + misc Bart Schaefer
2021-04-18 21:03     ` Bart Schaefer
2021-04-20 22:01       ` Daniel Shahaf
2021-04-21  0:06         ` Bart Schaefer
2021-04-21 21:36           ` Daniel Shahaf
2021-04-21 22:07  3%         ` Bart Schaefer
2021-04-14 19:48  1% Tests: A03quoting.ztst and B03print.ztst fail on Alpine Sören Tempel
2021-04-29 23:53     Bug in Functions/Misc/regexp-replace Jacob Menke
2021-04-30  6:51     ` Stephane Chazelas
2021-04-30  8:17  4%   ` tilde expansion after quoted : in assignments Stephane Chazelas
2021-04-30 17:43  0%     ` Bart Schaefer
2021-05-16  9:16     'while do done' hangs interactive zsh Arseny Maslennikov
2021-05-16 16:43  4% ` Stephane Chazelas
2021-05-16 18:02       ` Bart Schaefer
2021-05-16 18:25  5%     ` Martijn Dekker
2021-05-16 15:24     $PPID not updated when the PPID changes (parent killed) Vincent Lefevre
2021-05-16 18:37     ` Bart Schaefer
2021-05-17 20:26       ` Vincent Lefevre
2021-05-17 21:00         ` Bart Schaefer
2021-05-17 22:27           ` Phil Pennock
2021-05-17 23:15             ` Bart Schaefer
2021-05-18  8:15               ` Vincent Lefevre
2021-05-18 14:53                 ` Bart Schaefer
2021-05-19  4:25  9%               ` Bart Schaefer
2021-05-18 18:06  3%           ` Stephane Chazelas
2021-05-18 18:12  0%             ` Bart Schaefer
2021-05-18 18:50  3%               ` $SHLVL origin (was: $PPID not updated when the PPID changes (parent killed)) Stephane Chazelas
2021-05-18 15:56  4%         ` $PPID not updated when the PPID changes (parent killed) Stephane Chazelas
2021-06-03  2:04     [PATCH (not final)] (take three?) unset "array[$anything]" Bart Schaefer
2021-06-03  2:42     ` Bart Schaefer
2021-06-03  6:12       ` Bart Schaefer
2021-06-03  8:54         ` Peter Stephenson
2021-06-03 13:13           ` Stephane Chazelas
2021-06-03 14:41             ` Peter Stephenson
2021-06-04 19:25               ` Bart Schaefer
2021-06-05 18:18                 ` Peter Stephenson
2021-06-09 23:31                   ` Bart Schaefer
2021-06-13 16:51                     ` Peter Stephenson
2021-06-13 18:04                       ` Bart Schaefer
2021-06-13 19:48                         ` Peter Stephenson
2021-06-13 21:44                           ` Bart Schaefer
2021-06-14  7:19  5%                         ` Stephane Chazelas
2021-06-03 18:12             ` Bart Schaefer
2021-06-04  8:02               ` Stephane Chazelas
2021-06-04 18:36                 ` Bart Schaefer
2021-06-04 20:21                   ` Stephane Chazelas
2021-06-05  0:20                     ` Bart Schaefer
2021-06-05 17:05  4%                   ` Stephane Chazelas
2021-06-09 14:09     [BUG] builtin echo doesn't check write error Vincent Lefevre
2021-06-09 16:13     ` Bart Schaefer
2021-06-09 18:16  3%   ` Stephane Chazelas
2021-06-10  8:11  0%     ` Vincent Lefevre
2021-06-24  8:47  0%     ` Vincent Lefevre
2021-06-11 19:17     Where is this =(:) construct documented? Zach Riggle
2021-06-11 19:53     ` Stephane Chazelas
2021-06-11 19:58  3%   ` Roman Perepelitsa
2021-06-24  8:36  2% archived messages with "From " get truncated Vincent Lefevre
2021-06-27  6:09     [PR] vcs_info-examples: optimize +vi-git-untracked() #76 Suraj N. Kurapati
2021-06-27  9:13     ` Oliver Kiddle
2021-06-28 17:16  3%   ` Suraj N. Kurapati
2021-07-06 23:53  1% PATCH: use singular form for completion group descriptions for consistency Oliver Kiddle
2021-08-08  5:38     read -r flag not working on 5.8.1 David Milum
2021-08-08  5:53     ` David Milum
2021-08-08  5:59       ` Mikael Magnusson
2021-08-08 14:04  5%     ` Stephane Chazelas
2021-08-13  3:13     bug: nested for loop body is executed once! Daniil Iaitskov
2021-08-13  3:50  3% ` Lawrence Velázquez
2021-08-24 16:23  3% [BUG] ignored trap and subshell Vincent Lefevre
2021-08-24 17:29  0% ` Bart Schaefer
2021-08-24 17:33  0%   ` Bart Schaefer
2021-08-25 10:10  0% ` Peter Stephenson
2021-08-25 10:47  0%   ` Peter Stephenson
2021-08-27 12:43  1% PATCH: completion options update Oliver Kiddle
2021-08-31  1:04     tr [:lower:] Shineru
2021-08-31  1:39  3% ` Phil Pennock
2021-09-01 14:53  0%   ` Shineru
2021-09-06 21:55  3% Dump of backlogged commits coming Bart Schaefer
2021-09-26  8:43  3% [PATCH 1/4] docs: Clean up some subsection references Daniel Shahaf
2021-10-12  8:20  3% Question on unintuitive behaviour for function execution and parameter assignment Jett Husher
2021-10-12  8:31  3% ` Peter Stephenson
2021-10-13  8:42  3%   ` Jett Husher
2021-10-13  9:10  4%     ` Peter Stephenson
2021-10-21 12:40     Unexpected stdin-behavior Tycho Kirchner
2021-10-21 15:55     ` Bart Schaefer
     [not found]       ` <13d30855-d91c-7def-6834-f0ec24cfd598@mail.de>
2021-10-21 19:14         ` Bart Schaefer
2021-10-22 14:24  3%       ` Tycho Kirchner
2021-11-15 17:40  9% [BUG] POSIX arith: inf, nan should be variables Martijn Dekker
2021-11-16  9:06  5% ` Oliver Kiddle
2021-11-16 12:55  5% ` Vincent Lefevre
2021-11-28 20:34  5%   ` Oliver Kiddle
2021-12-01  3:31  5%     ` Daniel Shahaf
2021-12-01  3:37  9%       ` Bart Schaefer
2021-12-01  4:27  4%         ` Writing XFail tests (was: Re: [BUG] POSIX arith: inf, nan should be variables) Daniel Shahaf
2021-11-23  6:46  3% [PATCH] Do not define _POSIX_C_SOURCE when checking for sigset_t on Solaris Claes Nästén
2021-12-27 21:37  1% PATCH: update zfs completion Oliver Kiddle
2022-01-31 14:32  3% [PATCH] new completions for csplit, pr, ptx, truncate Jun. T
2022-02-06 17:44  2% can we have an option for cd to do a plain chdir() Stephane Chazelas
2022-03-02 22:38  4% Regression with stdin handling in non-interactive mode between 5.8 and 5.8.1 Lyude Paul
2022-03-03  9:39  5% ` Peter Stephenson
2022-03-03 11:52  5%   ` Peter Stephenson
2022-03-03 22:59  0%     ` Lyude Paul
2022-03-15 16:33     Test ./E03posix.ztst was expected to fail, but passed Vincent Lefevre
2022-03-15 16:53     ` Mikael Magnusson
2022-03-16 15:30  7%   ` Jun. T
2022-03-22  3:32         ` Jun T
2022-03-22 21:04  5%       ` Bart Schaefer
2022-03-23  2:26  3%         ` Vincent Lefevre
2022-03-23 10:38  5%           ` Stephane Chazelas
2022-03-23 16:17  0%             ` Vincent Lefevre
2022-03-23  7:14  4%         ` Jun T
2022-03-29  9:10 15%           ` Jun T
2022-03-24 18:36     _time_zone gives me candidates other than timezones Jordan Russell
2022-03-29 23:22  3% ` Bart Schaefer
2022-03-30  0:12  5%   ` Aaron Schrab
2022-03-31 15:25         ` Jun. T
2022-04-05 23:18  3%       ` Jordan Russell
2022-04-06 20:11  0%         ` Bart Schaefer
     [not found]     <1E0E1226-E3E8-40AD-87CD-93A602B1B08B@easesoftware.com>
     [not found]     ` <CAH+w=7baN47QxGiga9WVTHHny7JnjbbCudfkDKR+qEq1pAgcnw@mail.gmail.com>
     [not found]       ` <36966db7bf519a888d7daca39fdd39f1e39b8511.camel@fifi.org>
     [not found]         ` <CAH+w=7ZRAQTVBfvw1XN=2xEGVNf2ShD6eck+_iv=fGLcEqBLBg@mail.gmail.com>
2022-03-27 17:38  4%       ` [PATCH] Re: Parallel processing Bart Schaefer
2022-03-31  3:58  3% PATCH: Add nonblock to sysopen Matthew Martin
2022-04-03  3:29  5% [PATCH] Change documentation, dedication, loose ends dana
2022-04-09 20:07     Test release: 5.8.1.2-test dana
2022-04-10 20:07     ` Peter Stephenson
2022-04-12  9:16  3%   ` Peter Stephenson
2022-04-11  0:32  4% ` Axel Beckert
2022-04-11  8:30  0%   ` Axel Beckert
2022-04-11 21:14     5.8.1.2-test - test failures running as root Bart Schaefer
2022-04-11 22:38  5% ` [PATCH] " Bart Schaefer
2022-04-28 13:18     Possible missing status info for builtins sysopen and sysseek in zsh/system module Jim
2022-04-28 14:07     ` ERRNO is unset until set Matthew Martin
2022-04-28 14:16       ` Matthew Martin
2022-04-29  6:44         ` Bart Schaefer
2022-04-29 10:00           ` Mikael Magnusson
2022-04-29 17:02  3%         ` Bart Schaefer
2022-04-29 17:08  0%           ` Daniel Shahaf
2022-05-16  7:14     E02 failing on Alpine / musl libc dana
2022-05-17  2:33     ` Jun T
2022-05-19  3:27  4%   ` dana
2022-05-19 19:34     Bug in function in function Klaus Ethgen
2022-05-20 15:37     ` Bart Schaefer
2022-05-20 17:12  3%   ` Klaus Ethgen
2022-05-20 17:16  0%     ` Mikael Magnusson
2022-05-20 17:25  0%       ` Klaus Ethgen
2022-05-20 17:46  0%         ` Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).