Commit Graph

38 Commits

Author SHA1 Message Date
Dave Chen
b2a8323941 Revert the change from assert(0)-> ceph_abort() where is not applicable
Signed-off-by: Dave Chen <wei.d.chen@intel.com>
2017-01-14 12:46:15 +08:00
Sage Weil
61fca96c29 assert(0) -> ceph_abort()
Signed-off-by: Sage Weil <sage@redhat.com>
2016-11-21 23:37:31 -05:00
Kefu Chai
2e7c72d8e8 cmake: do not check for availability of static_cast<> anymore
it's implied by C++11 compliance.

Signed-off-by: Kefu Chai <kchai@redhat.com>
2016-07-13 17:23:11 +08:00
Sage Weil
59ddf4d619 include/assert: define ceph_assert[f]_always
These variants we promise never to compile out based on NDEBUG.

Signed-off-by: Sage Weil <sage@redhat.com>
2016-06-28 16:13:46 -04:00
Sage Weil
ae9991054f include/assert: define ceph_assert[f] that mirror assert[f]
We will transition to these.

Signed-off-by: Sage Weil <sage@redhat.com>
2016-06-28 16:13:46 -04:00
Sage Weil
bc1ca22a3f include/assert: drop some dead code
Signed-off-by: Sage Weil <sage@redhat.com>
2016-06-28 16:13:46 -04:00
Sage Weil
23d6438f12 include/assert: define ceph_abort_msg(cct, msg)
Abort with an error string.

Signed-off-by: Sage Weil <sage@redhat.com>
2016-06-28 16:13:46 -04:00
Sage Weil
8b4aef679c include/assert: ceph_abort should call abort(), not assert(0)
Signed-off-by: Sage Weil <sage@redhat.com>
2016-06-28 16:13:46 -04:00
Adam C. Emerson
f07e02928c assert: abort() rather than throw
Assertion failure should be big. It should be catastrophic. It should
make an impression!

It should also not throw exceptions. This change does exactly that.

More specifically it calls abort() so we don't throw out stack frames or
otherwise mess up debugging.

Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
2015-12-11 12:36:21 -05:00
Rohan Mars
a3a0e1cb30 aix gcc librados port
Signed-off-by: Rohan Mars <code@rohanmars.com>
2015-11-23 00:03:16 -05:00
Rohan Mars
b7cc9d4fc3 Solaris compilation/build changes
Signed-off-by: Rohan Mars <code@rohanmars.com>
2015-11-12 17:30:49 -08:00
John Coyle
4f7bcabca7 assert: __STRING is not defined by musl libc. Define __STRING when it is missing.
Signed-off-by: John Coyle <dx9err@gmail.com>
2015-10-18 15:16:47 -04:00
Adam Crume
4eac5187db Add assertf macro
Signed-off-by: Adam Crume <adamcrume@gmail.com>
2014-08-21 10:57:29 -07:00
Noah Watkins
ac044812d0 assert: choose function-var name on non-gnu
Selects __PRETTY_FUNCTION__ or __func__. Linux assumes GNU, and chooses
__PRETTY_FUNCTION__ if gcc/g++ versions are favorable.

This also includes a fix in ax_c_var_func.m4:

AC_TRY_COMPILE will wrap the test in main{}, and then GCC will complain
about nested functions. Just use the original main{} body.

diff --git a/m4/ax_c_var_func.m4 b/m4/ax_c_var_func.m4
index 0ad7d2b..8b57563 100644
--- a/m4/ax_c_var_func.m4
+++ b/m4/ax_c_var_func.m4
@@ -57,9 +57,9 @@ AC_DEFUN([AX_C_VAR_FUNC],
 [AC_REQUIRE([AC_PROG_CC])
 AC_CACHE_CHECK(whether $CC recognizes __func__, ac_cv_c_var_func,
 AC_TRY_COMPILE(,
-[int main() {
+[
 char *s = __func__;
-}],
+],
 AC_DEFINE(HAVE_FUNC,,
 [Define if the C complier supports __func__]) ac_cv_c_var_func=yes,
 ac_cv_c_var_func=no) )

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
2013-11-06 14:16:28 -08:00
Noah Watkins
6821a6e83a assert: use feature test for static_cast
Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
2013-11-04 13:14:11 -08:00
Christophe Courtaut
e1666d0400 Fix compilation -Wmismatched-tags warnings
Keep consistency in the code to not generate warnings of this type.

Signed-off-by: Christophe Courtaut <christophe.courtaut@gmail.com>
2013-08-09 11:58:58 +02:00
Sage Weil
fae1d47aae deliberately break encoding macros when wrong assert is present
Signed-off-by: Sage Weil <sage@inktank.com>
2012-06-07 10:19:09 -07:00
Sage Weil
a30601a1b6 assert: detect when /usr/include/assert.h clobbers us
The normal assert.h is very rude in that it clobbers any existing assert
define and replaces it with its own.  An sadly, lots of things we include
include the generic version.

Be extra rude in response.  Clobber any existing assert #define, and also
#define _ASSERT_H to be a magic value that our commonly-used dendl #define
depends on.  This way we get a compile error if the system version replaces
out own.

This is imperfect, since we will only detect their rudeness when we use
the debug macros.  I'm not coming up with something that is more widely
used that would work better, however.

Signed-off-by: Sage Weil <sage@inktank.com>
2012-06-06 16:07:04 -07:00
Stanislav Sedov
9fde4d946f First cut of FreeBSD support. This patch allowes ceph to compile successfully
under FreeBSD.

Signed-off-by:	Stanislav Sedov <stas@FreeBSD.org>
2011-10-04 17:34:41 -07:00
Sage Weil
47a8063556 assert: work around libatomic_ops vs assert in a less lame way
Signed-off-by: Sage Weil <sage@newdream.net>
2011-08-31 10:05:09 -07:00
Sage Weil
cf862c65fd assert: use our assert
Signed-off-by: Sage Weil <sage@newdream.net>
2011-08-31 10:00:51 -07:00
Colin Patrick McCabe
83020ad03f assert: de-globalize
Implement a simple registration system so that assert output can still
show up non-interleaved in daemons and utilities. Library code will just
use dout_emergency, which is simple and deadlock-free, but might be
interleaved with ongoing messages sometimes.

Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
2011-06-20 16:41:43 -07:00
Sage Weil
f9ed9885c8 assert: make our assert clobber any others too
Two can play this game, /usr/include/assert.h!

Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
2011-05-06 21:59:41 -07:00
Colin Patrick McCabe
5db1e50db3 debug.h: cleanup includes
Shouldn't need to include DoutStreambuf.h; that's all implementation.
Don't include Mutex.h, since we don't use it.
*Do* include config.h, since we need it.

Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
2011-02-18 07:36:06 -08:00
Colin Patrick McCabe
e58c3718af os: FileJournal::do_write: fix error handling
Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
2011-02-04 10:02:22 -08:00
Colin Patrick McCabe
a2abe5f53c assert.h: Add ceph_abort
Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
2011-02-04 09:28:30 -08:00
Sage Weil
22a7d42b58 assert: only include acconfig.h ifdef __CEPH__
Signed-off-by: Sage Weil <sage@newdream.net>
2010-08-03 09:42:26 -07:00
Markus Elfring
f4b9d9d847 Bug #98: Unique names for include guards
A couple of preprocessor symbols for include guards tampered with the reserved namespace.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Sage Weil <sage@newdream.net>
2010-06-17 10:47:37 -07:00
Yehuda Sadeh
ff0e871565 libatomic: fix assert.h compilation 2010-06-03 16:45:06 -07:00
Sage Weil
8a2a9bd6e4 assert: fix assert vs atomic_ops.h breakage
This was causing us to use the system assert, not the ceph one.
2010-06-03 09:01:58 -07:00
Sage Weil
414a6e3e87 spinlock: clean up #include deps 2010-04-09 14:52:27 -07:00
Sage Weil
df2422f364 assert: use ceph namespace 2010-04-08 09:09:43 -07:00
Sage Weil
c5faf4097a assert: throw FailedAssertion exception instead of inducing segfault
This will allow callers to catch failed assertions, if they so
choose.
2009-06-26 09:44:37 -07:00
Sage Weil
3b9e05f8d6 assert: turn off tls in assert macro
About 3% cpu time
2009-04-28 12:54:02 -07:00
Yehuda Sadeh
c98bb11a39 assert: some more assert_warn 2009-02-12 16:47:56 -08:00
Yehuda Sadeh
af812a0621 cosd: change some assert to assert_warn and clean exit 2009-02-12 15:05:12 -08:00
Yehuda Sadeh
b1203c227e assert: warn on assertion if requested for current thread 2009-02-09 16:29:43 -08:00
Sage Weil
8ba36cd8c8 custom assertion handler
Print assertion error to log file, if it is open.
2008-10-13 13:32:03 -07:00