[PATCH] D18521: Add parenthesis to silence warning

Duncan P. N. Exon Smith via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 28 13:50:00 PDT 2016


> On 2016-Mar-28, at 12:34, Nirav Dave <niravd at google.com> wrote:
> 
> niravd created this revision.
> niravd added a reviewer: dexonsmith.
> niravd added a subscriber: llvm-commits.
> 
> Add parenthesis to BitstreamReader.h to silence compilation warning
> 
> http://reviews.llvm.org/D18521

Looks like r264623 may have superseded this.  Thanks to both you and
Doug for fixing my commit for me ;).  (Next time feel free to review
the commit by replying on the list; I'm happy to fix myself.)

> 
> Files:
>  include/llvm/Bitcode/BitstreamReader.h
> 
> Index: include/llvm/Bitcode/BitstreamReader.h
> ===================================================================
> --- include/llvm/Bitcode/BitstreamReader.h
> +++ include/llvm/Bitcode/BitstreamReader.h
> @@ -367,7 +367,7 @@
> 
>     // Round to word boundary.
>     if (Limit & (sizeof(word_t) - 1))
> -      Limit += sizeof(word_t) - Limit & (sizeof(word_t) - 1);
> +      Limit += sizeof(word_t) - (Limit & (sizeof(word_t) - 1));

Strangely, the logic worked whichever way it was parenthesized.

I think my original tests would have caught this if it had been wrong,
but I nevertheless improved them in r264650 to be explicit.

> 
>     // Only change size if the new one is lower.
>     if (!Size || Size > Limit)
> 
> 
> <D18521.51823.patch>



More information about the llvm-commits mailing list