[mythtv] __always_inline on newer GCCs?

Nigel Pearson nigel at ind.tansu.com.au
Thu Jul 30 03:59:50 UTC 2009


Sadly, this change broke OS X builds:

Message: gcc doesn't respect inline keyword anymore, with GNUC use  
always_inline instead.

Index: /trunk/mythtv/libs/libmythhdhomerun/hdhomerun_os_posix.h
===================================================================
--- /trunk/mythtv/libs/libmythhdhomerun/hdhomerun_os_posix.h  
(revision 21016)
+++ /trunk/mythtv/libs/libmythhdhomerun/hdhomerun_os_posix.h  
(revision 21037)
@@ -61,4 +61,6 @@
  #ifndef __GNUC__
  #define __inline__ inline
+#else
+#define __inline__ __always_inline
  #endif



gcc ...
-o hdhomerun_channels.o hdhomerun_channels.c
In file included from hdhomerun_os.h:40,
                  from hdhomerun.h:35,
                  from hdhomerun_channels.c:33:
hdhomerun_os_posix.h:68: error: syntax error before 'int'
hdhomerun_os_posix.h:74: error: syntax error before 'uint64_t'
hdhomerun_os_posix.h:81: error: syntax error before 'int'
...

% gcc -v
Using built-in specs.
Target: i686-apple-darwin8
Configured with: /var/tmp/gcc/gcc-5370~2/src/configure --disable- 
checking -enable-werror --prefix=/usr --mandir=/share/man --enable- 
languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/ 
$/-4.0/ --with-gxx-include-dir=/include/c++/4.0.0 --with-slibdir=/usr/ 
lib --build=powerpc-apple-darwin8 --with-arch=nocona --with- 
tune=generic --program-prefix= --host=i686-apple-darwin8 -- 
target=i686-apple-darwin8
Thread model: posix
gcc version 4.0.1 (Apple Computer, Inc. build 5370)




Quick Google implies that attribute only works on GCC 3.1 - 3.4:
http://www.ohse.de/uwe/articles/gcc-attributes.html


I suspect we should re-use this logic:

% cat libs/libavutil/common.h
...
#ifdef __GNUC__
#    define AV_GCC_VERSION_AT_LEAST(x,y) (__GNUC__ > x || __GNUC__ ==  
x && __GNUC_MINOR__ >= y)
#else
#    define AV_GCC_VERSION_AT_LEAST(x,y) 0
#endif

#ifndef av_always_inline
#if AV_GCC_VERSION_AT_LEAST(3,1)
#    define av_always_inline __attribute__((always_inline)) inline
#else
#    define av_always_inline inline
#endif
#endif


--
Nigel Pearson, nigel at ind.tansu.com.au|"Reality is that which,  |
Telstra Net. Eng., Sydney, Australia | when you stop believing |
Office: 9202 3900    Fax:  9212 6348 | in it, doesn't go away."|
Mobile: 0408 664435  Home: 9792 6998 | Philip K. Dick - 'Valis'|



More information about the mythtv-dev mailing list