r278264 - Reapply [Sema] Add sizeof diagnostics for bzero
Joerg Sonnenberger via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 11 05:43:16 PDT 2016
On Wed, Aug 10, 2016 at 02:36:01PM -0700, Bruno Cardoso Lopes wrote:
> Hi Joerg,
> > Given that bzero is pretty much non-standard at this point, I strongly
> > dislike the approach of checking only the function name.
> Thanks for the feedback. bzero it's widely used though, I think it's a
> usability win to perform a diagnostic here, despite bzero being
Oh, I don't disagree that it is useful. Some projects still have a
ridiculous amount of non-standard bzero and bcmp invocations.
> Is there any additional reason why you dislike it or additional checks
> you suggest? IIUC, Sema::CheckMemaccessArguments already checks if the
> number of arguments is the same and if they are indeed what they're
> supposed to be.
It checks the number of arguments, but that's about it. It doesn't for
example check that the first argument is a pointer.
> If deprecation is the main issue here, shouldn't clang emit warnings
> to mention 'bzero' deprecation then?
It's not up to clang decide what the runtime environment provides or
deprecates. That said, bzero is no longer even part of SUSv4.
More information about the cfe-commits