compiler warnings in copy.c

Started by Robert Haasalmost 11 years ago4 messages
#1Robert Haas
robertmhaas@gmail.com

My compiler is unhappy with the latest changes to copy.c:

gcc -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels
-Wmissing-format-attribute -Wformat-security -fno-strict-aliasing
-fwrapv -fexcess-precision=standard -g -O2 -Wall -Werror
-I../../../src/include -D_GNU_SOURCE -I/usr/include/libxml2 -c -o
copy.o copy.c -MMD -MP -MF .deps/copy.Po
copy.c: In function ‘DoCopy’:
copy.c:924:30: error: ‘rte’ may be used uninitialized in this function
[-Werror=uninitialized]
copy.c:793:17: note: ‘rte’ was declared here
cc1: all warnings being treated as errors

From what I can see, this is a pretty legitimate complaint. If
stmt->relation == NULL, then rte never gets initialized, but we still
do cstate->range_table = list_make1(rte). That can't be good.

Also, you seem to have pushed these commits with a date more than two
weeks in the past. Please don't do that!

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#2Stephen Frost
sfrost@snowman.net
In reply to: Robert Haas (#1)
Re: compiler warnings in copy.c

* Robert Haas (robertmhaas@gmail.com) wrote:

My compiler is unhappy with the latest changes to copy.c:

gcc -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels
-Wmissing-format-attribute -Wformat-security -fno-strict-aliasing
-fwrapv -fexcess-precision=standard -g -O2 -Wall -Werror
-I../../../src/include -D_GNU_SOURCE -I/usr/include/libxml2 -c -o
copy.o copy.c -MMD -MP -MF .deps/copy.Po
copy.c: In function ‘DoCopy’:
copy.c:924:30: error: ‘rte’ may be used uninitialized in this function
[-Werror=uninitialized]
copy.c:793:17: note: ‘rte’ was declared here
cc1: all warnings being treated as errors

Huh, interesting that mine didn't.

From what I can see, this is a pretty legitimate complaint. If

stmt->relation == NULL, then rte never gets initialized, but we still
do cstate->range_table = list_make1(rte). That can't be good.

Yeah, I'll fix that.

Also, you seem to have pushed these commits with a date more than two
weeks in the past. Please don't do that!

Oh, wow, sorry about that. I had expected a rebase to update the date.

Thanks!

Stephen

#3Andres Freund
andres@2ndquadrant.com
In reply to: Stephen Frost (#2)
Re: compiler warnings in copy.c

On 2015-01-28 15:05:11 -0500, Stephen Frost wrote:

Also, you seem to have pushed these commits with a date more than two
weeks in the past. Please don't do that!

Oh, wow, sorry about that. I had expected a rebase to update the date.

It updates the committer, but not the author date. Use --pretty=fuller
to see all the details. You can pass rebase --ignore-date to also reset
the author date. Or commit --amend --reset

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#4Stephen Frost
sfrost@snowman.net
In reply to: Andres Freund (#3)
Re: compiler warnings in copy.c

* Andres Freund (andres@2ndquadrant.com) wrote:

On 2015-01-28 15:05:11 -0500, Stephen Frost wrote:

Also, you seem to have pushed these commits with a date more than two
weeks in the past. Please don't do that!

Oh, wow, sorry about that. I had expected a rebase to update the date.

It updates the committer, but not the author date. Use --pretty=fuller
to see all the details. You can pass rebase --ignore-date to also reset
the author date. Or commit --amend --reset

Thanks for the clarification as to what was happening. I've modified my
aliases to use 'git am --ignore-date' which appears to have fixed this.

Thanks!

Stephen