basic/log: do not treat all negative errnos as synthetic
Currently, IS_SYNTHETIC_ERRNO() evaluates to true for all negative errnos, because of the two's-complement negative value representation. Subsequently, ERRNO= is not logged for most of our own code. Let's fix this, by formatting all synthetic errnos as positive. Then, treat all negative values as non-synthetic. While at it, mark the evaluation order explicitly, and remove unneeded comment. Fixes #33800
This commit is contained in:
committed by
Zbigniew Jędrzejewski-Szmek
parent
11d5e2b5fb
commit
268f58076f
+2
-3
@@ -35,9 +35,8 @@ typedef enum LogTarget{
|
||||
* used as a regular log level. */
|
||||
#define LOG_NULL (LOG_EMERG - 1)
|
||||
|
||||
/* Note to readers: << and >> have lower precedence (are evaluated earlier) than & and | */
|
||||
#define SYNTHETIC_ERRNO(num) (1 << 30 | (num))
|
||||
#define IS_SYNTHETIC_ERRNO(val) ((val) >> 30 & 1)
|
||||
#define SYNTHETIC_ERRNO(num) (abs(num) | (1 << 30))
|
||||
#define IS_SYNTHETIC_ERRNO(val) (((val) >> 30) == 1)
|
||||
#define ERRNO_VALUE(val) (abs(val) & ~(1 << 30))
|
||||
|
||||
/* The callback function to be invoked when syntax warnings are seen
|
||||
|
||||
Reference in New Issue
Block a user