[patch] sim: add const markings to env string

Mike Frysinger vapier@gentoo.org
Sat Apr 10 07:57:00 GMT 2010


The sim-options code assigns a const string to "char *" in decoding the 
current environment settings, and only uses it to pass to a printf.  GCC 
outputs the warnings:
common/sim-options.c: In function 'standard_option_handler':
common/sim-options.c:271: warning: assignment discards qualifiers from pointer 
target type
common/sim-options.c:272: warning: assignment discards qualifiers from pointer 
target type
common/sim-options.c:273: warning: assignment discards qualifiers from pointer 
target type

So I've committed this as "obvious".
-mike

2010-04-10  Mike Frysinger  <vapier@gentoo.org>

	* sim-options.c (standard_option_handler): Add const markings to
	local "type" var.

RCS file: /cvs/src/src/sim/common/sim-options.c,v
retrieving revision 1.16
diff -u -p -r1.16 sim-options.c
--- sim/common/sim-options.c	30 Mar 2010 19:43:42 -0000	1.16
+++ sim/common/sim-options.c	10 Apr 2010 07:32:19 -0000
@@ -265,7 +265,7 @@ standard_option_handler (SIM_DESC sd, si
       if (WITH_ENVIRONMENT != ALL_ENVIRONMENT
 	  && WITH_ENVIRONMENT != STATE_ENVIRONMENT (sd))
 	{
-	  char *type;
+	  const char *type;
 	  switch (WITH_ENVIRONMENT)
 	    {
 	    case USER_ENVIRONMENT: type = "user"; break;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20100410/8c7ba34b/attachment.sig>


More information about the Gdb-patches mailing list