Re: Clang 3.3 Analyzer Results

From: Jeffrey Walton <noloader(at)gmail(dot)com>
To: Andres Freund <andres(at)2ndquadrant(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Clang 3.3 Analyzer Results
Date: 2013-11-12 20:41:35
Message-ID: CAH8yC8n=C0Q_YwoomXii7Pf1nB4Lx4MSre+tSPQ6nTawafzP0Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On Tue, Nov 12, 2013 at 3:35 PM, Andres Freund <andres(at)2ndquadrant(dot)com> wrote:
> On 2013-11-12 15:33:13 -0500, Jeffrey Walton wrote:
>> On Tue, Nov 12, 2013 at 3:25 PM, Andres Freund <andres(at)2ndquadrant(dot)com> wrote:
>> > On 2013-11-12 15:17:18 -0500, Jeffrey Walton wrote:
>> > ...
>> > It might not recognize our Assert() because it expands as:
>> > #define TrapMacro(condition, errorType) \
>> > ((bool) ((! assert_enabled) || ! (condition) || \
>> > (ExceptionalCondition(CppAsString(condition), (errorType), \
>> > __FILE__, __LINE__), 0)))
>> >
>> > #define Assert(condition) \
>> > Trap(!(condition), "FailedAssertion")
>> >
>> > Kevin, perhaps it reports less errors if you remove the assert_enabled
>> > check from TrapMacro? I guess you already compiled with --enable-cassert?
>
>> Also see http://clang-analyzer.llvm.org/annotations.html (ignore the
>> OS X specific stuff). There's a couple of ways to annotate source code
>> and custom asserts. In this case, a `noreturn` annotation will
>> probably do the trick.
>
> ExceptionalCondition is annotated with noreturn, but that doesn't
> necessarily help because the compiler cannot know that assert_enabled is
> true.
Oh, my bad. I overlooked that.

Jeff

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2013-11-12 20:50:55 Re: simple query with radically different plan after 9.0 -> 9.2 upgrade
Previous Message Jeffrey Walton 2013-11-12 20:36:35 Re: Clang 3.3 Analyzer Results

Browse pgsql-hackers by date

  From Date Subject
Next Message Nigel Heron 2013-11-12 20:54:34 Re: Can we add sample systemd service file to git repo?
Previous Message Jeffrey Walton 2013-11-12 20:36:35 Re: Clang 3.3 Analyzer Results