changeset 65b27e939646 in /z/repo/m5
details: http://repo.m5sim.org/m5?cmd=changeset;node=65b27e939646
description:
        inifile: Whack preprocessor access.
        We haven't used the preprocessor feature of the inifile stuff in a
        very long time, so let's get rid of it since it would otherwise take
        effort to maintain.

diffstat:

2 files changed, 12 deletions(-)
src/base/inifile.cc |    8 --------
src/base/inifile.hh |    4 ----

diffs (148 lines):

diff -r 3af77710f397 -r 65b27e939646 src/base/inifile.cc
--- a/src/base/inifile.cc       Wed Sep 10 14:26:15 2008 -0400
+++ b/src/base/inifile.cc       Fri Sep 19 09:11:40 2008 -0700
@@ -29,22 +29,8 @@
  *          Steve Reinhardt
  */
 
-#define USE_CPP
-
-#ifdef USE_CPP
-#include <sys/signal.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-
-#include <libgen.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#endif
-
 #include <fstream>
 #include <iostream>
-
 #include <vector>
 #include <string>
 
@@ -66,103 +52,6 @@
         ++i;
     }
 }
-
-
-#ifdef USE_CPP
-bool
-IniFile::loadCPP(const string &file, vector<char *> &cppArgs)
-{
-    // Open the file just to verify that we can.  Otherwise if the
-    // file doesn't exist or has bad permissions the user will get
-    // confusing errors from cpp/g++.
-    ifstream tmpf(file.c_str());
-
-    if (!tmpf.is_open())
-        return false;
-
-    tmpf.close();
-
-    char *cfile = strncpy(new char[file.size() + 1], file.c_str(),
-                          file.size());
-    char *dir = dirname(cfile);
-    char *dir_arg = NULL;
-    if (*dir != '.') {
-        string arg = "-I";
-        arg += dir;
-
-        dir_arg = new char[arg.size() + 1];
-        strncpy(dir_arg, arg.c_str(), arg.size());
-    }
-
-    delete [] cfile;
-
-    char tempfile[] = "/tmp/configXXXXXX";
-    int tmp_fd = mkstemp(tempfile);
-
-    int pid = fork();
-
-    if (pid == -1)
-        return false;
-
-    if (pid == 0) {
-        char filename[FILENAME_MAX];
-        string::size_type i = file.copy(filename, sizeof(filename) - 1);
-        filename[i] = '\0';
-
-        int arg_count = cppArgs.size();
-
-        const char **args = new const char *[arg_count + 20];
-
-        int nextArg = 0;
-        args[nextArg++] = "g++";
-        args[nextArg++] = "-E";
-        args[nextArg++] = "-P";
-        args[nextArg++] = "-nostdinc";
-        args[nextArg++] = "-nostdinc++";
-        args[nextArg++] = "-x";
-        args[nextArg++] = "c++";
-        args[nextArg++] = "-undef";
-
-        for (int i = 0; i < arg_count; i++)
-            args[nextArg++] = cppArgs[i];
-
-        if (dir_arg)
-            args[nextArg++] = dir_arg;
-
-        args[nextArg++] = filename;
-        args[nextArg++] = NULL;
-
-        close(STDOUT_FILENO);
-        if (dup2(tmp_fd, STDOUT_FILENO) == -1)
-            exit(1);
-
-        // execvp signature is intentionally broken wrt const-ness for
-        // backwards compatibility... see man page
-        execvp("g++", const_cast<char * const *>(args));
-
-        exit(0);
-    }
-
-    int retval;
-    waitpid(pid, &retval, 0);
-
-    delete [] dir_arg;
-
-    // check for normal completion of CPP
-    if (!WIFEXITED(retval) || WEXITSTATUS(retval) != 0)
-        return false;
-
-    close(tmp_fd);
-
-    bool status = false;
-
-    status = load(tempfile);
-
-    unlink(tempfile);
-
-    return status;
-}
-#endif
 
 bool
 IniFile::load(const string &file)
diff -r 3af77710f397 -r 65b27e939646 src/base/inifile.hh
--- a/src/base/inifile.hh       Wed Sep 10 14:26:15 2008 -0400
+++ b/src/base/inifile.hh       Fri Sep 19 09:11:40 2008 -0700
@@ -167,14 +167,6 @@
     /// @retval True if successful, false if errors were encountered.
     bool load(std::istream &f);
 
-    /// Load the specified file, passing it through the C preprocessor.
-    /// Parameter settings found in the file will be merged with any
-    /// already defined in this object.
-    /// @param file The path of the file to load.
-    /// @param cppFlags Vector of extra flags to pass to cpp.
-    /// @retval True if successful, false if errors were encountered.
-    bool loadCPP(const std::string &file, std::vector<char *> &cppFlags);
-
     /// Load the specified file.
     /// Parameter settings found in the file will be merged with any
     /// already defined in this object.
_______________________________________________
m5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/m5-dev

Reply via email to