[C++] Add casts to obstack_base calls

The recent libiberty import of upstream obstack.h (314dee8ea9) makes
obstack_base return a 'void *', with the consequence that a few places
in gdb need a (char *) cast.

gdb/ChangeLog:
2015-11-18  Simon Marchi  <simon.marchi@ericsson.com>
	    Pedro Alves  <palves@redhat.com>

	* break-catch-sig.c (signal_catchpoint_print_one): Add cast.
	* c-exp.y (parse_string_or_char, yylex): Add casts.
	* c-lang.c (evaluate_subexp_c): Add casts.
	* d-exp.y (parse_string_or_char, yylex): Add casts.
	* go-exp.y (parse_string_or_char, build_packaged_name): Add casts.
	* p-valprint.c (pascal_object_print_value_fields): Add casts.
	* valprint.c (generic_emit_char, generic_printstr): Add casts.
This commit is contained in:
Simon Marchi 2015-11-17 13:07:24 +00:00 committed by Pedro Alves
parent e3a3797ee5
commit 79f338988c
8 changed files with 24 additions and 12 deletions

View File

@ -1,3 +1,14 @@
2015-11-18 Simon Marchi <simon.marchi@ericsson.com>
Pedro Alves <palves@redhat.com>
* break-catch-sig.c (signal_catchpoint_print_one): Add cast.
* c-exp.y (parse_string_or_char, yylex): Add casts.
* c-lang.c (evaluate_subexp_c): Add casts.
* d-exp.y (parse_string_or_char, yylex): Add casts.
* go-exp.y (parse_string_or_char, build_packaged_name): Add casts.
* p-valprint.c (pascal_object_print_value_fields): Add casts.
* valprint.c (generic_emit_char, generic_printstr): Add casts.
2015-11-18 Simon Marchi <simon.marchi@ericsson.com>
* valops.c (value_cstring): Constify 'ptr' parameter.

View File

@ -279,7 +279,7 @@ signal_catchpoint_print_one (struct breakpoint *b,
obstack_grow (&text, name, strlen (name));
}
obstack_grow (&text, "", 1);
ui_out_field_string (uiout, "what", obstack_base (&text));
ui_out_field_string (uiout, "what", (const char *) obstack_base (&text));
do_cleanups (cleanup);
}
else

View File

@ -2247,7 +2247,7 @@ parse_string_or_char (const char *tokptr, const char **outptr,
++tokptr;
value->type = type;
value->ptr = obstack_base (&tempbuf);
value->ptr = (char *) obstack_base (&tempbuf);
value->length = obstack_object_size (&tempbuf);
*outptr = tokptr;
@ -3173,7 +3173,7 @@ yylex (void)
obstack_grow (&name_obstack, next->value.sval.ptr,
next->value.sval.length);
yylval.sval.ptr = obstack_base (&name_obstack);
yylval.sval.ptr = (const char *) obstack_base (&name_obstack);
yylval.sval.length = obstack_object_size (&name_obstack);
current.value = yylval;
current.token = classification;

View File

@ -701,7 +701,7 @@ evaluate_subexp_c (struct type *expect_type, struct expression *exp,
obstack_object_size (&output));
}
else
result = value_cstring (obstack_base (&output),
result = value_cstring ((const char *) obstack_base (&output),
obstack_object_size (&output),
type);
}

View File

@ -1005,7 +1005,7 @@ parse_string_or_char (const char *tokptr, const char **outptr,
else
value->type = C_STRING;
value->ptr = obstack_base (&tempbuf);
value->ptr = (char *) obstack_base (&tempbuf);
value->length = obstack_object_size (&tempbuf);
*outptr = tokptr;
@ -1558,7 +1558,7 @@ yylex (void)
obstack_grow (&name_obstack, next->value.sval.ptr,
next->value.sval.length);
yylval.sval.ptr = obstack_base (&name_obstack);
yylval.sval.ptr = (char *) obstack_base (&name_obstack);
yylval.sval.length = obstack_object_size (&name_obstack);
current.token = classify_name (pstate, expression_context_block);
@ -1638,7 +1638,7 @@ yylex (void)
obstack_grow (&name_obstack, next->value.sval.ptr,
next->value.sval.length);
yylval.sval.ptr = obstack_base (&name_obstack);
yylval.sval.ptr = (char *) obstack_base (&name_obstack);
yylval.sval.length = obstack_object_size (&name_obstack);
current.value = yylval;
current.token = classification;

View File

@ -975,7 +975,7 @@ parse_string_or_char (const char *tokptr, const char **outptr,
++tokptr;
value->type = C_STRING | (quote == '\'' ? C_CHAR : 0); /*FIXME*/
value->ptr = obstack_base (&tempbuf);
value->ptr = (char *) obstack_base (&tempbuf);
value->length = obstack_object_size (&tempbuf);
*outptr = tokptr;
@ -1363,7 +1363,7 @@ build_packaged_name (const char *package, int package_len,
obstack_grow_str (&name_obstack, ".");
obstack_grow (&name_obstack, name, name_len);
obstack_grow (&name_obstack, "", 1);
result.ptr = obstack_base (&name_obstack);
result.ptr = (char *) obstack_base (&name_obstack);
result.length = obstack_object_size (&name_obstack) - 1;
return result;

View File

@ -535,7 +535,8 @@ pascal_object_print_value_fields (struct type *type, const gdb_byte *valaddr,
int dont_print_statmem)
{
int i, len, n_baseclasses;
char *last_dont_print = obstack_next_free (&dont_print_statmem_obstack);
char *last_dont_print
= (char *) obstack_next_free (&dont_print_statmem_obstack);
type = check_typedef (type);

View File

@ -2362,7 +2362,7 @@ generic_emit_char (int c, struct type *type, struct ui_file *stream,
sizeof (gdb_wchar_t), &output, translit_char);
obstack_1grow (&output, '\0');
fputs_filtered (obstack_base (&output), stream);
fputs_filtered ((const char *) obstack_base (&output), stream);
do_cleanups (cleanups);
}
@ -2717,7 +2717,7 @@ generic_printstr (struct ui_file *stream, struct type *type,
sizeof (gdb_wchar_t), &output, translit_char);
obstack_1grow (&output, '\0');
fputs_filtered (obstack_base (&output), stream);
fputs_filtered ((const char *) obstack_base (&output), stream);
do_cleanups (cleanup);
}