From: Tom de Vries Date: Thu, 1 Oct 2015 05:42:50 +0000 (+0000) Subject: Make dumping of function attributes resemble source syntax X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=26e5d47d44df43aaa6a14ae56bc057913c1d3e4c;p=gcc.git Make dumping of function attributes resemble source syntax 2015-10-01 Tom de Vries * tree-cfg.c (dump_function_to_file): Dump function attributes using __attribute__(()) string. Move dumping of function attributes to before function name. From-SVN: r228315 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c8200dbff5c..c132980b9f4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-10-01 Tom de Vries + + * tree-cfg.c (dump_function_to_file): Dump function attributes using + __attribute__(()) string. Move dumping of function attributes to before + function name. + 2015-10-01 Lynn Boger PR target/66870 diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index e06ee28ab79..735ac463851 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -72,6 +72,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-cfgcleanup.h" #include "wide-int-print.h" #include "gimplify.h" +#include "attribs.h" /* This file contains functions for building the Control Flow Graph (CFG) for a function tree. */ @@ -7352,6 +7353,30 @@ dump_function_to_file (tree fndecl, FILE *file, int flags) && decl_is_tm_clone (fndecl)); struct function *fun = DECL_STRUCT_FUNCTION (fndecl); + if (DECL_ATTRIBUTES (fndecl) != NULL_TREE) + { + fprintf (file, "__attribute__(("); + + bool first = true; + tree chain; + for (chain = DECL_ATTRIBUTES (fndecl); chain; + first = false, chain = TREE_CHAIN (chain)) + { + if (!first) + fprintf (file, ", "); + + print_generic_expr (file, get_attribute_name (chain), dump_flags); + if (TREE_VALUE (chain) != NULL_TREE) + { + fprintf (file, " ("); + print_generic_expr (file, TREE_VALUE (chain), dump_flags); + fprintf (file, ")"); + } + } + + fprintf (file, "))\n"); + } + current_function_decl = fndecl; fprintf (file, "%s %s(", function_name (fun), tmclone ? "[tm-clone] " : ""); @@ -7369,13 +7394,6 @@ dump_function_to_file (tree fndecl, FILE *file, int flags) } fprintf (file, ")\n"); - if (DECL_ATTRIBUTES (fndecl) != NULL_TREE) - { - fprintf (file, "[ "); - print_generic_expr (file, DECL_ATTRIBUTES (fndecl), dump_flags); - fprintf (file, "]\n"); - } - if (flags & TDF_VERBOSE) print_node (file, "", fndecl, 2);