diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-02-28 16:21:34 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-02-28 16:21:34 +0000 |
commit | de30f210414a1f1f296c0cfb4406b171c1fc7b62 (patch) | |
tree | 570cc93d141bb7e250c4e73fafc53eba7d6e70bc /src/include/gnunet_common.h | |
parent | 652e255add3511262060f3a13517716a72e3cb52 (diff) | |
download | gnunet-de30f210414a1f1f296c0cfb4406b171c1fc7b62.tar.gz gnunet-de30f210414a1f1f296c0cfb4406b171c1fc7b62.zip |
generally use GNUNET_assert() instead of GNUNET_abort() to also log the error
Diffstat (limited to 'src/include/gnunet_common.h')
-rw-r--r-- | src/include/gnunet_common.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/include/gnunet_common.h b/src/include/gnunet_common.h index f2fa4b16f..fc5cb80d9 100644 --- a/src/include/gnunet_common.h +++ b/src/include/gnunet_common.h | |||
@@ -443,9 +443,11 @@ GNUNET_log_config_invalid (enum GNUNET_ErrorType kind, | |||
443 | /** | 443 | /** |
444 | * @ingroup logging | 444 | * @ingroup logging |
445 | * Abort the process, generate a core dump if possible. | 445 | * Abort the process, generate a core dump if possible. |
446 | * Most code should use `GNUNET_assert (0)` instead to | ||
447 | * first log the location of the failure. | ||
446 | */ | 448 | */ |
447 | void | 449 | void |
448 | GNUNET_abort (void) GNUNET_NORETURN; | 450 | GNUNET_abort_ (void) GNUNET_NORETURN; |
449 | 451 | ||
450 | 452 | ||
451 | /** | 453 | /** |
@@ -585,14 +587,14 @@ GNUNET_error_type_to_string (enum GNUNET_ErrorType kind); | |||
585 | * @ingroup logging | 587 | * @ingroup logging |
586 | * Use this for fatal errors that cannot be handled | 588 | * Use this for fatal errors that cannot be handled |
587 | */ | 589 | */ |
588 | #define GNUNET_assert(cond) do { if (! (cond)) { GNUNET_log(GNUNET_ERROR_TYPE_ERROR, _("Assertion failed at %s:%d.\n"), __FILE__, __LINE__); GNUNET_abort(); } } while(0) | 590 | #define GNUNET_assert(cond) do { if (! (cond)) { GNUNET_log(GNUNET_ERROR_TYPE_ERROR, _("Assertion failed at %s:%d.\n"), __FILE__, __LINE__); GNUNET_abort_(); } } while(0) |
589 | 591 | ||
590 | 592 | ||
591 | /** | 593 | /** |
592 | * @ingroup logging | 594 | * @ingroup logging |
593 | * Use this for fatal errors that cannot be handled | 595 | * Use this for fatal errors that cannot be handled |
594 | */ | 596 | */ |
595 | #define GNUNET_assert_at(cond, f, l) do { if (! (cond)) { GNUNET_log(GNUNET_ERROR_TYPE_ERROR, _("Assertion failed at %s:%d.\n"), f, l); GNUNET_abort(); } } while(0) | 597 | #define GNUNET_assert_at(cond, f, l) do { if (! (cond)) { GNUNET_log(GNUNET_ERROR_TYPE_ERROR, _("Assertion failed at %s:%d.\n"), f, l); GNUNET_abort_(); } } while(0) |
596 | 598 | ||
597 | 599 | ||
598 | /** | 600 | /** |