m4-commit
[Top][All Lists]
Advanced

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

[SCM] GNU M4 source repository branch, master, updated. cvs-readonly-16-


From: Eric Blake
Subject: [SCM] GNU M4 source repository branch, master, updated. cvs-readonly-16-g969296f
Date: Wed, 14 Nov 2007 23:39:52 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU M4 source repository".

http://git.sv.gnu.org/gitweb/?p=m4.git;a=commitdiff;h=969296fe02fb61b739d606b3144d6410ed5cd793

The branch, master has been updated
       via  969296fe02fb61b739d606b3144d6410ed5cd793 (commit)
      from  b4a3bec5f9cfec145db6f4cb281ba1673ca6bfc6 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 969296fe02fb61b739d606b3144d6410ed5cd793
Author: Eric Blake <address@hidden>
Date:   Wed Nov 14 16:39:43 2007 -0700

    Handle some defn corner cases differently.
    
    * doc/m4.texinfo (Defn): Update documentation; although this still
    doesn't match the branch, since it may be changed before 2.0.
    * m4/macro.c (expand_argument): Consistently ignore builtins in
    concatenation contexts.
    * m4/m4private.h (m4__symbol_type): Fix C89 compliance bug.
    
    Signed-off-by: Eric Blake <address@hidden>

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog      |    9 +++++++++
 doc/m4.texinfo |   10 +++++++++-
 m4/m4private.h |    2 +-
 m4/macro.c     |   23 ++++++++++++-----------
 4 files changed, 31 insertions(+), 13 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b55fe54..8688d19 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2007-11-14  Eric Blake  <address@hidden>
+
+       Handle some defn corner cases differently.
+       * doc/m4.texinfo (Defn): Update documentation; although this still
+       doesn't match the branch, since it may be changed before 2.0.
+       * m4/macro.c (expand_argument): Consistently ignore builtins in
+       concatenation contexts.
+       * m4/m4private.h (m4__symbol_type): Fix C89 compliance bug.
+
 2007-11-13  Eric Blake  <address@hidden>
 
        Fix memory leak in tail recursion.
diff --git a/doc/m4.texinfo b/doc/m4.texinfo
index 0265f27..0dc3d48 100644
--- a/doc/m4.texinfo
+++ b/doc/m4.texinfo
@@ -2277,6 +2277,12 @@ define(defn(`divnum'), `cannot redefine a builtin token')
 @result{}
 divnum
 @result{}0
+define(`echo', `$@@')
address@hidden
+define(`mydivnum', echo(defn(`divnum')))
address@hidden
+mydivnum
address@hidden
 @end example
 
 Since @code{defn} can take more than one argument, it can be used to
@@ -2289,11 +2295,13 @@ concatenate multiple macros into one.
 defn(`foo')
 @error{}m4:stdin:1: Warning: defn: undefined macro `foo'
 @result{}
+define(`echo', `$@@')
address@hidden
 define(`foo', `a')
 @result{}
 define(`bar', defn(`foo', `divnum'))
 @result{}
-define(`blah', defn(`divnum', `foo'))
+define(`blah', echo(defn(`divnum', `foo')))
 @result{}
 bar
 @result{}a0
diff --git a/m4/m4private.h b/m4/m4private.h
index 9d8a089..b067254 100644
--- a/m4/m4private.h
+++ b/m4/m4private.h
@@ -33,7 +33,7 @@ typedef enum {
   M4_SYMBOL_VOID, /* Traced but undefined.  */
   M4_SYMBOL_TEXT, /* Plain text.  */
   M4_SYMBOL_FUNC, /* Builtin function.  */
-  M4_SYMBOL_PLACEHOLDER, /* Placeholder for unknown builtin during -R.  */
+  M4_SYMBOL_PLACEHOLDER /* Placeholder for unknown builtin during -R.  */
 } m4__symbol_type;
 
 #define BIT_TEST(flags, bit)   (((flags) & (bit)) == (bit))
diff --git a/m4/macro.c b/m4/macro.c
index 2108c99..6ea3f89 100644
--- a/m4/macro.c
+++ b/m4/macro.c
@@ -160,7 +160,6 @@ expand_argument (m4 *context, m4_obstack *obs, 
m4_symbol_value *argp,
 {
   m4__token_type type;
   m4_symbol_value token;
-  const char *text;
   int paren_level = 0;
   const char *file = m4_get_current_file (context);
   int line = m4_get_current_line (context);
@@ -182,16 +181,16 @@ expand_argument (m4 *context, m4_obstack *obs, 
m4_symbol_value *argp,
        case M4_TOKEN_CLOSE:
          if (paren_level == 0)
            {
-
-             /* The argument MUST be finished, whether we want it or not.  */
+             /* FIXME - For now, we match the behavior of the branch,
+                except we don't issue warnings.  But in the future,
+                we want to allow concatenation of builtins and
+                text.  */
+             if (argp->type == M4_SYMBOL_FUNC
+                 && obstack_object_size (obs) == 0)
+               return type == M4_TOKEN_COMMA;
              obstack_1grow (obs, '\0');
-             text = obstack_finish (obs);
-
-             if (argp->type == M4_SYMBOL_VOID)
-               {
-                 VALUE_MODULE (argp) = NULL;
-                 m4_set_symbol_value_text (argp, text);
-               }
+             VALUE_MODULE (argp) = NULL;
+             m4_set_symbol_value_text (argp, obstack_finish (obs));
              return type == M4_TOKEN_COMMA;
            }
          /* fallthru */
@@ -216,8 +215,10 @@ expand_argument (m4 *context, m4_obstack *obs, 
m4_symbol_value *argp,
          break;
 
        case M4_TOKEN_MACDEF:
-         if (obstack_object_size (obs) == 0)
+         if (argp->type == M4_SYMBOL_VOID && obstack_object_size (obs) == 0)
            m4_symbol_value_copy (argp, &token);
+         else
+           argp->type = M4_SYMBOL_TEXT;
          break;
 
        default:


hooks/post-receive
--
GNU M4 source repository




reply via email to

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