Re: r337470 - [Sema] Add a new warning, -Wmemset-transposed-args

2018-07-26 Thread Erik Pilkington via cfe-commits
On 7/26/18 1:38 PM, Richard Smith wrote: On Thu, 26 Jul 2018 at 13:14, Erik Pilkington via cfe-commits mailto:cfe-commits@lists.llvm.org>> wrote: On 7/26/18 12:52 PM, Richard Smith wrote: Other than the (fixed) ffmpeg false positive, I see this firing in three places. One

Re: r337470 - [Sema] Add a new warning, -Wmemset-transposed-args

2018-07-26 Thread Richard Smith via cfe-commits
On Thu, 26 Jul 2018 at 13:22, Arthur O'Dwyer via cfe-commits < cfe-commits@lists.llvm.org> wrote: > On Thu, Jul 26, 2018 at 12:52 PM, Richard Smith > wrote: > >> Other than the (fixed) ffmpeg false positive, I see this firing in three >> places. >> >> One of them is in the libc tests for memset

Re: r337470 - [Sema] Add a new warning, -Wmemset-transposed-args

2018-07-26 Thread Richard Smith via cfe-commits
On Thu, 26 Jul 2018 at 13:14, Erik Pilkington via cfe-commits < cfe-commits@lists.llvm.org> wrote: > > > On 7/26/18 12:52 PM, Richard Smith wrote: > > Other than the (fixed) ffmpeg false positive, I see this firing in three > places. > > One of them is in the libc tests for memset and bzero,

Re: r337470 - [Sema] Add a new warning, -Wmemset-transposed-args

2018-07-26 Thread Arthur O'Dwyer via cfe-commits
On Thu, Jul 26, 2018 at 12:52 PM, Richard Smith wrote: > Other than the (fixed) ffmpeg false positive, I see this firing in three > places. > > One of them is in the libc tests for memset and bzero, where the 0 > argument is intentional. > One of them is here:

Re: r337470 - [Sema] Add a new warning, -Wmemset-transposed-args

2018-07-26 Thread Erik Pilkington via cfe-commits
On 7/26/18 12:52 PM, Richard Smith wrote: Other than the (fixed) ffmpeg false positive, I see this firing in three places. One of them is in the libc tests for memset and bzero, where the 0 argument is intentional. I don't find this case very convincing, if you're literally the one

Re: r337470 - [Sema] Add a new warning, -Wmemset-transposed-args

2018-07-26 Thread Richard Smith via cfe-commits
Other than the (fixed) ffmpeg false positive, I see this firing in three places. One of them is in the libc tests for memset and bzero, where the 0 argument is intentional. One of them is here: https://github.com/apache/xerces-c/blob/trunk/src/xercesc/util/XMLUTF16Transcoder.cpp#L114 (note that

Re: r337470 - [Sema] Add a new warning, -Wmemset-transposed-args

2018-07-23 Thread Erik Pilkington via cfe-commits
Sure, that seems pretty reasonable. r337706. Thanks for the suggestion! On 7/21/18 1:40 PM, Arthur O'Dwyer wrote: In this case Clang is complaining about     memset(complicated-expr, 0, 0); which means that transposing the last two arguments would not "fix" anything. Clang ought to not

Re: r337470 - [Sema] Add a new warning, -Wmemset-transposed-args

2018-07-23 Thread Aaron Ballman via cfe-commits
On Sat, Jul 21, 2018 at 4:40 PM, Arthur O'Dwyer via cfe-commits wrote: > In this case Clang is complaining about > > memset(complicated-expr, 0, 0); > > which means that transposing the last two arguments would not "fix" > anything. Clang ought to not complain in this case. +1 ~Aaron > It

Re: r337470 - [Sema] Add a new warning, -Wmemset-transposed-args

2018-07-21 Thread Arthur O'Dwyer via cfe-commits
In this case Clang is complaining about memset(complicated-expr, 0, 0); which means that transposing the last two arguments would not "fix" anything. Clang ought to not complain in this case. It doesn't have anything to do with coming from a macro; it's just that *both* arguments are zero.

Re: r337470 - [Sema] Add a new warning, -Wmemset-transposed-args

2018-07-21 Thread Nico Weber via cfe-commits
This has a false positive on ffmpeg: ../../third_party/ffmpeg/libavcodec/options.c:273:64: error: 'size' argument to memset is '0'; did you mean to transpose the last two arguments? [-Werror,-Wmemset-transposed-args] alloc_and_copy_or_fail(intra_matrix, 64 * sizeof(int16_t), 0); With: #define

r337470 - [Sema] Add a new warning, -Wmemset-transposed-args

2018-07-19 Thread Erik Pilkington via cfe-commits
Author: epilk Date: Thu Jul 19 09:46:15 2018 New Revision: 337470 URL: http://llvm.org/viewvc/llvm-project?rev=337470=rev Log: [Sema] Add a new warning, -Wmemset-transposed-args This diagnoses calls to memset that have the second and third arguments transposed, for example: memset(buf,