From 1291320053888523bab9f5f471340b704be79376 Mon Sep 17 00:00:00 2001 From: Houtan Bastani <houtan@dynare.org> Date: Fri, 4 Oct 2019 11:18:03 +0200 Subject: [PATCH] macro processor: handle empty files --- src/macro/Driver.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/macro/Driver.cc b/src/macro/Driver.cc index 2661091a..689d128a 100644 --- a/src/macro/Driver.cc +++ b/src/macro/Driver.cc @@ -50,6 +50,11 @@ Driver::parse(const string &file_arg, const string &basename_arg, istream &modfi istream is(command_line_defines_with_endl.rdbuf()); m.parse("command_line_defines", "command_line_defines", is, output, debug, vector<pair<string, string>>{}, paths); } + + // Handle empty files + if (modfile.rdbuf()->in_avail() == 0) + return; + stringstream file_with_endl; file_with_endl << modfile.rdbuf() << endl; -- GitLab