Skip site navigation (1) Skip section navigation (2)

Further news on Clang - spurious warnings

From: Peter Geoghegan <peter(at)2ndquadrant(dot)com>
To: PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Further news on Clang - spurious warnings
Date: 2011-08-02 23:52:17
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
I'm happy to report that thanks to some persistent complaining on my
part, the one outstanding issue when building Postgres with Clang -
the spurious warnings that occured as a result of it being statically
detected that there are assignments past what appears to be the end of
a single element array at the end of a struct - has been fixed in a
recent revision. Now, the only warning that remains is that same,
annoying Flex related bug also seen with GCC that we can't seem to do
anything about, because the Flex people refuse to acknowledge that
it's a bug.

However, at least when you see this warning when using Clang, you get
to see a comment beside the declaration that hints that the warning is

[peter(at)laptop postgresql]$ /home/peter/build/Release/bin/clang -O2
-Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels -Wformat-security
-fno-strict-aliasing -fwrapv -Wno-error -I. -I. -Isrc/include
-D_GNU_SOURCE   -c -o gram.o src/backend/parser/gram.c
In file included from gram.y:12949:
scan.c:16246:23: warning: unused variable 'yyg' [-Wunused-variable]
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var
may be unused depending upon options. */
1 warning generated.

This is not the case with GCC 4.6:

[peter(at)laptop postgresql]$ gcc -O2 -Wall -Wmissing-prototypes
-Wpointer-arith -Wdeclaration-after-statement -Wendif-labels
-Wformat-security -fno-strict-aliasing -fwrapv -Wno-error -I. -I.
-Isrc/include -D_GNU_SOURCE   -c -o gram.o src/backend/parser/gram.c
In file included from gram.y:12949:0:
scan.c: In function ‘yy_try_NUL_trans’:
scan.c:16246:23: warning: unused variable ‘yyg’ [-Wunused-variable]

Peter Geoghegan
PostgreSQL Development, 24x7 Support, Training and Services


pgsql-hackers by date

Next:From: Tom LaneDate: 2011-08-03 00:44:09
Subject: Re: pgbench internal contention
Previous:From: Tom LaneDate: 2011-08-02 21:05:27
Subject: Re: patch: move dumpUserConfig call in dumpRoles function of pg_dumpall.c

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group