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-181


From: Eric Blake
Subject: [SCM] GNU M4 source repository branch, master, updated. cvs-readonly-181-gc557201
Date: Wed, 24 Dec 2008 21:49:30 +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=c557201fd9771b93dd5b3193af322d7d86a4cf45

The branch, master has been updated
       via  c557201fd9771b93dd5b3193af322d7d86a4cf45 (commit)
      from  268aa74a4cd66160d4c589572294e50f455c2069 (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 c557201fd9771b93dd5b3193af322d7d86a4cf45
Author: Eric Blake <address@hidden>
Date:   Wed Dec 24 14:34:06 2008 -0700

    Relax eval as allowed by POSIX 2008.
    
    * modules/evalparse.c (m4_evaluate): Warn, not error, on invalid
    operator.  Quote expression in warning.
    * modules/mpeval.c (includes): Add quotearg.h.
    * doc/m4.texinfo (Eval, Improved forloop): Update tests.
    * NEWS: Update to reflect 1.6 support for `?:'.
    
    Signed-off-by: Eric Blake <address@hidden>

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

Summary of changes:
 ChangeLog           |    9 +++++++++
 NEWS                |    6 +++++-
 doc/m4.texinfo      |   19 +++++++++----------
 modules/evalparse.c |    5 +++--
 modules/mpeval.c    |    2 ++
 5 files changed, 28 insertions(+), 13 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 4321384..9d1c1c8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2008-12-24  Eric Blake  <address@hidden>
+
+       Relax eval as allowed by POSIX 2008.
+       * modules/evalparse.c (m4_evaluate): Warn, not error, on invalid
+       operator.  Quote expression in warning.
+       * modules/mpeval.c (includes): Add quotearg.h.
+       * doc/m4.texinfo (Eval, Improved forloop): Update tests.
+       * NEWS: Update to reflect 1.6 support for `?:'.
+
 2008-12-23  Eric Blake  <address@hidden>
 
        Add debugmode(o) to control dumpdef output location.
diff --git a/NEWS b/NEWS
index 4180190..ca4e0b0 100644
--- a/NEWS
+++ b/NEWS
@@ -158,7 +158,7 @@ promoted to 2.0.
     first line to show the definition of the macro being expanded.
 
 *** The `eval' and `mpeval' builtins now support the following new
-    operators: `>>>', `\', `?:', and  `,'.
+    operators: `>>>', `\', and  `,'.
 
 *** The `maketemp' builtin now always warns that it is obsolete, even in GNU
     mode where it uses the same secure algorithm as `mkstemp', because of
@@ -296,6 +296,10 @@ promoted to 2.0.
    context of a macro name, rather than acting on the empty string.  This
    was already done for `define', `pushdef', `builtin', and `indir'.
 
+** Enhance the `eval' builtin to understand the `?:' operator, and
+   downgrade a failed parse due to an unknown operator from an error to a
+   warning.
+
 ** A number of portability improvements inherited from gnulib.
 
 * Noteworthy changes in Version 1.4.10b (2008-02-25) [beta]
diff --git a/doc/m4.texinfo b/doc/m4.texinfo
index 3d039f6..c5e36dd 100644
--- a/doc/m4.texinfo
+++ b/doc/m4.texinfo
@@ -7506,7 +7506,6 @@ precedence rules, but where older versions and some other
 implementations of @code{m4} require explicit parentheses to get the
 correct result:
 
address@hidden status: 1
 @example
 eval(`1 == 2 > 0')
 @result{}1
@@ -7523,23 +7522,23 @@ eval(`(1 | 1) ^ 1')
 eval(`+ + - ~ ! ~ 0')
 @result{}1
 eval(`++0')
address@hidden:stdin:8: eval: invalid operator: ++0
address@hidden:stdin:8: Warning: eval: invalid operator: `++0'
 @result{}
 eval(`1 = 1')
address@hidden:stdin:9: eval: invalid operator: 1 = 1
address@hidden:stdin:9: Warning: eval: invalid operator: `1 = 1'
 @result{}
 eval(`0 |= 1')
address@hidden:stdin:10: eval: invalid operator: 0 |= 1
address@hidden:stdin:10: Warning: eval: invalid operator: `0 |= 1'
 @result{}
 eval(`2 || 1 / 0')
 @result{}1
 eval(`0 || 1 / 0')
address@hidden:stdin:12: Warning: eval: divide by zero: 0 || 1 / 0
address@hidden:stdin:12: Warning: eval: divide by zero: `0 || 1 / 0'
 @result{}
 eval(`0 && 1 % 0')
 @result{}0
 eval(`2 && 1 % 0')
address@hidden:stdin:14: Warning: eval: modulo by zero: 2 && 1 % 0
address@hidden:stdin:14: Warning: eval: modulo by zero: `2 && 1 % 0'
 @result{}
 @end example
 
@@ -7567,9 +7566,9 @@ eval(`2 ** 0')
 @result{}1
 eval(`0 ** 0')
 @result{}
address@hidden:stdin:5: Warning: eval: divide by zero: 0 ** 0
address@hidden:stdin:5: Warning: eval: divide by zero: `0 ** 0'
 eval(`4 ** -2')
address@hidden:stdin:6: Warning: eval: negative exponent: 4 ** -2
address@hidden:stdin:6: Warning: eval: negative exponent: `4 ** -2'
 @result{}
 eval(`2 || 4 ** -2')
 @result{}1
@@ -7632,7 +7631,7 @@ square(square(`5')` + 1')
 define(`foo', `666')
 @result{}
 eval(`foo / 6')
address@hidden:stdin:11: Warning: eval: bad expression: foo / 6
address@hidden:stdin:11: Warning: eval: bad expression: `foo / 6'
 @result{}
 eval(foo / 6)
 @result{}111
@@ -9317,7 +9316,7 @@ forloop(`', `1', `2', ` odd iterator name')
 forloop(`i', `5 + 5', `0xc', ` 0x`'eval(i, `16')')
 @result{} 0xa 0xb 0xc
 forloop(`i', `a', `b', `non-numeric bounds')
address@hidden:stdin:6: Warning: eval: bad input: (a) <= (b)
address@hidden:stdin:6: Warning: eval: bad input: `(a) <= (b)'
 @result{}
 @end example
 
diff --git a/modules/evalparse.c b/modules/evalparse.c
index 9927e13..ac30cfe 100644
--- a/modules/evalparse.c
+++ b/modules/evalparse.c
@@ -940,6 +940,8 @@ m4_evaluate (m4 *context, m4_obstack *obs, size_t argc, 
m4_macro_args *argv)
        err = EXCESS_INPUT;
     }
 
+  if (err != NO_ERROR)
+    str = quotearg_style_mem (locale_quoting_style, str, M4ARGLEN (1));
   switch (err)
     {
     case NO_ERROR:
@@ -967,8 +969,7 @@ m4_evaluate (m4 *context, m4_obstack *obs, size_t argc, 
m4_macro_args *argv)
       break;
 
     case INVALID_OPERATOR:
-      /* POSIX requires an error here, unless XCU ERN 137 is approved.  */
-      m4_error (context, 0, 0, me, _("invalid operator: %s"), str);
+      m4_warn (context, 0, me, _("invalid operator: %s"), str);
       break;
 
     case DIVIDE_ZERO:
diff --git a/modules/mpeval.c b/modules/mpeval.c
index 63cd56a..2d63d6e 100644
--- a/modules/mpeval.c
+++ b/modules/mpeval.c
@@ -32,6 +32,8 @@
 #  include <gmp.h>
 #endif
 
+#include "quotearg.h"
+
 /* Rename exported symbols for dlpreload()ing.  */
 #define m4_builtin_table       mpeval_LTX_m4_builtin_table
 #define m4_macro_table         mpeval_LTX_m4_macro_table


hooks/post-receive
--
GNU M4 source repository




reply via email to

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