From 985744ecc606211cb165e231a24a27b7e7835494 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Mon, 19 Apr 2010 15:55:10 +0000 Subject: [PATCH] Fix -Wcast-qual warnings. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101782 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/System/Unix/Program.inc | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/System/Unix/Program.inc b/lib/System/Unix/Program.inc index 47afe52f51d..358415f5266 100644 --- a/lib/System/Unix/Program.inc +++ b/lib/System/Unix/Program.inc @@ -206,14 +206,15 @@ Program::Execute(const Path &path, const char **args, const char **envp, if (!envp) #if !defined(__APPLE__) - envp = (const char**)environ; + envp = const_cast(environ); #else - envp = (const char**)*_NSGetEnviron(); // environ is missing in dylibs. + // environ is missing in dylibs. + envp = const_cast(*_NSGetEnviron()); #endif pid_t PID; - int Err = posix_spawn(&PID, path.c_str(), &FileActions, - /*attrp*/0, (char**)args, (char**)envp); + int Err = posix_spawn(&PID, path.c_str(), &FileActions, /*attrp*/0, + const_cast(args), const_cast(envp)); posix_spawn_file_actions_destroy(&FileActions); @@ -268,9 +269,12 @@ Program::Execute(const Path &path, const char **args, const char **envp, // Execute! if (envp != 0) - execve(path.c_str(), (char**)args, (char**)envp); + execve(path.c_str(), + const_cast(args), + const_cast(envp)); else - execv(path.c_str(), (char**)args); + execv(path.c_str(), + const_cast(args)); // If the execve() failed, we should exit. Follow Unix protocol and // return 127 if the executable was not found, and 126 otherwise. // Use _exit rather than exit so that atexit functions and static