r179406 - Define Neon intrinsics as "static inline" to avoid warning. rdar://13108414

Bob Wilson bob.wilson at apple.com
Tue Apr 16 15:58:49 PDT 2013


On Apr 16, 2013, at 3:53 PM, David Blaikie <dblaikie at gmail.com> wrote:

> Does the warning need fixing?
> 
We discussed the possibility of changing -Wstatic-in-inline to treat static functions defined with always_inline attributes as if they had been defined with the inline keyword.  This seemed like a cleaner solution.

> On Apr 13, 2013 6:20 AM, "Bob Wilson" <bob.wilson at apple.com> wrote:
> Author: bwilson
> Date: Fri Apr 12 15:17:20 2013
> New Revision: 179406
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=179406&view=rev
> Log:
> Define Neon intrinsics as "static inline" to avoid warning. rdar://13108414
> 
> We had been defining Neon intrinsics as "static" with always_inline attributes.
> If you use them from an extern inline function, you get a warning, e.g.:
> 
> static function 'vadd_u8' is used in an inline function with external linkage
> 
> This change simply adds the inline keyword to avoid that warning.
> 
> Modified:
>     cfe/trunk/test/Sema/arm-neon-types.c
>     cfe/trunk/utils/TableGen/NeonEmitter.cpp
> 
> Modified: cfe/trunk/test/Sema/arm-neon-types.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/arm-neon-types.c?rev=179406&r1=179405&r2=179406&view=diff
> ==============================================================================
> --- cfe/trunk/test/Sema/arm-neon-types.c (original)
> +++ cfe/trunk/test/Sema/arm-neon-types.c Fri Apr 12 15:17:20 2013
> @@ -1,4 +1,5 @@
>  // RUN: %clang_cc1 -triple thumbv7-apple-darwin10 -target-cpu cortex-a8 -fsyntax-only -Wvector-conversion -ffreestanding -verify %s
> +#ifndef INCLUDE
> 
>  #include <arm_neon.h>
> 
> @@ -33,3 +34,14 @@ int16x8_t test5(int *p) {
>  void test6(float *p, int32x2_t v) {
>    return vst1_s32(p, v); // expected-warning {{incompatible pointer types}}
>  }
> +
> +#define INCLUDE
> +#include "arm-neon-types.c"
> +#else
> +
> +// Make sure we don't get a warning about using a static function in an
> +// extern inline function from a header.
> +extern inline uint8x8_t test7(uint8x8_t a, uint8x8_t b) {
> +  return vadd_u8(a, b);
> +}
> +#endif
> 
> Modified: cfe/trunk/utils/TableGen/NeonEmitter.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/TableGen/NeonEmitter.cpp?rev=179406&r1=179405&r2=179406&view=diff
> ==============================================================================
> --- cfe/trunk/utils/TableGen/NeonEmitter.cpp (original)
> +++ cfe/trunk/utils/TableGen/NeonEmitter.cpp Fri Apr 12 15:17:20 2013
> @@ -1342,7 +1342,7 @@ void NeonEmitter::run(raw_ostream &OS) {
>      }
>    }
> 
> -  OS<<"#define __ai static __attribute__((__always_inline__, __nodebug__))\n\n";
> +  OS<<"#define __ai static inline __attribute__((__always_inline__, __nodebug__))\n\n";
> 
>    std::vector<Record*> RV = Records.getAllDerivedDefinitions("Inst");
> 
> 
> 
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130416/7ce0c4a3/attachment.html>


More information about the cfe-commits mailing list