Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add an unused (for the moment) module file
[simgrid.git] / src / xbt / asserts.c
1 /*  xbt/asserts.h -- assertion mechanism                                     */
2
3 /* Copyright (c) 2005, 2008, 2009, 2010. The SimGrid Team.
4  * All rights reserved.                                                     */
5
6 /* This program is free software; you can redistribute it and/or modify it
7  * under the terms of the license (GNU LGPL) which comes with this package. */
8
9 #include <stdlib.h>             /* abort */
10 #include "xbt/log.h"
11 #include "xbt/asserts.h"
12
13 XBT_LOG_EXTERNAL_CATEGORY(xbt);
14 XBT_LOG_DEFAULT_CATEGORY(xbt);
15
16 /**
17  * @brief Kill the program with an error message
18  * \param msg
19  *
20  * Things are so messed up that the only thing to do now, is to stop the program.
21  *
22  * The message is handled by a CRITICAL logging request
23  *
24  * If you want to pass arguments to the format, you can always write xbt_assert1(0,"fmt",args) or
25  * xbt_die(bprintf("fmt", arg))
26  */
27 void xbt_die(const char *msg)
28 {
29   CRITICAL1("%s", msg);
30   xbt_abort();
31 }
32
33 /** @brief Kill the program in silence */
34 void xbt_abort(void)
35 {
36   abort();
37 }