From 91db87b1cfac30fa3ea32f78e57f985e6eae2496 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org> Date: Wed, 16 Dec 2020 18:21:55 +0100 Subject: [PATCH] Forbid some basenames, since they will cause trouble Closes: preprocessor#62 --- src/DynareMain.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/DynareMain.cc b/src/DynareMain.cc index 6715c6ac..57857ff0 100644 --- a/src/DynareMain.cc +++ b/src/DynareMain.cc @@ -418,6 +418,15 @@ main(int argc, char **argv) pos != string::npos) basename.erase(pos); + // Forbid some basenames, since they will cause trouble (see preprocessor#62) + set<string> forbidden_basenames = { "T", "y", "x", "params", "steady_state", "it_", "true" }; + if (forbidden_basenames.find(basename) != forbidden_basenames.end()) + { + cerr << "ERROR: Please use another name for your .mod file. The one you have chosen (" + << argv[1] << ") conflicts with internal Dynare names." << endl; + exit(EXIT_FAILURE); + } + WarningConsolidation warnings(no_warn); // Process config file -- GitLab