diff options
-rw-r--r-- | share/man/man5/genassym.cf.5 | 12 | ||||
-rw-r--r-- | sys/kern/genassym.sh | 20 |
2 files changed, 28 insertions, 4 deletions
diff --git a/share/man/man5/genassym.cf.5 b/share/man/man5/genassym.cf.5 index 6409fdec337..94f7e318d23 100644 --- a/share/man/man5/genassym.cf.5 +++ b/share/man/man5/genassym.cf.5 @@ -1,4 +1,4 @@ -.\" $OpenBSD: genassym.cf.5,v 1.5 2003/05/21 09:28:09 jmc Exp $ +.\" $OpenBSD: genassym.cf.5,v 1.6 2004/02/01 13:13:35 miod Exp $ .\" $NetBSD: genassym.cf.5,v 1.8 2001/06/19 12:34:27 wiz Exp $ .\" .\" Copyright (c) 1997 Matthias Pfaller. @@ -109,6 +109,12 @@ invoked with an extra argument, as in the first argument of member will be prefixed by the remembered prefix, before being converted to upper case. .Pp +.Em "union foo" +.br +is similar to the +.Em struct +command, but applies to an union instead of a struct. +.Pp .Em "config <ctype> <gcc constraint> <asm print modifier>" .br can be used to customize the output of @@ -132,3 +138,7 @@ files occurred in .Ox 2.2 . Its use was generalized to all ports for .Ox 3.0 . +The +.Em union +command appeared in +.Ox 3.5 . diff --git a/sys/kern/genassym.sh b/sys/kern/genassym.sh index c9a6015f0a3..f3096373f91 100644 --- a/sys/kern/genassym.sh +++ b/sys/kern/genassym.sh @@ -1,4 +1,4 @@ -# $OpenBSD: genassym.sh,v 1.10 2003/07/02 00:37:31 avsm Exp $ +# $OpenBSD: genassym.sh,v 1.11 2004/02/01 13:13:37 miod Exp $ # $NetBSD: genassym.sh,v 1.9 1998/04/25 19:48:27 matthias Exp $ # @@ -94,9 +94,23 @@ $0 ~ /^endif/ { next; } +/^union[ \t]/ { + structname = $2; + prefixname = toupper($3); + structtype = "union" + if (union[structname] == 1) + next; + else { + union[structname] = 1; + $0 = "define " toupper(structname) "_SIZEOF sizeof(union " structname ")"; + } + # fall through +} + /^struct[ \t]/ { structname = $2; prefixname = toupper($3); + structtype = "struct" if (struct[structname] == 1) next; else { @@ -108,9 +122,9 @@ $0 ~ /^endif/ { /^member[ \t]/ { if (NF > 2) - $0 = "define " prefixname toupper($2) " offsetof(struct " structname ", " $3 ")"; + $0 = "define " prefixname toupper($2) " offsetof(" structtype " " structname ", " $3 ")"; else - $0 = "define " prefixname toupper($2) " offsetof(struct " structname ", " $2 ")"; + $0 = "define " prefixname toupper($2) " offsetof(" structtype " " structname ", " $2 ")"; # fall through } |