diff mbox

Fix warning in adaint.c

Message ID 20160115200436.GE3017@tucnak.redhat.com
State New
Headers show

Commit Message

Jakub Jelinek Jan. 15, 2016, 8:04 p.m. UTC
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.


	Jakub

Comments

Arnaud Charlet Jan. 15, 2016, 8:09 p.m. UTC | #1
> 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
>
diff mbox

Patch

--- 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.  */