This is the mail archive of the binutils-cvs@sourceware.org mailing list for the binutils 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]

[binutils-gdb] tc-i960.c: add some casts when assigning literals to args[i]


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=e2c7dcae81a7da1353b7c3d5db210fca479c9c4c

commit e2c7dcae81a7da1353b7c3d5db210fca479c9c4c
Author: Trevor Saunders <tbsaunde+binutils@tbsaunde.org>
Date:   Thu Mar 24 07:52:39 2016 -0400

    tc-i960.c: add some casts when assigning literals to args[i]
    
    parse_ldconst () takes a char ** as a in / out argument, and sometimes points
    args[0] to a constant string.  Then in some cases after parse_ldconst ()
         returns md_assemble () twiddles the contents of arg[0].  So it seems like
         it would take some work to avoid these casts, and its not really clear
         that work is worth it.
    
    gas/ChangeLog:
    
    2016-03-31  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>
    
    	* config/tc-i960.c (parse_ldconst): Cast to char * when assigning to
    	args[0].

Diff:
---
 gas/ChangeLog        |  5 +++++
 gas/config/tc-i960.c | 16 ++++++++--------
 2 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/gas/ChangeLog b/gas/ChangeLog
index ba3eeab..90ed4ae 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,5 +1,10 @@
 2016-03-31  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>
 
+	* config/tc-i960.c (parse_ldconst): Cast to char * when assigning to
+	args[0].
+
+2016-03-31  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>
+
 	* config/tc-m32c.c (m32c_md_end): cast the argument to md_assemble to
 	char *.
 	(m32c_indirect_operand): Likewise.
diff --git a/gas/config/tc-i960.c b/gas/config/tc-i960.c
index 45e8a44..667ab4c 100644
--- a/gas/config/tc-i960.c
+++ b/gas/config/tc-i960.c
@@ -1246,7 +1246,7 @@ parse_ldconst (char *arg[])	/* See above.  */
     {
     default:
       /* We're dependent on one or more symbols -- use "lda".  */
-      arg[0] = "lda";
+      arg[0] = (char *) "lda";
       break;
 
     case O_constant:
@@ -1263,26 +1263,26 @@ parse_ldconst (char *arg[])	/* See above.  */
                 lda xxx,<reg>.  */
       n = offs (e);
       if ((0 <= n) && (n <= 31))
-	arg[0] = "mov";
+	arg[0] = (char *) "mov";
       else if ((-31 <= n) && (n <= -1))
 	{
-	  arg[0] = "subo";
+	  arg[0] = (char *) "subo";
 	  arg[3] = arg[2];
 	  sprintf (buf, "%d", -n);
 	  arg[1] = buf;
-	  arg[2] = "0";
+	  arg[2] = (char *) "0";
 	}
       else if ((32 <= n) && (n <= 62))
 	{
-	  arg[0] = "addo";
+	  arg[0] = (char *) "addo";
 	  arg[3] = arg[2];
-	  arg[1] = "31";
+	  arg[1] = (char *) "31";
 	  sprintf (buf, "%d", n - 31);
 	  arg[2] = buf;
 	}
       else if ((shift = shift_ok (n)) != 0)
 	{
-	  arg[0] = "shlo";
+	  arg[0] = (char *) "shlo";
 	  arg[3] = arg[2];
 	  sprintf (buf, "%d", shift);
 	  arg[1] = buf;
@@ -1290,7 +1290,7 @@ parse_ldconst (char *arg[])	/* See above.  */
 	  arg[2] = buf2;
 	}
       else
-	arg[0] = "lda";
+	arg[0] = (char *) "lda";
       break;
 
     case O_illegal:


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