From 318c1eeb32834045adc7d4e46d5616fd041a8c9e Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Mon, 13 Dec 2010 15:50:47 -0500 Subject: [PATCH] godefs: guard against structs with pad fields Fixes #1162. R=r CC=golang-dev https://golang.org/cl/3619041 --- src/cmd/godefs/main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cmd/godefs/main.c b/src/cmd/godefs/main.c index d31d298a5e..cdecd6e8d8 100644 --- a/src/cmd/godefs/main.c +++ b/src/cmd/godefs/main.c @@ -133,7 +133,7 @@ Lang go = "type %s struct {\n", "type %s struct {\n", - "\tPad%d [%d]byte;\n", + "\tPad_godefs_%d [%d]byte;\n", "}\n", gotypefmt, @@ -150,7 +150,7 @@ Lang c = "typedef struct %s %s;\nstruct %s {\n", "typedef union %s %s;\nunion %s {\n", - "\tbyte pad%d[%d];\n", + "\tbyte pad_godefs_%d[%d];\n", "};\n", ctypefmt, @@ -391,7 +391,7 @@ Continue: if(cutprefix(name)) name += prefix; if(strcmp(name, "") == 0) { - snprint(nambuf, sizeof nambuf, "Pad%d", npad++); + snprint(nambuf, sizeof nambuf, "Pad_godefs_%d", npad++); name = nambuf; } Bprint(bout, "\t%#lT;\n", name, f->type);