aboutsummaryrefslogtreecommitdiff
path: root/gdb/c-typeprint.c
diff options
context:
space:
mode:
authorPhilippe Waroquiers <philippe.waroquiers@skynet.be>2019-01-10 22:31:07 +0100
committerPhilippe Waroquiers <philippe.waroquiers@skynet.be>2019-02-12 19:59:39 +0100
commitac8c53cc67724f990003009fd37a3d7dc662fcb3 (patch)
tree0f206aad70d0de7cc14022a51c8a1ebc52d217a3 /gdb/c-typeprint.c
parente486594504d72a3afa199392a9d95a56ef1d6293 (diff)
downloadfsf-binutils-gdb-ac8c53cc67724f990003009fd37a3d7dc662fcb3.zip
fsf-binutils-gdb-ac8c53cc67724f990003009fd37a3d7dc662fcb3.tar.gz
fsf-binutils-gdb-ac8c53cc67724f990003009fd37a3d7dc662fcb3.tar.bz2
Use function_name_style to print Ada and C function names
Note that ada-typeprint.c print_func_type is called with types representing functions and is also called to print a function NAME together with its type. In such a case, the function name will be printed using function name style. Similarly, c_print_type_1 is called to print a type, optionally with the name of an object of this type in the VARSTRING arg. So, c_print_type_1 uses function name style to print varstring when the type code indicates that c_print_type_1 TYPE is some 'real code'. gdb/ChangeLog 2019-02-12 Philippe Waroquiers <philippe.waroquiers@skynet.be> * ada-typeprint.c (print_func_type): Print function name style to print function name. * c-typeprint.c (c_print_type_1): Likewise.
Diffstat (limited to 'gdb/c-typeprint.c')
-rw-r--r--gdb/c-typeprint.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c
index 5e7e672..6690ca5 100644
--- a/gdb/c-typeprint.c
+++ b/gdb/c-typeprint.c
@@ -28,6 +28,7 @@
#include "language.h"
#include "demangle.h"
#include "c-lang.h"
+#include "cli/cli-style.h"
#include "typeprint.h"
#include "cp-abi.h"
#include "cp-support.h"
@@ -115,6 +116,7 @@ c_print_type_1 (struct type *type,
type = check_typedef (type);
local_name = typedef_hash_table::find_typedef (flags, type);
+ code = TYPE_CODE (type);
if (local_name != NULL)
{
fputs_filtered (local_name, stream);
@@ -124,7 +126,6 @@ c_print_type_1 (struct type *type,
else
{
c_type_print_base_1 (type, stream, show, level, language, flags, podata);
- code = TYPE_CODE (type);
if ((varstring != NULL && *varstring != '\0')
/* Need a space if going to print stars or brackets;
but not if we will print just a type name. */
@@ -144,7 +145,10 @@ c_print_type_1 (struct type *type,
if (varstring != NULL)
{
- fputs_filtered (varstring, stream);
+ if (code == TYPE_CODE_FUNC || code == TYPE_CODE_METHOD)
+ fputs_styled (varstring, function_name_style.style (), stream);
+ else
+ fputs_filtered (varstring, stream);
/* For demangled function names, we have the arglist as part of
the name, so don't print an additional pair of ()'s. */