From 68625a535e70278247b43e73b0acca92e615bf03 Mon Sep 17 00:00:00 2001 From: Joseph Ferano Date: Sun, 13 Sep 2026 14:34:19 +0700 Subject: [PATCH] A bindings gap stops a build, and says which file to edit --- lib/load.ml | 38 +++++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/lib/load.ml b/lib/load.ml index 3e110d5..6c5d7e9 100644 --- a/lib/load.ml +++ b/lib/load.ml @@ -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)