compiler attributes were hidden behind ATTRIBUTE_* macros
This commit is contained in:
parent
30c141f587
commit
dbe8924466
@ -25,7 +25,7 @@ Error* Error_create(const char* msg, bool is_msg_on_heap, ErrorCallPos p);
|
||||
void Error_free(Error* e);
|
||||
void Error_addCallPos(Error* e, ErrorCallPos p);
|
||||
str Error_toStr(Error* e);
|
||||
void Error_printAndExit(Error* e) __attribute__ ((__noreturn__));
|
||||
void Error_printAndExit(Error* e) ATTRIBUTE_NORETURN;
|
||||
|
||||
typedef struct Result_ {
|
||||
Error* error;
|
||||
|
||||
@ -64,6 +64,21 @@ typedef const char* cstr;
|
||||
/// @warning pointer can be null
|
||||
#define NULLABLE(NAME) NAME
|
||||
|
||||
#define ATTRIBUTE_PACKED \
|
||||
__attribute__((__packed__))
|
||||
|
||||
#define ATTRIBUTE_ALIGNED(BYTE_N) \
|
||||
__attribute__((aligned(BYTE_N)))
|
||||
|
||||
#define ATTRIBUTE_NORETURN \
|
||||
__attribute__ ((__noreturn__))
|
||||
|
||||
///@brief https://gcc.gnu.org/onlinedocs/gcc-15.2.0/gcc/Common-Function-Attributes.html#index-format-function-attribute
|
||||
///@param FMT_ARG_INDEX Index of format literal argument. First argument is 1.
|
||||
///@param VARIADIC_ARGS_INDEX Index of variadic arguments.
|
||||
#define ATTRIBUTE_CHECK_FORMAT_PRINTF(FMT_ARG_INDEX, VARIADIC_ARGS_INDEX) \
|
||||
__attribute__((__format__(__printf__, FMT_ARG_INDEX, VARIADIC_ARGS_INDEX)))
|
||||
|
||||
|
||||
#if __cplusplus
|
||||
}
|
||||
|
||||
@ -5,5 +5,5 @@
|
||||
char* _strcat_malloc(size_t n, cstr str0, ...);
|
||||
char* _vstrcat_malloc(size_t n, cstr str0, va_list argv);
|
||||
|
||||
char* NULLABLE(sprintf_malloc)(size_t buffer_size, cstr format, ...) __attribute__((__format__(__printf__, 2, 3)));
|
||||
char* NULLABLE(sprintf_malloc)(size_t buffer_size, cstr format, ...) ATTRIBUTE_CHECK_FORMAT_PRINTF(2, 3);
|
||||
char* NULLABLE(vsprintf_malloc)(size_t buffer_size, cstr format, va_list argv);
|
||||
|
||||
@ -27,7 +27,7 @@ str Error_toStr(Error* e){
|
||||
u32 len = List_len(&e->call_stack, ErrorCallPos);
|
||||
StringBuilder b = StringBuilder_alloc(e->msg.size + 80 * len);
|
||||
|
||||
StringBuilder_append_str(&b, STR("Error: "));
|
||||
StringBuilder_append_str(&b, STR("Catched Error: "));
|
||||
StringBuilder_append_str(&b, e->msg);
|
||||
for(u32 i = 0; i < len; i++){
|
||||
ErrorCallPos* ep = (ErrorCallPos*)e->call_stack.data + i;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user