[Simh] gcc c99 errors in vaxmod_defs.h and vax780_defs.h

Gregory Wright gwright at antiope.com
Mon Jul 21 11:41:01 EDT 2008


Hi,

On Jul 21, 2008, at 11:20 AM, HoffmanLabs wrote:

>
> Mac OS X 10.5.4 Leopard with Xtools 3.1 (current) with gcc 4.0.1.
>
> This code:
>
> /* Function prototypes for physical memory interface (inlined) */
>
> SIM_INLINE int32 ReadB (uint32 pa);
> SIM_INLINE int32 ReadW (uint32 pa);
> SIM_INLINE int32 ReadL (uint32 pa);
> SIM_INLINE int32 ReadLP (uint32 pa);
> SIM_INLINE void WriteB (uint32 pa, int32 val);
> SIM_INLINE void WriteW (uint32 pa, int32 val);
> SIM_INLINE void WriteL (uint32 pa, int32 val);
> ...
>
> runs afoul of c99 rules for inline, and gcc 4.0.1 is now (per its
> release notes) now enforcing these rules.
>
> Compilation errors are akin to the following:
>
> VAX/vaxmod_defs.h:455: warning: inline function ‘WriteB’ declared but
> never defined
> VAX/vaxmod_defs.h:454: warning: inline function ‘ReadLP’ declared but
> never defined
> VAX/vaxmod_defs.h:453: warning: inline function ‘ReadL’ declared but
> never defined
> ....
>
> I've implemented the following brute-force hack (in vaxmod_defs.h and
> vax780_defs.h) to get the code to build and run, but it's certainly  
> not
> the right fix.
>
> /* Function prototypes for physical memory interface (inlined) */
>
> #ifdef SIM_INLINE
> #undef SIM_INLINE
> #define SIM_INLINE extern
> #endif /* Hoff */
> SIM_INLINE int32 ReadB (uint32 pa);
> SIM_INLINE int32 ReadW (uint32 pa);
> SIM_INLINE int32 ReadL (uint32 pa);
> SIM_INLINE int32 ReadLP (uint32 pa);
> SIM_INLINE void WriteB (uint32 pa, int32 val);
> SIM_INLINE void WriteW (uint32 pa, int32 val);
> SIM_INLINE void WriteL (uint32 pa, int32 val);
> ...
>
>
> $ gcc --version
> i686-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5484)
>
> I've a set of Mac OS X build and install directions posted which  
> include
> this detail, and am working on some related pieces.
>
> I've also tweaked the local version of the build slightly as libpcap  
> is
> around.
>
> I don't immediately see any list archives referenced, so this c99-ism
> may be known and discussed elsewhere.
>
>

The issue came up last month, when I was porting the simh 3.8 to  
MacPorts.
Here's the reference:

http://mailman.trailing-edge.com/pipermail/simh/2008-June/001936.html

Something along the lines of the patch shown is probably the right  
thing to
use, but it needs to be checked for compatibility earlier gcc releases.

Greg





More information about the Simh mailing list