keyword inline from C99
Posted: Sun Aug 21, 2005 10:52 pm
Hi,
I encountered some problems building RND 3.1.1 on IRIX (with the Mipspro compiler) and
on Solaris (with Sun Studio).
From the error messages and my research on the web, I conclude that the code does not
comply with the restrictions put on the usage of the new "inline" keyword in the C99
standard.
If i do _not_ enable C99 on IRIX, the compiler complains:
/usr/people/heinz/pkgsrc/games/rocksndiamonds/work/.mipspro/bin/cc -O2 -64 -I/usr/people/heinz/pkgsrc/games/rocksndiamonds/work/.buildlink/include -DTARGET_X11 "-DRO_GAME_DIR=\"/usr/people/heinz/pkg/share/rocksndiamonds\"" "-DRW_GAME_DIR=\"/usr/people/heinz/pkg/var/games/rocksndiamonds\"" -c system.c -64 -L/usr/people/heinz/kgsrc/games/rocksndiamonds/work/.buildlink/lib
cc-1077 cc: ERROR File = x11.h, Line = 337
The indicated declaration has no storage class or type specifier.
inline void X11InitVideoDisplay(void);
^
cc-1065 cc: ERROR File = x11.h, Line = 337
A semicolon is expected at this point.
inline void X11InitVideoDisplay(void);
^
[ 100 other messages snipped ]
With C99 enabled, I get this:
cc-3580 c99: ERROR File = system.c, Line = 333
an entity with internal linkage cannot be referenced within an inline function
with external linkage
video.depth = GetRealDepth(depth);
^
[ similar errors in lines 356, 401, 442, 448, 449, 463, 473, 532, 1197 of system.c ]
GetRealDepth() is a static function ("an identifier with internal linkage") and is not allowed
to be referenced from within InitVideoBuffer() ("an inline definition with external linkage").
See chapter 6.7.4 of the C99 standard I found here:
http://www.open-std.org/jtc1/sc22/wg14/ ... /n1124.pdf
The errors
cc-3292 c99: ERROR File = x11.h, Line = 337
The extern inline function "X11InitVideoDisplay" was referenced but not
defined.
inline void X11InitVideoDisplay(void);
^
[ similar errors in line 338, 343 - 349 in x11.h]
seem to happen because there is no definition of X11InitVideoDisplay() available in the
translation unit for system.c, only the included declaration in x11.h.
I think
http://www.comeaucomputing.com/techtalk/c99/#inline
shows this rule with the function "NotDefined()".
Similar problems appear in gadget.c and probably other files I have not reached yet.
If you care about compilers other than gcc (which obviously handles "inline" in its own,
non-compliant way), I think the use of "inline" and "static" should be reconsidered.
ciao
Klaus
PS: Is there no decent mailing list? Writing in web forums sucks, IMNSHO.
I encountered some problems building RND 3.1.1 on IRIX (with the Mipspro compiler) and
on Solaris (with Sun Studio).
From the error messages and my research on the web, I conclude that the code does not
comply with the restrictions put on the usage of the new "inline" keyword in the C99
standard.
If i do _not_ enable C99 on IRIX, the compiler complains:
/usr/people/heinz/pkgsrc/games/rocksndiamonds/work/.mipspro/bin/cc -O2 -64 -I/usr/people/heinz/pkgsrc/games/rocksndiamonds/work/.buildlink/include -DTARGET_X11 "-DRO_GAME_DIR=\"/usr/people/heinz/pkg/share/rocksndiamonds\"" "-DRW_GAME_DIR=\"/usr/people/heinz/pkg/var/games/rocksndiamonds\"" -c system.c -64 -L/usr/people/heinz/kgsrc/games/rocksndiamonds/work/.buildlink/lib
cc-1077 cc: ERROR File = x11.h, Line = 337
The indicated declaration has no storage class or type specifier.
inline void X11InitVideoDisplay(void);
^
cc-1065 cc: ERROR File = x11.h, Line = 337
A semicolon is expected at this point.
inline void X11InitVideoDisplay(void);
^
[ 100 other messages snipped ]
With C99 enabled, I get this:
cc-3580 c99: ERROR File = system.c, Line = 333
an entity with internal linkage cannot be referenced within an inline function
with external linkage
video.depth = GetRealDepth(depth);
^
[ similar errors in lines 356, 401, 442, 448, 449, 463, 473, 532, 1197 of system.c ]
GetRealDepth() is a static function ("an identifier with internal linkage") and is not allowed
to be referenced from within InitVideoBuffer() ("an inline definition with external linkage").
See chapter 6.7.4 of the C99 standard I found here:
http://www.open-std.org/jtc1/sc22/wg14/ ... /n1124.pdf
The errors
cc-3292 c99: ERROR File = x11.h, Line = 337
The extern inline function "X11InitVideoDisplay" was referenced but not
defined.
inline void X11InitVideoDisplay(void);
^
[ similar errors in line 338, 343 - 349 in x11.h]
seem to happen because there is no definition of X11InitVideoDisplay() available in the
translation unit for system.c, only the included declaration in x11.h.
I think
http://www.comeaucomputing.com/techtalk/c99/#inline
shows this rule with the function "NotDefined()".
Similar problems appear in gadget.c and probably other files I have not reached yet.
If you care about compilers other than gcc (which obviously handles "inline" in its own,
non-compliant way), I think the use of "inline" and "static" should be reconsidered.
ciao
Klaus
PS: Is there no decent mailing list? Writing in web forums sucks, IMNSHO.