[dwgrep/f20] Add several patches to fix building with GCC 4.8

Petr Machata pmachata at fedoraproject.org
Mon Mar 2 11:59:36 UTC 2015


commit 7a0e291d5d038d79bf98df58c20a2bca150137ab
Author: Petr Machata <pmachata at redhat.com>
Date:   Mon Mar 2 12:59:05 2015 +0100

    Add several patches to fix building with GCC 4.8

 dwgrep-0.2-braced-init.patch |  30 ++++++++++++
 dwgrep-0.2-raw-strings.patch | 110 +++++++++++++++++++++++++++++++++++++++++++
 dwgrep-0.2-ref-init.patch    |  25 ++++++++++
 dwgrep.spec                  |   5 +-
 4 files changed, 169 insertions(+), 1 deletion(-)
---
diff --git a/dwgrep-0.2-braced-init.patch b/dwgrep-0.2-braced-init.patch
new file mode 100644
index 0000000..c9f600a
--- /dev/null
+++ b/dwgrep-0.2-braced-init.patch
@@ -0,0 +1,30 @@
+From c6d7bac725da2a302da7ccbc5c45b3a66ba20cc5 Mon Sep 17 00:00:00 2001
+From: Petr Machata <pmachata at redhat.com>
+Date: Mon, 2 Mar 2015 12:36:17 +0100
+Subject: [PATCH] Fix for GCC 4.8
+
+- There's a bug in GCC 4.8 where the order of elements passed to
+  braced-init-list is not honored.  We need to move the
+  zw_value_str_str before the std::string call to impose the right
+  ordering.
+---
+ dwgrep/dwgrep.cc | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/dwgrep/dwgrep.cc b/dwgrep/dwgrep.cc
+index 22bbe0a..0dafca0 100644
+--- a/dwgrep/dwgrep.cc
++++ b/dwgrep/dwgrep.cc
+@@ -255,7 +255,8 @@ dumper::dump_die (std::ostream &os, zw_value const &val, format fmt)
+ 	{zw_value_const_format_brief (tag.get (), zw_throw_on_error {})};
+ 
+       size_t sz;
+-      return std::string {zw_value_str_str (tmp.get (), &sz), sz};
++      auto buf = zw_value_str_str (tmp.get (), &sz);
++      return std::string {buf, sz};
+     } ();
+ 
+   {
+-- 
+2.1.0
+
diff --git a/dwgrep-0.2-raw-strings.patch b/dwgrep-0.2-raw-strings.patch
new file mode 100644
index 0000000..318d04e
--- /dev/null
+++ b/dwgrep-0.2-raw-strings.patch
@@ -0,0 +1,110 @@
+diff -up dwgrep-0.2/libzwerg/test-dw.cc\~ dwgrep-0.2/libzwerg/test-dw.cc
+--- dwgrep-0.2/libzwerg/test-dw.cc~	2015-02-28 01:51:29.000000000 +0100
++++ dwgrep-0.2/libzwerg/test-dw.cc	2015-03-02 12:51:55.400604996 +0100
+@@ -672,9 +672,9 @@ TEST_F (ZwTest, builtin_symbol_yields_on
+ 
+   ASSERT_EQ (1, run_dwquery
+ 	     (*builtins, "enum.o",
+-	      R"raw([symbol name] ==
+-		 ["", "enum.cc", "", "", "", "", "", "", "",
+-		  "", "", "", "ae", "af"])raw").size ());
++	      "[symbol name] =="
++	      "[\"\", \"enum.cc\", \"\", \"\", \"\", \"\", \"\", \"\", \"\","
++	      "\"\", \"\", \"\", \"ae\", \"af\"]").size ());
+ }
+ 
+ TEST_F (ZwTest, builtin_symbol_label)
+@@ -703,19 +703,20 @@ TEST_F (ZwTest, builtin_symbol_label)
+ 
+   EXPECT_EQ (1, run_dwquery
+ 	     (*builtins, "enum.o",
+-	      R"foo([symbol label] ==
+-		 [STT_NOTYPE, STT_FILE, STT_SECTION, STT_SECTION,
+-		  STT_SECTION, STT_SECTION, STT_SECTION, STT_SECTION,
+-		  STT_SECTION, STT_SECTION, STT_SECTION, STT_SECTION,
+-		  STT_OBJECT, STT_OBJECT])foo").size ());
++	      "[symbol label] == "
++	      "[STT_NOTYPE, STT_FILE, STT_SECTION, STT_SECTION,"
++	      " STT_SECTION, STT_SECTION, STT_SECTION, STT_SECTION,"
++	      " STT_SECTION, STT_SECTION, STT_SECTION, STT_SECTION,"
++	      " STT_OBJECT, STT_OBJECT]").size ());
+ 
+   EXPECT_EQ (1, run_dwquery
+ 	     (*builtins, "enum.o",
+-	      R"foo([symbol label "%s"] ==
+-		 ["STT_NOTYPE", "STT_FILE", "STT_SECTION", "STT_SECTION",
+-		  "STT_SECTION", "STT_SECTION", "STT_SECTION", "STT_SECTION",
+-		  "STT_SECTION", "STT_SECTION", "STT_SECTION", "STT_SECTION",
+-		  "STT_OBJECT", "STT_OBJECT"])foo").size ());
++	      "[symbol label \"%s\"] == "
++	      "[\"STT_NOTYPE\", \"STT_FILE\", \"STT_SECTION\", \"STT_SECTION\","
++	      " \"STT_SECTION\", \"STT_SECTION\", \"STT_SECTION\","
++	      " \"STT_SECTION\", \"STT_SECTION\", \"STT_SECTION\","
++	      " \"STT_SECTION\", \"STT_SECTION\", \"STT_OBJECT\","
++	      " \"STT_OBJECT\"]").size ());
+ 
+   EXPECT_EQ (1, run_dwquery
+ 	     (*builtins, "y.o",
+@@ -756,18 +757,19 @@ TEST_F (ZwTest, builtin_symbol_binding)
+ 
+   EXPECT_EQ (1, run_dwquery
+ 	     (*builtins, "enum.o",
+-	      R"foo([symbol binding] ==
+-		 [STB_LOCAL, STB_LOCAL, STB_LOCAL, STB_LOCAL, STB_LOCAL,
+-		  STB_LOCAL, STB_LOCAL, STB_LOCAL, STB_LOCAL, STB_LOCAL,
+-		  STB_LOCAL, STB_LOCAL, STB_GLOBAL, STB_GLOBAL])foo")
++	      "[symbol binding] == "
++	      "[STB_LOCAL, STB_LOCAL, STB_LOCAL, STB_LOCAL, STB_LOCAL, "
++	      " STB_LOCAL, STB_LOCAL, STB_LOCAL, STB_LOCAL, STB_LOCAL, "
++	      " STB_LOCAL, STB_LOCAL, STB_GLOBAL, STB_GLOBAL]")
+ 	     .size ());
+ 
+   EXPECT_EQ (1, run_dwquery
+ 	     (*builtins, "enum.o",
+-	      R"foo([symbol binding "%s"] ==
+-		 ["STB_LOCAL","STB_LOCAL","STB_LOCAL","STB_LOCAL","STB_LOCAL",
+-		  "STB_LOCAL","STB_LOCAL","STB_LOCAL","STB_LOCAL","STB_LOCAL",
+-		  "STB_LOCAL","STB_LOCAL","STB_GLOBAL","STB_GLOBAL"])foo")
++	      "[symbol binding \"%s\"] == "
++	      "[\"STB_LOCAL\",\"STB_LOCAL\",\"STB_LOCAL\",\"STB_LOCAL\","
++	      " \"STB_LOCAL\",\"STB_LOCAL\",\"STB_LOCAL\",\"STB_LOCAL\","
++	      " \"STB_LOCAL\",\"STB_LOCAL\",\"STB_LOCAL\",\"STB_LOCAL\","
++	      " \"STB_GLOBAL\",\"STB_GLOBAL\"]")
+ 	     .size ());
+ 
+   EXPECT_EQ (1, run_dwquery
+@@ -836,8 +838,7 @@ TEST_F (ZwTest, builtin_symbol_size)
+ 
+   EXPECT_EQ (1, run_dwquery
+ 	     (*builtins, "twocus",
+-	      R"foo([symbol (pos >= 63) size] ==
+-		 [4, 137, 11, 0, 0, 0, 16, 0, 0])foo")
++	      "[symbol (pos >= 63) size] == [4, 137, 11, 0, 0, 0, 16, 0, 0]")
+ 	     .size ());
+ }
+ 
+@@ -868,16 +869,16 @@ TEST_F (ZwTest, builtin_symbol_address_v
+ 
+   EXPECT_EQ (1, run_dwquery
+ 	     (*builtins, "twocus",
+-	      R"foo([symbol (pos >= 63) address] ==
+-		 [0x4005b8, 0x4004d0, 0x4004b2, 0x601038, 0x4003d0, 0x601024,
+-		  0x4004bd, 0, 0x400390])foo")
++	      "[symbol (pos >= 63) address] == "
++	      "[0x4005b8, 0x4004d0, 0x4004b2, 0x601038, 0x4003d0, 0x601024,"
++	      " 0x4004bd, 0, 0x400390]")
+ 	     .size ());
+ 
+   EXPECT_EQ (1, run_dwquery
+ 	     (*builtins, "twocus",
+-	      R"foo([symbol (pos >= 63) value] ==
+-		 [0x4005b8, 0x4004d0, 0x4004b2, 0x601038, 0x4003d0, 0x601024,
+-		  0x4004bd, 0, 0x400390])foo")
++	      "[symbol (pos >= 63) value] == "
++	      "[0x4005b8, 0x4004d0, 0x4004b2, 0x601038, 0x4003d0, 0x601024,"
++	      " 0x4004bd, 0, 0x400390]")
+ 	     .size ());
+ }
+ 
+
+Diff finished.  Mon Mar  2 12:52:15 2015
diff --git a/dwgrep-0.2-ref-init.patch b/dwgrep-0.2-ref-init.patch
new file mode 100644
index 0000000..8c0f3df
--- /dev/null
+++ b/dwgrep-0.2-ref-init.patch
@@ -0,0 +1,25 @@
+From d5efb5ef62b89577d129f6ae7ae31426ec548099 Mon Sep 17 00:00:00 2001
+From: Petr Machata <pmachata at redhat.com>
+Date: Mon, 2 Mar 2015 12:07:28 +0100
+Subject: [PATCH] Initialize a reference member using (), not {}
+
+---
+ dwgrep/dwgrep.cc | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/dwgrep/dwgrep.cc b/dwgrep/dwgrep.cc
+index 6f07b4f..22bbe0a 100644
+--- a/dwgrep/dwgrep.cc
++++ b/dwgrep/dwgrep.cc
+@@ -112,7 +112,7 @@ class dumper
+ 
+ public:
+   explicit dumper (zw_vocabulary const &voc)
+-    : m_voc {voc}
++    : m_voc (voc)
+   {}
+ 
+   enum class format
+-- 
+2.1.0
+
diff --git a/dwgrep.spec b/dwgrep.spec
index 6e207f2..9780f6d 100644
--- a/dwgrep.spec
+++ b/dwgrep.spec
@@ -9,6 +9,9 @@ Group:          Development/Tools
 License:        GPLv3+ and (GPLv2+ or LGPLv3+)
 URL:            http://pmachata.github.io/dwgrep/index.html
 Source0:        https://github.com/pmachata/dwgrep/archive/%{version}/dwgrep-%{version}.tar.gz
+Patch0:         dwgrep-0.2-ref-init.patch
+Patch1:         dwgrep-0.2-braced-init.patch
+Patch2:         dwgrep-0.2-raw-strings.patch
 
 BuildRequires:  bison
 BuildRequires:  cmake
@@ -73,7 +76,7 @@ Boost web page (http://pmachata.github.io/dwgrep/).
 
 
 %prep
-%setup -q -n dwgrep-%{version}
+%autosetup -p1
 
 
 %build


More information about the scm-commits mailing list