[mythtv] configure and "restrict"

Nigel Pearson nigel at ind.tansu.com.au
Wed Oct 29 01:03:05 UTC 2008


FFMPeg gives us this:

_restrict=
for restrict_keyword in restrict __restrict__ __restrict; do
     check_cc <<EOF && _restrict=$restrict_keyword && break
void foo(char * $restrict_keyword p);
EOF
done



which does the right thing with C:

MacBook% cat zot.c
void foo(char * restrict p);

MacBook% gcc -c -D_ISOC99_SOURCE -fasm -std=c99 -fasm -std=c99 -pipe - 
force_cpusubtype_ALL -Wno-sign-compare zot.c || echo DIED



but not for C++:

% g++ -c -D_ISOC99_SOURCE -fasm -std=c99 -fasm -std=c99 -pipe - 
force_cpusubtype_ALL -Wno-sign-compare zot.c || echo DIED
cc1plus: warning: command line option "-std=c99" is valid for C/ObjC  
but not for C++
cc1plus: warning: command line option "-std=c99" is valid for C/ObjC  
but not for C++
zot.c:1: error: expected ',' or '...' before 'p'
DIED

MacBook% g++ -v
Using built-in specs.
Target: i686-apple-darwin8
Configured with: /private/var/tmp/gcc/gcc-5363.obj~28/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 5363)




Before the FFmpeg resync, it was compiled without the
-std=c99, which meant restrict=__restrict__.

I am about to override on darwin, just for the
few C++ source files that include inttypes.h.


Any better (more portable) long-term suggestions?

--
Nigel Pearson, nigel at ind.tansu.com.au|Smart mice ... varmints|
Telstra Net. Eng., Sydney, Australia |used vector formulas.  |
Office: 9202 3900    Fax:  9261 3912 |  How'd you catch them?|
Mobile: 0408 664435  Home: 9792 6998 |Smart cheese.          |






More information about the mythtv-dev mailing list