1
0
mirror of https://github.com/golang/go synced 2024-11-23 05:30:07 -07:00

gc: abort if given an unknown debug (-d) flag

The check for unknown command line debug flags in gc was
incorrect: the loop over debugtab terminates when it reaches a
nil entry, but it was only reporting an error if the parser
had passed the last entry of debugtab (which it never did).
Fix this by reporting the usage error if the loop reaches a
nil entry.

LGTM=rsc
R=rsc
CC=golang-codereviews
https://golang.org/cl/166110043
This commit is contained in:
Austin Clements 2014-11-04 09:43:37 -05:00
parent 182ec4395e
commit 516d9ef53b

View File

@ -344,8 +344,8 @@ main(int argc, char *argv[])
break;
}
}
if(j == nelem(debugtab))
fatal("unknown debug information -d '%s'\n", f[i]);
if(debugtab[j].name == nil)
sysfatal("unknown debug information -d '%s'\n", f[i]);
}
}