This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug bootstrap/33309] gcc.c:6236: error: passing argument 1 of 'xputenv' discards qualifiers from pointer target type
- From: "fxcoudert at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 5 Sep 2007 09:53:17 -0000
- Subject: [Bug bootstrap/33309] gcc.c:6236: error: passing argument 1 of 'xputenv' discards qualifiers from pointer target type
- References: <bug-33309-276@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #3 from fxcoudert at gcc dot gnu dot org 2007-09-05 09:53 -------
(In reply to comment #2)
> Another option would be to constify xputenv and use CONST_CAST on the argument
> passed to putenv.
Like this?
Index: gcc.c
===================================================================
--- gcc.c (revision 128046)
+++ gcc.c (working copy)
@@ -297,7 +297,7 @@ static void set_spec (const char *, cons
static struct compiler *lookup_compiler (const char *, size_t, const char *);
static char *build_search_list (const struct path_prefix *, const char *,
bool, bool);
-static void xputenv (char *);
+static void xputenv (const char *);
static void putenv_from_prefixes (const struct path_prefix *, const char *,
bool);
static int access_check (const char *, int);
@@ -2602,11 +2602,11 @@ add_to_obstack (char *path, void *data)
/* Add or change the value of an environment variable, outputting the
change to standard error if in verbose mode. */
static void
-xputenv (char *string)
+xputenv (const char *string)
{
if (verbose_flag)
notice ("%s\n", string);
- putenv (string);
+ putenv (CONST_CAST (string));
}
/* Build a list of search directories from PATHS.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33309