m4-patches
[Top][All Lists]
Advanced

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

Fix build with -NDEBUG


From: Noah Misch
Subject: Fix build with -NDEBUG
Date: Thu, 07 Oct 2004 01:30:14 -0000
User-agent: Mutt/1.5.6i

This patch fixes the CVS m4 build under -DNDEBUG.  Under NDEBUG, m4private.h
defines macro replacements for some small functions, and those macros expand on
the paramter lists for the normal definitions of those functions.  This patch
parenthesizes the function names in the affected definitions to prevent that.

A CVS m4 built with -DNDEBUG runs about 30% faster on powerpc-apple-darwin5.5.
For example, running ``autoconf'' on the libtool configure.ac takes 238 seconds
instead of 363 seconds.  I'm hoping to get it down to 20 seconds...

2004-10-06  Noah Misch  <address@hidden>

        * m4/m4.c (m4_context_field_table, m4_context_opt_bit_table):
        Protect prototypes from macro expansion under -DNDEBUG.
        * m4/syntax.c (m4_get_syntax_lquote, m4_get_syntax_rquote,
        m4_get_syntax_bcomm, m4_get_syntax_ecomm,
        m4_is_syntax_single_quotes, m4_is_syntax_single_comments,
        m4_is_syntax_macro_escaped): Likewise.

Index: m4/m4.c
===================================================================
RCS file: /cvsroot/m4/m4/m4/m4.c,v
retrieving revision 1.13
diff -u -r1.13 m4.c
--- m4/m4.c     13 Nov 2003 12:05:58 -0000      1.13
+++ m4/m4.c     6 Oct 2004 23:19:14 -0000
@@ -94,7 +94,7 @@
 #undef m4_get_posixly_correct_opt
 
 #define M4FIELD(type, base, field)                                     \
-       type CONC(m4_get_, base) (m4 *context)                          \
+       type (CONC(m4_get_, base)) (m4 *context)                                
\
        {                                                               \
          assert (context);                                             \
          return context->field;                                        \
@@ -103,7 +103,7 @@
 #undef M4FIELD
 
 #define M4FIELD(type, base, field)                                     \
-       type CONC(m4_set_, base) (m4 *context, type value)              \
+       type (CONC(m4_set_, base)) (m4 *context, type value)            \
        {                                                               \
          assert (context);                                             \
          return context->field = value;                                \
@@ -112,7 +112,7 @@
 #undef M4FIELD
 
 #define M4OPT_BIT(bit, base)                                           \
-       bool CONC(m4_get_, base) (m4 *context)                  \
+       bool (CONC(m4_get_, base)) (m4 *context)                        \
        {                                                               \
          assert (context);                                             \
          return BIT_TEST (context->opt_flags, (bit));                  \
@@ -121,7 +121,7 @@
 #undef M4OPT_BIT
 
 #define M4OPT_BIT(bit, base)                                           \
-       bool CONC(m4_set_, base) (m4 *context, bool value)      \
+       bool (CONC(m4_set_, base)) (m4 *context, bool value)    \
        {                                                               \
          assert (context);                                             \
          if (value)                                                    \
Index: m4/syntax.c
===================================================================
RCS file: /cvsroot/m4/m4/m4/syntax.c,v
retrieving revision 1.12
diff -u -r1.12 syntax.c
--- m4/syntax.c 13 Nov 2003 12:05:58 -0000      1.12
+++ m4/syntax.c 6 Oct 2004 23:19:14 -0000
@@ -228,14 +228,14 @@
 }
 
 const char *
-m4_get_syntax_lquote (m4_syntax_table *syntax)
+(m4_get_syntax_lquote) (m4_syntax_table *syntax)
 {
   assert (syntax);
   return syntax->lquote.string;
 }
 
 const char *
-m4_get_syntax_rquote (m4_syntax_table *syntax)
+(m4_get_syntax_rquote) (m4_syntax_table *syntax)
 {
   assert (syntax);
   return syntax->rquote.string;
@@ -274,35 +274,35 @@
 }
 
 const char *
-m4_get_syntax_bcomm (m4_syntax_table *syntax)
+(m4_get_syntax_bcomm) (m4_syntax_table *syntax)
 {
   assert (syntax);
   return syntax->bcomm.string;
 }
 
 const char *
-m4_get_syntax_ecomm (m4_syntax_table *syntax)
+(m4_get_syntax_ecomm) (m4_syntax_table *syntax)
 {
   assert (syntax);
   return syntax->ecomm.string;
 }
 
 bool
-m4_is_syntax_single_quotes (m4_syntax_table *syntax)
+(m4_is_syntax_single_quotes) (m4_syntax_table *syntax)
 {
   assert (syntax);
   return syntax->is_single_quotes;
 }
 
 bool
-m4_is_syntax_single_comments (m4_syntax_table *syntax)
+(m4_is_syntax_single_comments) (m4_syntax_table *syntax)
 {
   assert (syntax);
   return syntax->is_single_comments;
 }
 
 bool
-m4_is_syntax_macro_escaped (m4_syntax_table *syntax)
+(m4_is_syntax_macro_escaped) (m4_syntax_table *syntax)
 {
   assert (syntax);
   return syntax->is_macro_escaped;




reply via email to

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