1 /***************************************************************************** 2 * cpp_compat.h 3 ***************************************************************************** 4 * Copyright (C) 2013-2015 L-SMASH Works project 5 * 6 * Authors: Yusuke Nakamura <muken.the.vfrmaniac@gmail.com> 7 * 8 * Permission to use, copy, modify, and/or distribute this software for any 9 * purpose with or without fee is hereby granted, provided that the above 10 * copyright notice and this permission notice appear in all copies. 11 * 12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 13 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 14 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 15 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 16 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 17 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 18 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 19 *****************************************************************************/ 20 21 /* This file is available under an ISC license. */ 22 23 #ifndef LW_CPP_COMPAT_H 24 #define LW_CPP_COMPAT_H 25 26 #ifdef __cplusplus 27 # ifndef __STDC_CONSTANT_MACROS 28 # define __STDC_CONSTANT_MACROS 29 # endif 30 # ifndef __STDC_LIMIT_MACROS 31 # define __STDC_LIMIT_MACROS 32 # endif 33 # ifndef __STDC_FORMAT_MACROS 34 # define __STDC_FORMAT_MACROS 35 # endif 36 # ifdef _MSC_VER 37 # define _CRT_SECURE_NO_WARNINGS 38 # pragma warning( disable:4996 ) 39 # endif 40 #endif /* __cplusplus */ 41 42 #ifdef __cplusplus 43 #define CPP_DEFINE_OR_SUBSTITUTE_OPERATOR( ENUM ) \ 44 inline ENUM operator |= ( ENUM &x, const ENUM y ) \ 45 { \ 46 x = (ENUM)(((unsigned int)x)|((unsigned int)y)); \ 47 return x; \ 48 } 49 #else 50 #define CPP_DEFINE_OR_SUBSTITUTE_OPERATOR( ENUM ) 51 #endif /* __cplusplus */ 52 53 #endif /* LW_CPP_COMPAT_H */ 54