From: Andrew Pinski Date: Tue, 19 May 2026 01:20:14 +0000 (-0700) Subject: stack_usage: Print out the user visibility name too X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=960895db668;p=thirdparty%2Fgcc.git stack_usage: Print out the user visibility name too Since the output here should be usable via humans, we should print out the user realable name and not just the mangled name. For C, that means we print out the same name twice which is fine. The mangled name is useful to correspond the assembly with the stack usage too. For C++ it will something like: t.c:2:5:_Z5unopti `int unopt(int)` 16 static Bootstrapped and tested on x86_64-linux-gnu. gcc/ChangeLog: * toplev.cc (output_stack_usage_1): Print out the human readable name in quotes. gcc/testsuite/ChangeLog: * gcc.dg/stack-usage-1.c: Update testcase. Signed-off-by: Andrew Pinski --- diff --git a/gcc/testsuite/gcc.dg/stack-usage-1.c b/gcc/testsuite/gcc.dg/stack-usage-1.c index 8714c57c197..1ba9d059956 100644 --- a/gcc/testsuite/gcc.dg/stack-usage-1.c +++ b/gcc/testsuite/gcc.dg/stack-usage-1.c @@ -116,5 +116,5 @@ int foo (void) return 0; } -/* { dg-final { scan-stack-usage "foo\t\(256|264\)\tstatic" } } */ +/* { dg-final { scan-stack-usage "foo `foo`\t\(256|264\)\tstatic" } } */ /* { dg-final { cleanup-stack-usage } } */ diff --git a/gcc/toplev.cc b/gcc/toplev.cc index 66fa927c53d..7925462bc58 100644 --- a/gcc/toplev.cc +++ b/gcc/toplev.cc @@ -842,6 +842,10 @@ output_stack_usage_1 (FILE *cf) print_decl_identifier (stack_usage_file, current_function_decl, PRINT_DECL_ORIGIN | PRINT_DECL_UNIQUE_NAME | PRINT_DECL_REMAP_DEBUG); + fprintf (stack_usage_file, " `"); + print_decl_identifier (stack_usage_file, current_function_decl, + PRINT_DECL_NAME); + fprintf (stack_usage_file, "`"); fprintf (stack_usage_file, "\t" HOST_WIDE_INT_PRINT_DEC"\t%s\n", stack_usage, stack_usage_kind_str[stack_usage_kind]); }