This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH, nds32] Committed: Do not use nreverse() on DECL_ATTRIBUTES(current_function_decl)).


Hi,

I notice the implementation of nreverse() would change the original tree list.
It is not good if the argument is an attributes list of current function.
Since the rationale of using it, in nds32 port, is just to display the
attributes in the order that user specifies, I think it is ok not to use it
on attributes list.

Bootstrapped and tested on nds32le-elf and nds32be-elf.
Committed as Rev.207777.


Index: gcc/ChangeLog
===================================================================
--- gcc/ChangeLog       (revision 207776)
+++ gcc/ChangeLog       (revision 207777)
@@ -1,5 +1,10 @@
 2014-02-14  Chung-Ju Wu  <jasonwucj@gmail.com>

+       * config/nds32/nds32.c (nds32_asm_function_prologue): Do not use
+       nreverse() because it changes the content of original tree list.
+
+2014-02-14  Chung-Ju Wu  <jasonwucj@gmail.com>
+
        * config/nds32/t-mlibs (MULTILIB_OPTIONS): Fix typo in comment.
        * config/nds32/nds32.c (nds32_merge_decl_attributes): Likewise.


Index: gcc/config/nds32/nds32.c
===================================================================
--- gcc/config/nds32/nds32.c    (revision 207776)
+++ gcc/config/nds32/nds32.c    (revision 207777)
@@ -1960,10 +1960,9 @@

   /* Display the attributes of this function.  */
   fprintf (file, "\t! function attributes: ");
-  /* GCC build attributes list with reverse order,
-     so we use nreverse() to make it looks like
-     the order that user specifies.  */
-  attrs = nreverse (DECL_ATTRIBUTES (current_function_decl));
+  /* Get the attributes tree list.
+     Note that GCC builds attributes list with reverse order.  */
+  attrs = DECL_ATTRIBUTES (current_function_decl);

   /* If there is no any attribute, print out "None".  */
   if (!attrs)


Best regards,
jasonwucj


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]