r3/include/r3_define.h
Steve Jones d12296af59 Don't typedef bool if compiling with C++
If using the C++ wrapper provided by r3.hpp, you get a compiler
error when r3_define.h tries to typedef bool as C++ already has
native bool type.  Modified the guard around this typedef
to include a check for C++ compilation (!defined(__cplusplus)).
2015-09-28 11:42:45 -05:00

37 lines
704 B
C

/*
* r3_define.h
* Copyright (C) 2014 c9s <yoanlin93@gmail.com>
*
* Distributed under terms of the MIT license.
*/
#ifndef DEFINE_H
#define DEFINE_H
#include <stdbool.h>
#if !defined(bool) && !defined(__cplusplus)
typedef unsigned char bool;
#endif
#ifndef FALSE
# define FALSE 0
#endif
#ifndef TRUE
# define TRUE 1
#endif
// #define DEBUG 1
#ifdef DEBUG
#define info(fmt, ...) \
do { fprintf(stderr, fmt, ##__VA_ARGS__); } while (0)
#define debug(fmt, ...) \
do { fprintf(stderr, "%s:%d:%s(): " fmt, __FILE__, \
__LINE__, __func__, __VA_ARGS__); } while (0)
#else
#define info(...);
#define debug(...);
#endif
#endif /* !DEFINE_H */