summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2004-02-01 13:13:38 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2004-02-01 13:13:38 +0000
commit36260b3aa8ab32c696a554956a28f2f278d99e78 (patch)
tree8afc8f3d177dcbb7d747311988fdafe6c0af3e2e /sys
parentc8cf656fed7c9f843495fd1f13b9514aaa40461c (diff)
Grok union like struct in genassym.cf. Will be needed shortly.
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/genassym.sh20
1 files changed, 17 insertions, 3 deletions
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
}