Commit 155e9851 authored by Matthias Braun's avatar Matthias Braun
Browse files

avoid some warnings by not using macros

[r28336]
parent cd919d60
...@@ -173,9 +173,7 @@ ...@@ -173,9 +173,7 @@
/** Set a length smaller than the current length of the array. Do not /** Set a length smaller than the current length of the array. Do not
* resize. len must be <= ARR_LEN(arr). */ * resize. len must be <= ARR_LEN(arr). */
#define ARR_SHRINKLEN(arr,len) \ static inline void ARR_SHRINKLEN(void *arr, size_t new_len);
(ARR_VRFY((arr)), assert(ARR_DESCR((arr))->nelts >= len), \
ARR_DESCR((arr))->nelts = len)
/** /**
* Resize a flexible array by growing it by delta elements. * Resize a flexible array by growing it by delta elements.
...@@ -255,6 +253,13 @@ FIRM_API void ir_verify_arr(const void *elts); ...@@ -255,6 +253,13 @@ FIRM_API void ir_verify_arr(const void *elts);
#define ARR_ELTS_OFFS offsetof(ir_arr_descr, elts) #define ARR_ELTS_OFFS offsetof(ir_arr_descr, elts)
#define ARR_DESCR(elts) ((ir_arr_descr *)(void *)((char *)(elts) - ARR_ELTS_OFFS)) #define ARR_DESCR(elts) ((ir_arr_descr *)(void *)((char *)(elts) - ARR_ELTS_OFFS))
static inline void ARR_SHRINKLEN(void *arr, size_t new_len)
{
ARR_VRFY(arr);
assert(ARR_DESCR(arr)->nelts >= new_len);
ARR_DESCR(arr)->nelts = new_len;
}
#include "../end.h" #include "../end.h"
#endif #endif
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment