Opened 17 years ago
Closed 17 years ago
Last modified 5 years ago
#2505 closed defect (fixed)
ALL: int8_t in graphics/animation in conflict with ISO99 C
|Reported by:||SF/lblume||Owned by:||fingolfin|
Build fails on Solaris 10 because of the following declaration conflict.
In file included from ./engines/sword1/animation.h:26, from engines/sword1/animation.cpp:26: ./graphics/animation.h:35: error: conflicting declaration 'typedef int8 int8_t' /usr/include/sys/int_types.h:54: error: 'int8_t' has a previous declaration as `typedef char int8_t' ./graphics/animation.h:35: error: declaration of `typedef int8 int8_t' /usr/include/sys/int_types.h:54: error: conflicts with previous declaration `typedef char int8_t' ./graphics/animation.h:35: error: declaration of `typedef int8 int8_t' /usr/include/sys/int_types.h:54: error: conflicts with previous declaration `typedef char int8_t' gmake: *** [engines/sword1/animation.o] Error 1
This is because in config.h, int8 is defined as: typedef signed char int8;
but it is already declared differently in int_types.h: #if defined(_CHAR_IS_SIGNED) typedef char int8_t;
The compiler doesn't like the difference, even if it amounts to the same.
As a quick workaround, I modify config.h before building, and it works. I don't know what would be a clean solution, though.
Ticket imported from: #1436178. Ticket imported from: bugs/2505.
Change History (11)
comment:1 by , 17 years ago
comment:2 by , 17 years ago
by , 17 years ago
Ugly hack to avoid int8 conflict on Solaris
comment:3 by , 17 years ago
Here is a patch for configure, that adds what I think is a ugly hack, but works around the problem on Solaris.
comment:4 by , 17 years ago
|Summary:||Conflicting declaration of int8_t on Solaris → ALL: int8_t in graphics/animation in conflict with ISO99 C|
comment:5 by , 17 years ago
Changing the definition of type int8 is the wrong solution, and not acceptable.
The real bug is that graphics/animation.h redefines the int8_t datatype, which is part of ISO99 C.
comment:6 by , 17 years ago
|Status:||new → closed|
comment:7 by , 17 years ago
If fixed this in CVS for now by replacing our custom typedefs by #include <inttypes.h>
Of course this might cause problems on systems that don't have inttypes.h. But since libmpeg2 / mpeg2dec also does #include <inttypes.h>, it can only be compiled when that header is present, so it *should* be fine... If it is not, then I will deal with that once we get bug reports from people with mpeg2dec but without inttypes.h :-).
comment:8 by , 17 years ago
It builds out of the box now, it feels too easy :-) Thanks!
comment:9 by , 5 years ago
comment:10 by , 5 years ago
|Component:||Ports → Port: Solaris|
config.h is generated by configure script. You may add some solaris-specific defines there. Feel free to attach your patch here.