[llvm] r305168 - [ADT] Use LLVM_ATTRIBUTE_USED instead of __attribute__ for unit test

Mikael Holmén via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 11 23:35:35 PDT 2017


Hi Francis,

I get the following when I compile with clang 3.6.0:

../unittests/ADT/SmallVectorTest.cpp:447:13: error: '__used__' attribute 
only applies to variables and functions [-Werror,-Wignored-attributes]
     typedef LLVM_ATTRIBUTE_USED std::output_iterator_tag iterator_category;
             ^
../include/llvm/Support/Compiler.h:115:44: note: expanded from macro 
'LLVM_ATTRIBUTE_USED'
#define LLVM_ATTRIBUTE_USED __attribute__((__used__))
                                            ^
Regards,
Mikael

On 06/11/2017 09:28 PM, Francis Ricci via llvm-commits wrote:
> Author: fjricci
> Date: Sun Jun 11 14:28:21 2017
> New Revision: 305168
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=305168&view=rev
> Log:
> [ADT] Use LLVM_ATTRIBUTE_USED instead of __attribute__ for unit test
> 
> Modified:
>      llvm/trunk/unittests/ADT/SmallVectorTest.cpp
> 
> Modified: llvm/trunk/unittests/ADT/SmallVectorTest.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/ADT/SmallVectorTest.cpp?rev=305168&r1=305167&r2=305168&view=diff
> ==============================================================================
> --- llvm/trunk/unittests/ADT/SmallVectorTest.cpp (original)
> +++ llvm/trunk/unittests/ADT/SmallVectorTest.cpp Sun Jun 11 14:28:21 2017
> @@ -444,11 +444,11 @@ TYPED_TEST(SmallVectorTest, AppendRepeat
>     SCOPED_TRACE("AppendRepeatedTest");
>   
>     struct output_iterator {
> -    typedef __attribute__((used)) std::output_iterator_tag iterator_category;
> -    typedef __attribute__((used)) int value_type;
> -    typedef __attribute__((used)) int difference_type;
> -    typedef __attribute__((used)) value_type *pointer;
> -    typedef __attribute__((used)) value_type &reference;
> +    typedef LLVM_ATTRIBUTE_USED std::output_iterator_tag iterator_category;
> +    typedef LLVM_ATTRIBUTE_USED int value_type;
> +    typedef LLVM_ATTRIBUTE_USED int difference_type;
> +    typedef LLVM_ATTRIBUTE_USED value_type *pointer;
> +    typedef LLVM_ATTRIBUTE_USED value_type &reference;
>       operator int() { return 2; }
>       operator Constructable() { return 7; }
>     };
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
> 


More information about the llvm-commits mailing list