[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] mig: silence compiler warnings in generated server code
From: |
Thomas Schwinge |
Subject: |
Re: [PATCH] mig: silence compiler warnings in generated server code |
Date: |
Mon, 24 Jul 2006 16:24:04 +0200 |
User-agent: |
Mutt/1.5.6+20040907i |
On Mon, Jul 24, 2006 at 09:55:36AM -0400, Ben Asselstine wrote:
> I couldn't find the offending line in upstream, so I sent it to
> debian-hurd on purpose. Maybe this is already fixed in upstream?
Seems so, yes.
The following changes (and some more infrastructural changes) are missing
in the Debian package:
#v+
2004-03-18 Roland McGrath <roland@frob.com>
* utils.c (do_skip_vfprintf): New macro.
(WriteCopyType, WritePackMsgType): Use that, so we do va_start and
va_end independently around each SkipVFPrintf call.
2004-02-10 Roland McGrath <roland@frob.com>
* user.c (WriteTypeCheck): Use BAD_TYPECHECK macro instead of type-pun.
* server.c (WriteTypeCheck): Likewise.
* utils.c (WriteBogusDefines): Write a #define for that macro.
* utils.c (WriteCheckDecl): Write auto const, not static const.
(WriteStaticShortDecl, WriteStaticLongDecl): Likewise.
#v-
> --- mig-1.3.1.orig/server.c 1999-10-11 08:44:49.000000000 +0000
> +++ mig-1.3.1/server.c 2006-07-23 20:06:32.000000000 +0000
> @@ -418,7 +418,7 @@ WriteTypeCheck(FILE *file, register cons
>
> fprintf(file, "#if\tTypeCheck\n");
> if (akCheck(arg->argKind, akbRequestQC))
> - fprintf(file, "\tif (* (int *) &In%dP->%s != * (int *) &%sCheck)\n",
> + fprintf(file, "\tif (memcmp (&In%dP->%s, &%sCheck, sizeof (int)))\n",
> arg->argRequestPos, arg->argTTName, arg->argVarName);
> else
> {
That's what Roland did:
utils.c
#v+
@@ -71,6 +71,12 @@
fprintf(file, "#define\tUseExternRCSId\t\t1\n");
fprintf(file, "#endif\n");
fprintf(file, "\n");
+
+ fprintf(file, "#define BAD_TYPECHECK(type, check) ({\\\n");
+ fprintf(file,
+ " union { mach_msg_type_t t; unsigned32_t w; } _t, _c;\\\n");
+ fprintf(file,
+ " _t.t = *(type); _c.t = *(check); _t.w != _c.w; })\n");
}
void
#v-
server.c
#v+
@@ -418,7 +418,7 @@
fprintf(file, "#if\tTypeCheck\n");
if (akCheck(arg->argKind, akbRequestQC))
- fprintf(file, "\tif (* (int *) &In%dP->%s != * (int *) &%sCheck)\n",
+ fprintf(file, "\tif (BAD_TYPECHECK(&In%dP->%s, &%sCheck))\n",
arg->argRequestPos, arg->argTTName, arg->argVarName);
else
{
#v-
Ben, perhaps you should now nudge the one who is maintaining the Debian
mig package.
Regards,
Thomas