the latest version of Clang/LLVM for the world and kernel

deeptech71 deeptech71 at
Mon Feb 18 05:58:32 UTC 2013

On 02/16/2013 17:17, Dimitry Andric wrote:
> On 2013-02-16 00:04, deeptech71 wrote:
>> First of all, you should understand that these are compilation errors
> No, they are only errors because we have turned on -Werror.

You meant to say: Yes, but they are only errors because we have turned on -Werror.

> Regarding this particular warning, it could be fixed by casting status
> to int, or adding -Wno-tautological-constant-out-of-range-compare to the
> flags for its WARNS= level (which is 2, if I looked it up correctly).

I'd change the variable to an int.

>> Second of all, you should understand that these are real errors; in this case, the compiler may omit generating code to check for a boolean condition, if the value of that condition is known at compile time, and thus generating a program with an undesired mode of operation.
> No, this is not the case with enums, unless you use the -fstrict-enums
> flag, which we don't use at the moment.  And even with that flag, I did
> not see any change in the resulting assembly.
> This is probably because it would break too much software, if such an
> optimization was implemented, even if that optimization is strictly
> speaking completely legal to do.

What makes you think that no semantic changes will occur in the future? What about other compilers?

As the makefile comments say, some warnings are kept enabled to create an incentive to fix the code. But the real incentive should be that fixing the code makes the difference between WRONG and non-WRONG.

>>>> * /usr/src/lib/libugidfw/ugidfw.c:74:10: error: comparison of unsigned expression < 0 is always false [-Werror,-Wtautological-compare]
>>>> *         if (len < 0 || len > left)
>>>> *             ~~~ ^ ~
> Normally, they are not errors, but just warnings, unless you changed
> something in the bsd.*.mk logic to not detect clang.

WRONG. Clang detection measures are intact here: /etc/make.conf contains:

More information about the freebsd-current mailing list