[clang-tools-extra] r260225 - [clang-tidy] Add -target in misc-misplaced-widening-cast test so it will work on various bots

Alexander Kornienko via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 10 06:38:38 PST 2016


On Wed, Feb 10, 2016 at 1:15 PM, Daniel Marjamäki <
Daniel.Marjamaki at evidente.se> wrote:

>
> Hello!
>
> That would make some sense to me.
>
> To catch portability issues users could use different relevant targets. Do
> you know if some do that?
>

They could, but I'm not sure it's a widespread practice to run analysis
tools for multiple targets. It's less convenient, requires more resources
and something one has specifically set up their development process for. So
I think, if this diagnostic could consider a conversion from "int" to
"long" (as well as short->int, long->long long, etc.) always a widening
conversion and vice versa, it might be useful. I don't know whether it will
significantly increase the number of false positives though, but we could
try. What do you think?



>
> Best regards,
> Daniel Marjamäki
>
>
> ..................................................................................................................
> Daniel Marjamäki Senior Engineer
> Evidente ES East AB  Warfvinges väg 34  SE-112 51 Stockholm  Sweden
>
> Mobile:                 +46 (0)709 12 42 62
> E-mail:                 Daniel.Marjamaki at evidente.se
>
> www.evidente.se
>
> ________________________________________
> Från: Alexander Kornienko [alexfh at google.com]
> Skickat: den 10 februari 2016 12:23
> Till: Daniel Marjamäki
> Kopia: cfe-commits
> Ämne: Re: SV: [clang-tools-extra] r260225 - [clang-tidy] Add -target in
> misc-misplaced-widening-cast test so it will work on various bots
>
> Makes sense. I wonder though whether the check should attempt to be
> platform-independent and warn regardless of whether int and long have the
> same bit width. What do you think?
>
> On Feb 10, 2016 9:35 AM, "Daniel Marjamäki" <Daniel.Marjamaki at evidente.se
> <mailto:Daniel.Marjamaki at evidente.se>> wrote:
>
> Hello!
>
> > I'm not sure this is a good fix. What was the specific issue (and on
> which buildbots)?
>
> Ok.
>
> The buildbots said:
>
> FileCheck error:
> '/home/linaro/buildbot/clang-cmake-thumbv7-a15/stage1/tools/clang/tools/extra/test/clang-tidy/Output/misc-misplaced-widening-cast.cpp.tmp.cpp.msg'
> is empty.
>
> My check only warns when there is a widening cast. If
> sizeof(int)==sizeof(long) then there is no warning for a int=>long
> conversion. In my testcases I tested various int=>long conversions.
>
> These are the failed builds:
>
> http://lab.llvm.org:8011/builders/clang-ppc64le-linux-lnt/builds/187
> http://lab.llvm.org:8011/builders/clang-x86-win2008-selfhost/builds/6265
> http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/9641
> http://lab.llvm.org:8011/builders/clang-cmake-thumbv7-a15/builds/9691
>
> Best regards,
> Daniel Marjamäki
>
>
> ..................................................................................................................
> Daniel Marjamäki Senior Engineer
> Evidente ES East AB  Warfvinges väg 34  SE-112 51 Stockholm  Sweden
>
> Mobile:                 +46 (0)709 12 42 62
> <tel:%2B46%20%280%29709%2012%2042%2062>
> E-mail:                 Daniel.Marjamaki at evidente.se<mailto:
> Daniel.Marjamaki at evidente.se>
>
> www.evidente.se<http://www.evidente.se>
>
> ________________________________________
> Från: Alexander Kornienko [alexfh at google.com<mailto:alexfh at google.com>]
> Skickat: den 9 februari 2016 17:41
> Till: Daniel Marjamäki
> Kopia: cfe-commits
> Ämne: Re: [clang-tools-extra] r260225 - [clang-tidy] Add -target in
> misc-misplaced-widening-cast test so it will work on various bots
>
> I'm not sure this is a good fix. What was the specific issue (and on which
> buildbots)?
>
> On Tue, Feb 9, 2016 at 4:43 PM, Daniel Marjamaki via cfe-commits <
> cfe-commits at lists.llvm.org<mailto:cfe-commits at lists.llvm.org><mailto:
> cfe-commits at lists.llvm.org<mailto:cfe-commits at lists.llvm.org>>> wrote:
> Author: danielmarjamaki
> Date: Tue Feb  9 09:43:05 2016
> New Revision: 260225
>
> URL: http://llvm.org/viewvc/llvm-project?rev=260225&view=rev
> Log:
> [clang-tidy] Add -target in misc-misplaced-widening-cast test so it will
> work on various bots
>
> Modified:
>
> clang-tools-extra/trunk/test/clang-tidy/misc-misplaced-widening-cast.cpp
>
> Modified:
> clang-tools-extra/trunk/test/clang-tidy/misc-misplaced-widening-cast.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-tidy/misc-misplaced-widening-cast.cpp?rev=260225&r1=260224&r2=260225&view=diff
>
> ==============================================================================
> ---
> clang-tools-extra/trunk/test/clang-tidy/misc-misplaced-widening-cast.cpp
> (original)
> +++
> clang-tools-extra/trunk/test/clang-tidy/misc-misplaced-widening-cast.cpp
> Tue Feb  9 09:43:05 2016
> @@ -1,4 +1,4 @@
> -// RUN: %check_clang_tidy %s misc-misplaced-widening-cast %t
> +// RUN: %check_clang_tidy %s misc-misplaced-widening-cast %t -- --
> -target x86_64-unknown-unknown
>
>  void assign(int a, int b) {
>    long l;
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org<mailto:cfe-commits at lists.llvm.org><mailto:
> cfe-commits at lists.llvm.org<mailto:cfe-commits at lists.llvm.org>>
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160210/a3140d7f/attachment-0001.html>


More information about the cfe-commits mailing list