Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix build with GCC 5.1 and C++11 ABI
AcademySoftwareFoundation/OpenImageIO#1174 git-svn-id: file:///srv/repos/svn-community/svn@135909 9fca08f4-af9d-4005-b8df-a31f2cc04f65
- Loading branch information
foutrelis
authored and
svntogit
committed
Jun 26, 2015
1 parent
06a5e79
commit 3f89963
Showing
2 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
From a2ccfad7c4962a5203ea2cf755fd102b4c67f997 Mon Sep 17 00:00:00 2001 | ||
From: Larry Gritz <lg@larrygritz.com> | ||
Date: Fri, 26 Jun 2015 11:46:23 -0700 | ||
Subject: [PATCH] ustring fixes for new gcc (5.1+) std::string ABI | ||
|
||
This makes it work (and adds a test). | ||
We still need to return and do something more clever for that case. | ||
I'll need to install gcc 5.1 first to see how the internals work. | ||
But in the mean time, at least this will unbreak things for people | ||
already on gcc 5.1. | ||
|
||
Fixes #1174 | ||
--- | ||
src/libutil/ustring.cpp | 7 ++++++- | ||
src/libutil/ustring_test.cpp | 2 ++ | ||
2 files changed, 8 insertions(+), 1 deletion(-) | ||
|
||
diff --git a/src/libutil/ustring.cpp b/src/libutil/ustring.cpp | ||
index 1d12533..4b4a8c2 100644 | ||
--- a/src/libutil/ustring.cpp | ||
+++ b/src/libutil/ustring.cpp | ||
@@ -318,7 +318,12 @@ ustring::TableRep::TableRep (string_view strref, size_t hash) | ||
// the std::string to make it point to our chars! In such a case, the | ||
// destructor will be careful not to allow a deallocation. | ||
|
||
-#if defined(__GNUC__) && !defined(_LIBCPP_VERSION) | ||
+#if defined(__GNUC__) && !defined(_LIBCPP_VERSION) && defined(_GLIBCXX_USE_CXX11_ABI) && _GLIBCXX_USE_CXX11_ABI | ||
+ // NEW gcc ABI | ||
+ // FIXME -- do something smart with this. | ||
+ | ||
+#elif defined(__GNUC__) && !defined(_LIBCPP_VERSION) | ||
+ // OLD gcc ABI | ||
// It turns out that the first field of a gcc std::string is a pointer | ||
// to the characters within the basic_string::_Rep. We merely redirect | ||
// that pointer, though for std::string to function properly, the chars |