[PATCH] D134461: [Clang] Warn when trying to deferencing void pointers in C

2022-09-26 Thread Jun Zhang via Phabricator via cfe-commits
junaire added a comment. Sorry for missing the conversation, I was in sleeping mode at that time ;D > This warning is quite noisy for the Linux kernel due to a couple of places > where a void * is dereferenced as part of compile time checking. I'm actually surprised to see that, I thought Clang

[PATCH] D134461: [Clang] Warn when trying to deferencing void pointers in C

2022-09-26 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added a comment. FWIW, I think the idea of allowing dereference of `void*` in an unevaluated context seems somewhat sensible, if sad. I suspect the kernel is not the only place to do this foolishness and take advantage of the extensions we/gcc permit for the `void` type. So I'll sa

[PATCH] D134461: [Clang] Warn when trying to deferencing void pointers in C

2022-09-26 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. In D134461#3815502 , @nathanchance wrote: > In D134461#3815458 , @aaron.ballman > wrote: > >> What do folks think of that idea? > > I think that all sounds reasonable to me (althou

[PATCH] D134461: [Clang] Warn when trying to deferencing void pointers in C

2022-09-26 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers added a comment. In D134461#3815458 , @aaron.ballman wrote: > In D134461#3815298 , @nathanchance > wrote: > >> This warning is quite noisy for the Linux kernel due to a couple of places >> where

[PATCH] D134461: [Clang] Warn when trying to deferencing void pointers in C

2022-09-26 Thread Nathan Chancellor via Phabricator via cfe-commits
nathanchance added a comment. In D134461#3815458 , @aaron.ballman wrote: > What do folks think of that idea? I think that all sounds reasonable to me (although I am far from an authority on these matters). As far as I understand it, the kernel cannot u

[PATCH] D134461: [Clang] Warn when trying to deferencing void pointers in C

2022-09-26 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added a comment. In D134461#3815298 , @nathanchance wrote: > This warning is quite noisy for the Linux kernel due to a couple of places > where a `void *` is dereferenced as part of compile time checking. Thank you for letting us know! >

[PATCH] D134461: [Clang] Warn when trying to deferencing void pointers in C

2022-09-26 Thread Nathan Chancellor via Phabricator via cfe-commits
nathanchance added subscribers: nickdesaulniers, nathanchance. nathanchance added a comment. This warning is quite noisy for the Linux kernel due to a couple of places where a `void *` is dereferenced as part of compile time checking. My original commentary is available on our GitHub issue track

[PATCH] D134461: [Clang] Warn when trying to deferencing void pointers in C

2022-09-24 Thread Jun Zhang via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rGe07ead85a368: [Clang] Warn when trying to dereference void pointers in C (authored by junaire). Changed prior to commit: https://reviews.llvm.org/D134461?vs=462643&id=462671#toc Repository: rG LLVM G

[PATCH] D134461: [Clang] Warn when trying to deferencing void pointers in C

2022-09-24 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision. aaron.ballman added a comment. This revision is now accepted and ready to land. LGTM aside from a minor nit in the tests. Thank you for this! Comment at: clang/test/C/drs/dr1xx.c:191-194 + return *vvp; /* expected-warning {{void function '

[PATCH] D134461: [Clang] Warn when trying to deferencing void pointers in C

2022-09-23 Thread Jun Zhang via Phabricator via cfe-commits
junaire updated this revision to Diff 462643. junaire added a comment. Address comments. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D134461/new/ https://reviews.llvm.org/D134461 Files: clang/docs/ReleaseNotes.rst clang/include/clang/Basic/Di

[PATCH] D134461: [Clang] Warn when trying to deferencing void pointers in C

2022-09-23 Thread Jun Zhang via Phabricator via cfe-commits
junaire added inline comments. Comment at: clang/test/C/drs/dr1xx.c:140 /* The behavior changed between C89 and C99. */ - (void)&*p; /* c89only-warning {{ISO C forbids taking the address of an expression of type 'void'}} */ + (void)&*p; /* c89only-warning {{ISO C forbids ta

[PATCH] D134461: [Clang] Warn when trying to deferencing void pointers in C

2022-09-23 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:6922 def ext_typecheck_indirection_through_void_pointer : ExtWarn< - "ISO C++ does not allow indirection on operand of type %0">, + "ISO %select{C++|C}0 does not allow indirection

[PATCH] D134461: [Clang] Warn when trying to deferencing void pointers in C

2022-09-23 Thread Jun Zhang via Phabricator via cfe-commits
junaire updated this revision to Diff 462428. junaire marked an inline comment as done. junaire added a comment. Add `&(*p)` test case in dr1xx.c. (Previous seperate test is removed as it mostly duplicate with the DR test) Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https