Commit a27845e9 authored by Wayne Stambaugh's avatar Wayne Stambaugh

Fix MinGW 64 bit build buigs.

* Patch Boost interlocked.hpp from version 1.56.
* Fix segfault in Eeschema when auto save event occurs before root sheet is initialized.
* Add assertion when SCH_SHEET_PATH::BuildSheetList is called with NULL pointer.
parent 547524cd
...@@ -219,6 +219,8 @@ ExternalProject_Add( boost ...@@ -219,6 +219,8 @@ ExternalProject_Add( boost
COMMAND ${PATCH_STR_CMD} "${PROJECT_SOURCE_DIR}/patches/boost_macosx_older_openssl.patch" #https://svn.boost.org/trac/boost/ticket/9273 COMMAND ${PATCH_STR_CMD} "${PROJECT_SOURCE_DIR}/patches/boost_macosx_older_openssl.patch" #https://svn.boost.org/trac/boost/ticket/9273
COMMAND ${PATCH_STR_CMD} "${PROJECT_SOURCE_DIR}/patches/boost_mingw.patch" #https://svn.boost.org/trac/boost/ticket/7262 COMMAND ${PATCH_STR_CMD} "${PROJECT_SOURCE_DIR}/patches/boost_mingw.patch" #https://svn.boost.org/trac/boost/ticket/7262
COMMAND ${PATCH_STR_CMD} "${PROJECT_SOURCE_DIR}/patches/boost_mingw64_interlocked.patch"
# tell bzr about "added" files by last patch: # tell bzr about "added" files by last patch:
COMMAND bzr add libs/context/src/asm/make_i386_ms_pe_gas.S COMMAND bzr add libs/context/src/asm/make_i386_ms_pe_gas.S
COMMAND bzr add libs/context/src/asm/jump_i386_ms_pe_gas.S COMMAND bzr add libs/context/src/asm/jump_i386_ms_pe_gas.S
......
...@@ -517,6 +517,8 @@ SCH_SHEET_PATH* SCH_SHEET_LIST::GetSheet( const wxString aPath, bool aHumanReada ...@@ -517,6 +517,8 @@ SCH_SHEET_PATH* SCH_SHEET_LIST::GetSheet( const wxString aPath, bool aHumanReada
void SCH_SHEET_LIST::BuildSheetList( SCH_SHEET* aSheet ) void SCH_SHEET_LIST::BuildSheetList( SCH_SHEET* aSheet )
{ {
wxCHECK_RET( aSheet != NULL, wxT( "Cannot build sheet list from undefined sheet." ) );
if( aSheet == g_RootSheet ) if( aSheet == g_RootSheet )
m_isRootSheet = true; m_isRootSheet = true;
......
...@@ -1084,9 +1084,15 @@ void SCH_EDIT_FRAME::OnSelectItem( wxCommandEvent& aEvent ) ...@@ -1084,9 +1084,15 @@ void SCH_EDIT_FRAME::OnSelectItem( wxCommandEvent& aEvent )
bool SCH_EDIT_FRAME::isAutoSaveRequired() const bool SCH_EDIT_FRAME::isAutoSaveRequired() const
{ {
// In case this event happens before g_RootSheet is initialized which does happen
// on mingw64 builds.
if( g_RootSheet != NULL )
{
SCH_SHEET_LIST sheetList; SCH_SHEET_LIST sheetList;
return sheetList.IsAutoSaveRequired(); return sheetList.IsAutoSaveRequired();
}
} }
...@@ -1161,7 +1167,7 @@ void SCH_EDIT_FRAME::addCurrentItemToList( wxDC* aDC ) ...@@ -1161,7 +1167,7 @@ void SCH_EDIT_FRAME::addCurrentItemToList( wxDC* aDC )
if( item->Type() == SCH_SHEET_PIN_T ) if( item->Type() == SCH_SHEET_PIN_T )
( (SCH_SHEET*)undoItem )->AddPin( (SCH_SHEET_PIN*) item ); ( (SCH_SHEET*)undoItem )->AddPin( (SCH_SHEET_PIN*) item );
else else
wxLogMessage(wxT( "addCurrentItemToList: expected type = SCH_SHEET_PIN_T, actual type = %d" ), wxLogMessage( wxT( "addCurrentItemToList: expected type = SCH_SHEET_PIN_T, actual type = %d" ),
item->Type() ); item->Type() );
} }
} }
......
=== modified file 'boost/detail/interlocked.hpp'
--- boost/detail/interlocked.hpp 2014-08-22 00:51:15 +0000
+++ boost/detail/interlocked.hpp 2014-08-22 18:54:49 +0000
@@ -1,12 +1,6 @@
#ifndef BOOST_DETAIL_INTERLOCKED_HPP_INCLUDED
#define BOOST_DETAIL_INTERLOCKED_HPP_INCLUDED
-// MS compatible compilers support #pragma once
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1020)
-# pragma once
-#endif
-
//
// boost/detail/interlocked.hpp
//
@@ -19,6 +13,11 @@
#include <boost/config.hpp>
+// MS compatible compilers support #pragma once
+#ifdef BOOST_HAS_PRAGMA_ONCE
+#pragma once
+#endif
+
#if defined( BOOST_USE_WINDOWS_H )
# include <windows.h>
@@ -31,6 +30,30 @@
# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER InterlockedCompareExchangePointer
# define BOOST_INTERLOCKED_EXCHANGE_POINTER InterlockedExchangePointer
+#elif defined( BOOST_USE_INTRIN_H )
+
+#include <intrin.h>
+
+# define BOOST_INTERLOCKED_INCREMENT _InterlockedIncrement
+# define BOOST_INTERLOCKED_DECREMENT _InterlockedDecrement
+# define BOOST_INTERLOCKED_COMPARE_EXCHANGE _InterlockedCompareExchange
+# define BOOST_INTERLOCKED_EXCHANGE _InterlockedExchange
+# define BOOST_INTERLOCKED_EXCHANGE_ADD _InterlockedExchangeAdd
+
+# if defined(_M_IA64) || defined(_M_AMD64) || defined(__x86_64__) || defined(__x86_64)
+
+# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER _InterlockedCompareExchangePointer
+# define BOOST_INTERLOCKED_EXCHANGE_POINTER _InterlockedExchangePointer
+
+# else
+
+# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest,exchange,compare) \
+ ((void*)BOOST_INTERLOCKED_COMPARE_EXCHANGE((long volatile*)(dest),(long)(exchange),(long)(compare)))
+# define BOOST_INTERLOCKED_EXCHANGE_POINTER(dest,exchange) \
+ ((void*)BOOST_INTERLOCKED_EXCHANGE((long volatile*)(dest),(long)(exchange)))
+
+# endif
+
#elif defined(_WIN32_WCE)
#if _WIN32_WCE >= 0x600
@@ -71,7 +94,7 @@
#elif defined( BOOST_MSVC ) || defined( BOOST_INTEL_WIN )
-#if defined( BOOST_MSVC ) && BOOST_MSVC >= 1600
+#if defined( BOOST_MSVC ) && BOOST_MSVC >= 1500
#include <intrin.h>
@@ -93,46 +116,53 @@
#endif
-# pragma intrinsic( _InterlockedIncrement )
-# pragma intrinsic( _InterlockedDecrement )
-# pragma intrinsic( _InterlockedCompareExchange )
-# pragma intrinsic( _InterlockedExchange )
-# pragma intrinsic( _InterlockedExchangeAdd )
-
# if defined(_M_IA64) || defined(_M_AMD64)
extern "C" void* __cdecl _InterlockedCompareExchangePointer( void* volatile *, void*, void* );
extern "C" void* __cdecl _InterlockedExchangePointer( void* volatile *, void* );
-# pragma intrinsic( _InterlockedCompareExchangePointer )
-# pragma intrinsic( _InterlockedExchangePointer )
-
-# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER _InterlockedCompareExchangePointer
-# define BOOST_INTERLOCKED_EXCHANGE_POINTER _InterlockedExchangePointer
-
-# else
-
-# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest,exchange,compare) \
- ((void*)BOOST_INTERLOCKED_COMPARE_EXCHANGE((long volatile*)(dest),(long)(exchange),(long)(compare)))
-# define BOOST_INTERLOCKED_EXCHANGE_POINTER(dest,exchange) \
- ((void*)BOOST_INTERLOCKED_EXCHANGE((long volatile*)(dest),(long)(exchange)))
-
-# endif
-
-# define BOOST_INTERLOCKED_INCREMENT _InterlockedIncrement
-# define BOOST_INTERLOCKED_DECREMENT _InterlockedDecrement
-# define BOOST_INTERLOCKED_COMPARE_EXCHANGE _InterlockedCompareExchange
-# define BOOST_INTERLOCKED_EXCHANGE _InterlockedExchange
-# define BOOST_INTERLOCKED_EXCHANGE_ADD _InterlockedExchangeAdd
+# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER _InterlockedCompareExchangePointer
+# define BOOST_INTERLOCKED_EXCHANGE_POINTER _InterlockedExchangePointer
+
+# else
+
+# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest,exchange,compare) \
+ ((void*)BOOST_INTERLOCKED_COMPARE_EXCHANGE((long volatile*)(dest),(long)(exchange),(long)(compare)))
+# define BOOST_INTERLOCKED_EXCHANGE_POINTER(dest,exchange) \
+ ((void*)BOOST_INTERLOCKED_EXCHANGE((long volatile*)(dest),(long)(exchange)))
+
+# endif
+
+# define BOOST_INTERLOCKED_INCREMENT _InterlockedIncrement
+# define BOOST_INTERLOCKED_DECREMENT _InterlockedDecrement
+# define BOOST_INTERLOCKED_COMPARE_EXCHANGE _InterlockedCompareExchange
+# define BOOST_INTERLOCKED_EXCHANGE _InterlockedExchange
+# define BOOST_INTERLOCKED_EXCHANGE_ADD _InterlockedExchangeAdd
+
+// Unlike __MINGW64__, __MINGW64_VERSION_MAJOR is defined by MinGW-w64 for both 32 and 64-bit targets.
+#elif defined(__MINGW64_VERSION_MAJOR)
+
+// MinGW-w64 provides intrin.h for both 32 and 64-bit targets.
+#include <intrin.h>
+
+# define BOOST_INTERLOCKED_INCREMENT _InterlockedIncrement
+# define BOOST_INTERLOCKED_DECREMENT _InterlockedDecrement
+# define BOOST_INTERLOCKED_COMPARE_EXCHANGE _InterlockedCompareExchange
+# define BOOST_INTERLOCKED_EXCHANGE _InterlockedExchange
+# define BOOST_INTERLOCKED_EXCHANGE_ADD _InterlockedExchangeAdd
+# if defined(__x86_64__) || defined(__x86_64)
+# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER _InterlockedCompareExchangePointer
+# define BOOST_INTERLOCKED_EXCHANGE_POINTER _InterlockedExchangePointer
+# else
+# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest,exchange,compare) \
+ ((void*)BOOST_INTERLOCKED_COMPARE_EXCHANGE((long volatile*)(dest),(long)(exchange),(long)(compare)))
+# define BOOST_INTERLOCKED_EXCHANGE_POINTER(dest,exchange) \
+ ((void*)BOOST_INTERLOCKED_EXCHANGE((long volatile*)(dest),(long)(exchange)))
+# endif
#elif defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined( __CYGWIN__ )
-#if defined(__MINGW64__)
-#define BOOST_INTERLOCKED_IMPORT
-#else
#define BOOST_INTERLOCKED_IMPORT __declspec(dllimport)
-#endif
-
namespace boost
{
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment