From 4b49bd47f464fb3fe31a943b913edb565fa68423 Mon Sep 17 00:00:00 2001 From: Steve Reinhardt Date: Wed, 31 Oct 2007 18:04:22 -0700 Subject: String constant const-ness changes to placate g++ 4.2. Also some bug fixes in MIPS ISA uncovered by g++ warnings (Python string compares don't work in C++!). --HG-- extra : convert_revision : b347cc0108f23890e9b73b3ee96059f0cea96cf6 --- src/base/hostinfo.cc | 2 +- src/base/hostinfo.hh | 2 +- src/base/inifile.cc | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) (limited to 'src/base') diff --git a/src/base/hostinfo.cc b/src/base/hostinfo.cc index 7cc07c11e..ef64feeb4 100644 --- a/src/base/hostinfo.cc +++ b/src/base/hostinfo.cc @@ -60,7 +60,7 @@ hostname() } uint64_t -procInfo(char *filename, char *target) +procInfo(const char *filename, const char *target) { int done = 0; char line[80]; diff --git a/src/base/hostinfo.hh b/src/base/hostinfo.hh index b6663ea69..70cd19203 100644 --- a/src/base/hostinfo.hh +++ b/src/base/hostinfo.hh @@ -37,7 +37,7 @@ std::string &hostname(); -uint64_t procInfo(char *filename, char *target); +uint64_t procInfo(const char *filename, const char *target); inline uint64_t memUsage() { return procInfo("/proc/self/status", "VmSize:"); } diff --git a/src/base/inifile.cc b/src/base/inifile.cc index 4d504d04f..809cbe172 100644 --- a/src/base/inifile.cc +++ b/src/base/inifile.cc @@ -111,7 +111,7 @@ IniFile::loadCPP(const string &file, vector &cppArgs) int arg_count = cppArgs.size(); - char **args = new char *[arg_count + 20]; + const char **args = new const char *[arg_count + 20]; int nextArg = 0; args[nextArg++] = "g++"; @@ -136,7 +136,9 @@ IniFile::loadCPP(const string &file, vector &cppArgs) if (dup2(tmp_fd, STDOUT_FILENO) == -1) exit(1); - execvp("g++", args); + // execvp signature is intentionally broken wrt const-ness for + // backwards compatibility... see man page + execvp("g++", const_cast(args)); exit(0); } -- cgit v1.2.3