Releases: google/emboss
Releases · google/emboss
Release list
v2026.0604.051943
Drop redundant Known() guard when discriminant is provably Known (#257)
The optimized switch block opens with
const auto emboss_reserved_switch_discrim = \${discriminant};
if (!emboss_reserved_switch_discrim.Known()) return false;
The Known() guard is a safety net: if reading the discriminant
failed, Ok() must return false. But fields_in_dependency_order
guarantees the discriminant field is validated earlier in Ok(), and
for a non-conditional, non-virtual field of the current structure
the earlier \`if (has_X().ValueOrDefault() && !X().Ok()) return false;\`
already enforces X().Ok(). Past that point the Maybe<> wrapper around
the field read is provably Known and the extra guard is dead code.
_is_discriminant_provably_known recognizes the safe shape — a
single-segment field_reference to a non-conditional non-virtual field
in the current structure's field list — and removes the guard in
that case. The detection is intentionally narrow; nested paths and
computed discriminants keep the guard.
One line saved per qualifying switch — minor on hosted targets, but
on Thumb-2 and MicroBlaze this removes a load, a compare, and a
conditional return per switch block, plus the constant-pool slot.
v2026.0604.051035
Extend switch matcher: disjunction, conjunction, single-entry demotio…
v2026.0604.003906
Render switch discriminant once per group; drop dead inner scope (#253)
* Render switch discriminant once per group; drop dead inner scope
The optimized Ok() switch-block code in _generate_optimized_ok_method_body
was rendering each switch group's discriminant twice: once unscoped at
grouping time to build the SWITCH: key, and again with the active
ExpressionScope at emit time. Render it once with the scope and reuse
the result. The result is stable for equivalent discriminants because
ExpressionScope.add dedupes by inner rendered form, so it still works
as a grouping key.
The ok_method_switch_block template's \${inner_scope_definitions}
placeholder was unused — the inner ExpressionScope it referenced had
nothing added to it. Removed both, which also drops the blank line
each switch block carried in the goldens.
No behavioral change; purely compile-time cleanup. Golden churn
limited to the blank-line removal in four files (one line per existing
switch block).
* Sort switch cases by value; coalesce identical-body cases (#254)
Three composing changes to the optimized Ok() switch generator:
1. Case-label sort. Each switch arm's labels are sorted by the
underlying integer/enum value before emit. _case_sort_key()
returns the int for sorting. Sorted cases give older embedded
GCCs (the ones shipped with microblaze-elf and many bare-metal
arm-none-eabi toolchains) a better shot at emitting a dense
jump table rather than an if-ladder.
2. Identical-body coalescing. Cases whose rendered body text is
identical (same field set in the same order) are merged into a
single arm with multiple \`case X:\` labels. The C++ compiler
emits one body for the whole arm — a real text-size win once a
later PR (disjunction matching) starts producing such pairs.
3. Multi-field per case. When two conditional fields share a
discriminant + case value (\`if tag == 0: a\` and \`if tag == 0: b\`),
they're now bundled into the same case arm rather than the second
falling back to a separate if-statement. Each field's validation
becomes one line of the case body.
The ok_method_switch_case template becomes ok_method_switch_arm,
taking pre-formatted \${case_labels} and \${case_body} strings.
Single-label single-field arms render identically to the old
template, so golden churn is limited to the f0_copy field in
testdata/many_conditionals.emb folding into case 0 of the
LargeConditionals switch.
v2026.0601.200710
Add clang-format to c++ backend (#262) * Format generated C++ headers with clang-format Apply Google-style clang-format to all generated .emb.h output, in both the bazel codegen path (emboss_codegen_cpp.main) and the standalone embossc driver. The clang-format binary path is resolved through the new compiler/back_end/cpp/clang_format_path module, which is the single seam to the underlying binary. The upstream version uses the clang-format PyPI package; downstream forks that cannot use the PyPI package can replace just clang_format_path.py and its BUILD entry with a shim returning an alternative path. * Regenerate build.json for new clang_format_path.py * Move clang_format import to module top in clang_format_path.py
v2026.0520.190324
Add scripts/regenerate_goldens.py for batch golden regeneration (#251) * Add scripts/regenerate_goldens.py for batch golden regeneration Mirrors the cpp_golden_test list in compiler/back_end/cpp/BUILD, invoking embossc on each input .emb file to regenerate the corresponding golden header. Makes generator changes (which usually require regenerating dozens of golden files) a one-command operation instead of a per-file dance. Also handles the testdata/imported_genfiles.emb genrule transform locally and cleans up afterward so the produced file doesn't collide with the bazel genrule on subsequent builds. * Note regenerate_goldens.py mirror in BUILD
v2026.0520.190155
Add scripts/regenerate_goldens.py for batch golden regeneration (#251) * Add scripts/regenerate_goldens.py for batch golden regeneration Mirrors the cpp_golden_test list in compiler/back_end/cpp/BUILD, invoking embossc on each input .emb file to regenerate the corresponding golden header. Makes generator changes (which usually require regenerating dozens of golden files) a one-command operation instead of a per-file dance. Also handles the testdata/imported_genfiles.emb genrule transform locally and cleans up afterward so the produced file doesn't collide with the bazel genrule on subsequent builds. * Note regenerate_goldens.py mirror in BUILD
v2026.0520.152057
Fix BUILD file formatting and action mnemonics (#261) * Fix BUILD file formatting and action mnemonics * Fix generated C++ switch statements
v2026.0520.012004
Fix TapPresubmit and Buildifier errors (#260)
v2026.0520.005033
Fix TapPresubmit and Buildifier errors (#255)
v2026.0519.231551
Bump black from 24.8.0 to 26.3.1 in the pip group across 1 directory …