diff options
-rw-r--r-- | Makefile | 1 | ||||
-rw-r--r-- | include/nsutils/assert.h | 24 |
2 files changed, 25 insertions, 0 deletions
@@ -49,6 +49,7 @@ include $(NSBUILD)/Makefile.top # Extra installation rules I := /$(INCLUDEDIR)/nsutils +INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):include/nsutils/assert.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):include/nsutils/errors.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):include/nsutils/base64.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):include/nsutils/endian.h diff --git a/include/nsutils/assert.h b/include/nsutils/assert.h new file mode 100644 index 0000000..0f8f14d --- /dev/null +++ b/include/nsutils/assert.h @@ -0,0 +1,24 @@ +/* + * This file is part of LibNSUtils. + * Licensed under the MIT License, + * http://www.opensource.org/licenses/mit-license.php + * Copyright 2022 Michael Drake <tlsa@netsurf-browser.org> + */ + +/** + * \file + * Static assertion macro. + */ + +#ifndef NSUTILS_ASSERT_H__ +#define NSUTILS_ASSERT_H__ + +/** Compile time assertion macro. */ +#define ns_static_assert(e) \ +{ \ + enum { \ + cyaml_static_assert_check = 1 / (!!(e)) \ + }; \ +} + +#endif |