[splint-discuss] Parsing error

Terry Colligan terry-splint at tenberry.com
Tue Apr 8 08:15:40 PDT 2008


On Tuesday 08 April 2008, Ludolf Holzheid wrote:
> On Tue, 2008-04-08 14:46:07 +0200, Putten Bob van der wrote:
> > Ludolf,
> > It is a special function register.
> > In the header file it is declared as:
> > sfr  U0BRG      =       0x3A1;   /* UART 0 baud rate generator */
> > 
> > But Splint does not 'like' sfr. 
> > 
> > So I wrote:
> > 
> > #ifdef S_SPLINT_S
> > #define sfr	unsigned int
> > #endif
> 
> So, the "unsigned int U0BRG = 0x3A1;" appears in a header, not in the
> body of a function (i.e. at 'file scope'). This is no valid C syntax.

  It certainly *is* valid C syntax.
  It's the definition of a global data variable (file scope) with
  an initialization.

  If you include this header in more than one source file, some
  implementations may complain about multiple definitions of U0BRG.

> You'll have to write a version of the header that conforms to the C
> standard. Let the compiler use the original header and splint the new
> one by e.g. different '-I' command line flags for splint and compiler.
> 
> HTH,
> 
> Ludolf
> 



-- 
Terry

Terry Colligan                         terry-splint at tenberry.com


More information about the splint-discuss mailing list