Skip to content

Commit

Permalink
mrb_assert definition moved to the beggining of mruby.h
Browse files Browse the repository at this point in the history
So that other files can immediately use it.
  • Loading branch information
dabroz committed Nov 21, 2016
1 parent 8cdaf1e commit c385782
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions include/mruby.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,21 @@
#include <stddef.h>
#include <limits.h>

#ifdef MRB_DEBUG
#include <assert.h>
#define mrb_assert(p) assert(p)
#define mrb_assert_int_fit(t1,n,t2,max) assert((n)>=0 && ((sizeof(n)<=sizeof(t2))||(n<=(t1)(max))))
#else
#define mrb_assert(p) ((void)0)
#define mrb_assert_int_fit(t1,n,t2,max) ((void)0)
#endif

#if __STDC_VERSION__ >= 201112L
#define mrb_static_assert(exp, str) _Static_assert(exp, str)
#else
#define mrb_static_assert(exp, str) mrb_assert(exp)
#endif

#include "mrbconf.h"
#include "mruby/common.h"
#include <mruby/value.h>
Expand Down Expand Up @@ -1135,21 +1150,6 @@ MRB_API void mrb_state_atexit(mrb_state *mrb, mrb_atexit_func func);
MRB_API void mrb_show_version(mrb_state *mrb);
MRB_API void mrb_show_copyright(mrb_state *mrb);

#ifdef MRB_DEBUG
#include <assert.h>
#define mrb_assert(p) assert(p)
#define mrb_assert_int_fit(t1,n,t2,max) assert((n)>=0 && ((sizeof(n)<=sizeof(t2))||(n<=(t1)(max))))
#else
#define mrb_assert(p) ((void)0)
#define mrb_assert_int_fit(t1,n,t2,max) ((void)0)
#endif

#if __STDC_VERSION__ >= 201112L
#define mrb_static_assert(exp, str) _Static_assert(exp, str)
#else
#define mrb_static_assert(exp, str) mrb_assert(exp)
#endif

MRB_API mrb_value mrb_format(mrb_state *mrb, const char *format, ...);

MRB_END_DECL
Expand Down

0 comments on commit c385782

Please sign in to comment.