Skip to content

Commit

Permalink
ICU-22450 Disable the type_info workaround on newer versions of libst…
Browse files Browse the repository at this point in the history
…dc++

The workaround for http://llvm.org/bugs/show_bug.cgi?id=13364 is related
to an ancient version of libstdc++ (4.6). On the flip side, with more recent
versions of GCC, the workaround can cause problems under some
conditions.

The _GLIBCXX_RELEASE macro was introduced in libstdc++ 7, checking for
it not being defined to enable the workaround makes it disabled with
libstdc++ >= 7, which don't need the workaround in the first place.
  • Loading branch information
glandium committed Aug 3, 2023
1 parent 9511fff commit fdcee9f
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion icu4c/source/common/unicode/std_string.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

// Workaround for a libstdc++ bug before libstdc++4.6 (2011).
// https://bugs.llvm.org/show_bug.cgi?id=13364
#if defined(__GLIBCXX__)
#if defined(__GLIBCXX__) && !defined(_GLIBCXX_RELEASE)
namespace std { class type_info; }
#endif
#include <string>
Expand Down
2 changes: 1 addition & 1 deletion icu4c/source/common/utypeinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include <exception>
using std::exception;
#endif
#if defined(__GLIBCXX__)
#if defined(__GLIBCXX__) && !defined(_GLIBCXX_RELEASE)
namespace std { class type_info; } // WORKAROUND: http://llvm.org/bugs/show_bug.cgi?id=13364
#endif
#include <typeinfo> // for 'typeid' to work
Expand Down
2 changes: 1 addition & 1 deletion icu4c/source/io/unicode/ustream.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
* C++ I/O stream API.
*/

#if defined(__GLIBCXX__)
#if defined(__GLIBCXX__) && !defined(_GLIBCXX_RELEASE)
namespace std { class type_info; } // WORKAROUND: http://llvm.org/bugs/show_bug.cgi?id=13364
#endif

Expand Down
2 changes: 1 addition & 1 deletion icu4c/source/test/intltest/dcfmtest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include <string.h>
#include <stdio.h>

#if defined(__GLIBCXX__)
#if defined(__GLIBCXX__) && !defined(_GLIBCXX_RELEASE)
namespace std { class type_info; } // WORKAROUND: http://llvm.org/bugs/show_bug.cgi?id=13364
#endif

Expand Down

0 comments on commit fdcee9f

Please sign in to comment.