summaryrefslogtreecommitdiff
path: root/cpp/src/Slice/Parser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/Slice/Parser.cpp')
-rw-r--r--cpp/src/Slice/Parser.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/cpp/src/Slice/Parser.cpp b/cpp/src/Slice/Parser.cpp
index 474503132b5..b38172de2a6 100644
--- a/cpp/src/Slice/Parser.cpp
+++ b/cpp/src/Slice/Parser.cpp
@@ -5453,6 +5453,13 @@ Slice::Unit::parse(const string& filename, FILE* file, bool debug, Slice::Featur
pushContainer(this);
pushDefinitionContext();
+ //
+ // MCPP Fix: mcpp doesn't always output the first #line when mcpp_lib_main is
+ // called repeatedly. We scan a fake #line here to ensure the top definition
+ // context is correctly initialized.
+ //
+ scanPosition(string("#line 1 " + _topLevelFile).c_str());
+
slice_in = file;
int status = slice_parse();
if(_errors)