Skip to content

Commit e19027f

Browse files
committed
Cleanup.
1 parent d7314dd commit e19027f

File tree

1 file changed

+3
-48
lines changed

1 file changed

+3
-48
lines changed

shared/parser.go

Lines changed: 3 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,9 @@ func parse(argList []string) parserResult {
266266
"-dead_strip": {0, pr.warningLinkUnaryCallback}, //iam: tor does this. We lose the bitcode :-(
267267
}
268268

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

305-
/*
306-
var argPatterns = map[string]flagInfo{
307-
`^.+\.(c|cc|cpp|C|cxx|i|s|S|bc)$`: {0, pr.inputFileCallback},
308-
`^.+\.([fF](|[0-9][0-9]|or|OR|pp|PP))$`: {0, pr.inputFileCallback},
309-
`^.+\.(o|lo|So|so|po|a|dylib)$`: {0, pr.objectFileCallback},
310-
`^.+\.dylib(\.\d)+$`: {0, pr.objectFileCallback},
311-
`^.+\.(So|so)(\.\d)+$`: {0, pr.objectFileCallback},
312-
`^-(l|L).+$`: {0, pr.linkUnaryCallback},
313-
`^-I.+$`: {0, pr.compileUnaryCallback},
314-
`^-D.+$`: {0, pr.compileUnaryCallback},
315-
`^-B.+$`: {0, pr.compileLinkUnaryCallback},
316-
`^-isystem.+$`: {0, pr.compileLinkUnaryCallback},
317-
`^-U.+$`: {0, pr.compileUnaryCallback},
318-
//iam: need to be careful here, not mix up linker and warning flags.
319-
`^-Wl,.+$`: {0, pr.linkUnaryCallback},
320-
`^-W[^l].*$`: {0, pr.compileUnaryCallback},
321-
`^-W[l][^,].*$`: {0, pr.compileUnaryCallback}, //iam: tor has a few -Wl...
322-
`^-fsanitize=.+$`: {0, pr.compileLinkUnaryCallback},
323-
`^-f.+$`: {0, pr.compileUnaryCallback},
324-
`^-rtlib=.+$`: {0, pr.linkUnaryCallback},
325-
`^-std=.+$`: {0, pr.compileUnaryCallback},
326-
`^-stdlib=.+$`: {0, pr.compileLinkUnaryCallback},
327-
`^-mtune=.+$`: {0, pr.compileUnaryCallback},
328-
`^--sysroot=.+$`: {0, pr.compileLinkUnaryCallback}, //both compile and link time
329-
`^-print-prog-name=.*$`: {0, pr.compileUnaryCallback},
330-
`^-print-file-name=.*$`: {0, pr.compileUnaryCallback},
331-
`^-mmacosx-version-min=.+$`: {0, pr.compileLinkUnaryCallback},
332-
`^-mstack-alignment=.+$`: {0, pr.compileUnaryCallback}, //iam: linux kernel stuff
333-
`^-march=.+$`: {0, pr.compileUnaryCallback}, //iam: linux kernel stuff
334-
`^-mregparm=.+$`: {0, pr.compileUnaryCallback}, //iam: linux kernel stuff
335-
`^-mcmodel=.+$`: {0, pr.compileUnaryCallback}, //iam: linux kernel stuff
336-
`^-mpreferred-stack-boundary=.+$`: {0, pr.compileUnaryCallback}, //iam: linux kernel stuff
337-
`^-mindirect-branch=.+$`: {0, pr.compileUnaryCallback}, //iam: linux kernel stuff
338-
`^--param=.+$`: {0, pr.compileUnaryCallback}, //iam: linux kernel stuff
339-
`^-fuse-ld=.+$`: {0, pr.linkUnaryCallback}, //iam: musl stuff
340-
341-
}
342-
*/
343-
344308
for len(argList) > 0 {
345309
var elem = argList[0]
346310

@@ -364,15 +328,6 @@ func parse(argList []string) parserResult {
364328
break
365329
}
366330
}
367-
//for pattern, fi := range argPatterns {
368-
// var regExp = regexp.MustCompile(pattern)
369-
// if regExp.MatchString(elem) {
370-
// fi.handler(elem, argList[1:1+fi.arity])
371-
// listShift = fi.arity
372-
// matched = true
373-
// break
374-
// }
375-
//}
376331
if !matched {
377332
LogWarning("Did not recognize the compiler flag: %v\n", elem)
378333
pr.compileUnaryCallback(elem, argList[1:1])

0 commit comments

Comments
 (0)