Skip to content

Commit

Permalink
Cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
ianamason committed Jan 4, 2019
1 parent d7314dd commit e19027f
Showing 1 changed file with 3 additions and 48 deletions.
51 changes: 3 additions & 48 deletions shared/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,9 @@ func parse(argList []string) parserResult {
"-dead_strip": {0, pr.warningLinkUnaryCallback}, //iam: tor does this. We lose the bitcode :-(
}

// iam: this is a list because matching needs to be done in order.
// if you add a NEW pattern; make sure it is befor any existing pattern that also
// matches and has a conflicting flagInfo value.
var argPatterns = [...]argPattern{
{`^.+\.(c|cc|cpp|C|cxx|i|s|S|bc)$`, flagInfo{0, pr.inputFileCallback}},
{`^.+\.([fF](|[0-9][0-9]|or|OR|pp|PP))$`, flagInfo{0, pr.inputFileCallback}},
Expand Down Expand Up @@ -302,45 +305,6 @@ func parse(argList []string) parserResult {
{`^--param=.+$`, flagInfo{0, pr.compileUnaryCallback}}, //iam: linux kernel stuff
}

/*
var argPatterns = map[string]flagInfo{
`^.+\.(c|cc|cpp|C|cxx|i|s|S|bc)$`: {0, pr.inputFileCallback},
`^.+\.([fF](|[0-9][0-9]|or|OR|pp|PP))$`: {0, pr.inputFileCallback},
`^.+\.(o|lo|So|so|po|a|dylib)$`: {0, pr.objectFileCallback},
`^.+\.dylib(\.\d)+$`: {0, pr.objectFileCallback},
`^.+\.(So|so)(\.\d)+$`: {0, pr.objectFileCallback},
`^-(l|L).+$`: {0, pr.linkUnaryCallback},
`^-I.+$`: {0, pr.compileUnaryCallback},
`^-D.+$`: {0, pr.compileUnaryCallback},
`^-B.+$`: {0, pr.compileLinkUnaryCallback},
`^-isystem.+$`: {0, pr.compileLinkUnaryCallback},
`^-U.+$`: {0, pr.compileUnaryCallback},
//iam: need to be careful here, not mix up linker and warning flags.
`^-Wl,.+$`: {0, pr.linkUnaryCallback},
`^-W[^l].*$`: {0, pr.compileUnaryCallback},
`^-W[l][^,].*$`: {0, pr.compileUnaryCallback}, //iam: tor has a few -Wl...
`^-fsanitize=.+$`: {0, pr.compileLinkUnaryCallback},
`^-f.+$`: {0, pr.compileUnaryCallback},
`^-rtlib=.+$`: {0, pr.linkUnaryCallback},
`^-std=.+$`: {0, pr.compileUnaryCallback},
`^-stdlib=.+$`: {0, pr.compileLinkUnaryCallback},
`^-mtune=.+$`: {0, pr.compileUnaryCallback},
`^--sysroot=.+$`: {0, pr.compileLinkUnaryCallback}, //both compile and link time
`^-print-prog-name=.*$`: {0, pr.compileUnaryCallback},
`^-print-file-name=.*$`: {0, pr.compileUnaryCallback},
`^-mmacosx-version-min=.+$`: {0, pr.compileLinkUnaryCallback},
`^-mstack-alignment=.+$`: {0, pr.compileUnaryCallback}, //iam: linux kernel stuff
`^-march=.+$`: {0, pr.compileUnaryCallback}, //iam: linux kernel stuff
`^-mregparm=.+$`: {0, pr.compileUnaryCallback}, //iam: linux kernel stuff
`^-mcmodel=.+$`: {0, pr.compileUnaryCallback}, //iam: linux kernel stuff
`^-mpreferred-stack-boundary=.+$`: {0, pr.compileUnaryCallback}, //iam: linux kernel stuff
`^-mindirect-branch=.+$`: {0, pr.compileUnaryCallback}, //iam: linux kernel stuff
`^--param=.+$`: {0, pr.compileUnaryCallback}, //iam: linux kernel stuff
`^-fuse-ld=.+$`: {0, pr.linkUnaryCallback}, //iam: musl stuff
}
*/

for len(argList) > 0 {
var elem = argList[0]

Expand All @@ -364,15 +328,6 @@ func parse(argList []string) parserResult {
break
}
}
//for pattern, fi := range argPatterns {
// var regExp = regexp.MustCompile(pattern)
// if regExp.MatchString(elem) {
// fi.handler(elem, argList[1:1+fi.arity])
// listShift = fi.arity
// matched = true
// break
// }
//}
if !matched {
LogWarning("Did not recognize the compiler flag: %v\n", elem)
pr.compileUnaryCallback(elem, argList[1:1])
Expand Down

0 comments on commit e19027f

Please sign in to comment.