Eric Blake <ebb9 <at> byu.net> writes:

> 
> 2006-07-26  Eric Blake  <ebb9 <at> byu.net>
> 
>       * doc/m4.texinfo (Macro Arguments, Changequote, Changecom)
>       (Dnl, M4wrap, Include): Document EOF issues, and add examples.
>       (Incompatibilities): Document incompatibility of changecom
>       vs. macro names, and of EOF in include.
>       * src/input.c (next_token): Reject unterminated comments at EOF.

This patch was inadequate for multicharacter end-comment strings:

$ m4-1.4.5
changecom(/*,*
)/**
^D
/*
$ # oops, older versions ate the close-comment string
$ m4-1.4.5a
changecom(/*,*
)/**
^D
stdin:2: m4: ERROR: end of file in comment
$ # even worse, since I correctly supplied the end of the comment

It turns out that a successful MATCH was inconsistent on whether it left ch as 
the first character of the matched string or changed it to the first character 
after the match, which bit the comment check where we were seeing whether ch 
was EOF after the end-comment match.

2006-08-02  Eric Blake  <[EMAIL PROTECTED]>

        * src/input.c (MATCH): Fix EOF detection on multi-byte comment
        close.

Index: src/input.c
===================================================================
RCS file: /sources/m4/m4/src/Attic/input.c,v
retrieving revision 1.1.1.1.2.15
diff -u -r1.1.1.1.2.15 input.c
--- src/input.c 1 Aug 2006 13:05:45 -0000       1.1.1.1.2.15
+++ src/input.c 2 Aug 2006 15:03:28 -0000
@@ -586,8 +586,7 @@
 #define MATCH(ch, s) \
   (to_uchar ((s)[0]) == (ch)                                            \
    && (ch) != '\0'                                                      \
-   && ((s)[1] == '\0'                                                   \
-       || (match_input ((s) + 1) ? (ch) = peek_input (), 1 : 0)))
+   && ((s)[1] == '\0' || (match_input ((s) + 1))))
 
 
 /*----------------------------------------------------------.
@@ -769,6 +768,10 @@
     {
       init_macro_token (td);
       (void) next_char ();
+#ifdef DEBUG_INPUT
+      fprintf (stderr, "next_token -> MACDEF (%s)\n",
+               find_builtin_by_addr (TOKEN_DATA_FUNC (td))->name);
+#endif
       return TOKEN_MACDEF;
     }
 




_______________________________________________
M4-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/m4-patches

Reply via email to