[PATCH] D150875: Make dereferencing a void* a hard-error instead of warn-as-error

Jessica Clarke via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 18 10:23:58 PDT 2023


jrtc27 added a comment.

In D150875#4353484 <https://reviews.llvm.org/D150875#4353484>, @erichkeane wrote:

> In D150875#4353467 <https://reviews.llvm.org/D150875#4353467>, @jrtc27 wrote:
>
>> We heavily rely on this extension in CheriBSD via `__typeof__((*(p))) * __capability` as we want to be able to take any pointer, including to an array or function that needs to undergo decay to be an actual pointer, and turn it into a `__capability`-qualified one. Presumably you're saying we should instead use `__typeof__((0, (p))) __capability` as an uglier alternative way to force decay?
>
> Do you do that in C++, or just C?  Note that this does NOT change the behavior in C.  In C++ I'd probably just suggest using `std::decay`.

In practice just C (kernel-only macro), though ideally the macro would still work in C++ (at least on CheriBSD; C++-based OSes will differ, but can of course do their own thing).


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D150875/new/

https://reviews.llvm.org/D150875



More information about the cfe-commits mailing list