This is Unofficial EPICS BASE Doxygen Site
epicsAssert.h
Go to the documentation of this file.
1 /*************************************************************************\
2 * Copyright (c) 2009 UChicago Argonne LLC, as Operator of Argonne
3 * National Laboratory.
4 * Copyright (c) 2002 The Regents of the University of California, as
5 * Operator of Los Alamos National Laboratory.
6 * EPICS BASE is distributed subject to a Software License Agreement found
7 * in file LICENSE that is included with this distribution.
8 \*************************************************************************/
9 
41 #ifndef INC_epicsAssert_H
42 #define INC_epicsAssert_H
43 
44 #include "libComAPI.h"
45 #include "compilerDependencies.h"
46 
47 #ifdef __cplusplus
48 extern "C" {
49 #endif
50 
51 
52 #ifndef epicsAssertAuthor
53 
54 # define epicsAssertAuthor 0
55 #endif
56 
57 #undef assert
58 
59 #ifdef NDEBUG
60 # define assert(ignore) ((void) 0)
61 #else /* NDEBUG */
62 
64 LIBCOM_API void epicsAssert (const char *pFile, const unsigned line,
65  const char *pExp, const char *pAuthorName);
66 
70 # define assert(exp) ((exp) ? (void)0 : \
71  epicsAssert(__FILE__, __LINE__, #exp, epicsAssertAuthor))
72 
73 #endif /* NDEBUG */
74 
75 
76 /* Compile-time checks */
77 #if __cplusplus>=201103L
78 #define STATIC_ASSERT(expr) static_assert(expr, #expr)
79 #else
80 #define STATIC_JOIN(x, y) STATIC_JOIN2(x, y)
81 #define STATIC_JOIN2(x, y) x ## y
82 
86 #define STATIC_ASSERT(expr) \
87  typedef int STATIC_JOIN(static_assert_failed_at_line_, __LINE__) \
88  [ (expr) ? 1 : -1 ] EPICS_UNUSED
89 #endif
90 
91 #ifdef __cplusplus
92 }
93 #endif
94 
95 #endif /* INC_epicsAssert_H */
void epicsAssert(const char *pFile, const unsigned line, const char *pExp, const char *pAuthorName)
Definition: osdAssert.c:24
char * line
Definition: reader.c:25
Compiler specific declarations.