mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-02-19 03:13:14 +00:00
* **Documentation** * Added new C coding style guide detailing naming conventions for files, directories, macros, constants, variables, functions, and type definitions with illustrative examples. * Updated C++ coding style documentation with clarifications on C naming conventions and header directory organization patterns. * **Refactor** * Updated header include paths throughout the codebase to use lowercase naming conventions consistently.
33 lines
742 B
C
33 lines
742 B
C
#pragma once
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#include <tactility/log.h>
|
|
|
|
__attribute__((noreturn)) extern void __crash(void);
|
|
|
|
#define CHECK_GET_MACRO(_1, _2, NAME, ...) NAME
|
|
#define check(...) CHECK_GET_MACRO(__VA_ARGS__, CHECK_MSG, CHECK_NO_MSG)(__VA_ARGS__)
|
|
|
|
#define CHECK_NO_MSG(condition) \
|
|
do { \
|
|
if (!(condition)) { \
|
|
LOG_E("Error", "Check failed: %s at %s:%d", #condition, __FILE__, __LINE__); \
|
|
__crash(); \
|
|
} \
|
|
} while (0)
|
|
|
|
#define CHECK_MSG(condition, message) \
|
|
do { \
|
|
if (!(condition)) { \
|
|
LOG_E("Error", "Check failed: %s at %s:%d", message, __FILE__, __LINE__); \
|
|
__crash(); \
|
|
} \
|
|
} while (0)
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|