提交 999359d0 编写于 作者: A Amil Khanzada 提交者: David Sharp

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>
上级 4ee9323b
......@@ -612,8 +612,8 @@ createdb(CreatedbStmt *stmt)
Oid src_dboid = InvalidOid;
Oid src_owner;
int src_encoding;
char *src_collate;
char *src_ctype;
char *src_collate = NULL;
char *src_ctype = NULL;
bool src_istemplate;
bool src_allowconn;
Oid src_lastsysoid = InvalidOid;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册