aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2017-03-14 00:11:09 +0000
committerPedro Alves <palves@redhat.com>2017-03-14 00:11:09 +0000
commit8a6200ba863f207d93467312431d107f50f0e2ab (patch)
tree0c5e0ec0f53904e75f684a1fee8c866d2c91d390 /gdb
parent9c7272f0833da2bfdf513d41bc41cdbc5f4fc5f7 (diff)
downloadgdb-8a6200ba863f207d93467312431d107f50f0e2ab.zip
gdb-8a6200ba863f207d93467312431d107f50f0e2ab.tar.gz
gdb-8a6200ba863f207d93467312431d107f50f0e2ab.tar.bz2
Restore test-cp-name-parser build
Commit c8b23b3f89fbb0 ("Add constructor and destructor to demangle_parse_info") a while ago broke the "test-cp-name-parser" build: $ make test-cp-name-parser [...] src/gdb/cp-name-parser.y: In function ‘int main(int, char**)’: src/gdb/cp-name-parser.y:2190:9: error: cannot convert ‘std::unique_ptr<demangle_parse_info>’ to ‘demangle_parse_info*’ in assignment result = cp_demangled_name_to_comp (str2, &errmsg); ^ src/gdb/cp-name-parser.y:2199:38: error: ‘cp_demangled_name_parse_free’ was not declared in this scope cp_demangled_name_parse_free (result); ^ src/gdb/cp-name-parser.y:2211:14: error: cannot convert ‘std::unique_ptr<demangle_parse_info>’ to ‘demangle_parse_info*’ in assignment result = cp_demangled_name_to_comp (argv[arg], &errmsg); ^ src/gdb/cp-name-parser.y:2219:43: error: ‘cp_demangled_name_parse_free’ was not declared in this scope cp_demangled_name_parse_free (result); ^ Makefile:2107: recipe for target 'test-cp-name-parser.o' failed make: *** [test-cp-name-parser.o] Error 1 This commit restores it. gdb/ChangeLog: 2017-03-14 Pedro Alves <palves@redhat.com> * cp-name-parser.y (cp_demangled_name_to_comp): Update comment. (main): Use std::unique_ptr. Remove calls to cp_demangled_name_parse_free.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/cp-name-parser.y17
2 files changed, 14 insertions, 9 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index b5edb572..608501b 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2017-03-14 Pedro Alves <palves@redhat.com>
+
+ * cp-name-parser.y (cp_demangled_name_to_comp): Update comment.
+ (main): Use std::unique_ptr. Remove calls to
+ cp_demangled_name_parse_free.
+
2017-03-13 Simon Marchi <simon.marchi@polymtl.ca>
* alpha-bsd-nat.c (alphabsd_fetch_inferior_registers,
diff --git a/gdb/cp-name-parser.y b/gdb/cp-name-parser.y
index 5278c05..70790fc 100644
--- a/gdb/cp-name-parser.y
+++ b/gdb/cp-name-parser.y
@@ -2057,10 +2057,9 @@ cp_merge_demangle_parse_infos (struct demangle_parse_info *dest,
}
/* Convert a demangled name to a demangle_component tree. On success,
- a structure containing the root of the new tree is returned; it must
- be freed by calling cp_demangled_name_parse_free. On error, NULL is
- returned, and an error message will be set in *ERRMSG (which does
- not need to be freed). */
+ a structure containing the root of the new tree is returned. On
+ error, NULL is returned, and an error message will be set in
+ *ERRMSG (which does not need to be freed). */
struct std::unique_ptr<demangle_parse_info>
cp_demangled_name_to_comp (const char *demangled_name, const char **errmsg)
@@ -2161,7 +2160,6 @@ main (int argc, char **argv)
char buf[65536];
int arg;
const char *errmsg;
- struct demangle_parse_info *result;
arg = 1;
if (argv[arg] && strcmp (argv[arg], "--debug") == 0)
@@ -2187,7 +2185,9 @@ main (int argc, char **argv)
printf ("%s\n", buf);
continue;
}
- result = cp_demangled_name_to_comp (str2, &errmsg);
+
+ std::unique_ptr<demangle_parse_info> result
+ = cp_demangled_name_to_comp (str2, &errmsg);
if (result == NULL)
{
fputs (errmsg, stderr);
@@ -2196,7 +2196,6 @@ main (int argc, char **argv)
}
cp_print (result->tree);
- cp_demangled_name_parse_free (result);
free (str2);
if (c)
@@ -2208,7 +2207,8 @@ main (int argc, char **argv)
}
else
{
- result = cp_demangled_name_to_comp (argv[arg], &errmsg);
+ std::unique_ptr<demangle_parse_info> result
+ = cp_demangled_name_to_comp (argv[arg], &errmsg);
if (result == NULL)
{
fputs (errmsg, stderr);
@@ -2216,7 +2216,6 @@ main (int argc, char **argv)
return 0;
}
cp_print (result->tree);
- cp_demangled_name_parse_free (result);
putchar ('\n');
}
return 0;