compile warnings in CVS

compile warnings in CVS

Post by Neil Conw » Mon, 19 Aug 2002 04:43:36



I get the following compiling the current CVS code with gcc 3.1:

...
fe-connect.c: In function `connectDBComplete':
fe-connect.c:1081: warning: suggest parentheses around && within ||
fe-connect.c:1086: warning: implicit declaration of function `gettimeofday'
...
pg_controldata.c: In function `main':
pg_controldata.c:91: warning: `%c' yields only last 2 digits of year in some locales
pg_controldata.c:93: warning: `%c' yields only last 2 digits of year in some locales

Cheers,

Neil

--

PGP Key ID: DB3C29FC

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

 
 
 

compile warnings in CVS

Post by Neil Conw » Mon, 19 Aug 2002 04:52:22



> I get the following compiling the current CVS code with gcc 3.1:

I also get 4 regression test failures, due to Gavin's improvements to
the parser error messages. AFAICT no actual problems, the expected
error message strings just needed to be updated.

Cheers,

Neil

--

PGP Key ID: DB3C29FC

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate

message can get through to the mailing list cleanly

 
 
 

compile warnings in CVS

Post by Tom La » Mon, 19 Aug 2002 05:11:23



> pg_controldata.c: In function `main':
> pg_controldata.c:91: warning: `%c' yields only last 2 digits of year in some locales
> pg_controldata.c:93: warning: `%c' yields only last 2 digits of year in some locales

Yeah.  I was willing to ignore that while pg_controldata was in contrib,
but it's much more annoying when it's in the main tree.  Anyone know if
gcc has a --not-quite-so-nannyish warnings mode?

IMHO %c is a perfectly reasonable format choice --- the strftime man
page defines it as
          %c        Locale's appropriate date and time representation.
While we could go over to some %Y-%M-etc-etc notation, that doesn't
strike me as a step forward.  pg_controldata's output should be
conveniently human-readable IMHO, and that means following local
conventions.

Another alternative is
        char *fmt = "%c";
        ...
        strftime(..., fmt, ...);

which I think will probably defeat gcc's check (haven't tried it
though).

Does anyone want to argue that %c is actually a bad choice?  I think
gcc's just being unreasonable here, but maybe I'm missing something
(and no, Y2K arguments won't change my mind).

                        regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate

message can get through to the mailing list cleanly

 
 
 

compile warnings in CVS

Post by Bruce Momji » Mon, 19 Aug 2002 09:05:55


--ELM1029629149-13422-0_
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=US-ASCII

OK, I have fixed the first two with the following patch.  The second
pair Tom has commented on.

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


> I get the following compiling the current CVS code with gcc 3.1:

> ...
> fe-connect.c: In function `connectDBComplete':
> fe-connect.c:1081: warning: suggest parentheses around && within ||
> fe-connect.c:1086: warning: implicit declaration of function `gettimeofday'
> ...
> pg_controldata.c: In function `main':
> pg_controldata.c:91: warning: `%c' yields only last 2 digits of year in some locales
> pg_controldata.c:93: warning: `%c' yields only last 2 digits of year in some locales

> Cheers,

> Neil

> --

> PGP Key ID: DB3C29FC

> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster

--
  Bruce Momjian                        |  http://candle.pha.pa.us

  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

--ELM1029629149-13422-0_
Content-Transfer-Encoding: 7bit
Content-Type: text/plain
Content-Disposition: inline; filename="/bjm/diff"

Index: src/interfaces/libpq/fe-connect.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/interfaces/libpq/fe-connect.c,v
retrieving revision 1.192
diff -c -r1.192 fe-connect.c
*** src/interfaces/libpq/fe-connect.c   17 Aug 2002 12:33:17 -0000      1.192
--- src/interfaces/libpq/fe-connect.c   18 Aug 2002 00:04:07 -0000
***************
*** 19,24 ****
--- 19,25 ----
  #include <fcntl.h>
  #include <errno.h>
  #include <ctype.h>
+ #include <time.h>

  #include "libpq-fe.h"
  #include "libpq-int.h"
***************
*** 1078,1095 ****
        }

!       while (NULL == rp || remains.tv_sec > 0 || remains.tv_sec == 0 && remains.tv_usec > 0)
        {
                /*
                 * If connecting timeout is set, get current time.
                 */
!               if ( NULL != rp && -1 == gettimeofday(&start_time, NULL))
                {
                        conn->status = CONNECTION_BAD;
                        return 0;
                }

!               /*
                 * Wait, if necessary.  Note that the initial state (just after
                 * PQconnectStart) is to wait for the socket to select for
                 * writing.
--- 1079,1096 ----
        }

!       while (rp == NULL || remains.tv_sec > 0 || (remains.tv_sec == 0 && remains.tv_usec > 0))
        {
                /*
                 * If connecting timeout is set, get current time.
                 */
!               if (rp != NULL && gettimeofday(&start_time, NULL) == -1)
                {
                        conn->status = CONNECTION_BAD;
                        return 0;
                }

!         /*
                 * Wait, if necessary.  Note that the initial state (just after
                 * PQconnectStart) is to wait for the socket to select for
                 * writing.

--ELM1029629149-13422-0_
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
MIME-Version: 1.0

---------------------------(end of broadcast)---------------------------

--ELM1029629149-13422-0_--

 
 
 

compile warnings in CVS

Post by Bruce Momji » Mon, 19 Aug 2002 09:06:27


Yes, very nanny-ish.  Not sure how to turn it off.

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



> > pg_controldata.c: In function `main':
> > pg_controldata.c:91: warning: `%c' yields only last 2 digits of year in some locales
> > pg_controldata.c:93: warning: `%c' yields only last 2 digits of year in some locales

> Yeah.  I was willing to ignore that while pg_controldata was in contrib,
> but it's much more annoying when it's in the main tree.  Anyone know if
> gcc has a --not-quite-so-nannyish warnings mode?

> IMHO %c is a perfectly reasonable format choice --- the strftime man
> page defines it as
>           %c        Locale's appropriate date and time representation.
> While we could go over to some %Y-%M-etc-etc notation, that doesn't
> strike me as a step forward.  pg_controldata's output should be
> conveniently human-readable IMHO, and that means following local
> conventions.

> Another alternative is
>    char *fmt = "%c";
>    ...
>    strftime(..., fmt, ...);

> which I think will probably defeat gcc's check (haven't tried it
> though).

> Does anyone want to argue that %c is actually a bad choice?  I think
> gcc's just being unreasonable here, but maybe I'm missing something
> (and no, Y2K arguments won't change my mind).

>                    regards, tom lane

> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate

> message can get through to the mailing list cleanly

--
  Bruce Momjian                        |  http://candle.pha.pa.us

  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html

 
 
 

compile warnings in CVS

Post by Bruce Momji » Mon, 19 Aug 2002 11:34:48


I have applied patches to the regression test to fix this.  Thanks.

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



> > I get the following compiling the current CVS code with gcc 3.1:

> I also get 4 regression test failures, due to Gavin's improvements to
> the parser error messages. AFAICT no actual problems, the expected
> error message strings just needed to be updated.

> Cheers,

> Neil

> --

> PGP Key ID: DB3C29FC

> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate

> message can get through to the mailing list cleanly

--
  Bruce Momjian                        |  http://candle.pha.pa.us

  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

---------------------------(end of broadcast)---------------------------

 
 
 

compile warnings in CVS

Post by Tom La » Mon, 19 Aug 2002 11:51:01


I said:

Quote:> Another alternative is
>    char *fmt = "%c";
>    ...
>    strftime(..., fmt, ...);
> which I think will probably defeat gcc's check (haven't tried it
> though).

I tried this, and it did shut up the warning in my local copy of gcc.
So I committed it.

Quote:> Does anyone want to argue that %c is actually a bad choice?

This is still open to debate if anyone wants to make the case...

                        regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html

 
 
 

1. compile warnings in CVS HEAD

I get the following warnings when compiling CVS HEAD:

be-secure.c: In function `open_server_SSL':
be-secure.c:719: warning: assignment from incompatible pointer type

timestamp.c: In function `dttofmtasc_replace':
timestamp.c:468: warning: `%g' yields only last 2 digits of year
timestamp.c:606: warning: `%x' yields only last 2 digits of year in some
locales

(That's the timestamp.c in src/interfaces/ecpg/pgtypeslib)

This build has SSL enabled (the SSL warning above has been present for a
while...). I'm using GCC 3.2.3 on Debian Linux.

Cheers,

Neil

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate

message can get through to the mailing list cleanly

2. create list of folders

3. [brad@cvs.openbsd.org: CVS: cvs.openbsd.org: src]

4. Need Address/fax no of Cognos (Impromptu)

5. SSL warning in CVS HEAD

6. (no subject)

7. compiler warnings from cvs tip

8. Expand tempdb in SQLSvr 6.5

9. CVS head doesn't compile

10. stupid patches to compile cvs docs with debian

11. cvs postgres doesn't compile with libreadline 4.2

12. compile error in CVS HEAD

13. (forw) Compile Issue, current CVS/UnixWare 7.1.1