]> Savannah Git Hosting - m4.git/commitdiff

Savannah Git Hosting - m4.git/commitdiff

git git@sv / m4.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5e49a74)
Fix regression in command line -D option, from 2006年08月25日.
2008年2月11日 18:32:12 +0000 (11:32 -0700)
2008年2月11日 18:32:12 +0000 (11:32 -0700)
* m4/m4private.h (m4_symbol_value_create): Delete fast accessor.
* m4/m4module.h: Fix typo.
* m4/symtab.c (m4_symbol_value_create): Prime the maximum number
of arguments.
* tests/macros.at (Command line define): Enhance test.
* tests/others.at (nul character): Enhance test.
* tests/null.m4: Likewise.
* tests/null.out: Likewise.

Signed-off-by: Eric Blake <ebb9@byu.net>

diff --git a/ChangeLog b/ChangeLog
index faf80ebfa6ca3959823fd94eaedb386af5b15f1a..d9b01756bf1668d33b3a468b51b378fd403f3829 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
2008年02月11日 Eric Blake <ebb9@byu.net>
+ Fix regression in command line -D option, from 2006年08月25日.
+ * m4/m4private.h (m4_symbol_value_create): Delete fast accessor.
+ * m4/m4module.h: Fix typo.
+ * m4/symtab.c (m4_symbol_value_create): Prime the maximum number
+ of arguments.
+ * tests/macros.at (Command line define): Enhance test.
+ * tests/others.at (nul character): Enhance test.
+ * tests/null.m4: Likewise.
+ * tests/null.out: Likewise.
+
Use gnulib's git-merge-changelog driver when available.
* .gitattributes: Add merge attributes for ChangeLog.
* bootstrap: Install driver, if not already present.
diff --git a/m4/m4module.h b/m4/m4module.h
index bdb31a3b67cce00052f1169dfada4397bdb940bc..5f144be2895d1cfc568fd6f3a19e49a6a695ad35 100644 (file)
--- a/m4/m4module.h
+++ b/m4/m4module.h
@@ -67,7 +67,7 @@ struct m4_builtin
const char * name; /* name found by builtin, printed by dumpdef */
int flags; /* bitwise OR of M4_BUILTIN_* bits */
size_t min_args; /* 0-based minimum number of arguments */
- /* max arguments, UINT_MAX if unlimited; must be >= min_args */
+ /* max arguments, SIZE_MAX if unlimited; must be >= min_args */
size_t max_args;
};
diff --git a/m4/m4private.h b/m4/m4private.h
index 28ac8674c478b6067107d706afae5a20a0467683..77590f38d23211b72cdf2dc3da3c3330f3cb024b 100644 (file)
--- a/m4/m4private.h
+++ b/m4/m4private.h
@@ -330,8 +330,7 @@ extern void m4__push_arg_quote (m4 *, m4_obstack *, m4_macro_args *,
# define m4_get_symbol_value(S) ((S)->value)
# define m4_set_symbol_value(S, V) ((S)->value = (V))
-# define m4_symbol_value_create() xzalloc (sizeof (m4_symbol_value))
-/* m4_symbol_value_delete is too complex for a simple macro. */
+/* m4_symbol_value_{create,delete} are too complex for a simple macro. */
# define m4_is_symbol_value_text(V) ((V)->type == M4_SYMBOL_TEXT)
# define m4_is_symbol_value_func(V) ((V)->type == M4_SYMBOL_FUNC)
diff --git a/m4/symtab.c b/m4/symtab.c
index 0d2055edfb8d33eee769e6c72af82418c516971f..f302fe8b8db2ca0aaabc5bbdebf91bf80af045ad 100644 (file)
--- a/m4/symtab.c
+++ b/m4/symtab.c
@@ -674,7 +674,9 @@ m4_get_symbol_traced (m4_symbol *symbol)
m4_symbol_value *
m4_symbol_value_create (void)
{
- return xzalloc (sizeof (m4_symbol_value));
+ m4_symbol_value *value = xzalloc (sizeof (m4_symbol_value));
+ VALUE_MAX_ARGS (value) = SIZE_MAX;
+ return value;
}
#undef m4_symbol_value_groks_macro
diff --git a/tests/macros.at b/tests/macros.at
index 3d74356216489184714e7c4f762db782fe4233d1..d0dd7e138cbe5be2cdc6da693e8c6df2685c6c7a 100644 (file)
--- a/tests/macros.at
+++ b/tests/macros.at
@@ -140,6 +140,15 @@ AT_CHECK_M4([-Ufoo in -Dfoo=bar in], [0], [[foo
bar
]])
+dnl Test macro arguments defined via -D
+AT_DATA([in], [[-foo-foo(1)-foo(1,2)-
+-bar-bar(1)-bar(1,2)-
+]])
+AT_CHECK_M4([-Dfoo -Dbar='$@' in], [0],
+[[----
+--1-1,2-
+]])
+
AT_CLEANUP
diff --git a/tests/null.m4 b/tests/null.m4
index e6e1816e42f3472db33906c157cc0bf132aa93e7..2fa38dd95dfdd9d8101da4db5c5e01a458452920 100644 (file)
Binary files a/tests/null.m4 and b/tests/null.m4 differ
diff --git a/tests/null.out b/tests/null.out
index 6e8a114c8eca2c8678d95bd97a16e65a4e73fbc2..c42e03c1d290b86eaadc6e9e38cac6bd77b70307 100644 (file)
Binary files a/tests/null.out and b/tests/null.out differ
diff --git a/tests/others.at b/tests/others.at
index bb6254a42abc1862cdfafe769af2b17ae30e670e..0b58c29bd9cbaa818ee8a192ab417b287983c0ce 100644 (file)
--- a/tests/others.at
+++ b/tests/others.at
@@ -1,5 +1,5 @@
# Hand crafted tests for GNU M4. -*- Autotest -*-
-# Copyright (C) 2001, 2006, 2007 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2006, 2007, 2008 Free Software Foundation, Inc.
# This file is part of GNU M4.
#
@@ -321,7 +321,13 @@ AT_SETUP([nul character])
cp "$abs_srcdir/null.out" expout
cp "$abs_srcdir/null.err" experr
-AT_CHECK_M4(["$abs_srcdir/null.m4"], [0], [expout], [experr])
+dnl all but m4exit
+AT_CHECK_M4([-Dm4exit "$abs_srcdir/null.m4"], [0], [expout], [experr])
+
+dnl just m4exit
+AT_CHECK_M4(["$abs_srcdir/null.m4"], [2],
+[[# This file tests m4 behavior on NUL bytes.
+]])
AT_CLEANUP
GNU M4 source repository
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /