Merge pull request #13093 from keszybz/two-assert-cc-cleanups
Two assert_cc cleanups
This commit is contained in:
+1
-1
@@ -73,7 +73,7 @@ int log_get_max_level_realm(LogRealm realm) _pure_;
|
||||
* for the application itself.
|
||||
*/
|
||||
|
||||
assert_cc(STRLEN(__FILE__) > STRLEN(RELATIVE_SOURCE_PATH) + 1)
|
||||
assert_cc(STRLEN(__FILE__) > STRLEN(RELATIVE_SOURCE_PATH) + 1);
|
||||
#define PROJECT_FILE (__FILE__ + STRLEN(RELATIVE_SOURCE_PATH) + 1)
|
||||
|
||||
int log_open(void);
|
||||
|
||||
+5
-6
@@ -344,18 +344,16 @@ static inline int __coverity_check__(int condition) {
|
||||
#endif
|
||||
|
||||
#define assert_not_reached(t) \
|
||||
do { \
|
||||
log_assert_failed_unreachable(t, PROJECT_FILE, __LINE__, __PRETTY_FUNCTION__); \
|
||||
} while (false)
|
||||
log_assert_failed_unreachable(t, PROJECT_FILE, __LINE__, __PRETTY_FUNCTION__)
|
||||
|
||||
#if defined(static_assert)
|
||||
#define assert_cc(expr) \
|
||||
static_assert(expr, #expr);
|
||||
static_assert(expr, #expr)
|
||||
#else
|
||||
#define assert_cc(expr) \
|
||||
struct CONCATENATE(_assert_struct_, __COUNTER__) { \
|
||||
char x[(expr) ? 0 : -1]; \
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
||||
#define assert_return(expr, r) \
|
||||
@@ -464,7 +462,8 @@ static inline int __coverity_check__(int condition) {
|
||||
* type for the array, in the hope that checkers such as ubsan don't complain that the initializers for \
|
||||
* the array are not representable by the base type. Ideally we'd use typeof(x) as base type, but that \
|
||||
* doesn't work, as we want to use this on bitfields and gcc refuses typeof() on bitfields.) */ \
|
||||
assert_cc((sizeof((long double[]){__VA_ARGS__})/sizeof(long double)) <= 20); \
|
||||
static const long double __assert_in_set[] _unused_ = { __VA_ARGS__ }; \
|
||||
assert_cc(ELEMENTSOF(__assert_in_set) <= 20); \
|
||||
switch(x) { \
|
||||
FOR_EACH_MAKE_CASE(__VA_ARGS__) \
|
||||
_found = true; \
|
||||
|
||||
@@ -189,7 +189,7 @@ int set_oom_score_adjust(int value);
|
||||
#error "Unknown pid_t size"
|
||||
#endif
|
||||
|
||||
assert_cc(TASKS_MAX <= (unsigned long) PID_T_MAX)
|
||||
assert_cc(TASKS_MAX <= (unsigned long) PID_T_MAX);
|
||||
|
||||
/* Like TAKE_PTR() but for child PIDs, resetting them to 0 */
|
||||
#define TAKE_PID(pid) \
|
||||
|
||||
Reference in New Issue
Block a user