From cb62fddd8acf23c17a0d7b6eac40e4d203fe9da6 Mon Sep 17 00:00:00 2001 From: jhuntley Date: Fri, 23 Jan 2015 13:27:56 -0500 Subject: [PATCH] Consolidating macro resolution to one header file as per project owner request. Added inline comments covering reasons for undef of macros. Resolves issues with problem #832: Adding UndefWindowsMacros.h to handle V8 CPP conflicts in Windows #832 --- libdevcore/UndefMacros.h | 46 ++++++++++++++++++++++++++++++++++++++++ libsolidity/Token.h | 12 +---------- libsolidity/Types.h | 7 +----- 3 files changed, 48 insertions(+), 17 deletions(-) create mode 100644 libdevcore/UndefMacros.h diff --git a/libdevcore/UndefMacros.h b/libdevcore/UndefMacros.h new file mode 100644 index 000000000..91249523b --- /dev/null +++ b/libdevcore/UndefMacros.h @@ -0,0 +1,46 @@ +/* + This file is part of cpp-ethereum. + + cpp-ethereum is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + cpp-ethereum is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with cpp-ethereum. If not, see . +*/ +/** @file UndefMacros.h + * @author Lefteris + * @date 2015 + * + * This header should be used to #undef some really evil macros defined by + * windows.h which result in conflict with our libsolidity/Token.h + */ +#pragma once + +#if defined(_MSC_VER) || defined(__MINGW32__) + +#undef DELETE +#undef IN +#undef VOID +#undef THIS +#undef CONST + +// Conflicting define on MinGW in windows.h +// windows.h(19): #define interface struct +#ifdef interface +#undef interface +#endif + +#elif defined(DELETE) || defined(IN) || defined(VOID) || defined(THIS) || defined(CONST) || defined(interface) + +#error "The preceding macros in this header file are reserved for V8's "\ +"TOKEN_LIST. Please add a platform specific define above to undefine "\ +"overlapping macros." + +#endif diff --git a/libsolidity/Token.h b/libsolidity/Token.h index 24b06d16c..19afaee3a 100644 --- a/libsolidity/Token.h +++ b/libsolidity/Token.h @@ -46,17 +46,7 @@ #include #include #include - -#if defined(DELETE) -#undef DELETE -#endif - -// Updates for mingw support. #undef conflicting defines which have been -// repurposed for TOKEN_LIST on windows. -#if defined(_MSC_VER) || defined(__MINGW32__) -#undef IN -#undef CONST -#endif +#include namespace dev { diff --git a/libsolidity/Types.h b/libsolidity/Types.h index 511e5f64f..afecf3c8e 100644 --- a/libsolidity/Types.h +++ b/libsolidity/Types.h @@ -30,12 +30,7 @@ #include #include #include - -// Updates for mingw support. #undef conflicting defines which have been -// repurposed for TOKEN_LIST on windows. -#if defined(_MSC_VER) || defined(__MINGW32__) -#undef VOID -#endif +#include namespace dev {