bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ncurses fails to compile with -fno-exceptions


From: Dimitar Zhekov
Subject: ncurses fails to compile with -fno-exceptions
Date: Wed, 9 Oct 2002 12:42:28 +0300 (EEST)

0. A short description.

When being compiled with GCC, ncurses assumes that exception
handling is always present. This isn't the case when the
exceptions are explicitly disabled with a "-fno-exceptions".

1. How to reproduce: "export CXXFLAGS=-fno-exceptions".
2. Reproduce on a different terminal: N/A.
3. Generate and examine a trace file: N/A.

4. Report details and symptoms, not just interpretations.

>From make output:

cd c++ && make DESTDIR="" all
make[1]: Entering directory `/home/build/ncurses/c++'
cd ../objects;  c++ -I../c++ -I../include -I. -DHAVE_CONFIG_H  -DNDEBUG -I. 
-I../include -O2 -pipe -s -fno-exceptions -fno-rtti -c ../c++/cursesf.cc
In file included from ../c++/cursesw.h:7,
                 from ../c++/cursesp.h:39,
                 from ../c++/cursesf.h:39,
                 from ../c++/cursesf.cc:34:
../c++/etip.h: In function `void THROW(const NCursesException*)':
../c++/etip.h:260: exception handling disabled, use -fexceptions to enable
In file included from 
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.2/include/c++/backward/strstream:51,
                 from 
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.2/include/c++/backward/strstream.h:33,
                 from ../c++/cursesw.h:17,
                 from ../c++/cursesp.h:39,
                 from ../c++/cursesf.h:39,
                 from ../c++/cursesf.cc:34:
/usr/lib/gcc-lib/i686-pc-linux-gnu/3.2/include/c++/backward/backward_warning.h:32:2:
 warning: #warning This file includes at least one deprecated or antiquated 
header. Please consider using one of the 32 headers found in section 17.4.1.2 
of the C++ standard. Examples include substituting the <X> header for the <X.h> 
header for C++ includes, or <sstream> instead of the deprecated header 
<strstream.h>. To disable this warning use -Wno-deprecated.
make[1]: *** [../objects/cursesf.o] Error 1
make[1]: Leaving directory `/home/build/ncurses/c++'
make: *** [all] Error 2

>From ncurses-5.2/c++/etip.h:

259:#else
260:      throw *e;
261:#endif

5. A possible fix.

--cut here--
diff -Nru3 ncurses-5.2/c++/etip.h.in ncurses/c++/etip.h.in
--- ncurses-5.2/c++/etip.h.in   1999-09-12 05:01:59.000000000 +0300
+++ ncurses/c++/etip.h.in       2002-10-08 20:33:37.000000000 +0300
@@ -247,13 +247,13 @@
 
 };
 
-#if !(defined(__GNUG__)||defined(__SUNPRO_CC))
+#if !((defined(__GNUG__)&&defined(__EXCEPTIONS))||defined(__SUNPRO_CC))
 #  include <iostream.h>
    extern "C" void exit(int);
 #endif
 
 inline void THROW(const NCursesException *e) {
-#if defined(__GNUG__)
+#if defined(__GNUG__) && defined(__EXCEPTIONS)
 #  if ((__GNUG__ <= 2) && (__GNUC_MINOR__ < 8))
       (*lib_error_handler)(e?e->classname():"",e?e->message:"");
 #else
--cut here--

This verifies the __EXCEPTIONS symbol, which is defined by GCC
by default and undefined if GCC is invoked with "-fno-exceptions".
Works with GCC 3.x, 2.95.3, 2.95.2 IIRC, don't know about earlier.

E-gards: Jimmy





reply via email to

[Prev in Thread] Current Thread [Next in Thread]