tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: macro directives inside macro arguments undefined



On Thu, 24 Feb 2011, Iain Hibbert wrote:

> The patch attached fixes building this with pcc (for which the behaviour
> is to error out with a syntax error), by moving the directives away from
> the arguments, any objections to commit?

further to this, there is another occurrence of this USE_FORT/sprint issue
in ipf/ipftest. The attached patch fixes that one by just moving all the
arguments inside the directives..

iain
Index: ip_rpcb_pxy.c
===================================================================
RCS file: /cvsroot/src/sys/dist/ipf/netinet/ip_rpcb_pxy.c,v
retrieving revision 1.14
diff -u -r1.14 ip_rpcb_pxy.c
--- ip_rpcb_pxy.c       19 Aug 2009 08:36:12 -0000      1.14
+++ ip_rpcb_pxy.c       24 Feb 2011 13:05:09 -0000
@@ -793,11 +793,13 @@
        bzero(uaddr, sizeof(uaddr)); /* Just in case we need padding. */
 #if defined(SNPRINTF) && defined(_KERNEL)
        SNPRINTF(uaddr, sizeof(uaddr),
+                      "%u.%u.%u.%u.%u.%u", i[0] & 0xff, i[1] & 0xff,
+                      i[2] & 0xff, i[3] & 0xff, p[0] & 0xff, p[1] & 0xff);
 #else
        (void) sprintf(uaddr,
-#endif
                       "%u.%u.%u.%u.%u.%u", i[0] & 0xff, i[1] & 0xff,
                       i[2] & 0xff, i[3] & 0xff, p[0] & 0xff, p[1] & 0xff);
+#endif
        len = strlen(uaddr);
        xlen = XDRALIGN(len);
 
@@ -1323,11 +1325,13 @@
        bzero(uaddr, sizeof(uaddr)); /* Just in case we need padding. */
 #if defined(SNPRINTF) && defined(_KERNEL)
        SNPRINTF(uaddr, sizeof(uaddr),
+                      "%u.%u.%u.%u.%u.%u", i[0] & 0xff, i[1] & 0xff,
+                      i[2] & 0xff, i[3] & 0xff, p[0] & 0xff, p[1] & 0xff);
 #else
        (void) sprintf(uaddr,
-#endif
                       "%u.%u.%u.%u.%u.%u", i[0] & 0xff, i[1] & 0xff,
                       i[2] & 0xff, i[3] & 0xff, p[0] & 0xff, p[1] & 0xff);
+#endif
        len = strlen(uaddr);
        xlen = XDRALIGN(len);
 
@@ -1403,12 +1407,15 @@
                                                padding. */
 #if defined(SNPRINTF) && defined(_KERNEL)
                SNPRINTF(uaddr, sizeof(uaddr),
+                              "%u.%u.%u.%u.%u.%u", i[0] & 0xff,
+                              i[1] & 0xff, i[2] & 0xff, i[3] & 0xff,
+                              p[0] & 0xff, p[1] & 0xff);
 #else
                (void) sprintf(uaddr,
-#endif
                               "%u.%u.%u.%u.%u.%u", i[0] & 0xff,
                               i[1] & 0xff, i[2] & 0xff, i[3] & 0xff,
                               p[0] & 0xff, p[1] & 0xff);
+#endif
                len = strlen(uaddr);
                xlen = XDRALIGN(len);
 


Home | Main Index | Thread Index | Old Index