Re: [PATCH] C++ fix for flex

2002-09-08 Thread David O'Brien

On Sat, Sep 07, 2002 at 11:55:08PM -0400, Craig Rodrigues wrote:
 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

Committed.  Thanks!

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



[PATCH] C++ fix for flex

2002-09-07 Thread Craig Rodrigues

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.sklSat 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_istreamchar   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