Skip to content

Correct AnalogFilter stability check #14

Description

@MitchellThompkins

The stability check in analog_filter.hpp uses a throw expression:

throw "constfilt: unstable analog filter";

This is incompatible with -fno-exceptions, which is standard practice on embedded and freestanding targets (aka bare metal). The compiler rejects any throw expression at the point of compilation, even if the branch is never reached, so the library fails to build entirely on its primary intended targets.

The check also assumes stdlib availability for any fallback (std::terminate, std::abort), which cannot be assumed in freestanding builds.

Current state: the check block is commented out in analog_filter.hpp. CheckStab template parameter is reserved but inert.

Candidate approaches:

  • __builtin_trap(): preserves the compile-time error via the non-constexpr call rule, but is GCC/Clang specific.
  • Undeclared [[noreturn]] customization point: portable, user supplies the handler per platform; compile-time error still works via the non-constexpr call rule; linker error if the user forgets to define it.

The customization point approach is the likely path forward.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions