Source-Changes-D archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: CVS commit: src/tests/lib/libc/c063
In article <bb1c3cc8-0bae-473a-808d-b0abf4cb5ab6%gmx.de@localhost>,
Roland Illig <roland.illig%gmx.de@localhost> wrote:
>Am 10.07.2024 um 03:12 schrieb Christos Zoulas:
>
>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(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.
Yes, I was thinking along the same lines. If the gcc construct does not
produce warnings, I would go with that.
christos
Home |
Main Index |
Thread Index |
Old Index