damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

pstatic_assert_scope.h (11606B)


      1 /*
      2  * january, 2017, ported to portable library by mikkelfj.
      3  * Based on dbgtools static assert counter, but with renamed macros.
      4  */
      5 
      6 /*
      7 	 dbgtools - platform independent wrapping of "nice to have" debug functions.
      8 
      9 	 version 0.1, october, 2013
     10 	
     11 	 https://github.com/wc-duck/dbgtools
     12 
     13 	 Copyright (C) 2013- Fredrik Kihlander
     14 
     15 	 This software is provided 'as-is', without any express or implied
     16 	 warranty.  In no event will the authors be held liable for any damages
     17 	 arising from the use of this software.
     18 
     19 	 Permission is granted to anyone to use this software for any purpose,
     20 	 including commercial applications, and to alter it and redistribute it
     21 	 freely, subject to the following restrictions:
     22 
     23 	 1. The origin of this software must not be misrepresented; you must not
     24 	    claim that you wrote the original software. If you use this software
     25 	    in a product, an acknowledgment in the product documentation would be
     26 	    appreciated but is not required.
     27 	 2. Altered source versions must be plainly marked as such, and must not be
     28 	    misrepresented as being the original software.
     29 	 3. This notice may not be removed or altered from any source distribution.
     30 
     31 	 Fredrik Kihlander
     32 */
     33 
     34 /**
     35  * Auto-generated header implementing a counter that increases by each include of the file.
     36  * 
     37  * This header will define the macro __PSTATIC_ASSERT_COUNTER to be increased for each inclusion of the file.
     38  * 
     39  * It has been generated with 3 amount of digits resulting in the counter wrapping around after
     40  * 10000 inclusions.
     41  * 
     42  * Usage:
     43  * 
     44  * #include "this_header.h"
     45  * int a = __PSTATIC_ASSERT_COUNTER; // 0
     46  * #include "this_header.h"
     47  * int b = __PSTATIC_ASSERT_COUNTER; // 1
     48  * #include "this_header.h"
     49  * int c = __PSTATIC_ASSERT_COUNTER; // 2
     50  * #include "this_header.h"
     51  * int d = __PSTATIC_ASSERT_COUNTER; // 3
     52  */
     53 
     54 #ifndef __PSTATIC_ASSERT_COUNTER
     55 #  define __PSTATIC_ASSERT_COUNTER_0 0
     56 #  define __PSTATIC_ASSERT_COUNTER_1
     57 #  define __PSTATIC_ASSERT_COUNTER_2
     58 #  define __PSTATIC_ASSERT_COUNTER_3
     59 #  define __PSTATIC_ASSERT_COUNTER_D1_0
     60 #  define __PSTATIC_ASSERT_COUNTER_D2_0
     61 #  define __PSTATIC_ASSERT_COUNTER_D3_0
     62 #endif /* __PSTATIC_ASSERT_COUNTER */
     63 
     64 #if !defined( __PSTATIC_ASSERT_COUNTER_D0_0 )
     65 #  define __PSTATIC_ASSERT_COUNTER_D0_0
     66 #  undef  __PSTATIC_ASSERT_COUNTER_0
     67 #  define __PSTATIC_ASSERT_COUNTER_0 0
     68 #elif !defined( __PSTATIC_ASSERT_COUNTER_D0_1 )
     69 #  define __PSTATIC_ASSERT_COUNTER_D0_1
     70 #  undef  __PSTATIC_ASSERT_COUNTER_0
     71 #  define __PSTATIC_ASSERT_COUNTER_0 1
     72 #elif !defined( __PSTATIC_ASSERT_COUNTER_D0_2 )
     73 #  define __PSTATIC_ASSERT_COUNTER_D0_2
     74 #  undef  __PSTATIC_ASSERT_COUNTER_0
     75 #  define __PSTATIC_ASSERT_COUNTER_0 2
     76 #elif !defined( __PSTATIC_ASSERT_COUNTER_D0_3 )
     77 #  define __PSTATIC_ASSERT_COUNTER_D0_3
     78 #  undef  __PSTATIC_ASSERT_COUNTER_0
     79 #  define __PSTATIC_ASSERT_COUNTER_0 3
     80 #elif !defined( __PSTATIC_ASSERT_COUNTER_D0_4 )
     81 #  define __PSTATIC_ASSERT_COUNTER_D0_4
     82 #  undef  __PSTATIC_ASSERT_COUNTER_0
     83 #  define __PSTATIC_ASSERT_COUNTER_0 4
     84 #elif !defined( __PSTATIC_ASSERT_COUNTER_D0_5 )
     85 #  define __PSTATIC_ASSERT_COUNTER_D0_5
     86 #  undef  __PSTATIC_ASSERT_COUNTER_0
     87 #  define __PSTATIC_ASSERT_COUNTER_0 5
     88 #elif !defined( __PSTATIC_ASSERT_COUNTER_D0_6 )
     89 #  define __PSTATIC_ASSERT_COUNTER_D0_6
     90 #  undef  __PSTATIC_ASSERT_COUNTER_0
     91 #  define __PSTATIC_ASSERT_COUNTER_0 6
     92 #elif !defined( __PSTATIC_ASSERT_COUNTER_D0_7 )
     93 #  define __PSTATIC_ASSERT_COUNTER_D0_7
     94 #  undef  __PSTATIC_ASSERT_COUNTER_0
     95 #  define __PSTATIC_ASSERT_COUNTER_0 7
     96 #elif !defined( __PSTATIC_ASSERT_COUNTER_D0_8 )
     97 #  define __PSTATIC_ASSERT_COUNTER_D0_8
     98 #  undef  __PSTATIC_ASSERT_COUNTER_0
     99 #  define __PSTATIC_ASSERT_COUNTER_0 8
    100 #elif !defined( __PSTATIC_ASSERT_COUNTER_D0_9 )
    101 #  define __PSTATIC_ASSERT_COUNTER_D0_9
    102 #  undef  __PSTATIC_ASSERT_COUNTER_0
    103 #  define __PSTATIC_ASSERT_COUNTER_0 9
    104 #else
    105 #  undef __PSTATIC_ASSERT_COUNTER_D0_1
    106 #  undef __PSTATIC_ASSERT_COUNTER_D0_2
    107 #  undef __PSTATIC_ASSERT_COUNTER_D0_3
    108 #  undef __PSTATIC_ASSERT_COUNTER_D0_4
    109 #  undef __PSTATIC_ASSERT_COUNTER_D0_5
    110 #  undef __PSTATIC_ASSERT_COUNTER_D0_6
    111 #  undef __PSTATIC_ASSERT_COUNTER_D0_7
    112 #  undef __PSTATIC_ASSERT_COUNTER_D0_8
    113 #  undef __PSTATIC_ASSERT_COUNTER_D0_9
    114 #  undef  __PSTATIC_ASSERT_COUNTER_0
    115 #  define __PSTATIC_ASSERT_COUNTER_0 0
    116 #  if !defined( __PSTATIC_ASSERT_COUNTER_D1_0 )
    117 #    define __PSTATIC_ASSERT_COUNTER_D1_0
    118 #    undef  __PSTATIC_ASSERT_COUNTER_1
    119 #    define __PSTATIC_ASSERT_COUNTER_1 0
    120 #  elif !defined( __PSTATIC_ASSERT_COUNTER_D1_1 )
    121 #    define __PSTATIC_ASSERT_COUNTER_D1_1
    122 #    undef  __PSTATIC_ASSERT_COUNTER_1
    123 #    define __PSTATIC_ASSERT_COUNTER_1 1
    124 #  elif !defined( __PSTATIC_ASSERT_COUNTER_D1_2 )
    125 #    define __PSTATIC_ASSERT_COUNTER_D1_2
    126 #    undef  __PSTATIC_ASSERT_COUNTER_1
    127 #    define __PSTATIC_ASSERT_COUNTER_1 2
    128 #  elif !defined( __PSTATIC_ASSERT_COUNTER_D1_3 )
    129 #    define __PSTATIC_ASSERT_COUNTER_D1_3
    130 #    undef  __PSTATIC_ASSERT_COUNTER_1
    131 #    define __PSTATIC_ASSERT_COUNTER_1 3
    132 #  elif !defined( __PSTATIC_ASSERT_COUNTER_D1_4 )
    133 #    define __PSTATIC_ASSERT_COUNTER_D1_4
    134 #    undef  __PSTATIC_ASSERT_COUNTER_1
    135 #    define __PSTATIC_ASSERT_COUNTER_1 4
    136 #  elif !defined( __PSTATIC_ASSERT_COUNTER_D1_5 )
    137 #    define __PSTATIC_ASSERT_COUNTER_D1_5
    138 #    undef  __PSTATIC_ASSERT_COUNTER_1
    139 #    define __PSTATIC_ASSERT_COUNTER_1 5
    140 #  elif !defined( __PSTATIC_ASSERT_COUNTER_D1_6 )
    141 #    define __PSTATIC_ASSERT_COUNTER_D1_6
    142 #    undef  __PSTATIC_ASSERT_COUNTER_1
    143 #    define __PSTATIC_ASSERT_COUNTER_1 6
    144 #  elif !defined( __PSTATIC_ASSERT_COUNTER_D1_7 )
    145 #    define __PSTATIC_ASSERT_COUNTER_D1_7
    146 #    undef  __PSTATIC_ASSERT_COUNTER_1
    147 #    define __PSTATIC_ASSERT_COUNTER_1 7
    148 #  elif !defined( __PSTATIC_ASSERT_COUNTER_D1_8 )
    149 #    define __PSTATIC_ASSERT_COUNTER_D1_8
    150 #    undef  __PSTATIC_ASSERT_COUNTER_1
    151 #    define __PSTATIC_ASSERT_COUNTER_1 8
    152 #  elif !defined( __PSTATIC_ASSERT_COUNTER_D1_9 )
    153 #    define __PSTATIC_ASSERT_COUNTER_D1_9
    154 #    undef  __PSTATIC_ASSERT_COUNTER_1
    155 #    define __PSTATIC_ASSERT_COUNTER_1 9
    156 #  else
    157 #    undef __PSTATIC_ASSERT_COUNTER_D1_1
    158 #    undef __PSTATIC_ASSERT_COUNTER_D1_2
    159 #    undef __PSTATIC_ASSERT_COUNTER_D1_3
    160 #    undef __PSTATIC_ASSERT_COUNTER_D1_4
    161 #    undef __PSTATIC_ASSERT_COUNTER_D1_5
    162 #    undef __PSTATIC_ASSERT_COUNTER_D1_6
    163 #    undef __PSTATIC_ASSERT_COUNTER_D1_7
    164 #    undef __PSTATIC_ASSERT_COUNTER_D1_8
    165 #    undef __PSTATIC_ASSERT_COUNTER_D1_9
    166 #    undef  __PSTATIC_ASSERT_COUNTER_1
    167 #    define __PSTATIC_ASSERT_COUNTER_1 0
    168 #    if !defined( __PSTATIC_ASSERT_COUNTER_D2_0 )
    169 #      define __PSTATIC_ASSERT_COUNTER_D2_0
    170 #      undef  __PSTATIC_ASSERT_COUNTER_2
    171 #      define __PSTATIC_ASSERT_COUNTER_2 0
    172 #    elif !defined( __PSTATIC_ASSERT_COUNTER_D2_1 )
    173 #      define __PSTATIC_ASSERT_COUNTER_D2_1
    174 #      undef  __PSTATIC_ASSERT_COUNTER_2
    175 #      define __PSTATIC_ASSERT_COUNTER_2 1
    176 #    elif !defined( __PSTATIC_ASSERT_COUNTER_D2_2 )
    177 #      define __PSTATIC_ASSERT_COUNTER_D2_2
    178 #      undef  __PSTATIC_ASSERT_COUNTER_2
    179 #      define __PSTATIC_ASSERT_COUNTER_2 2
    180 #    elif !defined( __PSTATIC_ASSERT_COUNTER_D2_3 )
    181 #      define __PSTATIC_ASSERT_COUNTER_D2_3
    182 #      undef  __PSTATIC_ASSERT_COUNTER_2
    183 #      define __PSTATIC_ASSERT_COUNTER_2 3
    184 #    elif !defined( __PSTATIC_ASSERT_COUNTER_D2_4 )
    185 #      define __PSTATIC_ASSERT_COUNTER_D2_4
    186 #      undef  __PSTATIC_ASSERT_COUNTER_2
    187 #      define __PSTATIC_ASSERT_COUNTER_2 4
    188 #    elif !defined( __PSTATIC_ASSERT_COUNTER_D2_5 )
    189 #      define __PSTATIC_ASSERT_COUNTER_D2_5
    190 #      undef  __PSTATIC_ASSERT_COUNTER_2
    191 #      define __PSTATIC_ASSERT_COUNTER_2 5
    192 #    elif !defined( __PSTATIC_ASSERT_COUNTER_D2_6 )
    193 #      define __PSTATIC_ASSERT_COUNTER_D2_6
    194 #      undef  __PSTATIC_ASSERT_COUNTER_2
    195 #      define __PSTATIC_ASSERT_COUNTER_2 6
    196 #    elif !defined( __PSTATIC_ASSERT_COUNTER_D2_7 )
    197 #      define __PSTATIC_ASSERT_COUNTER_D2_7
    198 #      undef  __PSTATIC_ASSERT_COUNTER_2
    199 #      define __PSTATIC_ASSERT_COUNTER_2 7
    200 #    elif !defined( __PSTATIC_ASSERT_COUNTER_D2_8 )
    201 #      define __PSTATIC_ASSERT_COUNTER_D2_8
    202 #      undef  __PSTATIC_ASSERT_COUNTER_2
    203 #      define __PSTATIC_ASSERT_COUNTER_2 8
    204 #    elif !defined( __PSTATIC_ASSERT_COUNTER_D2_9 )
    205 #      define __PSTATIC_ASSERT_COUNTER_D2_9
    206 #      undef  __PSTATIC_ASSERT_COUNTER_2
    207 #      define __PSTATIC_ASSERT_COUNTER_2 9
    208 #    else
    209 #      undef __PSTATIC_ASSERT_COUNTER_D2_1
    210 #      undef __PSTATIC_ASSERT_COUNTER_D2_2
    211 #      undef __PSTATIC_ASSERT_COUNTER_D2_3
    212 #      undef __PSTATIC_ASSERT_COUNTER_D2_4
    213 #      undef __PSTATIC_ASSERT_COUNTER_D2_5
    214 #      undef __PSTATIC_ASSERT_COUNTER_D2_6
    215 #      undef __PSTATIC_ASSERT_COUNTER_D2_7
    216 #      undef __PSTATIC_ASSERT_COUNTER_D2_8
    217 #      undef __PSTATIC_ASSERT_COUNTER_D2_9
    218 #      undef  __PSTATIC_ASSERT_COUNTER_2
    219 #      define __PSTATIC_ASSERT_COUNTER_2 0
    220 #      if !defined( __PSTATIC_ASSERT_COUNTER_D3_0 )
    221 #        define __PSTATIC_ASSERT_COUNTER_D3_0
    222 #        undef  __PSTATIC_ASSERT_COUNTER_3
    223 #        define __PSTATIC_ASSERT_COUNTER_3 0
    224 #      elif !defined( __PSTATIC_ASSERT_COUNTER_D3_1 )
    225 #        define __PSTATIC_ASSERT_COUNTER_D3_1
    226 #        undef  __PSTATIC_ASSERT_COUNTER_3
    227 #        define __PSTATIC_ASSERT_COUNTER_3 1
    228 #      elif !defined( __PSTATIC_ASSERT_COUNTER_D3_2 )
    229 #        define __PSTATIC_ASSERT_COUNTER_D3_2
    230 #        undef  __PSTATIC_ASSERT_COUNTER_3
    231 #        define __PSTATIC_ASSERT_COUNTER_3 2
    232 #      elif !defined( __PSTATIC_ASSERT_COUNTER_D3_3 )
    233 #        define __PSTATIC_ASSERT_COUNTER_D3_3
    234 #        undef  __PSTATIC_ASSERT_COUNTER_3
    235 #        define __PSTATIC_ASSERT_COUNTER_3 3
    236 #      elif !defined( __PSTATIC_ASSERT_COUNTER_D3_4 )
    237 #        define __PSTATIC_ASSERT_COUNTER_D3_4
    238 #        undef  __PSTATIC_ASSERT_COUNTER_3
    239 #        define __PSTATIC_ASSERT_COUNTER_3 4
    240 #      elif !defined( __PSTATIC_ASSERT_COUNTER_D3_5 )
    241 #        define __PSTATIC_ASSERT_COUNTER_D3_5
    242 #        undef  __PSTATIC_ASSERT_COUNTER_3
    243 #        define __PSTATIC_ASSERT_COUNTER_3 5
    244 #      elif !defined( __PSTATIC_ASSERT_COUNTER_D3_6 )
    245 #        define __PSTATIC_ASSERT_COUNTER_D3_6
    246 #        undef  __PSTATIC_ASSERT_COUNTER_3
    247 #        define __PSTATIC_ASSERT_COUNTER_3 6
    248 #      elif !defined( __PSTATIC_ASSERT_COUNTER_D3_7 )
    249 #        define __PSTATIC_ASSERT_COUNTER_D3_7
    250 #        undef  __PSTATIC_ASSERT_COUNTER_3
    251 #        define __PSTATIC_ASSERT_COUNTER_3 7
    252 #      elif !defined( __PSTATIC_ASSERT_COUNTER_D3_8 )
    253 #        define __PSTATIC_ASSERT_COUNTER_D3_8
    254 #        undef  __PSTATIC_ASSERT_COUNTER_3
    255 #        define __PSTATIC_ASSERT_COUNTER_3 8
    256 #      elif !defined( __PSTATIC_ASSERT_COUNTER_D3_9 )
    257 #        define __PSTATIC_ASSERT_COUNTER_D3_9
    258 #        undef  __PSTATIC_ASSERT_COUNTER_3
    259 #        define __PSTATIC_ASSERT_COUNTER_3 9
    260 #      else
    261 #        undef __PSTATIC_ASSERT_COUNTER_D3_1
    262 #        undef __PSTATIC_ASSERT_COUNTER_D3_2
    263 #        undef __PSTATIC_ASSERT_COUNTER_D3_3
    264 #        undef __PSTATIC_ASSERT_COUNTER_D3_4
    265 #        undef __PSTATIC_ASSERT_COUNTER_D3_5
    266 #        undef __PSTATIC_ASSERT_COUNTER_D3_6
    267 #        undef __PSTATIC_ASSERT_COUNTER_D3_7
    268 #        undef __PSTATIC_ASSERT_COUNTER_D3_8
    269 #        undef __PSTATIC_ASSERT_COUNTER_D3_9
    270 #        undef  __PSTATIC_ASSERT_COUNTER_3
    271 #        define __PSTATIC_ASSERT_COUNTER_3 0
    272 #      endif
    273 #    endif
    274 #  endif
    275 #endif
    276 
    277 #define __PSTATIC_ASSERT_COUNTER_JOIN_DIGITS_MACRO_(digit0,digit1,digit2,digit3) digit0##digit1##digit2##digit3
    278 #define __PSTATIC_ASSERT_COUNTER_JOIN_DIGITS_MACRO(digit0,digit1,digit2,digit3) __PSTATIC_ASSERT_COUNTER_JOIN_DIGITS_MACRO_(digit0,digit1,digit2,digit3)
    279 #undef  __PSTATIC_ASSERT_COUNTER
    280 #define __PSTATIC_ASSERT_COUNTER __PSTATIC_ASSERT_COUNTER_JOIN_DIGITS_MACRO(__PSTATIC_ASSERT_COUNTER_3,__PSTATIC_ASSERT_COUNTER_2,__PSTATIC_ASSERT_COUNTER_1,__PSTATIC_ASSERT_COUNTER_0)