From 753ddb7ce076a12df07b2f800fe785cf659277df Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Mon, 22 Dec 2008 11:40:53 +0100 Subject: Some cleanup in the C++ preprocessor. Introduced pp-scanner.cpp, renamed `pp' to `Preprocessor' and removed useless #includes. --- src/libs/cplusplus/pp-macro-expander.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/libs/cplusplus/pp-macro-expander.cpp') diff --git a/src/libs/cplusplus/pp-macro-expander.cpp b/src/libs/cplusplus/pp-macro-expander.cpp index 21148d2446..6a7d7e75df 100644 --- a/src/libs/cplusplus/pp-macro-expander.cpp +++ b/src/libs/cplusplus/pp-macro-expander.cpp @@ -32,11 +32,26 @@ ***************************************************************************/ #include "pp.h" +#include "pp-cctype.h" #include "pp-macro-expander.h" #include using namespace CPlusPlus; +inline static bool comment_p (const char *__first, const char *__last) +{ + if (__first == __last) + return false; + + if (*__first != '/') + return false; + + if (++__first == __last) + return false; + + return (*__first == '/' || *__first == '*'); +} + MacroExpander::MacroExpander (Environment &env, pp_frame *frame) : env(env), frame(frame), lines(0), generated_lines(0) @@ -137,7 +152,7 @@ const char *MacroExpander::operator () (const char *__first, const char *__last, __result->append(__first, next_pos - __first); __first = next_pos; } - else if (_PP_internal::comment_p (__first, __last)) + else if (comment_p (__first, __last)) { __first = skip_comment_or_divop (__first, __last); int n = skip_comment_or_divop.lines; -- cgit v1.2.1