Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions tools/allocscompilerwrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,9 @@ def main(self):
del os.environ["CC"]
self.debugMsg(sys.argv[0] + " called with args " + " ".join(sys.argv) + "\n")

if self.onlyPreprocessing():
self.debugMsg("We are only preprocessing, so we won't do anything liballocs-related.")

if Phase.LINK in self.enabledPhases:
self.debugMsg("We are a link command\n")
else:
Expand Down
4 changes: 4 additions & 0 deletions tools/compilerwrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,10 @@ def printErrors(self, errfile):

# the phase options themselves
phaseOptions = [dict({}) for n in range(Phase.DRIVER, 1+Phase.LINK)]

# Report whether we're doing anything other than preprocessing
def onlyPreprocessing(self):
return self.enabledPhases == {Phase.PREPROCESS}

# What do we do with '--' or equivalents?
# It *is* still necessary, and part of "items", because some "options" are actually "options"
Expand Down
15 changes: 14 additions & 1 deletion tools/lang/c/bin/allocscc
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ class AllocsCC(AllocsCompilerWrapper):
return ["free(P)"]

def getCustomCompileArgs(self):
if self.onlyPreprocessing():
return []
# "-pipe" interferes with -save-temps, with disastrous conseqeunces
# trying to create files named "-.i", "-.s" which then get interpreted
# as command-line options.
Expand Down Expand Up @@ -74,7 +76,7 @@ class AllocsCC(AllocsCompilerWrapper):
def getIncludeArgs(self, sourceFiles):
return ["-include", \
REAL_DIR + "/../../../../include/liballocs_cil_inlines.h"] \
if len(sourceFiles) > 0 and self.areAllSourceFilesC(sourceFiles) else []
if len(sourceFiles) > 0 and self.areAllSourceFilesC(sourceFiles) and not self.onlyPreprocessing() else []

def getCillyArgs(self, sourceFiles):
allSourceFilesAreC = self.areAllSourceFilesC(sourceFiles)
Expand All @@ -86,6 +88,11 @@ class AllocsCC(AllocsCompilerWrapper):
# Should fix this.
#"--load=%s" % (self.getLibAllocsBaseDir() + "tools/lang/c/dumpmemacc/dumpmemacc.cmxs"), \
# "--dodumpmemacc", \

# If we're only preprocessing (i.e. if -E is passed) we bypass cilly
# So, cilly arguments shouldn't be added...!
if self.onlyPreprocessing():
return []
return [
"--save-temps",
"--decil",
Expand All @@ -106,6 +113,12 @@ class AllocsCC(AllocsCompilerWrapper):
# silence them.

def getBasicCompilerCommand(self):
if self.onlyPreprocessing():
# TW: This should probably error if ALLOCSCC_CC isn't in environ, but for now...
if "ALLOCSCC_CC" in os.environ:
return [os.environ["ALLOCSCC_CC"]]
return ["cc"]

return [cilly_cmd] + \
(["--gcc=%s" % os.environ["ALLOCSCC_CC"]] if "ALLOCSCC_CC" in os.environ else [])

Expand Down