From 03a353856772eaa5e11372603cd59363fb3ff8a0 Mon Sep 17 00:00:00 2001 From: Houtan Bastani <houtan@dynare.org> Date: Fri, 7 Oct 2016 15:48:18 +0200 Subject: [PATCH] =?UTF-8?q?preprocessor:=20don=E2=80=99t=20automatically?= =?UTF-8?q?=20declare=20external=20functions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- preprocessor/ParsingDriver.cc | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/preprocessor/ParsingDriver.cc b/preprocessor/ParsingDriver.cc index ec9d8a0b38..01ace7b5fb 100644 --- a/preprocessor/ParsingDriver.cc +++ b/preprocessor/ParsingDriver.cc @@ -2678,16 +2678,13 @@ ParsingDriver::add_model_var_or_external_function(string *function_name, bool in return add_model_variable(mod_file->symbol_table.getID(*function_name), (int) rv.second); } else - { - //declare it as a function - warning(*function_name + " not declared. It is being automatically declared as an external function."); - declare_symbol(function_name, eExternalFunction, NULL, NULL); - current_external_function_options.nargs = stack_external_function_args.top().size(); - mod_file->external_functions_table.addExternalFunction(mod_file->symbol_table.getID(*function_name), - current_external_function_options, in_model_block); - reset_current_external_function_options(); - } + error("To use an external function (" + *function_name + ") within the model block, you must first declare it via the external_function() statement."); } + declare_symbol(function_name, eExternalFunction, NULL, NULL); + current_external_function_options.nargs = stack_external_function_args.top().size(); + mod_file->external_functions_table.addExternalFunction(mod_file->symbol_table.getID(*function_name), + current_external_function_options, in_model_block); + reset_current_external_function_options(); } //By this point, we're sure that this function exists in the External Functions Table and is not a mod var -- GitLab