Hi,

As I am fixing some of the C++ ports for GCC 3.2, I found a problem with lex.
The following patch is required for lex to generate code which
can compile with GCC 3.2.  It applies to /usr/src/usr.bin/lex


--- flex.skl.orig       Sat Sep  7 23:44:38 2002
+++ flex.skl    Sat Sep  7 23:45:06 2002
@@ -26,7 +26,8 @@
 
 #include <stdlib.h>
 %+
-class istream;
+#include <iosfwd>
+using namespace std;
 %*
 #include <unistd.h>




For Standard C++, you cannot forward declare istream as:
class istream;

because in Standard C++, istream is a typedef for a template:
  typedef basic_istream<char>           istream;


The correct fix is to include <iosfwd>.  Under gcc 2.95,
<iosfwd> forward declares istream as "class istream;" and
under gcc 3.2, <iosfwd> forward declares istream as the typedef.

The "using namespace std;" is required because in gcc 3.2, istream
is in the std namespace.  In gcc 2.95, this line will be benign.
-- 
Craig Rodrigues        
http://www.gis.net/~craigr    
[EMAIL PROTECTED]

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to