m4-patches
[Top][All Lists]
Advanced

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

several buglets in CVS m4


From: Ralf Wildenhues
Subject: several buglets in CVS m4
Date: Fri, 16 Jun 2006 09:33:37 +0200
User-agent: Mutt/1.5.11

[ Please keep me in Cc:, I am not subscribed. ]

Hello Eric, Gary,  ;-)

Here's a list of suspicious things and easy patches.  I've not yet had
time to look into the more difficult ones yet, sorry about that.

1) The modules/gnu.la library has the global unprefixed symbol `format'.
This looks like a bug to me.

2) modules/m4.la has the global symbol m4_sysval, so has the m4_ prefix
but not the m4_LTX_m4_ prefix.

3) Automake creates build tree directory rules for the targets it writes
the rules for (the .dirstamp stuff), but not for manually written rules;
this needs to be done for doc/m4.1 (for a VPATH build).  Patch below,
written not to depend on the Automake internal detail .dirstamp.

4) GCC 4.0 has dropped the cast-as-lvalue extension, needing a change in 
src/stackovf.c.  Patch below.

5) GCC 4.1 uncovered a potential bug in reload_frozen_state: with
suitable settings M4ERROR may not exit the program but suppress the
warning (is that correct, by the way, or is that the real bug?), leaving
the following code to potentially read uninitialized memory.  Suggested
patch below, but please make sure this is what is intended.

Cheers,
Ralf

        * Makefile.am (doc/m4.1): Create the doc directory if needed.

        * src/stackovf.c (stackovf_exit): Move cast to `void *'...
        * m4/m4private.h (DELETE): ...here, to avoid unportable
        cast-as-lvalue.

        * src/freeze.c (reload_frozen_state): Initialize `number' in
        case M4ERROR does not exit the program.

Index: Makefile.am
===================================================================
RCS file: /cvsroot/m4/m4/Makefile.am,v
retrieving revision 1.30
diff -u -r1.30 Makefile.am
--- Makefile.am 16 Jun 2006 03:51:28 -0000      1.30
+++ Makefile.am 16 Jun 2006 05:47:40 -0000
@@ -248,6 +248,7 @@
 dist_man_MANS  = doc/m4.1
 
 doc/m4.1: $(srcdir)/configure.ac $(srcdir)/src/main.c
+       @test -d doc || mkdir doc
        @if test -f src/m4$(EXEEXT); then \
          echo "Updating the \`man' page \`$@'"; \
          $(SHELL) $(srcdir)/$(config_aux_dir)/missing --run \
Index: m4/m4private.h
===================================================================
RCS file: /cvsroot/m4/m4/m4/m4private.h,v
retrieving revision 1.47
diff -u -r1.47 m4private.h
--- m4/m4private.h      10 Jun 2006 21:23:30 -0000      1.47
+++ m4/m4private.h      16 Jun 2006 05:47:40 -0000
@@ -342,7 +342,7 @@
 
 
 /* Convenience macro to zero a variable after freeing it.  */
-#define DELETE(Expr)   ((Expr) = (free (Expr), (void *) 0))
+#define DELETE(Expr)   ((Expr) = (free ((void *) Expr), (void *) 0))
 
 
 #if DEBUG
Index: src/stackovf.c
===================================================================
RCS file: /cvsroot/m4/m4/src/stackovf.c,v
retrieving revision 1.15
diff -u -r1.15 stackovf.c
--- src/stackovf.c      4 May 2005 22:02:07 -0000       1.15
+++ src/stackovf.c      16 Jun 2006 05:47:40 -0000
@@ -413,7 +413,7 @@
 void
 stackovf_exit (void)
 {
-  DELETE ((void *) stackbuf);
+  DELETE (stackbuf);
 }
 
 #endif /* USE_STACKOVF */
Index: src/freeze.c
===================================================================
RCS file: /cvsroot/m4/m4/src/freeze.c,v
retrieving revision 1.42
diff -u -r1.42 freeze.c
--- src/freeze.c        16 Jun 2006 01:32:41 -0000      1.42
+++ src/freeze.c        16 Jun 2006 05:47:40 -0000
@@ -445,6 +445,7 @@
          {
            /* 3 argument 'F' operations are invalid for format version 1.  */
            M4ERROR ((EXIT_FAILURE, 0, _("Ill-formed frozen file")));
+           number[2] = 0;
          }
 
        VALIDATE ('\n');
@@ -644,6 +645,7 @@
          {
            /* 3 argument 'T' operations are invalid for format version 1.  */
            M4ERROR ((EXIT_FAILURE, 0, _("Ill-formed frozen file")));
+           number[2] = 0;
          }
 
        VALIDATE ('\n');




reply via email to

[Prev in Thread] Current Thread [Next in Thread]