Date: Sat, 7 Sep 2002 23:55:08 -0400 From: Craig Rodrigues <rodrigc@attbi.com> To: freebsd-current@freebsd.org Subject: [PATCH] C++ fix for flex Message-ID: <20020907235508.A6911@attbi.com>
next in thread | raw e-mail | index | archive | help
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 rodrigc@attbi.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020907235508.A6911>