diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2023-11-06 12:43:53 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2023-11-06 12:43:53 +0200 |
commit | 5482d1db320a86a0eccfa4118528261e77194eda (patch) | |
tree | 0110a5c77c8d65bd936ac476ac5404b001df38e2 /libbuild2/cc/lexer.cxx | |
parent | 6bd285316c4bceb38d5a7e5e9967cc84302056b4 (diff) |
Fix C-comment scanning bug in cc::lexer
Diffstat (limited to 'libbuild2/cc/lexer.cxx')
-rw-r--r-- | libbuild2/cc/lexer.cxx | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/libbuild2/cc/lexer.cxx b/libbuild2/cc/lexer.cxx index 96bd887..d20e0dc 100644 --- a/libbuild2/cc/lexer.cxx +++ b/libbuild2/cc/lexer.cxx @@ -1111,21 +1111,18 @@ namespace build2 if (eos (c)) fail (p) << "unterminated comment"; - if (c == '*' && (c = peek ()) == '/') + if (c == '*') { - get (c); - break; + if ((c = peek ()) == '/') + { + get (c); + break; + } } - - if (c != '*' && c != '\\') + else { // Direct buffer scan. // - // Note that we should call get() prior to the direct buffer - // scan (see butl::char_scanner for details). - // - get (c); - const char* b (gptr_); const char* e (egptr_); const char* p (b); |