Fix _STLP_USE_EXCEPTIONS

See 814dc3187578d2aa718d9d218707239ec6ddf18e
013fff3524b2798e9d45aefcc13236021da234db
ac2a8a648f99d118c8b8183a6cebefd3c596d197

Change-Id: I47fc735a7a621c1c3cde85f488f7f71532f8d4d0
diff --git a/src/ios.cpp b/src/ios.cpp
index cb35e0b..7bbfecd 100644
--- a/src/ios.cpp
+++ b/src/ios.cpp
@@ -30,6 +30,7 @@
 //----------------------------------------------------------------------
 // ios_base members
 
+#ifdef _STLP_USE_EXCEPTIONS
 // class ios_base::failure, a subclass of exception.  It's used solely
 // for reporting errors.
 
@@ -38,6 +39,7 @@
 {}
 
 ios_base::failure::~failure() _STLP_NOTHROW_INHERENTLY {}
+#endif
 
 #if !defined (_STLP_STATIC_CONST_INIT_BUG) && !defined (_STLP_NO_STATIC_CONST_DEFINITION)
 // Definitions of ios_base's formatting flags.
diff --git a/stlport/stl/_exception.h b/stlport/stl/_exception.h
index a0bf4ad..1dd7127 100644
--- a/stlport/stl/_exception.h
+++ b/stlport/stl/_exception.h
@@ -185,8 +185,11 @@
 #  endif
 };
 
+#ifdef _STLP_USE_EXCEPTIONS
 // forward declaration
 class __Named_exception;
+#endif
+
 _STLP_END_NAMESPACE
 #endif
 
diff --git a/stlport/stl/_ios_base.h b/stlport/stl/_ios_base.h
index c9e10ad..8c7a65b 100644
--- a/stlport/stl/_ios_base.h
+++ b/stlport/stl/_ios_base.h
@@ -48,11 +48,13 @@
 class _STLP_CLASS_DECLSPEC ios_base {
 public:
 
+# ifdef _STLP_USE_EXCEPTIONS
   class _STLP_CLASS_DECLSPEC failure : public __Named_exception {
   public:
     explicit failure(const string&);
     virtual ~failure() _STLP_NOTHROW_INHERENTLY;
   };
+#endif
 
   typedef int fmtflags;
   typedef int iostate;
diff --git a/stlport/stl/_stdexcept.h b/stlport/stl/_stdexcept.h
index dba5d01..ac24160 100644
--- a/stlport/stl/_stdexcept.h
+++ b/stlport/stl/_stdexcept.h
@@ -25,7 +25,7 @@
 
 #if !defined (_STLP_USE_NATIVE_STDEXCEPT) || defined (_STLP_USE_OWN_NAMESPACE)
 
-#  if defined(_STLP_USE_EXCEPTIONS) || 1
+#  if defined(_STLP_USE_EXCEPTIONS)
 
 _STLP_BEGIN_NAMESPACE
 
@@ -103,7 +103,7 @@
 
 _STLP_END_NAMESPACE
 
-#  endif
+#  endif /* _STLP_USE_EXCEPTIONS */
 #endif
 
 #endif /* _STLP_INTERNAL_STDEXCEPT */
diff --git a/stlport/stl/_stdexcept_base.h b/stlport/stl/_stdexcept_base.h
index 993f2e9..bac2c17 100644
--- a/stlport/stl/_stdexcept_base.h
+++ b/stlport/stl/_stdexcept_base.h
@@ -25,9 +25,7 @@
 #    include <stl/_exception.h>
 #  endif
 
-#  if defined(_STLP_USE_EXCEPTIONS) || 1
-/* TODO: use same conditions on fwd def of __Named_exception
-         in _exception.h and its use in _ios_base.h */
+#  if defined(_STLP_USE_EXCEPTIONS)
 
 #    ifndef _STLP_INTERNAL_CSTRING
 #      include <stl/_cstring.h>
@@ -93,7 +91,7 @@
 
 _STLP_END_NAMESPACE
 
-#  endif /* Not o32, and no exceptions */
-#endif /* _STLP_STDEXCEPT_SEEN */
+#  endif /* _STLP_USE_EXCEPTIONS */
+#endif
 
 #endif /* _STLP_INTERNAL_STDEXCEPT_BASE */