Commit 6983ea08 by Matt Austern Committed by Matt Austern

Compile speed improvement.

	* parser.c (cp_lexer_print_token): Only define if ENABLE_CHECKING set.
	Otherwise define a stub macro that expands to nothing.
	(cp_lexer_debugging_p): Only define if ENABLE_CHECKING set.  Otherwise
	define a stub macro that expands to 0.
	(cp_lexer_start_debugging): Only define if ENABLE_CHECKING set.
	(cp_lexer_stop_debugging): Likewise.
	(cp_lexer_debug_stream): Only define if ENABLE_CHECKING set.  Otherwise
	define a stub macro that expands to NULL.
	(cp_lexer_new_main): Only set debugging_p if ENABLE_CHECKING set.
	(cp_lexer_new_from_tokens): Likewise.

From-SVN: r87059
parent 80d8221e
2004-0903 Matt Austern <austern@apple.com>
Compile speed improvement.
* parser.c (cp_lexer_print_token): Only define if ENABLE_CHECKING set.
Otherwise define a stub macro that expands to nothing.
(cp_lexer_debugging_p): Only define if ENABLE_CHECKING set. Otherwise
define a stub macro that expands to 0.
(cp_lexer_start_debugging): Only define if ENABLE_CHECKING set.
(cp_lexer_stop_debugging): Likewise.
(cp_lexer_debug_stream): Only define if ENABLE_CHECKING set. Otherwise
define a stub macro that expands to NULL.
(cp_lexer_new_main): Only set debugging_p if ENABLE_CHECKING set.
(cp_lexer_new_from_tokens): Likewise.
2004-09-03 Jan Hubicka <jh@suse.cz> 2004-09-03 Jan Hubicka <jh@suse.cz>
* decl.c (finish_function): Clean out pointers we no longer need. * decl.c (finish_function): Clean out pointers we no longer need.
......
...@@ -256,6 +256,7 @@ static void cp_lexer_rollback_tokens ...@@ -256,6 +256,7 @@ static void cp_lexer_rollback_tokens
(cp_lexer *); (cp_lexer *);
static inline void cp_lexer_set_source_position_from_token static inline void cp_lexer_set_source_position_from_token
(cp_lexer *, const cp_token *); (cp_lexer *, const cp_token *);
#ifdef ENABLE_CHECKING
static void cp_lexer_print_token static void cp_lexer_print_token
(FILE *, cp_token *); (FILE *, cp_token *);
static inline bool cp_lexer_debugging_p static inline bool cp_lexer_debugging_p
...@@ -264,6 +265,11 @@ static void cp_lexer_start_debugging ...@@ -264,6 +265,11 @@ static void cp_lexer_start_debugging
(cp_lexer *) ATTRIBUTE_UNUSED; (cp_lexer *) ATTRIBUTE_UNUSED;
static void cp_lexer_stop_debugging static void cp_lexer_stop_debugging
(cp_lexer *) ATTRIBUTE_UNUSED; (cp_lexer *) ATTRIBUTE_UNUSED;
#else
#define cp_lexer_debug_stream NULL
#define cp_lexer_print_token(str, tok)
#define cp_lexer_debugging_p(lexer) 0
#endif /* ENABLE_CHECKING */
/* Manifest constants. */ /* Manifest constants. */
...@@ -292,8 +298,10 @@ static void cp_lexer_stop_debugging ...@@ -292,8 +298,10 @@ static void cp_lexer_stop_debugging
/* Variables. */ /* Variables. */
#ifdef ENABLE_CHECKING
/* The stream to which debugging output should be written. */ /* The stream to which debugging output should be written. */
static FILE *cp_lexer_debug_stream; static FILE *cp_lexer_debug_stream;
#endif /* ENABLE_CHECKING */
/* Create a new main C++ lexer, the lexer that gets tokens from the /* Create a new main C++ lexer, the lexer that gets tokens from the
preprocessor. */ preprocessor. */
...@@ -332,8 +340,10 @@ cp_lexer_new_main (void) ...@@ -332,8 +340,10 @@ cp_lexer_new_main (void)
/* Create the STRINGS array. */ /* Create the STRINGS array. */
VARRAY_TREE_INIT (lexer->string_tokens, 32, "strings"); VARRAY_TREE_INIT (lexer->string_tokens, 32, "strings");
#ifdef ENABLE_CHECKING
/* Assume we are not debugging. */ /* Assume we are not debugging. */
lexer->debugging_p = false; lexer->debugging_p = false;
#endif /* ENABLE_CHECKING */
return lexer; return lexer;
} }
...@@ -383,20 +393,26 @@ cp_lexer_new_from_tokens (cp_token_cache *tokens) ...@@ -383,20 +393,26 @@ cp_lexer_new_from_tokens (cp_token_cache *tokens)
/* Create the STRINGS array. */ /* Create the STRINGS array. */
VARRAY_TREE_INIT (lexer->string_tokens, 32, "strings"); VARRAY_TREE_INIT (lexer->string_tokens, 32, "strings");
#ifdef ENABLE_CHECKING
/* Assume we are not debugging. */ /* Assume we are not debugging. */
lexer->debugging_p = false; lexer->debugging_p = false;
#endif /* ENABLE_CHECKING */
return lexer; return lexer;
} }
/* Returns nonzero if debugging information should be output. */ /* Returns nonzero if debugging information should be output. */
#ifdef ENABLE_CHECKING
static inline bool static inline bool
cp_lexer_debugging_p (cp_lexer *lexer) cp_lexer_debugging_p (cp_lexer *lexer)
{ {
return lexer->debugging_p; return lexer->debugging_p;
} }
#endif /* ENABLE_CHECKING */
/* Set the current source position from the information stored in /* Set the current source position from the information stored in
TOKEN. */ TOKEN. */
...@@ -910,6 +926,8 @@ cp_lexer_rollback_tokens (cp_lexer* lexer) ...@@ -910,6 +926,8 @@ cp_lexer_rollback_tokens (cp_lexer* lexer)
/* Print a representation of the TOKEN on the STREAM. */ /* Print a representation of the TOKEN on the STREAM. */
#ifdef ENABLE_CHECKING
static void static void
cp_lexer_print_token (FILE * stream, cp_token* token) cp_lexer_print_token (FILE * stream, cp_token* token)
{ {
...@@ -994,6 +1012,8 @@ cp_lexer_stop_debugging (cp_lexer* lexer) ...@@ -994,6 +1012,8 @@ cp_lexer_stop_debugging (cp_lexer* lexer)
--lexer->debugging_p; --lexer->debugging_p;
} }
#endif /* ENABLE_CHECKING */
/* Decl-specifiers. */ /* Decl-specifiers. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment