Skip to content

Comments

For Review & Comments#1

Open
EricWF wants to merge 13 commits intoreviewedfrom
main
Open

For Review & Comments#1
EricWF wants to merge 13 commits intoreviewedfrom
main

Conversation

@EricWF
Copy link
Member

@EricWF EricWF commented Jan 5, 2026

No description provided.

Specification changes:
- Generic entrypoint now takes a single void* to a versioned data
  object (contract_violation_data_v1) instead of 6 individual params
- Versioning rules: first byte is version, new versions append only,
  old runtimes ignore unknown fields
- TU-local wrappers construct the versioned struct on the stack and
  call the generic entrypoint
- Field type enumerators renamed with __cxa_field_ prefix
- Removed field_summary (unused)
- Fixed section numbering (5.3 → 5.2)
- Fixed undefined contract_violation_field_t → __cxa_field_type_t
- Replaced accessor API with sample implementations showing both
  runtime entrypoint and compiler-emitted pseudocode
- Fixed std::contract_violation → std::contracts::contract_violation
- Added TODO for handler linkage specification

Other changes:
- Added rationale.rst (design rationale, separated from spec)
- Tightened requirements.rst (removed filler sections)
- Reorganized index.rst (spec first, background second)
Runtime-provided wrappers (§4.2) conflict with the versioning strategy:
they construct the versioned struct internally, locked to the runtime's
version. A newer compiler wanting to pass v2 data cannot do so through
an old runtime's wrapper. Requiring the compiler to always construct the
versioned struct preserves forward compatibility.

- Removed section 4.2 (runtime wrapper entrypoints)
- Renumbered 4.3 → 4.2 (compiler-generated wrappers)
- Added observed-semantic wrapper example alongside enforced
- Removed runtime wrapper from sample implementation (§6.1)
- Documented rationale for compiler-only wrappers
Includes:
- contracts_abi.h: ABI types (__cxa_source_location, descriptor table, etc.)
- contracts_runtime.cpp: runtime entrypoint + sample std::contracts::contract_violation
- main.cpp: simulated compiler-emitted code exercising observed and enforced semantics
- Makefile for building with clang++

The runtime demonstrates the key ABI flow: walking the descriptor table,
extracting fields from static data, and constructing contract_violation
using source_location::__create_from_pointer (matching libc++ layout).

Also cleans up spec_answers_to_open_questions.rst (remove LLM artifacts,
fix broken cross-references).
- GitHub Actions workflow to build and run the example, verifying
  contract violations print to stderr and the enforced check aborts
- Link to the example directory from section 6 of the spec
- Add efcs/cxx-abi as a submodule for the Itanium ABI patch
- Gitignore the example binary and remove it from tracking
Each ABI type and enumeration now gets its own subsection with a
dedicated code block and prose description, closer to how entities
are specified in the C++ standard.

Also adds a README linking to contracts-abi.com, the example
directory, and the Itanium ABI patch.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant