# HG changeset patch # User Rob Landley # Date 1453052507 21600 # Node ID 47fe4b7798136110cdbb65be3999cd673bf880e7 # Parent 60ca4cb1ba55d41a2f97353a09b2aefcbf1e02d7 Patch from Tristan Van Berkom to fix bug preventing ccwrap calling raw++ for g++ diff -r 60ca4cb1ba55 -r 47fe4b779813 sources/toys/ccwrap.c --- a/sources/toys/ccwrap.c Mon Jan 11 17:37:20 2016 -0600 +++ b/sources/toys/ccwrap.c Sun Jan 17 11:41:47 2016 -0600 @@ -157,7 +157,7 @@ // Read the command line arguments and work out status int main(int argc, char *argv[]) { - char *topdir, *ccprefix, *dynlink, *cc, *temp, **keepv, **hdr, **outv; + char *topdir, *ccprefix, *dynlink, *cc = 0, *temp, **keepv, **hdr, **outv; int i, keepc, srcfiles, flags, outc; struct dlist *libs = 0; @@ -237,7 +237,7 @@ } // We want to strip off the bin/ but the path we followed can end with // a symlink, so append .. instead. - strcpy(++temp, ".."); + strcpy(++temp, "/.."); topdir = realpath(topdir, 0); // Add our binary's directory and the tools directory to $PATH so gcc's @@ -252,11 +252,11 @@ // Override header/library search path with environment variable? temp = getenv("CCWRAP_TOPDIR"); if (!temp) { - cc = xmprintf("%sCCWRAP_TOPDIR", ccprefix); + char *icc = xmprintf("%sCCWRAP_TOPDIR", ccprefix); - for (i=0; cc[i]; i++) if (cc[i] == '-') cc[i]='_'; - temp = getenv(cc); - free(cc); + for (i=0; icc[i]; i++) if (icc[i] == '-') icc[i]='_'; + temp = getenv(icc); + free(icc); } if (temp) { free(topdir); @@ -264,7 +264,7 @@ } // Name of the C compiler we're wrapping. - cc = getenv("CCWRAP_CC"); + if (!cc) cc = getenv("CCWRAP_CC"); if (!cc) cc = "rawcc"; // Does toolchain have a shared libcc?