From 4d287a94f251764466738f7c91137c14eba27731 Mon Sep 17 00:00:00 2001
From: Houtan Bastani <houtan@dynare.org>
Date: Tue, 9 Apr 2019 15:10:47 +0200
Subject: [PATCH] remove leading newlines when noemptylinemacro is passed

---
 src/DynareMain1.cc | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/DynareMain1.cc b/src/DynareMain1.cc
index c2592fdd..1ff3c3fc 100644
--- a/src/DynareMain1.cc
+++ b/src/DynareMain1.cc
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015-2017 Dynare Team
+ * Copyright (C) 2015-2019 Dynare Team
  *
  * This file is part of Dynare.
  *
@@ -47,7 +47,10 @@ main1(const string &filename, const string &basename, istream &modfile, bool deb
 
       string str (macro_output.str());
       if (no_empty_line_macro)
-        str.erase(unique(str.begin(), str.end(), compareNewline), str.end());
+        {
+          str.erase(0, str.find_first_not_of('\n'));
+          str.erase(unique(str.begin(), str.end(), compareNewline), str.end());
+        }
       macro_output_file << str;
       macro_output_file.close();
     }
-- 
GitLab