Make make_errors.go -reset reproducible.
Change-Id: I71114e26149d66acc9f9c66464b8a2a64a59cadc
Reviewed-on: https://boringssl-review.googlesource.com/3381
Reviewed-by: Adam Langley <agl@google.com>
diff --git a/util/make_errors.go b/util/make_errors.go
index cd7c8dd..d1e5438 100644
--- a/util/make_errors.go
+++ b/util/make_errors.go
@@ -319,17 +319,24 @@
max++
+ // Sort the keys, so this script is reproducible.
+ keys := make([]string, 0, len(assignments))
for key, value := range assignments {
if value == -1 {
- if reserved >= 0 && max >= reserved {
- // If this happens, try passing
- // -reset. Otherwise bump up reservedReasonCode.
- panic("Automatically-assigned values exceeded limit!")
- }
- assignments[key] = max
- max++
+ keys = append(keys, key)
}
}
+ sort.Strings(keys)
+
+ for _, key := range keys {
+ if reserved >= 0 && max >= reserved {
+ // If this happens, try passing -reset. Otherwise bump
+ // up reservedReasonCode.
+ panic("Automatically-assigned values exceeded limit!")
+ }
+ assignments[key] = max
+ max++
+ }
}
func handleDeclareMacro(line, join, macroName string, m map[string]int) {