From d089c730d4ca10b70bb09cd56bd8d81d9db0be69 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Adjemian=20=28Charybdis=29?=
 <stephane.adjemian@univ-lemans.fr>
Date: Fri, 14 Oct 2016 16:35:15 +0200
Subject: [PATCH] Remove preprocessor warning.

Do not issue a warning when observed exogenous variables do not appear
in the model.
---
 DynamicModel.cc |  8 +++++++-
 SymbolTable.cc  | 12 ++++++++++++
 SymbolTable.hh  |  2 ++
 3 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/DynamicModel.cc b/DynamicModel.cc
index cc3dcf1c..ce3ea113 100644
--- a/DynamicModel.cc
+++ b/DynamicModel.cc
@@ -3897,11 +3897,17 @@ DynamicModel::findUnusedEndogenous()
 set<int>
 DynamicModel::findUnusedExogenous()
 {
-  set<int> usedExo, unusedExo;
+  set<int> usedExo, unusedExo, unobservedExo;
   for (int i = 0; i < (int) equations.size(); i++)
     equations[i]->collectVariables(eExogenous, usedExo);
+  for (int i = 0; i < (int) equations.size(); i++)
+    equations[i]->collectVariables(eExogenous, usedExo);
+  set<int> observedExo = symbol_table.getExogenous();
   set<int> allExo = symbol_table.getExogenous();
   set_difference(allExo.begin(), allExo.end(),
+                 observedExo.begin(), observedExo.end(),
+                 inserter(unobservedExo, unobservedExo.begin()));
+  set_difference(unobservedExo.begin(), unobservedExo.end(),
                  usedExo.begin(), usedExo.end(),
                  inserter(unusedExo, unusedExo.begin()));
   return unusedExo;
diff --git a/SymbolTable.cc b/SymbolTable.cc
index 6d5f6ac2..ce7fed3f 100644
--- a/SymbolTable.cc
+++ b/SymbolTable.cc
@@ -861,6 +861,18 @@ SymbolTable::getExogenous() const
   return exogs;
 }
 
+set<int>
+SymbolTable::getObservedExogenous() const
+{
+  set <int> oexogs;
+  for (symbol_table_type::const_iterator it = symbol_table.begin();
+       it != symbol_table.end(); it++)
+    if (getType(it->second) == eExogenous)
+      if (isObservedExogenousVariable(it->second))
+        oexogs.insert(it->second);
+  return oexogs;
+}
+
 set<int>
 SymbolTable::getEndogenous() const
 {
diff --git a/SymbolTable.hh b/SymbolTable.hh
index 1015003d..37f95c18 100644
--- a/SymbolTable.hh
+++ b/SymbolTable.hh
@@ -328,6 +328,8 @@ public:
   vector <int> getTrendVarIds() const;
   //! Get list of exogenous variables
   set <int> getExogenous() const;
+  //! Get list of exogenous variables
+  set <int> getObservedExogenous() const;
   //! Get list of endogenous variables
   set <int> getEndogenous() const;
   //! Is a given symbol an auxiliary variable
-- 
GitLab