LibJuno 1.0.4
LibJuno is a lightweight C11 library designed specifically for embedded systems.
Loading...
Searching...
No Matches
macros.h
Go to the documentation of this file.
1/*
2 MIT License
3
4 Copyright (c) 2025 Robin A. Onsay
5
6 Permission is hereby granted, free of charge, to any person obtaining
7 a copy of this software and associated documentation files
8 (the "Software"), to deal in the Software without restriction,
9 including without limitation the rights to use, copy, modify, merge,
10 publish, distribute, sublicense, and/or sell copies of the Software,
11 and to permit persons to whom the Software is furnished to do so,
12 subject to the following conditions:
13
14 The above copyright notice and this permission notice shall be
15 included in all copies or substantial portions of the Software.
16*/
28#ifndef JUNO_MACROS_H
29#define JUNO_MACROS_H
30
31#include "juno/status.h"
32#include <stdint.h>
33
50// @{"req": ["REQ-SYS-007", "REQ-SYS-008", "REQ-SYS-010", "REQ-SYS-011"]}
51#define JUNO_ASSERT_EXISTS(ptr) \
52if(!(ptr)) \
53{ \
54 return JUNO_STATUS_NULLPTR_ERROR; \
55}
56
67#define JUNO_ASSERT_EXISTS_MODULE(ptr, ptMod, str) if(!(ptr)) \
68{ \
69 JUNO_FAIL_MODULE(JUNO_STATUS_NULLPTR_ERROR, ptMod, str); \
70 return JUNO_STATUS_NULLPTR_ERROR; \
71}
72
88// @{"req": ["REQ-SYS-008"]}
89#define JUNO_ASSERT_SUCCESS(tStatus, ...) if(tStatus != JUNO_STATUS_SUCCESS) \
90{ \
91 __VA_ARGS__; \
92}
93
96#endif // JUNO_MACROS_H
Status codes and failure-handling helpers for LibJuno.