GCC 4.3 prints an unsuppressable warning about any use of a static inline
function in a non-static inline function.  This includes static inline
functions in GCC's own target-specific extra_headers header files.

For example, this short file uses the ARM/NEON intrinsics functions defined in
arm_neon.h:

====

#include <arm_neon.h>

extern inline uint8x8_t vect_add(uint8x8_t a, uint8x8_t b)
{
        return vadd_u8(a, b);
}

====

$ arm-linux-gnueabi-gcc -mfpu=neon -c inline-test-neon.c
inline-test-neon.c: In function 'vect_add':
inline-test-neon.c:5: warning: 'vadd_u8' is static but used in inline function
'vect_add' which is not static


The example uses gnu_inline style inlining, but the same thing happens with
C99-style inlining if "extern inline" is changed to "inline".

PR 34000 fixed this problem for x86 targets (the *mmintrin.h files), but the
problem persists for other targets.

In particular, the following header files mentioned in extra_targets lines in
config.gcc still have static inline functions:

arm/arm_neon.h
arm/mmintrin.h
i386/cpuid.h
mips/loongson.h
rs6000/ppu_intrinsics.h
rs6000/si2vmx.h
rs6000/spe.h
rs6000/spu2vmx.h
sh/ushmedia.h
spu/spu_internals.h
spu/spu_mfcio.h
spu/vmx2spu.h

PR 34000's fix, of changing "static __inline void
__attribute__((__always_inline__, __artificial__))" to "extern __inline void
__attribute__((__gnu_inline__, __always_inline__, __artificial__))", should
work for the other targets as well.


Full gcc -v output:

$ arm-linux-gnueabi-gcc -v -mfpu=neon -c inline-test-neon.c
Using built-in specs.
Target: arm-linux-gnueabi
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.4.2-1ubuntu1'
--with-bugurl=file:///usr/share/doc/gcc-4.4-armel/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared
--enable-multiarch --enable-linker-build-id --with-system-zlib
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/arm-linux-gnueabi/include/c++/4.4.2
--program-suffix=-4.4 --enable-nls --enable-clocale=gnu
--enable-libstdcxx-debug --enable-objc-gc --disable-sjlj-exceptions
--with-arch=armv7-a --with-tune=cortex-a8 --with-float=softfp --with-fpu=vfp
--disable-werror --enable-checking=release --program-prefix=arm-linux-gnueabi-
--includedir=/usr/arm-linux-gnueabi/include
--with-headers=/usr/arm-linux-gnueabi/include
--with-libs=/usr/arm-linux-gnueabi/lib --build=i486-linux-gnu
--host=i486-linux-gnu --target=arm-linux-gnueabi
Thread model: posix
gcc version 4.4.2 (Ubuntu 4.4.2-1ubuntu1)
COLLECT_GCC_OPTIONS='-v' '-mfpu=neon' '-c' '-march=armv7-a' '-mtune=cortex-a8'
'-mfloat-abi=softfp'
 /usr/lib/gcc/arm-linux-gnueabi/4.4.2/cc1 -quiet -v inline-test-neon.c -quiet
-dumpbase inline-test-neon.c -mfpu=neon -march=armv7-a -mtune=cortex-a8
-mfloat-abi=softfp -auxbase inline-test-neon -version -o /tmp/ccWFWFb1.s
ignoring duplicate directory
"/usr/lib/gcc/arm-linux-gnueabi/4.4.2/../../../../arm-linux-gnueabi/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/arm-linux-gnueabi/4.4.2/include
 /usr/lib/gcc/arm-linux-gnueabi/4.4.2/include-fixed
 /usr/arm-linux-gnueabi/include
End of search list.
GNU C (Ubuntu 4.4.2-1ubuntu1) version 4.4.2 (arm-linux-gnueabi)
        compiled by GNU C version 4.4.1, GMP version 4.3.1, MPFR version
2.4.1-p2.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: eb94b7d3ec6a4a03406c63875e22eff0
inline-test-neon.c: In function 'vect_add':
inline-test-neon.c:5: warning: 'vadd_u8' is static but used in inline function
'vect_add' which is not static
COLLECT_GCC_OPTIONS='-v' '-mfpu=neon' '-c' '-march=armv7-a' '-mtune=cortex-a8'
'-mfloat-abi=softfp'
 /usr/lib/gcc/arm-linux-gnueabi/4.4.2/../../../../arm-linux-gnueabi/bin/as
-march=armv7-a -mfloat-abi=softfp -mfpu=neon -meabi=5 -o inline-test-neon.o
/tmp/ccWFWFb1.s
COMPILER_PATH=/usr/lib/gcc/arm-linux-gnueabi/4.4.2/:/usr/lib/gcc/arm-linux-gnueabi/4.4.2/:/usr/lib/gcc/arm-linux-gnueabi/:/usr/lib/gcc/arm-linux-gnueabi/4.4.2/:/usr/lib/gcc/arm-linux-gnueabi/:/usr/lib/gcc/arm-linux-gnueabi/4.4.2/../../../../arm-linux-gnueabi/bin/
LIBRARY_PATH=/usr/lib/gcc/arm-linux-gnueabi/4.4.2/:/usr/lib/gcc/arm-linux-gnueabi/4.4.2/../../../../arm-linux-gnueabi/lib/
COLLECT_GCC_OPTIONS='-v' '-mfpu=neon' '-c' '-march=armv7-a' '-mtune=cortex-a8'
'-mfloat-abi=softfp'


-- 
           Summary: GCC pedwarns about use of static inline functions from
                    system headers in extern inline functions
           Product: gcc
           Version: 4.4.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: lennox at cs dot columbia dot edu
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: arm-linux-gnueabi


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42951

Reply via email to