Permalink
Browse files

Fix gcc5 dual string ABI issue

  • Loading branch information...
1 parent a41b76b commit cce89e3597df3cd6b6ea8d42d44f1ce2c12f5337 @YasserAsmi committed Sep 25, 2016
Showing with 18 additions and 3 deletions.
  1. +10 −2 .gitignore
  2. +4 −1 CMakeLists.txt
  3. +1 −0 include/var.h
  4. +3 −0 src/var.cpp
View
@@ -1,2 +1,10 @@
-docs/html
-build
+CMakeCache.txt
+CMakeFiles
+CMakeScripts
+Makefile
+cmake_install.cmake
+.browse.VC.db
+.browse.VC.db-shm
+.browse.VC.db-wal
+bin
+lib
View
@@ -12,7 +12,10 @@ option(CXX11 "Enable C++11 support" OFF)
message(STATUS "CXX11 = " ${CXX11})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -Wall -Wextra -Wno-unused-parameter -Wno-variadic-macros -Wno-ignored-qualifiers")
-#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-unused-parameter -Wno-variadic-macros -Wno-ignored-qualifiers")
+
+if (CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 5.0)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GLIBCXX_USE_CXX11_ABI=0")
+endif()
if(CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
View
@@ -918,6 +918,7 @@ class Variant
std::string* strData() const
{
+ assert(type == V_STRING);
return (std::string*)&strMemData;
}
};
View
@@ -1054,18 +1054,21 @@ bool Variant::deleteData()
case V_ARRAY:
{
delete mData.arrayData;
+ mData.arrayData = NULL;
}
break;
case V_OBJECT:
{
delete mData.objectData;
+ mData.objectData = NULL;
}
break;
case V_FUNCTION:
{
delete mData.funcData;
+ mData.funcData = NULL;
}
break;

0 comments on commit cce89e3

Please sign in to comment.