Version: SVN (using KDE 4.5.3) OS: Linux I'm using KDevelop & friends master from git (2010-11-23). Consider the following code sample (__GNUC__ is just a random macro): #if (__GNUC__ >= 0x800) #endif The first line is error-highlighted as: Expected ")", found x. The same happens with: #if __GNUC__ >= (0x800) #endif However, no error occurs with: #if __GNUC__ >= 0x800 #endif Thanks Reproducible: Always openSUSE 11.3 x86_64 with KDE 4.5.3 from OBS.
if possible this should be fixed for 4.2.0
commit 23c67db831373ecbed403eb885e47c61bf83a533 branch master Author: David nolden <david.nolden.kde@art-master.de> Date: Wed Jan 12 21:27:34 2011 +0100 Properly skip hexadecimal numbers in pp_skip_number. The problem is that everything starting at the "x" is pre-tokenized into one IndexedString by tokenizeFromByteArray, so we have to handle the case that the input is not a single character. BUG: 257696 diff --git a/languages/cpp/parser/rpp/pp-scanner.cpp b/languages/cpp/parser/rpp/pp-scanner.cpp index 84eb40e..e7d2576 100644 --- a/languages/cpp/parser/rpp/pp-scanner.cpp +++ b/languages/cpp/parser/rpp/pp-scanner.cpp @@ -171,7 +171,7 @@ uint pp_skip_identifier::operator()(Stream& input) void pp_skip_number::operator()(Stream& input, Stream& output) { while (!input.atEnd()) { - if (!isLetterOrNumber(input.current()) && input != '_') + if (isCharacter(input.current()) && !isLetterOrNumber(input.current()) && input != '_') return; output << input; diff --git a/languages/cpp/parser/tests/test_parser.cpp b/languages/cpp/parser/tests/test_parser.cpp index b4dddc2..2e683e4 100644 --- a/languages/cpp/parser/tests/test_parser.cpp +++ b/languages/cpp/parser/tests/test_parser.cpp @@ -449,6 +449,7 @@ private slots: QCOMPARE(preprocess("#if ~1\n#define NUMBER 10\n#else\n#define NUMBER 20\n#endif\nNUMBER").trimmed(), QString("10")); QCOMPARE(preprocess("#define MACRO(a, b) ab\nMACRO\n(aa, bb)").trimmed(), QString("ab")); QCOMPARE(preprocess("#define MACRO(a, b) ab\nMACRO(aa,\n bb)").trimmed(), QString("ab")); + QCOMPARE(preprocess("#if 0x1\n #define NUMBER 10\n#else\n#define NUMBER 20\n#endif\nNUMBER\n").trimmed(), QString("10")); } void testPreprocessorStringify() {
commit a46663a1f93c6ecfbc228d69797ea25db361c6ac branch 4.2 Author: David nolden <david.nolden.kde@art-master.de> Date: Wed Jan 12 21:27:34 2011 +0100 backport from master: Properly skip hexadecimal numbers in pp_skip_number. The problem is that everything starting at the "x" is pre-tokenized into one IndexedString by tokenizeFromByteArray, so we have to handle the case that the input is not a single character. CCBUG: 257696 diff --git a/languages/cpp/parser/rpp/pp-scanner.cpp b/languages/cpp/parser/rpp/pp-scanner.cpp index 84eb40e..e7d2576 100644 --- a/languages/cpp/parser/rpp/pp-scanner.cpp +++ b/languages/cpp/parser/rpp/pp-scanner.cpp @@ -171,7 +171,7 @@ uint pp_skip_identifier::operator()(Stream& input) void pp_skip_number::operator()(Stream& input, Stream& output) { while (!input.atEnd()) { - if (!isLetterOrNumber(input.current()) && input != '_') + if (isCharacter(input.current()) && !isLetterOrNumber(input.current()) && input != '_') return; output << input; diff --git a/languages/cpp/parser/tests/test_parser.cpp b/languages/cpp/parser/tests/test_parser.cpp index b4dddc2..2e683e4 100644 --- a/languages/cpp/parser/tests/test_parser.cpp +++ b/languages/cpp/parser/tests/test_parser.cpp @@ -449,6 +449,7 @@ private slots: QCOMPARE(preprocess("#if ~1\n#define NUMBER 10\n#else\n#define NUMBER 20\n#endif\nNUMBER").trimmed(), QString("10")); QCOMPARE(preprocess("#define MACRO(a, b) ab\nMACRO\n(aa, bb)").trimmed(), QString("ab")); QCOMPARE(preprocess("#define MACRO(a, b) ab\nMACRO(aa,\n bb)").trimmed(), QString("ab")); + QCOMPARE(preprocess("#if 0x1\n #define NUMBER 10\n#else\n#define NUMBER 20\n#endif\nNUMBER\n").trimmed(), QString("10")); } void testPreprocessorStringify() {
Moving all the bugs from the CPP Parser. It was not well defined the difference between it and C++ Language Support and people kept reporting in both places indistinctively