Thread: CVS HEAD compile warning

CVS HEAD compile warning

From
Neil Conway
Date:
$ cd src/interfaces/ecpg
$ make
[ ... ]
bison -y -d  preproc.y
mv -f y.tab.c ./preproc.c
mv -f y.tab.h ./preproc.h
/usr/bin/flex  -o'pgc.c' pgc.l
pgc.l:979: warning, -s option given but default rule can be matched

-Neil



Re: CVS HEAD compile warning

From
Tom Lane
Date:
Neil Conway <neilc@samurai.com> writes:
> /usr/bin/flex  -o'pgc.c' pgc.l
> pgc.l:979: warning, -s option given but default rule can be matched

That's interesting, because I get no such warning here.  What version
of flex are you using?  (Mine is 2.5.4)
        regards, tom lane


Re: CVS HEAD compile warning

From
Bruce Momjian
Date:
Neil Conway wrote:
> $ cd src/interfaces/ecpg
> $ make
> [ ... ]
> bison -y -d  preproc.y
> mv -f y.tab.c ./preproc.c
> mv -f y.tab.h ./preproc.h
> /usr/bin/flex  -o'pgc.c' pgc.l
> pgc.l:979: warning, -s option given but default rule can be matched
>

FYI, I am not seeing this with my flex 2.5.4 and bison 1.875:

---------------------------------------------------------------------------

(2) touch preproc.y
(2) touch pgc.l
(2) gmake
gmake -C ../../../../src/port all
gmake[1]: Entering directory
`/usr/var/local/src/gen/pgsql/CURRENT/pgsql/src/port'
gmake[1]: Nothing to be done for `all'.
gmake[1]: Leaving directory
`/usr/var/local/src/gen/pgsql/CURRENT/pgsql/src/port'
bison -y -d  preproc.y
mv -f y.tab.c ./preproc.c
mv -f y.tab.h ./preproc.h
/usr/bin/flex  -o'pgc.c' pgc.l
gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
-Wmissing-declarations -O1 -Wall -Wmissing-prototypes
-Wmissing-declarations -Wpointer-arith -Wcast-align -Wno-error
-I./../include -I. -I../../../../src/include
-I/usr/local/include/readline -I/usr/contrib/include  -DMAJOR_VERSION=3
-DMINOR_VERSION=1 -DPATCHLEVEL=1
-DINCLUDEDIR=\"/usr/local/pgsql/include\"
-DPKGINCLUDEDIR=\"/usr/local/pgsql/include\"   -c -o preproc.o preproc.c
In file included from preproc.y:6186:
pgc.c: In function `yylex':
pgc.c:1436: warning: label `find_rule' defined but not used
preproc.y: At top level:
pgc.c:3416: warning: `yy_flex_realloc' defined but not used
gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
-Wmissing-declarations -O1 -Wall -Wmissing-prototypes
-Wmissing-declarations -Wpointer-arith -Wcast-align -Wno-error
-I./../include -I. -I../../../../src/include
-I/usr/local/include/readline -I/usr/contrib/include  -DMAJOR_VERSION=3
-DMINOR_VERSION=1 -DPATCHLEVEL=1
-DINCLUDEDIR=\"/usr/local/pgsql/include\"
-DPKGINCLUDEDIR=\"/usr/local/pgsql/include\"   -c -o ecpg_keywords.o
ecpg_keywords.c
gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
-Wmissing-declarations -O1 -Wall -Wmissing-prototypes
-Wmissing-declarations -Wpointer-arith -Wcast-align -Wno-error
-I./../include -I. -I../../../../src/include
-I/usr/local/include/readline -I/usr/contrib/include  -DMAJOR_VERSION=3
-DMINOR_VERSION=1 -DPATCHLEVEL=1
-DINCLUDEDIR=\"/usr/local/pgsql/include\"
-DPKGINCLUDEDIR=\"/usr/local/pgsql/include\"   -c -o keywords.o
keywords.c
gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
-Wmissing-declarations -O1 -Wall -Wmissing-prototypes
-Wmissing-declarations -Wpointer-arith -Wcast-align -Wno-error
-I./../include -I. -I../../../../src/include
-I/usr/local/include/readline -I/usr/contrib/include  -DMAJOR_VERSION=3
-DMINOR_VERSION=1 -DPATCHLEVEL=1
-DINCLUDEDIR=\"/usr/local/pgsql/include\"
-DPKGINCLUDEDIR=\"/usr/local/pgsql/include\"   -c -o c_keywords.o
c_keywords.c
gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes
-Wmissing-declarations -O1 -Wall -Wmissing-prototypes
-Wmissing-declarations -Wpointer-arith -Wcast-align -Wno-error
-L../../../../src/port -L/usr/local/lib -L/usr/contrib/lib
-Wl,-rpath,/usr/local/pgsql/lib -O1 -Wall -Wmissing-prototypes
-Wmissing-declarations -Wpointer-arith -Wcast-align preproc.o type.o
ecpg.o ecpg_keywords.o output.o keywords.o c_keywords.o
../ecpglib/typename.o descriptor.o variable.o -lssl -lcrypto -lz
-lreadline -ltermcap -lgetopt -lcompat -lipc -ldl -lm -lutil  -lpgport 
-o ecpg

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 


Re: CVS HEAD compile warning

From
Neil Conway
Date:
Tom Lane <tgl@sss.pgh.pa.us> writes:
> That's interesting, because I get no such warning here.  What version
> of flex are you using?  (Mine is 2.5.4)

[nconway@tokyo:/home/nconway]% flex --version
flex 2.5.31

(The flex 2.5.31-22 debian package)

-Neil



Re: CVS HEAD compile warning

From
Tom Lane
Date:
Neil Conway <neilc@samurai.com> writes:
> Tom Lane <tgl@sss.pgh.pa.us> writes:
>> That's interesting, because I get no such warning here.  What version
>> of flex are you using?  (Mine is 2.5.4)

> [nconway@tokyo:/home/nconway]% flex --version
> flex 2.5.31

Oh, that thing.  We deliberately backed off of 2.5.31 some time ago
because it seemed too broken to be worth our time; see for instance
http://archives.postgresql.org/pgsql-hackers/2003-04/msg00732.php
(searching the archives for "2.5.31" turns up various other interesting
comments).

Peter claimed some time later that he'd fixed CVS tip to work with
2.5.31, but I'm still not willing to put any effort into it.  IMHO
the burden of proof is on 2.5.31 to prove that it's not broken.

Red Hat's still shipping 2.5.4a according to a quick look...
        regards, tom lane


Re: CVS HEAD compile warning

From
Michael Meskes
Date:
On Wed, Feb 25, 2004 at 05:22:59PM -0500, Neil Conway wrote:
> /usr/bin/flex  -o'pgc.c' pgc.l
> pgc.l:979: warning, -s option given but default rule can be matched

Hmm, maybe the change is that "-s" is now enabled by default. I just
didn't find any mention of this in the docs and no option to enable the
default rule again.

But then I wonder which inout flex thinks could trigger the default
rule. Any idea how to find out?

Bruce, Tom, or anyone else with flex 2.5.4, could you please run
/usr/bin/flex -s -o'pgc.c' pgc.l 
and check if the same warning appears?

Michael
-- 
Michael Meskes
Email: Michael at Fam-Meskes dot De
ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: meskes@jabber.org
Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!


Re: CVS HEAD compile warning

From
Tom Lane
Date:
Michael Meskes <meskes@postgresql.org> writes:
> Hmm, maybe the change is that "-s" is now enabled by default.

Right.  I inserted "%option nodefault" into pgc.l (and all our other
flex source files) a day or two ago, after realizing that it is a very
effective tool for catching missed cases in a set of lex rules.

I knew at the time that ecpg was the only one of our lexers in which
echo-to-stdout could conceivably be a reasonable default rule.  But
since flex 2.5.4 did not complain, I went ahead and committed the
addition in ecpg as well as everyplace else.

At this point I think our first question is whether flex 2.5.31 is
correctly detecting a hole in the ecpg lexer rules that was missed by
flex 2.5.4, or whether the warning is simply wrong.

If the warning is valid, you need to decide whether you like the idea of
a default spit-to-stdout action, or you'd prefer to put in an additional
flex rule to cover the missing case.
        regards, tom lane


Re: CVS HEAD compile warning

From
Gaetano Mendola
Date:
Tom Lane wrote:


> Red Hat's still shipping 2.5.4a according to a quick look...

Well Red Hat's still ship Postgres 7.3.4 ...

I'm not considering anymore RH to be up to date with various versions
:-(

Gaetano



Re: CVS HEAD compile warning

From
Michael Meskes
Date:
On Thu, Feb 26, 2004 at 02:44:52AM -0500, Tom Lane wrote:
> I knew at the time that ecpg was the only one of our lexers in which
> echo-to-stdout could conceivably be a reasonable default rule.  But
> since flex 2.5.4 did not complain, I went ahead and committed the
> addition in ecpg as well as everyplace else.

Actually it was actively used back in earlier versions of ecpg, but I
thought it wasn't anymore.

> At this point I think our first question is whether flex 2.5.31 is
> correctly detecting a hole in the ecpg lexer rules that was missed by
> flex 2.5.4, or whether the warning is simply wrong.

Yes, that's it. The big problem seems to be that flex does not have a
way to help finding that hole.

> If the warning is valid, you need to decide whether you like the idea of
> a default spit-to-stdout action, or you'd prefer to put in an additional
> flex rule to cover the missing case.

I'd prefer to program my own default rule.

Michael
-- 
Michael Meskes
Email: Michael at Fam-Meskes dot De
ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: meskes@jabber.org
Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!


Re: CVS HEAD compile warning

From
Tom Lane
Date:
Michael Meskes <meskes@postgresql.org> writes:
>> At this point I think our first question is whether flex 2.5.31 is
>> correctly detecting a hole in the ecpg lexer rules that was missed by
>> flex 2.5.4, or whether the warning is simply wrong.

> Yes, that's it. The big problem seems to be that flex does not have a
> way to help finding that hole.

Yeah, I was scratching my head over that too.  You'd think there'd be
some more useful debug output.

FWIW, I found two basic causes of that failure when I was fixing the
other lexers:

* not accounting for the fact that "." matches everything but newline. You can write .|\n instead.

* not ensuring that a single character can always be matched.  For instance, one lexer had several rules for \ followed
byvarious things, but no rule that could match \ not followed by anything, which meant that \ just before EOF was a
missingcase.
 

But I'm not sure that helps, since flex 2.5.4 detected those cases.
We don't really know what we're dealing with in this ecpg situation...
        regards, tom lane


Re: CVS HEAD compile warning

From
tswan@idigx.com
Date:
> Tom Lane wrote:
>
>
>> Red Hat's still shipping 2.5.4a according to a quick look...
>
> Well Red Hat's still ship Postgres 7.3.4 ...
>
> I'm not considering anymore RH to be up to date with various versions
> :-(
>
> Gaetano
>
>

Not to jump immediately to RH's defense, but Fedora Core 2 (currently in
beta) is going to ship with PostgreSQL 7.4.x.   AFAIK, the update strategy
for most Red Hat distributions does not include major application version
changes in a release maintenance update.  RH will often backport patches
to fix bugs or security issues from newer versions of applications so that
library version numbers do not change and it doesn't adversely affect any
other dependent systems.

Look at this list's archive to see how difficult it is to update from
7.3.x to 7.4.x without the RPM or automated upgrade issue.  There has been
some talk about resurrecting pg_upgrade, but that's not an easy task. 
Even then, that may not solve the entire upgrade problem for RPM based
distributions.