[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ./configure --disable-shared
From: |
Eric Blake |
Subject: |
Re: ./configure --disable-shared |
Date: |
Tue, 5 Sep 2006 23:15:44 +0000 (UTC) |
User-agent: |
Loom/3.14 (http://gmane.org/) |
Eric Blake <ebb9 <at> byu.net> writes:
>
> 2006-09-05 Eric Blake <ebb9 <at> byu.net>
>
> * m4/input.c (lex_debug): Remove dead code that broke compilation
> with --enable-debug.
> * m4/module.c (install_builtin_table, install_macro_table)
> (m4__module_init, m4__module_open, module_close)
> (module_remove): Fix compilation when --enable-debug.
Some of the messages in module.c looked rather useful, even when not using
DEBUG_MODULES. So I am installing this followup, which augments the power of
the --debug option/debugmode macro to add the 'm' flag.
2006-09-05 Eric Blake <address@hidden>
* m4/m4module.h (m4_debug_message): New prototype.
(M4_DEBUG_TRACE_MODULE): New debug bit.
* m4/m4private.h (M4_DEBUG_MESSAGE, M4_DEBUG_MESSAGE1)
(M4_DEBUG_MESSAGE2): Delete these macros.
* m4/debug.c (m4_debug_message): New method.
(m4_debug_decode): Add module tracing as flag `m'.
* m4/input.c (m4_push_file, file_clean): Use new method.
* m4/path.c (m4_path_search): Likewise.
* po/Makevars (XGETTEXT_OPTIONS): Likewise.
* m4/module.c (install_builtin_table, install_macro_table)
(m4__module_open, module_close, module_remove): Promote several
module debug messages outside of DEBUG_MODULES.
(m4__module_init, module_remove) [DEBUG_MODULES]: Don't mix
DEBUG_MODULES with normal trace output.
* src/main.c (usage): Document new flag.
* doc/m4.texinfo (Debug Levels): Likewise.
* Makefile.am ($(TESTSUITE)): Add missing dependency.
* tests/m4.in: Neutralize platform-dependent module filenames.
* tests/options.at (--debug): Update expected output.
Index: Makefile.am
===================================================================
RCS file: /sources/m4/m4/Makefile.am,v
retrieving revision 1.42
diff -u -r1.42 Makefile.am
--- Makefile.am 27 Jul 2006 22:34:55 -0000 1.42
+++ Makefile.am 5 Sep 2006 23:01:45 -0000
@@ -389,7 +389,7 @@
AUTOM4TE = autom4te
AUTOTEST = $(AUTOM4TE) --language=autotest
-$(TESTSUITE): tests/package.m4 $(TESTSUITE_AT)
+$(TESTSUITE): tests/package.m4 $(TESTSUITE_AT) tests/m4
$(AUTOTEST) -I '$(srcdir)/tests' -o address@hidden address@hidden
mv address@hidden $@
Index: doc/m4.texinfo
===================================================================
RCS file: /sources/m4/m4/doc/m4.texinfo,v
retrieving revision 1.41
diff -u -r1.41 m4.texinfo
--- doc/m4.texinfo 5 Sep 2006 17:28:45 -0000 1.41
+++ doc/m4.texinfo 5 Sep 2006 23:01:46 -0000
@@ -2653,6 +2653,9 @@
@item l
Show the current input line number in each trace output line.
address@hidden m
+Print a message each time a module is manipulated (@pxref{Modules}).
+
@item p
Print a message when a named file is found through the path search
mechanism (@pxref{Search Path}), giving the actual file name used.
Index: m4/debug.c
===================================================================
RCS file: /sources/m4/m4/m4/debug.c,v
retrieving revision 1.23
diff -u -r1.23 debug.c
--- m4/debug.c 23 Aug 2006 11:39:26 -0000 1.23
+++ m4/debug.c 5 Sep 2006 23:01:46 -0000
@@ -19,6 +19,7 @@
#include <stdio.h>
#include <sys/stat.h>
+#include <stdarg.h>
#include "m4private.h"
@@ -84,6 +85,10 @@
level |= M4_DEBUG_TRACE_CALLID;
break;
+ case 'm':
+ level |= M4_DEBUG_TRACE_MODULE;
+ break;
+
case 'V':
level |= M4_DEBUG_TRACE_VERBOSE;
break;
@@ -204,3 +209,26 @@
}
putc (' ', debug_file);
}
+
+/* If the current debug mode includes MODE, and there is a current
+ debug file, then output a debug message described by FORMAT. A
+ message header is supplied, as well as a trailing newline. */
+void
+m4_debug_message (m4 *context, int mode, const char *format, ...)
+{
+ /* Check that mode has exactly one bit set. */
+ assert ((mode & (mode - 1)) == 0);
+ assert (format);
+
+ if (m4_get_debug_file (context) != NULL
+ && m4_is_debug_bit (context, mode))
+ {
+ va_list args;
+
+ m4_debug_message_prefix (context);
+ va_start (args, format);
+ vfprintf (m4_get_debug_file (context), format, args);
+ va_end (args);
+ putc ('\n', m4_get_debug_file (context));
+ }
+}
Index: m4/input.c
===================================================================
RCS file: /sources/m4/m4/m4/input.c,v
retrieving revision 1.45
diff -u -r1.45 input.c
--- m4/input.c 5 Sep 2006 16:58:02 -0000 1.45
+++ m4/input.c 5 Sep 2006 23:01:46 -0000
@@ -222,14 +222,12 @@
static void
file_clean (m4 *context)
{
- if (m4_is_debug_bit (context, M4_DEBUG_TRACE_INPUT))
- {
- if (isp->u.u_f.lineno)
- M4_DEBUG_MESSAGE2 (context, _("input reverted to %s, line %d"),
- isp->u.u_f.name, isp->u.u_f.lineno);
- else
- M4_DEBUG_MESSAGE (context, _("input exhausted"));
- }
+ if (isp->u.u_f.lineno)
+ m4_debug_message (context, M4_DEBUG_TRACE_INPUT,
+ _("input reverted to %s, line %d"),
+ isp->u.u_f.name, isp->u.u_f.lineno);
+ else
+ m4_debug_message (context, M4_DEBUG_TRACE_INPUT, _("input exhausted"));
fclose (isp->u.u_f.file);
m4_set_current_file (context, isp->u.u_f.name);
@@ -255,8 +253,8 @@
next = NULL;
}
- if (BIT_TEST (m4_get_debug_level_opt (context), M4_DEBUG_TRACE_INPUT))
- M4_DEBUG_MESSAGE1 (context, _("input read from %s"), title);
+ m4_debug_message (context, M4_DEBUG_TRACE_INPUT,
+ _("input read from %s"), title);
i = (input_block *) obstack_alloc (current_input,
sizeof (struct input_block));
Index: m4/m4module.h
===================================================================
RCS file: /sources/m4/m4/m4/m4module.h,v
retrieving revision 1.82
diff -u -r1.82 m4module.h
--- m4/m4module.h 5 Sep 2006 13:25:24 -0000 1.82
+++ m4/m4module.h 5 Sep 2006 23:01:46 -0000
@@ -127,8 +127,8 @@
#define m4_context_field_table \
M4FIELD(m4_symbol_table *, symbol_table, symtab) \
M4FIELD(m4_syntax_table *, syntax_table, syntax) \
- M4FIELD(const char *, current_file, current_file) \
- M4FIELD(int, current_line, current_line) \
+ M4FIELD(const char *, current_file, current_file) \
+ M4FIELD(int, current_line, current_line) \
M4FIELD(FILE *, debug_file, debug_file) \
M4FIELD(m4_obstack, trace_messages, trace_messages) \
M4FIELD(int, exit_status, exit_status) \
@@ -286,9 +286,11 @@
M4_DEBUG_TRACE_INPUT = (1 << 8),
/* x: add call id to trace output */
M4_DEBUG_TRACE_CALLID = (1 << 9),
+ /* m: trace module actions */
+ M4_DEBUG_TRACE_MODULE = (1 << 10),
/* V: very verbose -- print everything */
- M4_DEBUG_TRACE_VERBOSE = ((1 << 10) - 1)
+ M4_DEBUG_TRACE_VERBOSE = ((1 << 11) - 1)
};
/* default flags -- equiv: aeq */
@@ -300,6 +302,8 @@
extern int m4_debug_decode (m4 *, int, const char *);
extern bool m4_debug_set_output (m4 *, const char *);
extern void m4_debug_message_prefix (m4 *);
+extern void m4_debug_message (m4 *, int, const char *, ...)
+ M4_GNUC_PRINTF (3, 4);
@@ -405,9 +409,9 @@
/* --- PATH MANAGEMENT --- */
-extern void m4_include_env_init (m4 *);
+extern void m4_include_env_init (m4 *);
extern void m4_add_include_directory (m4 *, const char *, bool);
-extern FILE * m4_path_search (m4 *, const char *, char **);
+extern FILE * m4_path_search (m4 *, const char *, char **);
Index: m4/m4private.h
===================================================================
RCS file: /sources/m4/m4/m4/m4private.h,v
retrieving revision 1.58
diff -u -r1.58 m4private.h
--- m4/m4private.h 5 Sep 2006 13:25:24 -0000 1.58
+++ m4/m4private.h 5 Sep 2006 23:01:46 -0000
@@ -186,9 +186,9 @@
#define VALUE_MAX_ARGS(T) ((T)->max_args)
#define VALUE_PENDING(T) ((T)->pending_expansions)
-#define SYMBOL_NEXT(S) (VALUE_NEXT ((S)->value))
-#define SYMBOL_HANDLE(S) (VALUE_HANDLE ((S)->value))
-#define SYMBOL_FLAGS(S) (VALUE_FLAGS ((S)->value))
+#define SYMBOL_NEXT(S) (VALUE_NEXT ((S)->value))
+#define SYMBOL_HANDLE(S) (VALUE_HANDLE ((S)->value))
+#define SYMBOL_FLAGS(S) (VALUE_FLAGS ((S)->value))
#define SYMBOL_ARG_SIGNATURE(S) (VALUE_ARG_SIGNATURE ((S)->value))
#define SYMBOL_MIN_ARGS(S) (VALUE_MIN_ARGS ((S)->value))
#define SYMBOL_MAX_ARGS(S) (VALUE_MAX_ARGS ((S)->value))
@@ -344,33 +344,6 @@
# include <dmalloc.h>
#endif /* WITH_DMALLOC */
-/* Other debug stuff. */
-
-#define M4_DEBUG_MESSAGE(C, Fmt) M4_STMT_START { \
- if (m4_get_debug_file (C) != NULL) \
- { \
- m4_debug_message_prefix (C); \
- fprintf (m4_get_debug_file (C), Fmt); \
- putc ('\n', m4_get_debug_file (C)); \
- } } M4_STMT_END
-
-#define M4_DEBUG_MESSAGE1(C, Fmt, Arg1) M4_STMT_START {
\
- if (m4_get_debug_file (C) != NULL) \
- { \
- m4_debug_message_prefix (C); \
- fprintf (m4_get_debug_file (C), Fmt, Arg1); \
- putc ('\n', m4_get_debug_file (C)); \
- } } M4_STMT_END
-
-#define M4_DEBUG_MESSAGE2(C, Fmt, Arg1, Arg2) M4_STMT_START { \
- if (m4_get_debug_file (C) != NULL) \
- { \
- m4_debug_message_prefix (C); \
- fprintf (m4_get_debug_file (C), Fmt, Arg1, Arg2); \
- putc ('\n', m4_get_debug_file (C)); \
- } } M4_STMT_END
-
-
/* Convenience macro to zero a variable after freeing it. */
Index: m4/module.c
===================================================================
RCS file: /sources/m4/m4/m4/module.c,v
retrieving revision 1.44
diff -u -r1.44 module.c
--- m4/module.c 5 Sep 2006 16:58:02 -0000 1.44
+++ m4/module.c 5 Sep 2006 23:01:46 -0000
@@ -175,10 +175,9 @@
free (name);
}
-#ifdef DEBUG_MODULES
- M4_DEBUG_MESSAGE1(context, "module %s: builtins loaded",
+ m4_debug_message (context, M4_DEBUG_TRACE_MODULE,
+ _("module %s: builtins loaded"),
m4_get_module_name (handle));
-#endif /* DEBUG_MODULES */
}
return bp;
@@ -206,10 +205,9 @@
m4_symbol_pushdef (M4SYMTAB, mp->name, value);
}
-#ifdef DEBUG_MODULES
- M4_DEBUG_MESSAGE1(context, "module %s: macros loaded",
+ m4_debug_message (context, M4_DEBUG_TRACE_MODULE,
+ _("module %s: macros loaded"),
m4_get_module_name (handle));
-#endif /* DEBUG_MODULES */
}
return mp;
@@ -367,7 +365,7 @@
module_dlerror ());
#ifdef DEBUG_MODULES
- M4_DEBUG_MESSAGE (context, "Module loader initialized.");
+ fprintf (stderr, "Module loader initialized.\n");
#endif /* DEBUG_MODULES */
}
@@ -386,15 +384,14 @@
if (handle)
{
-#ifdef DEBUG_MODULES
const lt_dlinfo *info = lt_dlgetinfo (handle);
/* If we have a handle, there must be handle info. */
assert (info);
- M4_DEBUG_MESSAGE2(context, "module %s: opening at %s",
+ m4_debug_message (context, M4_DEBUG_TRACE_MODULE,
+ _("module %s: opening file `%s'"),
name ? name : MODULE_SELF_NAME, info->filename);
-#endif
/* Find and run any initializing function in the opened module,
each time the module is opened. */
@@ -403,9 +400,8 @@
{
(*init_func) (context, handle, obs);
-#ifdef DEBUG_MODULES
- M4_DEBUG_MESSAGE1(context, "module %s: init hook called", name);
-#endif /* DEBUG_MODULES */
+ m4_debug_message (context, M4_DEBUG_TRACE_MODULE,
+ _("module %s: init hook called"), name);
}
if (!init_func
@@ -417,9 +413,8 @@
_("module `%s' has no entry points"), name);
}
-#ifdef DEBUG_MODULES
- M4_DEBUG_MESSAGE1(context, "module %s: opened", name);
-#endif /* DEBUG_MODULES */
+ m4_debug_message (context, M4_DEBUG_TRACE_MODULE,
+ _("module %s: opened"), name);
}
else
{
@@ -455,7 +450,7 @@
iface_id = NULL;
if (!errors)
- errors = lt_dlexit();
+ errors = lt_dlexit ();
if (errors)
{
@@ -497,9 +492,8 @@
{
(*finish_func) (context, handle, obs);
-#ifdef DEBUG_MODULES
- M4_DEBUG_MESSAGE1(context, "module %s: finish hook called", name);
-#endif /* DEBUG_MODULES */
+ m4_debug_message (context, M4_DEBUG_TRACE_MODULE,
+ _("module %s: finish hook called"), name);
}
if (!lt_dlisresident (handle))
@@ -507,15 +501,13 @@
errors = lt_dlclose (handle);
if (!errors)
{
-#ifdef DEBUG_MODULES
- M4_DEBUG_MESSAGE1(context, "module %s: closed", name);
-#endif /* DEBUG_MODULES */
+ m4_debug_message (context, M4_DEBUG_TRACE_MODULE,
+ _("module %s: closed"), name);
}
}
-#ifdef DEBUG_MODULES
else
- M4_DEBUG_MESSAGE1(context, "module %s: resident module not closed", name);
-#endif /* DEBUG_MODULES */
+ m4_debug_message (context, M4_DEBUG_TRACE_MODULE,
+ _("module %s: resident module not closed"), name);
if (errors)
{
@@ -523,7 +515,7 @@
name, module_dlerror ());
}
- free ((void *) name);
+ DELETE (name);
}
static int
@@ -531,19 +523,13 @@
{
const lt_dlinfo *info;
int errors = 0;
+ const char * name;
-#ifdef DEBUG_MODULES
- char * name;
+ assert (handle);
/* Be careful when closing myself. */
- if (handle)
- {
- name = m4_get_module_name (handle);
- name = xstrdup (name ? name : MODULE_SELF_NAME);
- }
-#endif /* DEBUG_MODULES */
-
- assert (handle);
+ name = m4_get_module_name (handle);
+ name = xstrdup (name ? name : MODULE_SELF_NAME);
info = lt_dlgetinfo (handle);
@@ -552,8 +538,8 @@
#ifdef DEBUG_MODULES
if (info->ref_count > 1)
{
- M4_DEBUG_MESSAGE2(context, "module %s: now has %d references.",
- name, info->ref_count -1);
+ fprintf (stderr, "module %s: now has %d references.",
+ name, info->ref_count -1);
}
#endif /* DEBUG_MODULES */
@@ -565,13 +551,14 @@
removed, we needn't try to remove them again! */
m4__symtab_remove_module_references (M4SYMTAB, handle);
-#ifdef DEBUG_MODULES
- M4_DEBUG_MESSAGE1(context, "module %s: symbols unloaded", name);
-#endif /* DEBUG_MODULES */
+ m4_debug_message (context, M4_DEBUG_TRACE_MODULE,
+ _("module %s: symbols unloaded"), name);
}
if (!errors)
module_close (context, handle, obs);
+ DELETE (name);
+
return errors;
}
Index: m4/path.c
===================================================================
RCS file: /sources/m4/m4/m4/path.c,v
retrieving revision 1.19
diff -u -r1.19 path.c
--- m4/path.c 25 Aug 2006 19:23:02 -0000 1.19
+++ m4/path.c 5 Sep 2006 23:01:46 -0000
@@ -177,9 +177,9 @@
fp = fopen (name, "r");
if (fp != NULL)
{
- if (BIT_TEST (m4_get_debug_level_opt (context), M4_DEBUG_TRACE_PATH))
- M4_DEBUG_MESSAGE2 (context, _("path search for `%s' found `%s'"),
- file, name);
+ m4_debug_message (context, M4_DEBUG_TRACE_PATH,
+ _("path search for `%s' found `%s'"),
+ file, name);
if (set_cloexec_flag (fileno (fp), true) != 0)
m4_error (context, 0, errno,
_("cannot protect input file across forks"));
Index: po/Makevars
===================================================================
RCS file: /sources/m4/m4/po/Makevars,v
retrieving revision 1.4
diff -u -r1.4 Makevars
--- po/Makevars 22 Aug 2006 16:16:48 -0000 1.4
+++ po/Makevars 5 Sep 2006 23:01:46 -0000
@@ -36,9 +36,7 @@
--flag=asprintf:2:c-format --flag=vasprintf:2:c-format \
--flag=asnprintf:3:c-format --flag=vasnprintf:3:c-format \
--flag=m4_error:4:c-format --flag=m4_error_at_line:6:c-format \
- --flag=M4_DEBUG_MESSAGE:2:c-format \
- --flag=M4_DEBUG_MESSAGE1:2:c-format \
- --flag=M4_DEBUG_MESSAGE2:2:c-format
+ --flag=m4_debug_message:3:c-format
# This is the copyright holder that gets inserted into the header of the
# $(DOMAIN).pot file. Set this to the copyright holder of the surrounding
Index: src/main.c
===================================================================
RCS file: /sources/m4/m4/src/main.c,v
retrieving revision 1.78
diff -u -r1.78 main.c
--- src/main.c 29 Aug 2006 20:38:30 -0000 1.78
+++ src/main.c 5 Sep 2006 23:01:46 -0000
@@ -147,6 +147,9 @@
f say current input file name\n\
i show changes in input files\n\
l say current input line number\n\
+"), stdout);
+ fputs (_("\
+ m show actions related to modules\n\
p show results of path searches\n\
q quote values as necessary, with a or e flag\n\
t trace for all macro calls, not only traceon'ed\n\
@@ -275,13 +278,13 @@
case 'H':
/* -H was supported in 1.4.x. FIXME - make obsolete after
- 2.0, and remove after 2.1. For now, keep it silent. */
+ 2.0, and remove after 2.1. For now, keep it silent. */
break;
case 'N':
case DIVERSIONS_OPTION:
/* -N became an obsolete no-op in 1.4.x. FIXME - remove
- support for -N after 2.0. */
+ support for -N after 2.0. */
error (0, 0, _("Warning: `m4 %s' is deprecated"),
optchar == 'N' ? "-N" : "--diversions");
break;
Index: tests/m4.in
===================================================================
RCS file: /sources/m4/m4/tests/m4.in,v
retrieving revision 1.6
diff -u -r1.6 m4.in
--- tests/m4.in 22 Aug 2006 16:16:48 -0000 1.6
+++ tests/m4.in 5 Sep 2006 23:01:46 -0000
@@ -34,7 +34,11 @@
# actual program, either lt-m4, or m4.
#
# - In both cases, beware of .exe.
-sed 's,^[^:]*[lt-]*m4[.ex]*:,m4:,' /tmp/m4-$$ >&2
+# - Also, when tracing modules, lines of the form
+# m4debug: module m4: opening file `m4.a'
+# must be reduced, since module names are platform dependent.
+sed -e 's,^[^:]*[lt-]*m4[.ex]*:,m4:,' \
+ -e '/^m4debug: module/s/opening file.*/opening file/' /tmp/m4-$$ >&2
rm /tmp/m4-$$
exit $status
Index: tests/options.at
===================================================================
RCS file: /sources/m4/m4/tests/options.at,v
retrieving revision 1.6
diff -u -r1.6 options.at
--- tests/options.at 29 Aug 2006 20:38:30 -0000 1.6
+++ tests/options.at 5 Sep 2006 23:01:46 -0000
@@ -95,7 +95,15 @@
dnl Test all flags.
AT_CHECK_M4([-dV in], [0], [[0
3
-]], [[m4debug: path search for `in' found `in'
+]], [[m4debug: module m4: opening file
+m4debug: module m4: init hook called
+m4debug: module m4: opened
+m4debug: module m4: builtins loaded
+m4debug: module gnu: opening file
+m4debug: module gnu: opened
+m4debug: module gnu: builtins loaded
+m4debug: module gnu: macros loaded
+m4debug: path search for `in' found `in'
m4debug: input read from in
m4trace:in:1: -1- id 1: divnum ...
m4trace:in:1: -1- id 1: divnum -> ???
@@ -104,6 +112,10 @@
m4trace:in:2: -1- id 2: len(`abc') -> ???
m4trace:in:2: -1- id 2: len(...) -> `3'
m4debug:in:3: input exhausted
+m4debug: module gnu: symbols unloaded
+m4debug: module gnu: closed
+m4debug: module m4: symbols unloaded
+m4debug: module m4: resident module not closed
]])
dnl Test addition and subtraction of flags.