Re: Further news on Clang - spurious warnings

From: Peter Geoghegan <peter(at)2ndquadrant(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>, PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Further news on Clang - spurious warnings
Date: 2011-08-05 18:52:32
Message-ID: CAEYLb_W-7ZBvG3Fe9HCz9CPhieUc5egmnyBDPEQX0diAGmC6vQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Now, apart from the Flex warning, there are just 3 warnings left. They
all look like this:

repl_gram.y:106:30: warning: implicit conversion from enumeration type
'enum ReplNodeTag' to different enumeration type 'NodeTag' (aka 'enum
NodeTag') [-Wconversion]
(yyval.node) = (Node *)
makeNode(IdentifySystemCmd);

^~~~~~~~~~~~~~~~~~~~~~~~~~~
../../../src/include/nodes/nodes.h:475:64: note: expanded from:
#define makeNode(_type_) ((_type_ *)
newNode(sizeof(_type_),T_##_type_))
^
<scratch space>:180:1: note: expanded from:
T_IdentifySystemCmd
^
../../../src/include/nodes/nodes.h:452:19: note: expanded from:
_result->type = (tag); \
~ ^~~
Attached patch fixes all 3 warnings with an explicit cast, so the
number of warnings with Clang is the same number as GCC 4.5 - 1. On
GCC 4.6, there are still quite a few -Wunused-but-set-variable
warnings left despite an effort to eradicate them. Perhaps I should
look into that next.

--
Peter Geoghegan       http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training and Services

Attachment Content-Type Size
clang_cast_warning.patch text/x-patch 545 bytes

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2011-08-05 19:07:38 Re: Further news on Clang - spurious warnings
Previous Message Kohei KaiGai 2011-08-05 18:36:10 Re: [v9.1] sepgsql - userspace access vector cache