aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJannick <unknown>2017-08-28 17:03:55 +1000
committerJannick <unknown>2017-08-28 17:03:55 +1000
commit16d18724972298c4bf5fb59925649f869118fbac (patch)
tree82dfffc7f291263e1a3bd6764fd07a6874cface1
parent46404ed78ae5c479558d0ff7f4147ba67c8fabb7 (diff)
downloadscintilla-mirror-16d18724972298c4bf5fb59925649f869118fbac.tar.gz
Bug [#1966]. #define A is treated as #define A 1.
-rw-r--r--doc/ScintillaHistory.html1
-rw-r--r--lexers/LexCPP.cxx2
2 files changed, 3 insertions, 0 deletions
diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html
index a645bc066..a6ea45827 100644
--- a/doc/ScintillaHistory.html
+++ b/doc/ScintillaHistory.html
@@ -535,6 +535,7 @@
<li>
The C++ lexer improved preprocessor conformance.
Default value of 0 for undefined preprocessor symbols.
+ #define A is treated as #define A 1.
<a href="http://sourceforge.net/p/scintilla/bugs/1966/">Bug #1966</a>.
</li>
<li>
diff --git a/lexers/LexCPP.cxx b/lexers/LexCPP.cxx
index fbdbd77ca..3fa925b40 100644
--- a/lexers/LexCPP.cxx
+++ b/lexers/LexCPP.cxx
@@ -1333,6 +1333,8 @@ void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int i
while ((startValue < restOfLine.length()) && IsSpaceOrTab(restOfLine[startValue]))
startValue++;
std::string value = restOfLine.substr(startValue);
+ if (OnlySpaceOrTab(value))
+ value = "1"; // No value defaults to 1
preprocessorDefinitions[key] = value;
ppDefineHistory.push_back(PPDefinition(lineCurrent, key, value));
definitionsChanged = true;