diff mbox series

[ARM] Cast string pointers to int to avoid compiler warnings.

Message ID CAKdteOZKVZMeXZGQOaqj-Dz3MTj3maMi24iRu0e6f7u2M-MdNw@mail.gmail.com
State Accepted
Commit 3878d82a2b901f064e1f24b07520f2c38937c1f5
Headers show
Series [ARM] Cast string pointers to int to avoid compiler warnings. | expand

Commit Message

Christophe Lyon Oct. 1, 2018, 9:30 p.m. UTC
Hi,

While building newlib for ARM, I noticed that GCC complains about
implicit casts. This small patch makes them explicit, just like in
other parts of the same source file.

OK?

Christophe
commit e923f12ef309d1d79df7bc7c324966a9f647605b
Author: Christophe Lyon <christophe.lyon@linaro.org>
Date:   Mon Oct 1 17:22:43 2018 +0000

    [ARM] Cast string pointers to int to avoid compiler warnings.
    
    2018-10-01  Christophe Lyon  <christophe.lyon@linaro.org>
    
    	* newlib/libc/sys/arm/syscalls.c (_unlink): Cast 'path' to int.
    	(_system): Cast 's' to int.
    	(_rename): Cast 'newpath' and 'oldpath' to int.

Comments

Christophe Lyon Oct. 5, 2018, 9:19 a.m. UTC | #1
ping?

This is similar to what is done in other places in the same source file.
On Mon, 1 Oct 2018 at 23:30, Christophe Lyon <christophe.lyon@linaro.org> wrote:
>

> Hi,

>

> While building newlib for ARM, I noticed that GCC complains about

> implicit casts. This small patch makes them explicit, just like in

> other parts of the same source file.

>

> OK?

>

> Christophe
Richard Earnshaw (lists) Oct. 5, 2018, 11:02 a.m. UTC | #2
On 01/10/18 22:30, Christophe Lyon wrote:
> Hi,

> 

> While building newlib for ARM, I noticed that GCC complains about

> implicit casts. This small patch makes them explicit, just like in

> other parts of the same source file.

> 

> OK?

> 

> Christophe

> 

> 

> newlib-3.txt

> 

> 

> commit e923f12ef309d1d79df7bc7c324966a9f647605b

> Author: Christophe Lyon <christophe.lyon@linaro.org>

> Date:   Mon Oct 1 17:22:43 2018 +0000

> 

>     [ARM] Cast string pointers to int to avoid compiler warnings.

>     

>     2018-10-01  Christophe Lyon  <christophe.lyon@linaro.org>

>     

>     	* newlib/libc/sys/arm/syscalls.c (_unlink): Cast 'path' to int.

>     	(_system): Cast 's' to int.

>     	(_rename): Cast 'newpath' and 'oldpath' to int.


I was about to moan that you hadn't updated the copy in libgloss.  But
then I saw that it already had the same patch...

Pushed.

R.

> 

> diff --git a/newlib/libc/sys/arm/syscalls.c b/newlib/libc/sys/arm/syscalls.c

> index 6d2ad79..d871464 100644

> --- a/newlib/libc/sys/arm/syscalls.c

> +++ b/newlib/libc/sys/arm/syscalls.c

> @@ -542,7 +542,7 @@ _unlink (const char *path __attribute__ ((unused)))

>  {

>  #ifdef ARM_RDI_MONITOR

>    int block[2];

> -  block[0] = path;

> +  block[0] = (int) path;

>    block[1] = strlen(path);

>    return wrap (do_AngelSWI (AngelSWI_Reason_Remove, block)) ? -1 : 0;

>  #else

> @@ -635,7 +635,7 @@ _system (const char *s)

>       meaning to its return value.  Try to do something reasonable....  */

>    if (!s)

>      return 1;  /* maybe there is a shell available? we can hope. :-P */

> -  block[0] = s;

> +  block[0] = (int) s;

>    block[1] = strlen (s);

>    e = wrap (do_AngelSWI (AngelSWI_Reason_System, block));

>    if ((e >= 0) && (e < 256))

> @@ -662,9 +662,9 @@ _rename (const char * oldpath, const char * newpath)

>  {

>  #ifdef ARM_RDI_MONITOR

>    int block[4];

> -  block[0] = oldpath;

> +  block[0] = (int) oldpath;

>    block[1] = strlen(oldpath);

> -  block[2] = newpath;

> +  block[2] = (int) newpath;

>    block[3] = strlen(newpath);

>    return wrap (do_AngelSWI (AngelSWI_Reason_Rename, block)) ? -1 : 0;

>  #else

>
diff mbox series

Patch

diff --git a/newlib/libc/sys/arm/syscalls.c b/newlib/libc/sys/arm/syscalls.c
index 6d2ad79..d871464 100644
--- a/newlib/libc/sys/arm/syscalls.c
+++ b/newlib/libc/sys/arm/syscalls.c
@@ -542,7 +542,7 @@  _unlink (const char *path __attribute__ ((unused)))
 {
 #ifdef ARM_RDI_MONITOR
   int block[2];
-  block[0] = path;
+  block[0] = (int) path;
   block[1] = strlen(path);
   return wrap (do_AngelSWI (AngelSWI_Reason_Remove, block)) ? -1 : 0;
 #else
@@ -635,7 +635,7 @@  _system (const char *s)
      meaning to its return value.  Try to do something reasonable....  */
   if (!s)
     return 1;  /* maybe there is a shell available? we can hope. :-P */
-  block[0] = s;
+  block[0] = (int) s;
   block[1] = strlen (s);
   e = wrap (do_AngelSWI (AngelSWI_Reason_System, block));
   if ((e >= 0) && (e < 256))
@@ -662,9 +662,9 @@  _rename (const char * oldpath, const char * newpath)
 {
 #ifdef ARM_RDI_MONITOR
   int block[4];
-  block[0] = oldpath;
+  block[0] = (int) oldpath;
   block[1] = strlen(oldpath);
-  block[2] = newpath;
+  block[2] = (int) newpath;
   block[3] = strlen(newpath);
   return wrap (do_AngelSWI (AngelSWI_Reason_Rename, block)) ? -1 : 0;
 #else