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>
diff --git a/crypto/fipsmodule/delocate.go b/crypto/fipsmodule/delocate.go
index 0a07f0f..aeee218 100644
--- a/crypto/fipsmodule/delocate.go
+++ b/crypto/fipsmodule/delocate.go
@@ -74,11 +74,18 @@
}
}
+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
// definition. If so, it returns the symbol and true. Otherwise it returns ""
// and false.
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] != '.' {
symbol := line[:len(line)-1]