[llvm] r198273 - Silence g++ 4.9 build issue in unit tests

Alp Toker alp at nuanti.com
Wed Jan 1 14:35:58 PST 2014


On 01/01/2014 19:19, dblaikie at gmail.com wrote:
>
>
> On Tue Dec 31 2013 at 11:03:34 PM, Alp Toker <alp at nuanti.com 
> <mailto:alp at nuanti.com>> wrote:
>
>     Author: alp
>     Date: Wed Jan  1 00:57:01 2014
>     New Revision: 198273
>
>     URL: http://llvm.org/viewvc/llvm-project?rev=198273&view=rev
>     Log:
>     Silence g++ 4.9 build issue in unit tests
>
>     Stopgap measure until we can just use static_assert().
>
>     Modified:
>         llvm/trunk/unittests/IR/ValueMapTest.cpp
>
>     Modified: llvm/trunk/unittests/IR/ValueMapTest.cpp
>     URL:
>     http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/IR/ValueMapTest.cpp?rev=198273&r1=198272&r2=198273&view=diff
>     ==============================================================================
>     --- llvm/trunk/unittests/IR/ValueMapTest.cpp (original)
>     +++ llvm/trunk/unittests/IR/ValueMapTest.cpp Wed Jan  1 00:57:01 2014
>     @@ -117,7 +117,8 @@ TYPED_TEST(ValueMapTest, OperationsWork)
>
>      template<typename ExpectedType, typename VarType>
>      void CompileAssertHasType(VarType) {
>     -  typedef char assert[is_same<ExpectedType, VarType>::value ? 1 :
>     -1];
>     +  LLVM_ATTRIBUTE_UNUSED typedef char
>     +  assert[is_same<ExpectedType, VarType>::value ? 1 : -1];
>
>
> Naming something 'assert' which is a standard macro (even if the 
> standard header that defines it is not included) seems questionable.

Works because assert() is an object-like macro and this usage is without 
parens, so not related to including headers. Still, whoever wrote it is 
pushing their luck..

>
> & is there a reason we're not using the LLVM_STATIC_ASSERT macro here?

Requires LLVM_ENABLE_CXX11 which isn't yet enabled on most (any?) of the 
builders.

I'd just wait until C++11 and change the lot.

Alp.


>      }
>
>      TYPED_TEST(ValueMapTest, Iteration) {
>
>
>     _______________________________________________
>     llvm-commits mailing list
>     llvm-commits at cs.uiuc.edu <mailto:llvm-commits at cs.uiuc.edu>
>     http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>

-- 
http://www.nuanti.com
the browser experts




More information about the llvm-commits mailing list