1From b126134f68f4a5bd826141be68337ac15a7c2c04 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 12 Feb 2019 11:58:34 -0800
4Subject: [PATCH 06/10] replace (sym_iterator)0 with sym_iterator()
5
6clang/libc++ find this error
7
8libpp/xml_utils.cpp:409:43: error: calling a private constructor of class 'std::__1::__wrap_iter<const sym
9bol_entry *const *>'
10|                 { lo = hi = 0; name = ""; begin = end = (sym_iterator)0;}
11|                                                         ^
12|
13
14default constructed iterator isn't supposed to be used for anything
15
16Upstream-Status: Pending
17Signed-off-by: Khem Raj <raj.khem@gmail.com>
18---
19 libpp/xml_utils.cpp | 26 +++++++++++++-------------
20 1 file changed, 13 insertions(+), 13 deletions(-)
21
22diff --git a/libpp/xml_utils.cpp b/libpp/xml_utils.cpp
23index 3de41e58..f45d3ae2 100644
24--- a/libpp/xml_utils.cpp
25+++ b/libpp/xml_utils.cpp
26@@ -73,7 +73,7 @@ void dump_symbol(string const & prefix, sym_iterator it, bool want_nl = true)
27
28 void dump_symbols(string const & prefix, sym_iterator b, sym_iterator e)
29 {
30-	if (b == (sym_iterator)0)
31+	if (b == sym_iterator())
32 		return;
33
34 	for (sym_iterator it = b; it != e; ++it)
35@@ -167,7 +167,7 @@ string xml_utils::get_profile_header(string cpu_name, double const speed)
36 	}
37
38 	str << init_attr(CPU_NAME, cpu_type) << endl;
39-	if (processor.size() > 0)
40+	if (processor.size() > 0)
41 		str << init_attr(PROCESSOR, string(processor)) << endl;
42 	if (nr_cpus > 1) str << init_attr(SEPARATED_CPUS, nr_cpus) << endl;
43 	str << init_attr(MHZ, speed) << endl;
44@@ -320,11 +320,11 @@ void xml_utils::build_subclasses(ostream & out)
45 			(*sc_ptr)[new_index].subclass_name = subclass_name;
46 			out << open_element(CLASS, true);
47 			out << init_attr(NAME, subclass_name);
48-			if (nr_cpus > 1)
49+			if (nr_cpus > 1)
50 				out << init_attr(CPU_NUM, pclass.ptemplate.cpu);
51-			if (nr_events > 1)
52+			if (nr_events > 1)
53 				out << init_attr(EVENT_NUM, event);
54-			if (has_nonzero_masks)
55+			if (has_nonzero_masks)
56 				out << init_attr(EVENT_MASK, pclass.ptemplate.unitmask);
57 			out << close_element();
58 		}
59@@ -406,7 +406,7 @@ xml_utils::output_summary_data(ostream & out, count_array_t const & summary, siz
60 class module_info {
61 public:
62 	module_info()
63-		{ lo = hi = 0; name = ""; begin = end = (sym_iterator)0;}
64+		{ lo = hi = 0; name = ""; begin = end = sym_iterator();}
65 	void dump();
66 	void build_module(string const & n, sym_iterator it,
67 	                  size_t l, size_t h);
68@@ -540,21 +540,21 @@ void module_info::add_to_summary(count_array_t const & counts)
69
70 void module_info::set_begin(sym_iterator b)
71 {
72-	if (begin == (sym_iterator)0)
73+	if (begin == sym_iterator())
74 		begin = b;
75 }
76
77
78 void module_info::set_end(sym_iterator e)
79 {
80-	if (end == (sym_iterator)0)
81+	if (end == sym_iterator())
82 		end = e;
83 }
84
85
86 bool module_info::is_closed(string const & n)
87 {
88-	return (name == n) && end != (sym_iterator)0;
89+	return (name == n) && end != sym_iterator();
90 }
91
92
93@@ -585,7 +585,7 @@ void module_info::output_summary(ostream & out)
94
95 void module_info::output_symbols(ostream & out, bool is_module)
96 {
97-	if (begin == (sym_iterator)0)
98+	if (begin == sym_iterator())
99 		return;
100
101 	for (sym_iterator it = begin; it != end; ++it)
102@@ -606,7 +606,7 @@ void binary_info::close_binary(sym_iterator it)
103 void binary_info::dump()
104 {
105 	cverb << vxml << "app_name=" << name << endl;
106-	if (begin != (sym_iterator)0)
107+	if (begin != sym_iterator())
108 		dump_symbols("	", begin, end);
109
110 	for (size_t i = 0; i < nr_modules; ++i)
111@@ -648,7 +648,7 @@ add_module_symbol(string const & module, string const & app,
112 		// mark end of enclosing binary symbols if there have been any
113 		// NOTE: it is possible for the binary's symbols to follow its
114 		// module symbols
115-		if (begin != (sym_iterator)0 && end == (sym_iterator)0)
116+		if (begin != sym_iterator() && end == sym_iterator())
117 			set_end(it);
118
119 		// build the new module
120@@ -718,7 +718,7 @@ summarize_processes(extra_images const & extra_found_images)
121 {
122 	// add modules to the appropriate threads in the process hierarchy
123 	for (sym_iterator it = symbols_begin ; it != symbols_end; ++it) {
124-		string binary = get_image_name((*it)->app_name,
125+		string binary = get_image_name((*it)->app_name,
126 			image_name_storage::int_filename, extra_found_images);
127 		string module = get_image_name((*it)->image_name,
128 			image_name_storage::int_filename, extra_found_images);
129--
1302.31.0
131
132