SGI: Development

_POSIX_C_SOURCE=200112 and timeval?

What's the trick to use timeval when _POSIX_C_SOURCE=200112 is set? Consider the following small program:
Code:
#include <sys/time.h>
#include <time.h>

int main()
{

struct timeval tv;
gettimeofday(&tv,NULL);
return 0;
}
When compiled with
Code:
/usr/bin/c99 -D_POSIX_C_SOURCE=200112 -c -o tv.o tv.c
timeval is an "incomplete type", without the -D_POSIX_C_SOURCE=200112, things work as they should. I currently assume the the ffmpeg maintainers have some good reason to set _POSIX_C_SOURCE, so I don't want to remove this.
I would include <sys/types> first.
<sys/types.h> seems to be unnecessary when not in _POSIX_C_SOURCE mode, and doesn't help otherwise.
Does defining _BSD_TIME or _BSD_COMPAT help at all?

_________________
:1600SW: :O2: :Octane2: :Octane2: :Fuel: :O200:
http://irix-tools.homeunix.net/
-D_BSD_TIME doesn't help, but with -D_BSD_COMPAT the above example does compile... how about ffmpeg? ;)

_________________
:1600SW: :O2: :Octane2: :Octane2: :Fuel: :O200:
http://irix-tools.homeunix.net/
Quote:
how about ffmpeg?
SIGBUS: Bus error (default) at [fill_rectangle:61 ,0x42d8a2c] It would not surprise me if that was caused by some other of my rushed patches. I just wanted to have a bunch of libavformat headers to compile blender 2.50...
Alignment problem?

I started ffmpeg building this afternoon - I'll have a play tomorrow and see if I can get it into any semblance of working...

_________________
:1600SW: :O2: :Octane2: :Octane2: :Fuel: :O200:
http://irix-tools.homeunix.net/
I'd suspect some of the DECLARE_ALIGNED_... statements to be the source of the problem, but they should just be hints for performance optimization, and not actually required for correct operation.
canavan wrote:
I'd suspect some of the DECLARE_ALIGNED_... statements to be the source of the problem, but they should just be hints for performance optimization, and not actually required for correct operation.

ffmpeg wants proper alignment of its data so that it does not have to perform unaligned load and stores, which are slower (and the assembly parts rely upon this).

So if you have enabled the use of the `ps2' assembler code in libavcodec, you definitely want to make sure your alignment hints are correct as the assembler code will perform aligned loads and stores (ld/sd) instead of possibly-misaligned loads and stores (ldlo ldhi/sdlo sdhi).

_________________
:Indigo: :Indigo2: :Indigo2IMP: :Indy: :Indy: :Indy: :O2: :O2: :Octane: :Octane: :O200: - :O200: :Fuel: among ~160 machines...
Looking for IP26 and IP28...