From 3f8c5776301c4bab06900e559d2912fde058f10f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Tue, 5 Mar 2013 12:53:37 +0100
Subject: [PATCH] Remove spurious display when there is zero preprocessor
 warning

---
 preprocessor/ModFile.cc | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/preprocessor/ModFile.cc b/preprocessor/ModFile.cc
index 47371866cf..1fbe8a386e 100644
--- a/preprocessor/ModFile.cc
+++ b/preprocessor/ModFile.cc
@@ -640,8 +640,10 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, bool no_log, b
 
   if (!no_warn)
     {
-      mOutputFile << "disp('Note: " << warnings.countWarnings() << " warning(s) encountered in the preprocessor')" << endl
-                  << "if ~isempty(lastwarn)" << endl
+      if (warnings.countWarnings() > 0)
+        mOutputFile << "disp('Note: " << warnings.countWarnings() << " warning(s) encountered in the preprocessor')" << endl;
+
+      mOutputFile << "if ~isempty(lastwarn)" << endl
                   << "  disp('Note: warning(s) encountered in MATLAB/Octave code')" << endl
                   << "end" << endl;
     }
-- 
GitLab