dbcommands: fix maybe-unitialized warning from upstream
Prior to this commit, the below warnings were occurring with GCC versions 6.2.0
on CentOS 6 and 6.3.0 on Ubuntu 14.
These are actually invalid because the `get_dbinfo()` call will always fill in
those variables but the compiler is not smart enough to detect this.
The code change of this commit has not happened on the latest upstream Postgres
(10.1), so there will be merge conflicts in future, but we decided as a team
in #3871 that it was better to fix the warnings.
In file included from ../../../src/include/postgres.h:53:0,
from dbcommands.c:22:
dbcommands.c: In function ‘createdb’:
../../../src/include/utils/elog.h:184:4: error: ‘src_ctype’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
errfinish rest; \
^~~~~~~~~
dbcommands.c:616:11: note: ‘src_ctype’ was declared here
char *src_ctype;
^~~~~~~~~
In file included from ../../../src/include/postgres.h:53:0,
from dbcommands.c:22:
../../../src/include/utils/elog.h:184:4: error: ‘src_collate’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
errfinish rest; \
^~~~~~~~~
dbcommands.c:615:11: note: ‘src_collate’ was declared here
char *src_collate;
^~~~~~~~~~~
Signed-off-by: NDavid Sharp <dsharp@pivotal.io>
Showing
想要评论请 注册 或 登录