[PATCH] Fix warning in adaint.c

Jakub Jelinek jakub@redhat.com
Fri Jan 15 20:04:00 GMT 2016


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



More information about the Gcc-patches mailing list