Skip to content

General contracts impl cleanup #12

@JAChapmanII

Description

@JAChapmanII

Use void_node for places we need a "NOP" instead of building a new node (build_contract_check in case of CCS_IGNORE, any other places?)

Ensure all remaining warning/error messages don't use %s to insert English text.

Move attr name checking fully into cp_parser_contract_attribute_spec, return NULL_TREE early when the contract being parsed isn't a contract.

In build_contract_functor_declaration there's the note:

  /* FIXME will later optimizations delete unused args to prevent extra arg
   * passing? do we care? */

about potentially generating pre/post fns with fewer arguments as a potential optimization. This should probably be downgraded to just a note about a possible optimization (maybe using the optimizer partial-inlining code) and not an actual FIXME.

Comment and rename build_contract_handler_fn, possibly build_contract_handler_fn_call.
Move setting current_function_returns_abnormally and TREE_NOTHROW into here. Are we always actually building this call from inside the function that needs these set? Use build_call_n?

These shouldn't be set here, they should be set as part of building the call to the handler. You should get that by changing build_call_expr to build_call_n...

Fix possibly outdated comment

  /* FIXME: It looks  like we have two bits of information for
     continuing.  Is this right?  */

I think this was referring to the fact that we have both continue_ and continuation_mode arguments on __on_contract_violation rather than needing to distinguish >2 states.

Elaborate about roles.

Move more code from decl.c into the contracts file cxx-contracts.c.

Rename cxx-contracts.c to contracts.cc.

Figure out where contract.cc in libstdc++-v3 should end up; does it need to be moved to libstdc++-v3/libsupc++?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions