[clang] [clang] Implement -fstrict-bool (PR #160790)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 2 14:45:55 PST 2025
=?utf-8?q?Félix?= Cloutier <fcloutier at apple.com>,
=?utf-8?q?Félix?= Cloutier <fcloutier at apple.com>,
=?utf-8?q?Félix?= Cloutier <fcloutier at apple.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/160790 at github.com>
apple-fcloutier wrote:
@AaronBallman, I'll have a change ready addressing all of the outstanding feedback, but I wanted to pre-check this with you:
* Currently, `clang -O0` and `clang -O1` and above have incompatible representations of `bool` (-O0 behaves as if using -fno-strict-bool=truncate, -O1 and above as if using -fstrict-bool).
* If we change the -fno-strict-bool default to be -fno-strict-bool=nonzero, I assume I should also change the -O0 behavior to match (or else -O0 will be incompatible with both -fstrict-bool and -fno-strict-bool, which seems unnecessary).
* Changing the -O0 behavior is, trivially, a break over existing -O0 behavior.
* If we decide that the `-fno-strict-bool` default is `truncate`, then there is no reason to change the -O0 behavior.
I see 3 possibilities and I would like to see which one you prefer:
* -fno-strict-bool defaults to truncate, which matches the current -O0 behavior
* -fno-strict-bool defaults to nonzero, and we update the -O0 behavior
* -fno-strict-bool defaults to nonzero, and we do not update the -O0 behavior
https://github.com/llvm/llvm-project/pull/160790
More information about the cfe-commits
mailing list