Skip to content

Commit 9902ebc

Browse files
author
Alexander Korotkov
committed
Some improvements to static analyzer checking.
1 parent 18ed1a2 commit 9902ebc

File tree

4 files changed

+8
-3
lines changed

4 files changed

+8
-3
lines changed

Makefile

+4
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ include $(top_builddir)/src/Makefile.global
2626
include $(top_srcdir)/contrib/contrib-global.mk
2727
endif
2828

29+
ifdef USE_ASSERT_CHECKING
30+
override CFLAGS += -DUSE_ASSERT_CHECKING
31+
endif
32+
2933
jsquery_gram.o: jsquery_scan.c
3034

3135
jsquery_gram.c: BISONFLAGS += -d

jsonb_gin_ops.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ make_value_path_entry_handler(ExtractedNode *node, Pointer extra)
462462
{
463463
Entries *e = (Entries *)extra;
464464
uint32 hash;
465-
bool lossy, partialMatch;
465+
bool lossy, partialMatch = false;
466466
GINKey *key;
467467
KeyExtra *keyExtra;
468468
int result;
@@ -1175,6 +1175,7 @@ gin_debug_query_path_value(PG_FUNCTION_ARGS)
11751175
Entries e = {0};
11761176
char *s;
11771177

1178+
11781179
jq = PG_GETARG_JSQUERY(0);
11791180
s = debugJsQuery(jq, make_path_value_entry_handler,
11801181
check_path_value_entry_handler, (Pointer)&e);

jsquery_op.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ checkScalarIn(JsQueryItem *jsq, JsonbValue *jb)
270270
static bool
271271
executeArrayOp(JsQueryItem *jsq, int32 op, JsonbValue *jb)
272272
{
273-
int32 r;
273+
int32 r = 0; /* keep static analyzer quiet */
274274
JsonbIterator *it;
275275
JsonbValue v;
276276
JsQueryItem elem;

travis/pg-travis-test.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ if [ $CHECK_CODE = "true" ]; then
3636
if [ "$CC" = "clang" ]; then
3737
sudo apt-get -y install -qq clang-$LLVM_VER
3838

39-
scan-build-$LLVM_VER --status-bugs make USE_PGXS=1 PG_CONFIG=$config_path || status=$?
39+
scan-build-$LLVM_VER --status-bugs make USE_PGXS=1 USE_ASSERT_CHECKING=1 PG_CONFIG=$config_path || status=$?
4040
exit $status
4141

4242
elif [ "$CC" = "gcc" ]; then

0 commit comments

Comments
 (0)