1 /*---------------------------------------------------------------------------*
2   Project:  Horizon
3   File:     assert.h
4 
5   Copyright (C)2009-2012 Nintendo Co., Ltd.  All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain
8   proprietary information of Nintendo of America Inc. and/or Nintendo
9   Company Ltd., and are protected by Federal copyright law.  They may
10   not be disclosed to third parties or copied or duplicated in any form,
11   in whole or in part, without the prior written consent of Nintendo.
12 
13   $Rev: 46347 $
14  *---------------------------------------------------------------------------*/
15 
16 /* Please see man pages for details
17 
18 
19 
20 */
21 
22 #ifndef NN_ASSERT_H_
23 #define NN_ASSERT_H_
24 
25 #include <nn/dbg/dbg_DebugString.h>
26 #include <nn/dbg/dbg_Break.h>
27 #include <nn/Result.h>
28 #include <nn/config.h>
29 //TORIAEZU
30 #include <nn/os/os_MemoryMapSelect.h>
31 
32 #include <cfloat>
33 
34 
35 
36 //
37 //
38 
39 
40 /* =======================================================================
41         Dummy for reference use
42    ======================================================================== */
43 
44 //
45 //
46 
47 //---------------------------------------------------------------------------
48 //
49 //
50 //
51 //
52 //
53 //
54 //
55 //
56 //
57 //
58 //
59 //
60 //
61 //
62 //
63 //---------------------------------------------------------------------------
64 #define NN_ASSERT(exp)
65 
66 //---------------------------------------------------------------------------
67 //
68 //
69 //
70 //
71 //
72 //
73 //
74 //
75 //---------------------------------------------------------------------------
76 #define NN_ASSERTMSG(exp, ...)
77 
78 //---------------------------------------------------------------------------
79 //
80 //
81 //
82 //
83 //
84 //
85 //
86 //
87 //
88 //---------------------------------------------------------------------------
89 #define NN_ASSERTMSG_WITH_RESULT(exp, result, ...)
90 
91 //
92 
93 //
94 //
95 
96 //---------------------------------------------------------------------------
97 //
98 //
99 //
100 //
101 //
102 //
103 //
104 //
105 //
106 //---------------------------------------------------------------------------
107 #define NN_ALIGN_ASSERT(exp, align)
108 
109 //---------------------------------------------------------------------------
110 //
111 //
112 //
113 //
114 //
115 //
116 //
117 //
118 //
119 //---------------------------------------------------------------------------
120 #define NN_EQUAL_ASSERT(exp, equ)
121 
122 //---------------------------------------------------------------------------
123 //
124 //
125 //
126 //
127 //
128 //
129 //
130 //
131 //---------------------------------------------------------------------------
132 #define NN_FLOAT_ASSERT(exp)
133 
134 //---------------------------------------------------------------------------
135 //
136 //
137 //
138 //
139 //
140 //
141 //
142 //
143 //---------------------------------------------------------------------------
144 #define NN_MIN_ASSERT(exp, min)
145 
146 //---------------------------------------------------------------------------
147 //
148 //
149 //
150 //
151 //
152 //
153 //
154 //
155 //---------------------------------------------------------------------------
156 #define NN_MAX_ASSERT(exp, max)
157 
158 //---------------------------------------------------------------------------
159 //
160 //
161 //
162 //
163 //
164 //
165 //
166 //
167 //
168 //---------------------------------------------------------------------------
169 #define NN_MINMAX_ASSERT(exp, min, max)
170 
171 //---------------------------------------------------------------------------
172 //
173 //
174 //
175 //
176 //
177 //
178 //
179 //
180 //---------------------------------------------------------------------------
181 #define NN_NOT_EQUAL_ASSERT(exp, equ)
182 
183 //---------------------------------------------------------------------------
184 //
185 //
186 //
187 //
188 //
189 //
190 //
191 //---------------------------------------------------------------------------
192 #define NN_NULL_ASSERT(exp)
193 
194 //---------------------------------------------------------------------------
195 //
196 //
197 //
198 //
199 //
200 //
201 //
202 //
203 //---------------------------------------------------------------------------
204 #define NN_POINTER_ASSERT(p)
205 
206 //---------------------------------------------------------------------------
207 //
208 //
209 //
210 //
211 //
212 //
213 //---------------------------------------------------------------------------
214 #define NN_THIS_ASSERT()
215 
216 
217 //---------------------------------------------------------------------------
218 //
219 //
220 //
221 //
222 //
223 //
224 //
225 //---------------------------------------------------------------------------
226 #define NN_RESULT_ASSERT(exp)
227 
228 //
229 
230 
231 #define NN_ASSERT_RESULT(exp)
232 #define NN_ASSERT_WITH_RESULT(exp, result)
233 
234 
235 
236 //
237 //
238 
239 //---------------------------------------------------------------------------
240 //
241 //
242 //
243 //
244 //
245 //---------------------------------------------------------------------------
246 #define NN_COMPILER_ASSERT(exp)
247 
248 //
249 
250 
251 
252 //
253 //
254 
255 //---------------------------------------------------------------------------
256 //
257 //
258 //
259 //
260 //
261 //
262 //
263 //
264 //
265 //
266 //
267 //
268 //---------------------------------------------------------------------------
269 #define NN_PANIC(...)
270 
271 //---------------------------------------------------------------------------
272 //
273 //
274 //
275 //
276 //
277 //
278 //
279 //
280 //---------------------------------------------------------------------------
281 #define NN_PANIC_WITH_RESULT(result, ...)
282 
283 //---------------------------------------------------------------------------
284 //
285 //
286 //
287 //
288 //
289 //
290 //
291 //---------------------------------------------------------------------------
292 #define NN_PANIC_IF_FAILED(result)
293 
294 //
295 
296 //
297 
298 #undef NN_ALIGN_ASSERT
299 #undef NN_ASSERT
300 #undef NN_ASSERTMSG
301 #undef NN_ASSERTMSG_WITH_RESULT
302 #undef NN_ASSERT_RESULT
303 #undef NN_ASSERT_WITH_RESULT
304 #undef NN_EQUAL_ASSERT
305 #undef NN_FLOAT_ASSERT
306 #undef NN_MAX_ASSERT
307 #undef NN_MINMAX_ASSERT
308 #undef NN_MIN_ASSERT
309 #undef NN_NOT_EQUAL_ASSERT
310 #undef NN_NULL_ASSERT
311 #undef NN_PANIC
312 #undef NN_PANIC_WITH_RESULT
313 #undef NN_POINTER_ASSERT
314 #undef NN_RESULT_ASSERT
315 #undef NN_THIS_ASSERT
316 #undef NN_PANIC_IF_FAILED
317 #undef NN_COMPILER_ASSERT
318 
319 
320 
321 
322 
323 
324 /* =======================================================================
325         Definition entity
326    ======================================================================== */
327 
328 #ifndef NN_BUILD_DOCUMENT
329 
330     /* ------------------------------------------------------------------------
331             assert
332        ------------------------------------------------------------------------ */
333 
334     #ifndef NN_SWITCH_DISABLE_ASSERT_WARNING
335         #ifdef NN_SYSTEM_KERNEL
336             #define NN_ASSERTMSG(exp, ...)                                                          \
337                 (void) ((exp) || ( NN_LOG("Failed assertion at %s:%d\n  ", NN_FILE_NAME, __LINE__), \
338                                    NN_LOG(__VA_ARGS__),                                             \
339                                    NN_LOG("\n"),                                                    \
340                                    ::nn::dbg::Break(nn::dbg::BREAK_REASON_ASSERT),                  \
341                                    0) )
342             #define NN_ASSERTMSG_WITH_RESULT(exp, result, ...)  NN_ASSERTMSG(exp, __VA_ARGS__)
343         #else
344             #ifndef NN_SWITCH_DISABLE_DEBUG_PRINT
345                 // assert enabled; print enabled
346                 #define NN_ASSERTMSG(exp, ...)                                                  \
347                     (void) ((exp) || (nndbgBreakWithMessage_(NN_DBG_BREAK_REASON_ASSERT, NN_FILE_NAME, __LINE__, __VA_ARGS__), 0))
348                 #define NN_ASSERTMSG_WITH_RESULT(exp, result, ...)                              \
349                     (void) ((exp) || (nndbgBreakWithResultMessage_(NN_DBG_BREAK_REASON_ASSERT, (nnResult)(result), NN_FILE_NAME, __LINE__, __VA_ARGS__), 0))
350             #else
351                 // assert enabled; print disabled
352                 #define NN_ASSERTMSG(exp, ...)                                                  \
353                     (void) ((exp) || (nndbgBreak(NN_DBG_BREAK_REASON_ASSERT), 0))
354                 #define NN_ASSERTMSG_WITH_RESULT(exp, result, ...)                              \
355                     (void) ((exp) || (nndbgBreak(NN_DBG_BREAK_REASON_ASSERT), 0))
356             #endif
357         #endif
358     #else
359         // assert disabled
360         #define NN_ASSERTMSG(exp, ...)                      ((void)0)
361         #define NN_ASSERTMSG_WITH_RESULT(exp, result, ...)  ((void)0)
362     #endif // NN_SWITCH_DISABLE_ASSERT_WARNING
363 
364     #ifndef NN_SWITCH_DISABLE_ASSERT_WARNING_FOR_SDK
365         #ifdef NN_SYSTEM_KERNEL
366             #define NN_TASSERTMSG_(exp, ...)                        NN_ASSERTMSG(exp, __VA_ARGS__)
367             #define NN_SASSERTMSG_(exp, ...)                        NN_ASSERTMSG(exp, __VA_ARGS__)
368             #define NN_TASSERTMSG_WITH_RESULT_(exp, result, ...)    NN_ASSERTMSG(exp, __VA_ARGS__)
369             #define NN_SASSERTMSG_WITH_RESULT_(exp, result, ...)    NN_ASSERTMSG(exp, __VA_ARGS__)
370         #else
371             #ifndef NN_SWITCH_DISABLE_DEBUG_PRINT_FOR_SDK
372                 // assert enabled; print enabled
373                 #define NN_TASSERTMSG_(exp, ...) \
374                     (void) ((exp) || (nndbgBreakWithTMessage_(NN_DBG_BREAK_REASON_ASSERT, NN_FILE_NAME, __LINE__, __VA_ARGS__), 0))
375                 #define NN_SASSERTMSG_(exp, ...) \
376                     (void) ((exp) || (nndbgBreakWithMessage_(NN_DBG_BREAK_REASON_ASSERT, NN_FILE_NAME, __LINE__, __VA_ARGS__), 0))
377                 #define NN_TASSERTMSG_WITH_RESULT_(exp, result, ...) \
378                     (void) ((exp) || (nndbgBreakWithResultTMessage_(NN_DBG_BREAK_REASON_ASSERT, (nnResult)(result), NN_FILE_NAME, __LINE__, __VA_ARGS__), 0))
379                 #define NN_SASSERTMSG_WITH_RESULT_(exp, result, ...) \
380                     (void) ((exp) || (nndbgBreakWithResultMessage_(NN_DBG_BREAK_REASON_ASSERT, (nnResult)(result), NN_FILE_NAME, __LINE__, __VA_ARGS__), 0))
381             #else
382                 // assert enabled; print disabled
383                 #define NN_TASSERTMSG_(exp, ...) \
384                     (void) ((exp) || (nndbgBreak(NN_DBG_BREAK_REASON_ASSERT), 0))
385                 #define NN_SASSERTMSG_(exp, ...) \
386                     (void) ((exp) || (nndbgBreak(NN_DBG_BREAK_REASON_ASSERT), 0))
387                 #define NN_TASSERTMSG_WITH_RESULT_(exp, result, ...) \
388                     (void) ((exp) || (nndbgBreak(NN_DBG_BREAK_REASON_ASSERT), 0))
389                 #define NN_SASSERTMSG_WITH_RESULT_(exp, result, ...) \
390                     (void) ((exp) || (nndbgBreak(NN_DBG_BREAK_REASON_ASSERT), 0))
391             #endif
392         #endif
393     #else
394         // assert disabled
395         #define NN_TASSERTMSG_(exp, ...)                        ((void)0)
396         #define NN_SASSERTMSG_(exp, ...)                        ((void)0)
397         #define NN_TASSERTMSG_WITH_RESULT_(exp, result, ...)    ((void)0)
398         #define NN_SASSERTMSG_WITH_RESULT_(exp, result, ...)    ((void)0)
399     #endif // NN_SWITCH_DISABLE_ASSERT_WARNING_FOR_SDK
400 
401 
402     #define NN_ANY_TO_UPTR(ptr)         ((uptr)((const void*)(ptr)))
403     #define NN_IS_VALID_POINTER(ptr)    ( (NN_OS_ADDR_NULL_TRAP_END <= NN_ANY_TO_UPTR(ptr)) \
404                                             && (NN_ANY_TO_UPTR(ptr) < NN_OS_ADDR_SPACE_END) )
405 
406 
407     #define NN_ASSERT(  exp)                    NN_ASSERTMSG(  (exp), "%s", #exp)
408     #define NN_TASSERT_(exp)                    NN_TASSERTMSG_((exp), "%s", #exp)
409     #define NN_SASSERT_(exp)                    NN_SASSERTMSG_((exp), "%s", #exp)
410 
411     #define NN_RESULT_ASSERT(  exp)             NN_ASSERTMSG_WITH_RESULT(  (exp).IsSuccess(), (exp), "\"%s\" is Failure.", #exp)
412     #define NN_RESULT_TASSERT_(exp)             NN_TASSERTMSG_WITH_RESULT_((exp).IsSuccess(), (exp), "\"%s\" is Failure.", #exp)
413 
414     #define NN_NULL_ASSERT(  exp)               NN_ASSERTMSG(   (exp) != NULL, "%s must not be NULL", #exp )
415     #define NN_NULL_TASSERT_(exp)               NN_TASSERTMSG_( (exp) != NULL, "%s must not be NULL", #exp )
416 
417     #define NN_ALIGN_ASSERT(  exp, align)       NN_ASSERTMSG(   ((uptr)(exp)) % (align) == 0, "%s(=0x%08x) must be %d byte aligned.", #exp, (exp), align )
418     #define NN_ALIGN_TASSERT_(exp, align)       NN_TASSERTMSG_( ((uptr)(exp)) % (align) == 0, "%s(=0x%08x) must be %d byte aligned.", #exp, (exp), align )
419 
420     #define NN_MIN_ASSERT(  exp, min)           NN_ASSERTMSG(   (exp) >= (min), "%s(=%d) must be >= %s(=%d).", #exp, (exp), #min, min )
421     #define NN_MIN_TASSERT_(exp, min)           NN_TASSERTMSG_( (exp) >= (min), "%s(=%d) must be >= %s(=%d).", #exp, (exp), #min, min )
422 
423     #define NN_MAX_ASSERT(  exp, max)           NN_ASSERTMSG(   (exp) <= (max), "%s(=%d) must be <= %s(=%d).", #exp, (exp), #max, max )
424     #define NN_MAX_TASSERT_(exp, max)           NN_TASSERTMSG_( (exp) <= (max), "%s(=%d) must be <= %s(=%d).", #exp, (exp), #max, max )
425 
426     #define NN_MINMAX_ASSERT(  exp, min, max)   NN_ASSERTMSG(   (exp) >= (min) && (exp) <= (max), "%s(=%d) must be >= %s(=%d) and <= %s(=%d).", #exp, (exp), #min, min, #max, max )
427     #define NN_MINMAX_TASSERT_(exp, min, max)   NN_TASSERTMSG_( (exp) >= (min) && (exp) <= (max), "%s(=%d) must be >= %s(=%d) and <= %s(=%d).", #exp, (exp), #min, min, #max, max )
428 
429     #define NN_EQUAL_ASSERT(  exp, equ)         NN_ASSERTMSG(   (exp) == (equ), "%s(=%d) must be == %s(=%d).", #exp, (exp), #equ, equ )
430     #define NN_EQUAL_TASSERT_(exp, equ)         NN_TASSERTMSG_( (exp) == (equ), "%s(=%d) must be == %s(=%d).", #exp, (exp), #equ, equ )
431 
432     #define NN_NOT_EQUAL_ASSERT(  exp, equ)     NN_ASSERTMSG(   (exp) != (equ), "%s(=%d) must be != %s(=%d).", #exp, (exp), #equ, equ )
433     #define NN_NOT_EQUAL_TASSERT_(exp, equ)     NN_TASSERTMSG_( (exp) != (equ), "%s(=%d) must be != %s(=%d).", #exp, (exp), #equ, equ )
434 
435     #define NN_POINTER_ASSERT(  p)              NN_ASSERTMSG(  NN_IS_VALID_POINTER(p), "%s(=0x%08X) is invalid pointer", #p, (p))
436     #define NN_POINTER_TASSERT_(p)              NN_TASSERTMSG_(NN_IS_VALID_POINTER(p), "%s(=0x%08X) is invalid pointer", #p, (p))
437 
438     #define NN_THIS_ASSERT(  )                  NN_POINTER_ASSERT(  this)
439     #define NN_THIS_TASSERT_()                  NN_POINTER_TASSERT_(this)
440 
441     #define NN_ASSERT_WITH_RESULT(  exp, result)    NN_ASSERTMSG_WITH_RESULT(   (exp), (result), "%s", #exp )
442     #define NN_TASSERT_WITH_RESULT_(exp, result)    NN_TASSERTMSG_WITH_RESULT_( (exp), (result), "%s", #exp )
443     #define NN_SASSERT_WITH_RESULT_(exp, result)    NN_SASSERTMSG_WITH_RESULT_( (exp), (result), "%s", #exp )
444 
445     #define NN_FLOAT_ASSERT(exp)                NN_ASSERTMSG((-FLT_MAX <= (exp) && (exp) <= FLT_MAX), "Floating Point Value Error\n"#exp" is infinite or nan.")
446     #define NN_FLOAT_TASSERT_(exp)              NN_TASSERTMSG_((-FLT_MAX <= (exp) && (exp) <= FLT_MAX), "Floating Point Value Error\n"#exp" is infinite or nan.")
447     #define NN_FLOAT_SASSERT_(exp)              NN_FLOAT_TASSERT_exp)
448 
449 
450     #define NN_ASSERT_RESULT(exp)               NN_RESULT_ASSERT(exp)
451     #define NN_TASSERT_RESULT_(exp)             NN_RESULT_TASSERT_(exp)
452 
453 
454 
455 
456 
457     /* ------------------------------------------------------------------------
458             panic
459        ------------------------------------------------------------------------ */
460 
461     #ifndef NN_SWITCH_DISABLE_DEBUG_PRINT
462         // print enabled
463         #define NN_PANIC(...)   nndbgBreakWithMessage_ (NN_DBG_BREAK_REASON_PANIC, NN_FILE_NAME, __LINE__, __VA_ARGS__)
464         #define NN_PANIC_WITH_RESULT(result, ...) \
465             nndbgBreakWithResultMessage_(NN_DBG_BREAK_REASON_PANIC, (nnResult)(result), NN_FILE_NAME, __LINE__, __VA_ARGS__)
466     #else
467         // print disabled
468         #define NN_PANIC(...)                       nndbgPanic()
469         #define NN_PANIC_WITH_RESULT(result, ...)   (((void)(result)), nndbgPanic())
470     #endif
471 
472     #ifndef NN_SWITCH_DISABLE_DEBUG_PRINT_FOR_SDK
473         // print enabled
474         #define NN_TPANIC_(...) nndbgBreakWithTMessage_(NN_DBG_BREAK_REASON_PANIC, NN_FILE_NAME, __LINE__, __VA_ARGS__)
475         #define NN_SPANIC_(...) nndbgBreakWithMessage_ (NN_DBG_BREAK_REASON_PANIC, NN_FILE_NAME, __LINE__, __VA_ARGS__)
476         #define NN_TPANIC_WITH_RESULT_(result, ...) \
477             nndbgBreakWithResultTMessage_(NN_DBG_BREAK_REASON_PANIC, (nnResult)(result), NN_FILE_NAME, __LINE__, __VA_ARGS__)
478     #else
479         // print disabled
480         #define NN_TPANIC_(...)                     nndbgPanic()
481         #define NN_SPANIC_(...)                     nndbgPanic()
482         #define NN_TPANIC_WITH_RESULT_(result, ...) (((void)(result)), nndbgPanic())
483     #endif
484 
485 
486     #define NN_PANIC_IF_FALSE(exp)      (void) ( (exp) || (NN_PANIC  ("Failed condition."), 0) )
487     #define NN_TPANIC_IF_FALSE_(exp)    (void) ( (exp) || (NN_TPANIC_("Failed condition."), 0) )
488 
489     #define NN_PANIC_IF_NULL(  exp)     NN_PANIC_IF_FALSE(  exp)
490     #define NN_TPANIC_IF_NULL_(exp)     NN_TPANIC_IF_FALSE_(exp)
491 
492     #define NN_PANIC_IF_FAILED(result)                      \
493         do {                                                \
494             ::nn::Result nn_result_try_result = (result);   \
495             if (nn_result_try_result.IsFailure())           \
496             {                                               \
497                 NN_PANIC_WITH_RESULT(nn_result_try_result, "\"%s\" is Failure.", #result);    \
498             }                                               \
499         } while (0)
500 
501     #define NN_TPANIC_IF_FAILED_(result)                    \
502         do {                                                \
503             ::nn::Result nn_result_try_result = (result);   \
504             if (nn_result_try_result.IsFailure())           \
505             {                                               \
506                 NN_TPANIC_WITH_RESULT_(nn_result_try_result, "\"%s\" is Failure.", #result);    \
507             }                                               \
508         } while (0)
509 
510 
511 
512     /* ------------------------------------------------------------------------
513             warning
514        ------------------------------------------------------------------------ */
515 
516     #ifndef NN_SWITCH_DISABLE_ASSERT_WARNING
517         #ifndef NN_SWITCH_DISABLE_DEBUG_PRINT
518             #define NN_WARNING(exp, ...) \
519                 (void) ((exp) || (nndbgPrintWarning_(NN_FILE_NAME, __LINE__, __VA_ARGS__), 0))
520         #else
521             #define NN_WARNING(exp, ...)  ((void)0)
522         #endif
523     #else
524         #define NN_WARNING(exp, ...)  ((void)0)
525     #endif // NN_SWITCH_DISABLE_ASSERT_WARNING
526 
527     #ifndef NN_SWITCH_DISABLE_ASSERT_WARNING_FOR_SDK
528         #ifndef NN_SWITCH_DISABLE_DEBUG_PRINT_FOR_SDK
529             #define NN_TWARNING_(exp, ...) \
530                 (void) ((exp) || (nndbgTPrintWarning_(NN_FILE_NAME, __LINE__, __VA_ARGS__), 0))
531             #define NN_SWARNING_(exp, ...) \
532                 (void) ((exp) || (nndbgPrintWarning_(NN_FILE_NAME, __LINE__, __VA_ARGS__), 0))
533         #else
534             #define NN_TWARNING_(exp, ...)  ((void)0)
535             #define NN_SWARNING_(exp, ...)  ((void)0)
536         #endif
537     #else
538         #define NN_TWARNING_(exp, ...)  ((void)0)
539         #define NN_SWARNING_(exp, ...)  ((void)0)
540     #endif // NN_SWITCH_DISABLE_ASSERT_WARNING_FOR_SDK
541 
542 
543 
544 
545 
546     /* ------------------------------------------------------------------------
547             static_assert
548        ------------------------------------------------------------------------ */
549 
550     #ifdef __cplusplus
551 
552         namespace nn
553         {
554             template <bool> struct STATIC_ASSERTION_FAILURE;
555             template <> struct STATIC_ASSERTION_FAILURE<true> {};
556 
557             namespace detail
558             {
559                 template<int x> struct static_assert_test {};
560             }
561         }
562 
563         #define NN_ASSERT_H_STRING_JOIN_(X, Y)  NN_ASSERT_H_STRING_JOIN1_(X, Y)
564         #define NN_ASSERT_H_STRING_JOIN1_(X, Y) X##Y
565 
566         /* Please see man pages for details
567 
568 
569 
570 
571 
572         */
573         #define NN_STATIC_ASSERT(exp)                                           \
574             typedef ::nn::detail::static_assert_test<                           \
575                     sizeof(::nn::STATIC_ASSERTION_FAILURE<(exp) != 0>)          \
576                 > NN_ASSERT_H_STRING_JOIN_(nn_static_assert_typedef_, __LINE__)
577 
578         /* Please see man pages for details
579 
580 
581 
582 
583 
584         */
585         #define NN_STATIC_ASSERT_IS_POD(T)                                              \
586             typedef union                                                               \
587             {                                                                           \
588                 T NN_ASSERT_H_STRING_JOIN_(nn_static_assert_is_pod_menber_, __LINE__);  \
589             }                                                                           \
590             NN_ASSERT_H_STRING_JOIN_(nn_static_assert_is_pod_, __LINE__)
591 
592     #else // __cplusplus
593 
594         #define NN_STATIC_ASSERT(expr)      void NN_ASSERT_H_STRING_JOIN_##__FILE__##__LINE__(int arg[(expr) ? 1 : -1])
595         #define NN_STATIC_ASSERT_IS_POD(T)  ((void)0)
596 
597     #endif
598 
599     #define NN_COMPILER_ASSERT(x) NN_STATIC_ASSERT(x)
600 
601 
602 #endif
603 
604 
605 
606 
607 
608 #endif /* NN_ASSERT_H_ */
609