IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 39424


Ignore:
Timestamp:
Mar 1, 2016, 11:41:19 AM (10 years ago)
Author:
eugene
Message:

libtap macros need to use the standard c version if C99; otherwise, assume the gnu style can be used

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ohana.20160226/src/libtap/include/tap_ohana.h

    r10312 r39424  
    2828   and requires the caller to add the final comma if they've ommitted
    2929   the optional arguments */
    30 #ifdef __GNUC__
     30#if __STDC_VERSION__ >= 199901L /* we are C99 */
     31# define ok(e, ...) ((e) ?                                              \
     32                     _gen_result(1, __func__, __FILE__, __LINE__,       \
     33                                 __VA_ARGS__) :                         \
     34                     _gen_result(0, __func__, __FILE__, __LINE__,       \
     35                                 __VA_ARGS__))
     36
     37# define ok1(e) ((e) ?                                                  \
     38                 _gen_result(1, __func__, __FILE__, __LINE__, "%s", #e) : \
     39                 _gen_result(0, __func__, __FILE__, __LINE__, "%s", #e))
     40
     41# define pass(...) ok(1, __VA_ARGS__);
     42# define fail(...) ok(0, __VA_ARGS__);
     43
     44# define skip_start(test, n, ...)                       \
     45        do {                                            \
     46                if((test)) {                            \
     47                        skip(n,  __VA_ARGS__);          \
     48                        continue;                       \
     49                }
     50#elif __GNUC__ /* we are at least gcc */
    3151# define ok(e, test, ...) ((e) ?                                        \
    3252                           _gen_result(1, __func__, __FILE__, __LINE__, \
     
    4868                        continue;                       \
    4969                }
    50 #elif __STDC_VERSION__ >= 199901L /* __GNUC__ */
    51 # define ok(e, ...) ((e) ?                                              \
    52                      _gen_result(1, __func__, __FILE__, __LINE__,       \
    53                                  __VA_ARGS__) :                         \
    54                      _gen_result(0, __func__, __FILE__, __LINE__,       \
    55                                  __VA_ARGS__))
    56 
    57 # define ok1(e) ((e) ?                                                  \
    58                  _gen_result(1, __func__, __FILE__, __LINE__, "%s", #e) : \
    59                  _gen_result(0, __func__, __FILE__, __LINE__, "%s", #e))
    60 
    61 # define pass(...) ok(1, __VA_ARGS__);
    62 # define fail(...) ok(0, __VA_ARGS__);
    63 
    64 # define skip_start(test, n, ...)                       \
    65         do {                                            \
    66                 if((test)) {                            \
    67                         skip(n,  __VA_ARGS__);          \
    68                         continue;                       \
    69                 }
    70 #else /* __STDC_VERSION__ */
     70#else /* neither __STDC_VERSION__ nor gcc: */
    7171# error "Needs gcc or C99 compiler for variadic macros."
    7272#endif /* __STDC_VERSION__ */
Note: See TracChangeset for help on using the changeset viewer.