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



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.

Roland



Home | Main Index | Thread Index | Old Index