gnu: python-babel: Update to 2.7.0.
[guix.git] / gnu / packages / patches / glog-gcc-5-demangling.patch
blob7f3f42cecad8ffbd6cc729126d35a9ed21be1f71
1 Fix symbol demangling for GCC 5, as reported at:
3 https://github.com/google/glog/issues/14
5 Patch from:
7 https://github.com/google/glog/pull/50
9 From b1639e3014996fbc7635870e013559c54e7e3b2f Mon Sep 17 00:00:00 2001
10 From: =?UTF-8?q?David=20Mart=C3=ADnez=20Moreno?= <ender@debian.org>
11 Date: Thu, 13 Aug 2015 09:31:26 -0700
12 Subject: [PATCH] Fix ABI demangling for the GCC 5.x case.
14 When glog is compiled with gcc-5.2 in cxx11 ABI mode, it barfs about unmangled symbols. This patches it getting inspiration from binutils and demangle.cc itself, although it may be totally wrong or maybe have to use ParseAbiTag in more places. I haven't read the spec for the symbols, though.
16 This patch makes the demangle unit test pass correctly.
17 ---
18 src/demangle.cc | 19 +++++++++++++++++++
19 1 file changed, 19 insertions(+)
21 diff --git a/src/demangle.cc b/src/demangle.cc
22 index e858181..0f0c831 100644
23 --- a/src/demangle.cc
24 +++ b/src/demangle.cc
25 @@ -439,6 +439,7 @@ static bool ParseExprPrimary(State *state);
26 static bool ParseLocalName(State *state);
27 static bool ParseDiscriminator(State *state);
28 static bool ParseSubstitution(State *state);
29 +static bool ParseAbiTag(State *state);
31 // Implementation note: the following code is a straightforward
32 // translation of the Itanium C++ ABI defined in BNF with a couple of
33 @@ -567,6 +568,8 @@ static bool ParseNestedName(State *state) {
34 static bool ParsePrefix(State *state) {
35 bool has_something = false;
36 while (true) {
37 + if (ParseAbiTag(state))
38 + continue;
39 MaybeAppendSeparator(state);
40 if (ParseTemplateParam(state) ||
41 ParseSubstitution(state) ||
42 @@ -585,6 +588,22 @@ static bool ParsePrefix(State *state) {
43 return true;
46 +// <abi-tag> ::= B <source-name>
47 +static bool ParseAbiTag(State *state) {
48 + State copy = *state;
50 + Append(state, "[", 1);
51 + if (ParseOneCharToken(state, 'B') &&
52 + ParseSourceName(state))
53 + {
54 + Append(state, "]", 1);
55 + return true;
56 + }
58 + *state = copy;
59 + return false;
62 // <unqualified-name> ::= <operator-name>
63 // ::= <ctor-dtor-name>
64 // ::= <source-name>