Don't get confused by comments when recognising symbol definitions.

Change-Id: I7550beef400478913336aef62107024e499f075b
Reviewed-on: https://boringssl-review.googlesource.com/15346
Reviewed-by: Adam Langley <agl@google.com>
This commit is contained in:
Adam Langley 2017-04-21 09:37:36 -07:00
parent 518ba0772b
commit 08c9b84410

View File

@ -74,11 +74,18 @@ func main() {
} }
} }
func removeComment(line string) string {
if i := strings.Index(line, "#"); i != -1 {
return line[:i]
}
return line
}
// isSymbolDef returns detects whether line contains a (non-local) symbol // isSymbolDef returns detects whether line contains a (non-local) symbol
// definition. If so, it returns the symbol and true. Otherwise it returns "" // definition. If so, it returns the symbol and true. Otherwise it returns ""
// and false. // and false.
func isSymbolDef(line string) (string, bool) { func isSymbolDef(line string) (string, bool) {
line = strings.TrimSpace(line) line = strings.TrimSpace(removeComment(line))
if len(line) > 0 && line[len(line)-1] == ':' && line[0] != '.' { if len(line) > 0 && line[len(line)-1] == ':' && line[0] != '.' {
symbol := line[:len(line)-1] symbol := line[:len(line)-1]