basic/log: do not treat all negative errnos as synthetic
authorMike Yuan <me@yhndnzj.com>
Wed, 24 Jul 2024 14:28:48 +0000 (16:28 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 25 Jul 2024 10:03:59 +0000 (12:03 +0200)
commit268f58076f7e0258dce75f521d08199092279853
tree2b6bf518c578ccc94eb445f4599fa01f6f4068bf
parent11d5e2b5fbf9f6bfa5763fd45b56829ad4f0777f
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
src/basic/log.h
src/test/test-log.c