public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix warning in adaint.c
@ 2016-01-15 20:04 Jakub Jelinek
  2016-01-15 20:09 ` Arnaud Charlet
  0 siblings, 1 reply; 4+ messages in thread
From: Jakub Jelinek @ 2016-01-15 20:04 UTC (permalink / raw)
  To: Arnaud Charlet; +Cc: gcc-patches

Hi!

I've noticed
../../gcc/ada/adaint.c: In function 'char* __gnat_locate_exec_on_path(char*)':
../../gcc/ada/adaint.c:2799:34: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
   if (path_val == NULL) path_val = "";
                                  ^
warning, fixed thusly.
Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2016-01-15  Jakub Jelinek  <jakub@redhat.com>

	* adaint.c (__gnat_locate_exec_on_path): Use const char * instead
	of char * for path_val to avoid warnings.

--- gcc/ada/adaint.c.jj	2015-11-18 11:19:23.412735554 +0100
+++ gcc/ada/adaint.c	2016-01-15 14:23:31.029079447 +0100
@@ -2791,7 +2791,7 @@ __gnat_locate_exec_on_path (char *exec_n
   WS2SC (apath_val, wapath_val, EXPAND_BUFFER_SIZE);
 
 #else
-  char *path_val = getenv ("PATH");
+  const char *path_val = getenv ("PATH");
 
   /* If PATH is not defined, proceed with __gnat_locate_exec anyway, so we can
      find files that contain directory names.  */

	Jakub

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix warning in adaint.c
  2016-01-15 20:04 [PATCH] Fix warning in adaint.c Jakub Jelinek
@ 2016-01-15 20:09 ` Arnaud Charlet
  2016-01-17 17:51   ` [PATCH] Another warning fix " Jakub Jelinek
  0 siblings, 1 reply; 4+ messages in thread
From: Arnaud Charlet @ 2016-01-15 20:09 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches

> I've noticed
> ../../gcc/ada/adaint.c: In function 'char*
> __gnat_locate_exec_on_path(char*)':
> ../../gcc/ada/adaint.c:2799:34: warning: deprecated conversion from
> string constant to 'char*' [-Wwrite-strings]
>    if (path_val == NULL) path_val = "";
>                                   ^
> warning, fixed thusly.
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

OK, thanks.

> 2016-01-15  Jakub Jelinek  <jakub@redhat.com>
> 
> 	* adaint.c (__gnat_locate_exec_on_path): Use const char * instead
> 	of char * for path_val to avoid warnings.
> 
> --- gcc/ada/adaint.c.jj	2015-11-18 11:19:23.412735554 +0100
> +++ gcc/ada/adaint.c	2016-01-15 14:23:31.029079447 +0100
> @@ -2791,7 +2791,7 @@ __gnat_locate_exec_on_path (char *exec_n
>    WS2SC (apath_val, wapath_val, EXPAND_BUFFER_SIZE);
>  
>  #else
> -  char *path_val = getenv ("PATH");
> +  const char *path_val = getenv ("PATH");
>  
>    /* If PATH is not defined, proceed with __gnat_locate_exec anyway, so we
>    can
>       find files that contain directory names.  */
> 
> 	Jakub
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] Another warning fix in adaint.c
  2016-01-15 20:09 ` Arnaud Charlet
@ 2016-01-17 17:51   ` Jakub Jelinek
  2016-01-17 17:56     ` Arnaud Charlet
  0 siblings, 1 reply; 4+ messages in thread
From: Jakub Jelinek @ 2016-01-17 17:51 UTC (permalink / raw)
  To: Arnaud Charlet; +Cc: gcc-patches

Hi!

Following patch fixes another warning in adaint.c:
../../gcc/ada/adaint.c: In function 'void __gnat_killprocesstree(int, int)':
../../gcc/ada/adaint.c:3284:26: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
   while (d = readdir (dir))
                          ^

Bootstrapped/regtested on x86_64-linux, ok for trunk?

2016-01-17  Jakub Jelinek  <jakub@redhat.com>

	* adaint.c (__gnat_killprocesstree): Avoid -Wparentheses warning.

--- gcc/ada/adaint.c.jj	2016-01-15 21:15:09.000000000 +0100
+++ gcc/ada/adaint.c	2016-01-16 10:32:44.133293832 +0100
@@ -3281,7 +3281,7 @@ void __gnat_killprocesstree (int pid, in
 
   /* kill child processes first */
 
-  while (d = readdir (dir))
+  while ((d = readdir (dir)) != NULL)
     {
       if ((d->d_type & DT_DIR) == DT_DIR)
         {


	Jakub

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Another warning fix in adaint.c
  2016-01-17 17:51   ` [PATCH] Another warning fix " Jakub Jelinek
@ 2016-01-17 17:56     ` Arnaud Charlet
  0 siblings, 0 replies; 4+ messages in thread
From: Arnaud Charlet @ 2016-01-17 17:56 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches

> Following patch fixes another warning in adaint.c:
> ../../gcc/ada/adaint.c: In function 'void
> __gnat_killprocesstree(int, int)':
> ../../gcc/ada/adaint.c:3284:26: warning: suggest parentheses around
> assignment used as truth value [-Wparentheses]
>    while (d = readdir (dir))
>                           ^
> 
> Bootstrapped/regtested on x86_64-linux, ok for trunk?

Yes, thanks.

> 2016-01-17  Jakub Jelinek  <jakub@redhat.com>
> 
> 	* adaint.c (__gnat_killprocesstree): Avoid -Wparentheses warning.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-01-17 17:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-15 20:04 [PATCH] Fix warning in adaint.c Jakub Jelinek
2016-01-15 20:09 ` Arnaud Charlet
2016-01-17 17:51   ` [PATCH] Another warning fix " Jakub Jelinek
2016-01-17 17:56     ` Arnaud Charlet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).