Bug 59670 - '%option c++' produces warnings about deprecated headers
'%option c++' produces warnings about deprecated headers
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: flex (Show other bugs)
7.3
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Ngo Than
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2002-02-11 14:18 EST by Enrico Scholz
Modified: 2008-05-01 11:38 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2002-03-12 08:23:08 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Patch against flex-2.5.4a-19 (3.51 KB, patch)
2002-02-11 14:19 EST, Enrico Scholz
no flags Details | Diff
Corrected flex-2.5.4a-gcc31.patch (3.11 KB, patch)
2002-03-01 14:47 EST, Enrico Scholz
no flags Details | Diff

  None (edit)
Description Enrico Scholz 2002-02-11 14:18:00 EST
Description of Problem:

flex produces C++ code which contains the deprecated

| #include <iostream.h>

The same happens when including FlexLexer.h. Both cases cause warnings (see
below) which are breaking -Werror builds.

I will attach a patch using '#include <iostream.h>' iff compiling with gcc<3;
else '#include <iostream>' will be used.

The patch for FlexLexer.h is a little bit ugly since there is to differ between
'std::istream' or 'istream'. It is done with a macro; 'using namespace std;' is
not applicably since its an include file.



Version-Release number of selected component (if applicable):

flex-2.5.4a-19


Steps to Reproduce:

1. $ cat >test.ll <<"EOF"
%option c++
%%
%%
EOF
$ flex test.ll
$ g++ -c lex.yy.cc
In file included from /usr/include/g++-v3/backward/iostream.h:31,
                from lex.yy.cc:24:
/usr/include/g++-v3/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.

2. $ echo '#include <FlexLexer.h>' >test.cc
$ g++ test.cc
In file included from /usr/include/g++-v3/backward/iostream.h:31,
                 from /usr/include/FlexLexer.h:47,
                 from test.cc:1:
/usr/include/g++-v3/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.
Comment 1 Enrico Scholz 2002-02-11 14:19:17 EST
Created attachment 45303 [details]
Patch against flex-2.5.4a-19
Comment 2 Bernhard Rosenkraenzer 2002-02-19 07:38:17 EST
I disagree with the need for the FLEX_STD macro. We should not encourage the creation of 
non-standards compliant code, and any anywhere near current gcc can handle 
std::istream/<iostream> even if it's not enforced. 
 
I've changed the code to use the correct constructs unconditionally. (2.5.4a-20)
Comment 3 Enrico Scholz 2002-02-20 05:24:29 EST
Since in FlexLexer.h the suggested

- #include <iostream.h>
+ #include <iostream>

was omitted, it is still in 2.5.4a-20:

| $ echo '#include <FlexLexer.h>' >test.cc
| $ g++ test.cc
| In file included from /usr/include/g++-v3/backward/iostream.h:31,
|                  from /usr/include/FlexLexer.h:47,
|                  from test.cc:1:
| /usr/include/g++-v3/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.

Comment 4 Bernhard Rosenkraenzer 2002-02-20 06:33:27 EST
 Right, overlooked that one. Fixed in -21.
Comment 5 Enrico Scholz 2002-03-01 14:34:51 EST
Still bugs in 2.5.4a-21...

In FlexLexer.h all of the 'ostream' were not replaced by 'std::ostream'; only
the 'istream' were fixed:

| $ grep ostream /usr/include/FlexLexer.h 
| #include <iostream>
|         int yylex( std::istream* new_in, ostream* new_out = 0 )
|                                          ostream* new_out = 0 ) = 0;
|         yyFlexLexer( std::istream* arg_yyin = 0, ostream* arg_yyout = 0 );
|        virtual void switch_streams( std::istream* new_in, ostream* new_out );
|        ostream* yyout; // output sink for default LexerOutput
         ~~~~~~~
         should be std::ostream; above similarly
Comment 6 Enrico Scholz 2002-03-01 14:47:06 EST
Created attachment 47140 [details]
Corrected flex-2.5.4a-gcc31.patch
Comment 7 Ngo Than 2002-03-12 08:02:30 EST
 It's fixed in 2.5.4a-22.
Comment 8 Enrico Scholz 2002-03-12 08:23:03 EST
If we are speaking about the same 2.5.4a-22

| * Tue Feb 26 2002 Than Ngo <than@redhat.com> 2.5.4a-22
| - rebuild in new enviroment

then the bad 'ostream' is still alive...
Comment 9 Ngo Than 2002-04-02 08:06:42 EST
oh, i have overlooked, it's definitively fixed in 2.5.4a-23 ;-)

Note You need to log in before you can comment on or make changes to this bug.