[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch-1_4 and DEBUG
From: |
Eric Blake |
Subject: |
branch-1_4 and DEBUG |
Date: |
Thu, 22 Jun 2006 17:05:05 +0000 (UTC) |
User-agent: |
Loom/3.14 (http://gmane.org/) |
This simple patch allows even 'make CFLAGS=-DDEBUG' to be clean.
2006-06-22 Eric Blake <address@hidden>
Avoid compiler warnings during -DDEBUG.
* src/m4.h (M4_GNUC_ATTRIBUTE, M4_GNUC_UNUSED): New macros.
[DEBUG]: Also imply DEBUG_OUTPUT and DEBUG_STKOVF.
* src/input.c (print_token) [DEBUG_INPUT]: Use correct format.
(lex_debug) [DEBUG_INPUT]: Fix to compile. Mark unused.
(next_token) [DEBUG_INPUT]: Print before returning.
* src/path.c (include_dump) [DEBUG_INCL]: Mark unused.
* src/symtab.c (symtab_debug) [DEBUG_SYM]: Mark unused.
Index: src/input.c
===================================================================
RCS file: /sources/m4/m4/src/Attic/input.c,v
retrieving revision 1.1.1.1.2.6
diff -u -r1.1.1.1.2.6 input.c
--- src/input.c 6 Jun 2006 13:20:57 -0000 1.1.1.1.2.6
+++ src/input.c 22 Jun 2006 17:03:45 -0000
@@ -728,10 +728,10 @@
ch = peek_input ();
if (ch == CHAR_EOF)
{
- return TOKEN_EOF;
#ifdef DEBUG_INPUT
fprintf (stderr, "next_token -> EOF\n");
#endif
+ return TOKEN_EOF;
}
if (ch == CHAR_MACRO)
{
@@ -872,7 +872,7 @@
break;
case TOKEN_MACDEF:
- fprintf (stderr, "macro: 0x%x\n", TOKEN_DATA_FUNC (td));
+ fprintf (stderr, "macro: %p\n", TOKEN_DATA_FUNC (td));
break;
case TOKEN_EOF:
@@ -882,13 +882,13 @@
fprintf (stderr, "\t\"%s\"\n", TOKEN_DATA_TEXT (td));
}
-static void
+static void M4_GNUC_UNUSED
lex_debug (void)
{
token_type t;
token_data td;
- while ((t = next_token (&td)) != NULL)
+ while ((t = next_token (&td)) != TOKEN_EOF)
print_token ("lex", t, &td);
}
#endif
Index: src/m4.h
===================================================================
RCS file: /sources/m4/m4/src/m4.h,v
retrieving revision 1.1.1.1.2.10
diff -u -r1.1.1.1.2.10 m4.h
--- src/m4.h 22 Jun 2006 14:55:48 -0000 1.1.1.1.2.10
+++ src/m4.h 22 Jun 2006 17:03:45 -0000
@@ -477,13 +477,25 @@
/* Other debug stuff. */
#ifdef DEBUG
-# define DEBUG_INPUT
-# define DEBUG_MACRO
-# define DEBUG_SYM
-# define DEBUG_INCL
+# define DEBUG_INCL 1
+# define DEBUG_INPUT 1
+# define DEBUG_MACRO 1
+# define DEBUG_OUTPUT 1
+# define DEBUG_STKOVF 1
+# define DEBUG_SYM 1
#endif
/* Convert a possibly-signed character to an unsigned character. This is
a bit safer than casting to unsigned char, since it catches some type
errors that the cast doesn't. */
static inline unsigned char to_uchar (char ch) { return ch; }
+
+/* Take advantage of GNU C compiler source level optimization hints,
+ using portable macros. */
+#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4)
+# define M4_GNUC_ATTRIBUTE(args) __attribute__(args)
+#else
+# define M4_GNUC_ATTRIBUTE(args)
+#endif /* __GNUC__ */
+
+#define M4_GNUC_UNUSED M4_GNUC_ATTRIBUTE((unused))
Index: src/path.c
===================================================================
RCS file: /sources/m4/m4/src/Attic/path.c,v
retrieving revision 1.1.1.1.2.3
diff -u -r1.1.1.1.2.3 path.c
--- src/path.c 28 May 2006 04:24:01 -0000 1.1.1.1.2.3
+++ src/path.c 22 Jun 2006 17:03:45 -0000
@@ -145,7 +145,7 @@
#ifdef DEBUG_INCL
-static int
+static void M4_GNUC_UNUSED
include_dump (void)
{
includes *incl;
Index: src/symtab.c
===================================================================
RCS file: /sources/m4/m4/src/Attic/symtab.c,v
retrieving revision 1.1.1.1.2.9
diff -u -r1.1.1.1.2.9 symtab.c
--- src/symtab.c 15 Jun 2006 21:29:16 -0000 1.1.1.1.2.9
+++ src/symtab.c 22 Jun 2006 17:03:45 -0000
@@ -349,7 +349,7 @@
static void symtab_print_list (int i);
-static void
+static void M4_GNUC_UNUSED
symtab_debug (void)
{
token_data td;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch-1_4 and DEBUG,
Eric Blake <=