aboutsummaryrefslogtreecommitdiff
path: root/src/include/postgres_fe.h
diff options
context:
space:
mode:
authorAndrew Dunstan <andrew@dunslane.net>2012-12-14 18:03:07 -0500
committerAndrew Dunstan <andrew@dunslane.net>2012-12-14 18:03:07 -0500
commit1c382655ad90b7cd224230452f7056040337facf (patch)
tree378e1dd57280308b4267f7f7c55677b233be3fd8 /src/include/postgres_fe.h
parent75758a6ff01156e163779f5f7386fa36720fb38f (diff)
downloadpostgresql-1c382655ad90b7cd224230452f7056040337facf.tar.gz
postgresql-1c382655ad90b7cd224230452f7056040337facf.zip
Provide Assert() for frontend code.
Per discussion on-hackers. psql is converted to use the new code. Follows a suggestion from Heikki Linnakangas.
Diffstat (limited to 'src/include/postgres_fe.h')
-rw-r--r--src/include/postgres_fe.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/include/postgres_fe.h b/src/include/postgres_fe.h
index fcfbd31d35c..8fd580fbf75 100644
--- a/src/include/postgres_fe.h
+++ b/src/include/postgres_fe.h
@@ -24,4 +24,16 @@
#include "c.h"
+/*
+ * Assert() can be used in both frontend and backend code. In frontend code it
+ * just calls the standard assert, if it's available. If use of assertions is
+ * not configured, it does nothing.
+ */
+#ifdef USE_ASSERT_CHECKING
+#include <assert.h>
+#define Assert(p) assert(p)
+#else
+#define Assert(p)
+#endif
+
#endif /* POSTGRES_FE_H */