https://bugs.fuchsia.dev/p/fuchsia/issues/detail?id=43203

Clone this repo:

Branches

  1. 195a936 [nlassert] Add GN support to build nlassert header by Prashanth Swaminathan · 3 weeks ago master
  2. 2d214e8 Initial import of nlassert by Nicolas Sylvain · 10 weeks ago

Build Status Coverage Status

Nest Labs Assert

Introduction

This package defines macros and interfaces for performing both compile- and run-time assertion checking and run-time exception handling.

Where exception-handing is concerned, the format of the macros are inspired by those found in Mac OS Classic and, later, Mac OS X. These, in turn, were inspired by “Living In an Exceptional World” by Sean Parent (develop, The Apple Technical Journal, Issue 11, August/September 1992). See:

http://www.mactech.com/articles/develop/issue_11/Parent_final.html

for the methodology behind these error handling and assertion macros.

Overview

The interfaces in this package come in two interface modalities:

  • Run-time Interfaces that dynamically check a logical assertion and alter run-time execution on assertion firing.
  • Compile-time Interfaces that statically check a logical assertion and terminate compile-time execution on assertion firing.

Run-time

The run-time modality interfaces in this package come in three families:

  • Assertion Similar to the traditional C Standard Library assert().
  • Precondition Designed to be placed at the head of an interface or method to check incoming parameters and return on assertion failure.
  • Exception Designed to jump to a local label on assertion failure to support the method of error and exception handling that advocates a single function or method return site and, by extension, consolidated points of exception and error handling as well as resource clean-up.

There are several styles of interfaces within each family and several potential variants within each style, all of which are summarized below and are described in detail in the following sections.

Compile-time

The compile-time modality interfaces in this package are simpler and come in a single family with a couple of styles and variants, all intended to provide parallelism with the run-time interfaces.

Interact

There are numerous avenues for nlassert support:

Versioning

nlassert follows the Semantic Versioning guidelines for release cycle transparency and to maintain backwards compatibility.

License

nlassert is released under the Apache License, Version 2.0 license. See the LICENSE file for more information.