Make make_errors.go -reset reproducible.

Change-Id: I71114e26149d66acc9f9c66464b8a2a64a59cadc
Reviewed-on: https://boringssl-review.googlesource.com/3381
Reviewed-by: Adam Langley <agl@google.com>
This commit is contained in:
David Benjamin 2015-02-09 21:30:53 -05:00 committed by Adam Langley
parent e8fe46adf0
commit fc233962db

View File

@ -319,17 +319,24 @@ func assignNewValues(assignments map[string]int, reserved int) {
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) {