Browse Source

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
cl-refactor
jhuntley 10 years ago
parent
commit
cb62fddd8a
  1. 46
      libdevcore/UndefMacros.h
  2. 12
      libsolidity/Token.h
  3. 7
      libsolidity/Types.h

46
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 <http://www.gnu.org/licenses/>.
*/
/** @file UndefMacros.h
* @author Lefteris <lefteris@ethdev.com>
* @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

12
libsolidity/Token.h

@ -46,17 +46,7 @@
#include <libdevcore/Log.h>
#include <libsolidity/Utils.h>
#include <libsolidity/Exceptions.h>
#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 <libdevcore/UndefMacros.h>
namespace dev
{

7
libsolidity/Types.h

@ -30,12 +30,7 @@
#include <libsolidity/Exceptions.h>
#include <libsolidity/ASTForward.h>
#include <libsolidity/Token.h>
// 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 <libdevcore/UndefMacros.h>
namespace dev
{

Loading…
Cancel
Save