svn commit: r269323 - head/usr.bin/m4

Sergey Kandaurov pluknet at freebsd.org
Thu Jul 31 07:51:26 UTC 2014


On 31 July 2014 09:56, Baptiste Daroussin <bapt at freebsd.org> wrote:
> Author: bapt
> Date: Thu Jul 31 05:56:15 2014
> New Revision: 269323
> URL: http://svnweb.freebsd.org/changeset/base/269323
>
> Log:
>   lower warning level to fix build with gcc
>
> Modified:
>   head/usr.bin/m4/Makefile
>
> Modified: head/usr.bin/m4/Makefile
> ==============================================================================
> --- head/usr.bin/m4/Makefile    Thu Jul 31 05:12:21 2014        (r269322)
> +++ head/usr.bin/m4/Makefile    Thu Jul 31 05:56:15 2014        (r269323)
> @@ -16,6 +16,7 @@ NO_WMISSING_VARIABLE_DECLARATIONS=
>  SRCS=  eval.c expr.c look.c main.c misc.c gnum4.c trace.c parser.y tokenizer.l
>  .PATH: ${.CURDIR}/lib
>  SRCS+= ohash.c
> +WARNS= 3
>
>  tokenizer.o: parser.h
>
>

I am suspicious of this approach.
Unless objections, I'd like to commit the following one
(it also follows the NetBSD way in fixing up .Ox m4 import).
Although it is low quality as well, it allows to keep WARNS.

Index: lib/ohash.c
===================================================================
--- lib/ohash.c    (revision 269324)
+++ lib/ohash.c    (working copy)
@@ -120,7 +120,7 @@
 void *
 ohash_remove(struct ohash *h, unsigned int i)
 {
-    void        *result = (void *)h->t[i].p;
+    void        *result = __DECONST(void *, h->t[i].p);

     if (result == NULL || result == DELETED)
         return NULL;
@@ -141,7 +141,7 @@
     if (h->t[i].p == DELETED)
         return NULL;
     else
-        return (void *)h->t[i].p;
+        return __DECONST(void *, h->t[i].p);
 }

 void *
@@ -180,7 +180,7 @@
 {
     for (; *pos < h->size; (*pos)++)
         if (h->t[*pos].p != DELETED && h->t[*pos].p != NULL)
-            return (void *)h->t[(*pos)++].p;
+            return __DECONST(void *, h->t[(*pos)++].p);
     return NULL;
 }

Index: misc.c
===================================================================
--- misc.c    (revision 269324)
+++ misc.c    (working copy)
@@ -265,7 +265,7 @@
 extern char *__progname;

 void
-m4errx(int eval, const char *fmt, ...)
+m4errx(int exval, const char *fmt, ...)
 {
     fprintf(stderr, "%s: ", __progname);
     fprintf(stderr, "%s at line %lu: ", CURRENT_NAME, CURRENT_LINE);
@@ -277,7 +277,7 @@
         va_end(ap);
     }
     fprintf(stderr, "\n");
-    exit(eval);
+    exit(exval);
 }

 /*


-- 
wbr,
pluknet


More information about the svn-src-all mailing list