src/core/model/abort.h
author Tom Henderson <tomh@tomh.org>
Sun, 22 May 2011 23:18:47 -0700
changeset 7256 b04ba6772f8c
parent 7169 358f71a624d8
child 10654 0148f9c47331
permissions -rw-r--r--
rerun check-style.py at default level to enforce space after function name
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3781
0eea20a7b592 bug 339: unconditional assert API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
0eea20a7b592 bug 339: unconditional assert API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     2
/*
6370
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
     3
 * Copyright (c) 2008 INRIA, 2010 NICTA
3781
0eea20a7b592 bug 339: unconditional assert API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     4
 *
0eea20a7b592 bug 339: unconditional assert API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
0eea20a7b592 bug 339: unconditional assert API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
0eea20a7b592 bug 339: unconditional assert API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     7
 * published by the Free Software Foundation;
0eea20a7b592 bug 339: unconditional assert API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     8
 *
0eea20a7b592 bug 339: unconditional assert API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
0eea20a7b592 bug 339: unconditional assert API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
0eea20a7b592 bug 339: unconditional assert API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0eea20a7b592 bug 339: unconditional assert API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    12
 * GNU General Public License for more details.
0eea20a7b592 bug 339: unconditional assert API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    13
 *
0eea20a7b592 bug 339: unconditional assert API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
0eea20a7b592 bug 339: unconditional assert API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
0eea20a7b592 bug 339: unconditional assert API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
0eea20a7b592 bug 339: unconditional assert API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    17
 *
6370
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
    18
 * Author:  Original author unknown
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
    19
 *          Quincy Tse <quincy.tse@nicta.com.au>
3781
0eea20a7b592 bug 339: unconditional assert API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    20
 */
0eea20a7b592 bug 339: unconditional assert API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    21
#ifndef NS3_ABORT_H
0eea20a7b592 bug 339: unconditional assert API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    22
#define NS3_ABORT_H
0eea20a7b592 bug 339: unconditional assert API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    23
0eea20a7b592 bug 339: unconditional assert API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    24
#include "fatal-error.h"
0eea20a7b592 bug 339: unconditional assert API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    25
6370
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
    26
/**
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
    27
 * \ingroup debugging
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
    28
 * \brief Abnormal program termination
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
    29
 *
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
    30
 * \param msg message to output when this macro is hit.
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
    31
 *
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
    32
 * This macro is essentially equivalent to NS_FATAL_ERROR,
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
    33
 * excepts it prepends the error message with the string
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
    34
 * "aborted. ". When this macro is hit a runtime, the
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
    35
 * program will be halted using std::terminate, which
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
    36
 * triggers clean up code regestered by std::set_terminate.
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
    37
 *
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
    38
 * This macro is enable unconditionally in all builds,
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
    39
 * including debug and optimized builds.
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
    40
 *
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
    41
 * \see NS_FATAL_ERROR
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
    42
 */
3937
04f9377661b8 convince global routing not to crash in the presence of bridges
Craig Dowell <craigdo@ee.washington.edu>
parents: 3781
diff changeset
    43
#define NS_ABORT_MSG(msg)                                       \
6370
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
    44
  do {                                                          \
7169
358f71a624d8 core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6821
diff changeset
    45
      std::cerr << "aborted. ";                                   \
358f71a624d8 core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6821
diff changeset
    46
      NS_FATAL_ERROR (msg);                                       \
358f71a624d8 core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6821
diff changeset
    47
    } while (false)
3937
04f9377661b8 convince global routing not to crash in the presence of bridges
Craig Dowell <craigdo@ee.washington.edu>
parents: 3781
diff changeset
    48
04f9377661b8 convince global routing not to crash in the presence of bridges
Craig Dowell <craigdo@ee.washington.edu>
parents: 3781
diff changeset
    49
6370
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
    50
/**
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
    51
 * \ingroup debugging
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
    52
 * \brief Abnormal program termination if cond is true.
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
    53
 *
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
    54
 * \param cond condition to be evaluated.
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
    55
 *
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
    56
 * This is similar to NS_ASSERT(!(cond)), except this check
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
    57
 * is enabled in all builds. If cond is evaluated to true,
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
    58
 * the espression evaluating to true is printed to stderr,
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
    59
 * followed by a call to the NS_FATAL_ERROR_NO_MSG() macro
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
    60
 * which prints the details of filename and line number to
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
    61
 * stderr. The program will be halted by calling
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
    62
 * std::terminate(), triggering any clean up code registered
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
    63
 * by std::set_terminate (NS3 default is a stream-flushing
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
    64
 * code, but may be overridden).
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
    65
 *
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
    66
 * This macro is enable unconditionally in all builds,
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
    67
 * including debug and optimized builds.
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
    68
 */
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
    69
#define NS_ABORT_IF(cond)                                               \
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
    70
  do {                                                                  \
7169
358f71a624d8 core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6821
diff changeset
    71
      if (cond)                                                           \
358f71a624d8 core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6821
diff changeset
    72
        {                                                                 \
358f71a624d8 core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6821
diff changeset
    73
          std::cerr << "aborted. cond=\"" << # cond << ", ";               \
358f71a624d8 core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6821
diff changeset
    74
          NS_FATAL_ERROR_NO_MSG ();                                       \
358f71a624d8 core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6821
diff changeset
    75
        }                                                                 \
358f71a624d8 core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6821
diff changeset
    76
    } while (false)
3781
0eea20a7b592 bug 339: unconditional assert API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    77
6370
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
    78
/**
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
    79
 * \ingroup debugging
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
    80
 * \brief Abnormal program termination if cond is true.
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
    81
 *
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
    82
 * \param cond condition to be evaluated.
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
    83
 * \param msg message to output when cond is true.
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
    84
 *
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
    85
 * This is similar to NS_ASSERT_MSG(!(cond)), except this
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
    86
 * check is enabled in all builds. If cond is evaluated to
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
    87
 * true, the espression evaluating to true is printed to
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
    88
 * stderr, followed by a call to the NS_FATAL_ERROR() macro
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
    89
 * which prints the user-specified error message, and details
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
    90
 * of filename and line number to stderr. The program will
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
    91
 * be halted by calling std::terminate(), triggering any
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
    92
 * clean up code registered by std::set_terminate (NS3
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
    93
 * default is a stream-flushing code, but may be overridden).
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
    94
 *
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
    95
 * This macro is enable unconditionally in all builds,
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
    96
 * including debug and optimized builds.
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
    97
 */
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
    98
#define NS_ABORT_MSG_IF(cond, msg)                                      \
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
    99
  do {                                                                  \
7169
358f71a624d8 core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6821
diff changeset
   100
      if (cond)                                                           \
358f71a624d8 core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6821
diff changeset
   101
        {                                                                 \
358f71a624d8 core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6821
diff changeset
   102
          std::cerr << "aborted. cond=\"" << # cond << "\", ";             \
358f71a624d8 core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6821
diff changeset
   103
          NS_FATAL_ERROR (msg);                                           \
358f71a624d8 core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6821
diff changeset
   104
        }                                                                 \
358f71a624d8 core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6821
diff changeset
   105
    } while (false)
3781
0eea20a7b592 bug 339: unconditional assert API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   106
6370
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
   107
/**
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
   108
 * \ingroup debugging
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
   109
 * \brief Abnormal program termination if cond is false.
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
   110
 *
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
   111
 * \param cond condition to be evaluated.
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
   112
 *
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
   113
 * This is an alias for NS_ABORT_IF(!(cond))
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
   114
 *
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
   115
 * \see NS_ABORT_IF
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
   116
 */
7169
358f71a624d8 core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6821
diff changeset
   117
#define NS_ABORT_UNLESS(cond)                                                       \
7256
b04ba6772f8c rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents: 7169
diff changeset
   118
  NS_ABORT_IF (!(cond))
3781
0eea20a7b592 bug 339: unconditional assert API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   119
6370
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
   120
/**
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
   121
 * \ingroup debugging
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
   122
 * \brief Abnormal program termination if cond is false.
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
   123
 *
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
   124
 * \param cond condition to be evaluated.
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
   125
 * \param msg message to output if cond is false.
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
   126
 *
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
   127
 * This is an alias for NS_ABORT_MSG_IF(!(cond))
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
   128
 *
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
   129
 * \see NS_ABORT_MSG_IF
0a0b6bf5fdfd bug 933: Flushing ostream and files on abnormal program exit
Quincy Tse <quincy.tse@gmail.com>
parents: 3937
diff changeset
   130
 */
7169
358f71a624d8 core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6821
diff changeset
   131
#define NS_ABORT_MSG_UNLESS(cond, msg)                                      \
7256
b04ba6772f8c rerun check-style.py at default level to enforce space after function name
Tom Henderson <tomh@tomh.org>
parents: 7169
diff changeset
   132
  NS_ABORT_MSG_IF (!(cond),msg)
3781
0eea20a7b592 bug 339: unconditional assert API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   133
0eea20a7b592 bug 339: unconditional assert API.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   134
#endif /* NS3_ABORT_H */