Re: clang's static checker report.

From: Grzegorz Jaskiewicz <gj(at)pointblue(dot)com(dot)pl>
To: Greg Stark <gsstark(at)mit(dot)edu>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Alex Hunsaker <badalex(at)gmail(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: clang's static checker report.
Date: 2009-08-30 11:21:04
Message-ID: 2A66594A-E5A0-47DE-A41C-5EB41E1147EC@pointblue.com.pl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 29 Aug 2009, at 18:05, Greg Stark wrote:

> Oh, I think I see what's happening. Our assertions can still be turned
> off at run-time with the variable assert_enabled.

Index: src/include/postgres.h
===================================================================
RCS file: /projects/cvsroot/pgsql/src/include/postgres.h,v
retrieving revision 1.92
diff -b -u -r1.92 postgres.h
--- src/include/postgres.h 1 Jan 2009 17:23:55 -0000 1.92
+++ src/include/postgres.h 30 Aug 2009 11:17:50 -0000
@@ -639,6 +639,7 @@
*/

extern PGDLLIMPORT bool assert_enabled;
+#define assert_enabled (1)

/*
* USE_ASSERT_CHECKING, if defined, turns on all the assertions.
@@ -666,7 +667,7 @@
* Isn't CPP fun?
*/
#define TrapMacro(condition, errorType) \
- ((bool) ((! assert_enabled) || ! (condition) || \
+ ((bool) ( ! (condition) || \
(ExceptionalCondition(CppAsString(condition), (errorType), \
__FILE__, __LINE__))))

@@ -689,8 +690,10 @@
Trap(!(condition), "BadState")
#endif /* USE_ASSERT_CHECKING */

+#undef assert_enabled
+
extern int ExceptionalCondition(const char *conditionName,
const char *errorType,
- const char *fileName, int lineNumber);
+ const char *fileName, int lineNumber) __attribute__
((analyzer_noreturn));

like that ?
This is another excerpt from my local mods, that I use before running
clang-checker over it.

but looking at Assert() macros in code (it expands macros if you
hoover mouse pointer over one) - it still keeps 'assert_enabled'
literal there. damn...

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tatsuo Ishii 2009-08-30 12:01:55 PQexecPrepared() behavior
Previous Message Jan Otto 2009-08-30 10:35:58 Re: drop tablespace error: invalid argument