A bindings gap stops a build, and says which file to edit

This commit is contained in:
Joseph Ferano 2026-09-13 14:34:19 +07:00
parent 2957804ebc
commit 68625a535e

View File

@ -877,17 +877,33 @@ let rec import ~seen ~open_ ~loc alias dir =
in
List.iter
(fun (x : Cimport.const_diff) ->
(* Only the findings that are the *library* contradicting the
package stop a build. A [defenum] nobody mapped and a rule
that reaches nothing are about the package's own
`bindings` file, and they gate `flan generate-c`, which is
where that file is edited telling a lane that added an
enum to go and fix a config, in a message shaped like "the
layout is wrong", is the wrong thing to stop a build
with. *)
if not x.Cimport.cmapping then
fail (Option.value ~default:loc (cloc x.Cimport.cname))
"the package disagrees with %s: %s" h x.Cimport.cwhy)
(* Both kinds stop a build, and they are worded differently
because they are different accusations.
[cmapping = false] is the library contradicting the
package: a value that is one number here and another
there. [cmapping = true] is the package's own `bindings`
file not covering something a [defenum] nobody mapped,
a rule that reaches nothing.
The second was gated to `flan generate-c` at first, on the
argument that stopping a build over a config file is the
wrong stop. The objection was really to the *wording*: it
arrived wrapped in "the package disagrees with the
header", which describes a layout bug and sends the reader
to the wrong file. Gating it instead meant an unchecked
enum member exactly the silent wrongness the header read
exists to catch went unreported on every ordinary build,
and "remember to run generate-c" is the same shape as
"remember to check the header by eye", which is what this
replaced. So: still fatal, and the wording names the file
and both ways out. *)
let at = Option.value ~default:loc (cloc x.Cimport.cname) in
if x.Cimport.cmapping then
fail at "%s" x.Cimport.cwhy
else
fail at "the package disagrees with %s: %s" h
x.Cimport.cwhy)
(Cimport.check_constants ~config ~enums ~consts:pconsts dump);
r)
(header_specs ~loc dir)