[mythtv] configure and "restrict"

Janne Grunau janne-mythtv at grunau.be
Wed Oct 29 09:58:07 UTC 2008


On Wednesday 29 October 2008 02:03:05 Nigel Pearson wrote:
> 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

any specific reason why there are C specific flags in the g++ command? I 
hope you haven't copied that from a C++ compile during mythtv 
compilation. FFmpeg's CFLAGS shouldn't be used for C++ files and aren't 
on linux.

> 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?

I would guess that gcc still supports __restrict__ with -std=c99 and 
will support that for a long time. I would move it to the begin of the 
restrict_keyword list.

Janne


More information about the mythtv-dev mailing list