Skip to content

Add explicit control of assertions #241

@bonachea

Description

@bonachea

The Caffeine library uses the Assert library to add many correctness checking assertions. This includes both internal sanity checks and also validation of input to PRIF calls. These assertions are extremely valuable for correctness validation and debugging, but also incur a runtime performance overhead.

As such, it's important to ensure clients of Caffeine choose the appropriate build mode for their use case, namely:

  • Assertions ON: For correctness testing and validation
  • Assertions OFF: For performance testing and production use

Currently there's no consistent explicit control for this build mode:

  • install.sh currently defaults to Assertions ON, unless it sees a -[DU]ASSERTIONS argument in CPPFLAGS or FFLAGS (which then take precedence). This can also be overridden at fpm invocation time.
  • Builds without install.sh that pass no -[DU]ASSERTIONS argument will result in the default behavior of Assertions OFF

To make matters worse, assertions are currently controlled in caffeine.c using a completely separate mechanism: they are enabled by default and -DNDEBUG in the C compiler flags turns them off.

This is messy and error-prone.

We should deploy a robust and uniform mechanism to control the Caffiene build mode.

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