You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by jp...@apache.org on 2012/09/15 06:03:16 UTC
git commit: TS-1464: apply noreturn attribute to _TSReleaseAssert
Updated Branches:
refs/heads/master 48bbfbfd2 -> 0a87a651e
TS-1464: apply noreturn attribute to _TSReleaseAssert
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/0a87a651
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/0a87a651
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/0a87a651
Branch: refs/heads/master
Commit: 0a87a651eb08afe5d547da76fb9955bfdee6e7b6
Parents: 48bbfbf
Author: James Peach <jp...@apache.org>
Authored: Fri Sep 14 21:02:36 2012 -0700
Committer: James Peach <jp...@apache.org>
Committed: Fri Sep 14 21:03:00 2012 -0700
----------------------------------------------------------------------
proxy/InkAPI.cc | 5 ++---
proxy/InkIOCoreAPI.cc | 2 +-
proxy/api/ts/ts.h.in | 12 ++++++++++--
3 files changed, 13 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0a87a651/proxy/InkAPI.cc
----------------------------------------------------------------------
diff --git a/proxy/InkAPI.cc b/proxy/InkAPI.cc
index 345ed66..01ba1bb 100644
--- a/proxy/InkAPI.cc
+++ b/proxy/InkAPI.cc
@@ -403,11 +403,10 @@ TSError(const char *fmt, ...)
}
// Assert in debug AND optim
-int
+void
_TSReleaseAssert(const char *text, const char *file, int line)
{
_ink_assert(text, file, line);
- return 0;
}
// Assert only in debug
@@ -430,7 +429,7 @@ _TSAssert(const char *text, const char *file, int line)
#define sdk_assert(EX) (void)(EX)
#else
#define sdk_assert(EX) \
- (void)((EX) || (_TSReleaseAssert(#EX, __FILE__, __LINE__)))
+ ( (void)((EX) ? (void)0 : _TSReleaseAssert(#EX, __FILE__, __LINE__)) )
#endif
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0a87a651/proxy/InkIOCoreAPI.cc
----------------------------------------------------------------------
diff --git a/proxy/InkIOCoreAPI.cc b/proxy/InkIOCoreAPI.cc
index c4596fc..4da1d25 100644
--- a/proxy/InkIOCoreAPI.cc
+++ b/proxy/InkIOCoreAPI.cc
@@ -44,7 +44,7 @@
#define sdk_assert(EX) (void)(EX)
#else
#define sdk_assert(EX) \
- (void)((EX) || (_TSReleaseAssert(#EX, __FILE__, __LINE__)))
+ ( (void)((EX) ? (void)0 : _TSReleaseAssert(#EX, __FILE__, __LINE__)) )
#endif
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/0a87a651/proxy/api/ts/ts.h.in
----------------------------------------------------------------------
diff --git a/proxy/api/ts/ts.h.in b/proxy/api/ts/ts.h.in
index e5b2484..95bba46 100644
--- a/proxy/api/ts/ts.h.in
+++ b/proxy/api/ts/ts.h.in
@@ -51,6 +51,14 @@
#endif
#endif
+#if !defined(TS_NORETURN)
+#if defined(__GNUC__) || defined(__clang__)
+#define TS_NORETURN __attribute__((noreturn))
+#else
+#define TS_NORETURN
+#endif
+#endif
+
#ifdef __cplusplus
extern "C"
{
@@ -1249,11 +1257,11 @@ extern "C"
/* --------------------------------------------------------------------------
Assertions */
- tsapi int _TSReleaseAssert(const char* txt, const char* f, int l);
+ tsapi void _TSReleaseAssert(const char* txt, const char* f, int l) TS_NORETURN;
tsapi int _TSAssert(const char* txt, const char* f, int l);
#define TSReleaseAssert(EX) \
- (void)((EX) || (_TSReleaseAssert(#EX, __FILE__, __LINE__)))
+ ( (void)((EX) ? (void)0 : _TSReleaseAssert(#EX, __FILE__, __LINE__)) )
#define TSAssert(EX) \
(void)((EX) || (_TSAssert(#EX, __FILE__, __LINE__)))