diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/BaseCppTest.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/BaseCppTest.java index e6a4526c2..6117be8cc 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/BaseCppTest.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/cpp/BaseCppTest.java @@ -394,7 +394,8 @@ public class BaseCppTest extends BaseRuntimeTestSupport implements RuntimeTestSu + "\n" + "\n" + "int main(int argc, const char* argv[]) {\n" - + " ANTLRFileStream input(argv[1]);\n" + + " ANTLRFileStream input;\n" + + " input.loadFile(argv[1]);\n" + " lexer(&input);\n" + " CommonTokenStream tokens(&lexer);\n" + "" @@ -436,7 +437,8 @@ public class BaseCppTest extends BaseRuntimeTestSupport implements RuntimeTestSu + "using namespace antlr4;\n" + "\n" + "int main(int argc, const char* argv[]) {\n" - + " ANTLRFileStream input(argv[1]);\n" + + " ANTLRFileStream input;\n" + + " input.loadFile(argv[1]);\n" + " lexer(&input);\n" + " CommonTokenStream tokens(&lexer);\n" + " tokens.fill();\n" diff --git a/runtime/Cpp/runtime/src/atn/ParserATNSimulator.cpp b/runtime/Cpp/runtime/src/atn/ParserATNSimulator.cpp index 025c9c937..01c83c15e 100755 --- a/runtime/Cpp/runtime/src/atn/ParserATNSimulator.cpp +++ b/runtime/Cpp/runtime/src/atn/ParserATNSimulator.cpp @@ -1348,7 +1348,9 @@ Parser* ParserATNSimulator::getParser() { return parser; } -#pragma warning (disable:4996) // 'getenv': This function or variable may be unsafe. Consider using _dupenv_s instead. +#ifdef _MSC_VER +#pragma warning (disable:4996) // 'getenv': This function or variable may be unsafe. Consider using _dupenv_s instead. +#endif bool ParserATNSimulator::getLrLoopSetting() { char *var = std::getenv("TURN_OFF_LR_LOOP_ENTRY_BRANCH_OPT"); @@ -1358,7 +1360,9 @@ bool ParserATNSimulator::getLrLoopSetting() { return value == "true" || value == "1"; } +#ifdef _MSC_VER #pragma warning (default:4996) +#endif void ParserATNSimulator::InitializeInstanceFields() { _mode = PredictionMode::LL;