Roland Illig
2024-07-10 04:37:26 UTC
Am 10.07.2024 um 03:12 schrieb Christos Zoulas:
src/tests/lib/libc/c063/t_fchmodat.c
ATF_REQUIRE(cond) currently expands to "if (!(cond))", and I guess due
to the parentheses around "cond", GCC does not warn about the assignment
in the condition.
One idea is to rewrite ATF_REQUIRE to be "if (cond) {} else", which
would make GCC complain directly.
Another idea is to make lint warn about the pattern "!(a = b)", even
though its output is not looked upon by many people.
Roland
--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de
src/tests/lib/libc/c063/t_fchmodat.c
- ATF_REQUIRE(st.st_mode = 0600);
+ ATF_REQUIRE(st.st_mode == 0600);
Should we do something to detect bugs like these mechanically?+ ATF_REQUIRE(st.st_mode == 0600);
ATF_REQUIRE(cond) currently expands to "if (!(cond))", and I guess due
to the parentheses around "cond", GCC does not warn about the assignment
in the condition.
One idea is to rewrite ATF_REQUIRE to be "if (cond) {} else", which
would make GCC complain directly.
Another idea is to make lint warn about the pattern "!(a = b)", even
though its output is not looked upon by many people.
Roland
--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de