[splint-discuss] tab, no warnings but gcc doesn't compile, search splint-discuss

Michael Wojcik Michael.Wojcik at MicroFocus.com
Mon Aug 6 07:50:51 EDT 2007


> 2)I have an example that shows no warnings by Splint, yet 
> doesn't compile using GCC version 4.0.3, how can this be?

Splint is not required to detect every condition that would prevent
another implementation from translating a source unit.  Why would it be?

> int
> main(){
> 
> static int add1(int int1, int int2);

This is illegal.  A function declaration at function scope cannot have
the static sc-specifier.  See ISO 9899-1999 6.7.1 #5: "The declaration
of an identifier for a function that has block scope shall have no
explicit storage-class specifier other than extern".

Since it's a violation of the standard, no implementation is required to
translate it.  Since it's not a constraint violation, no implementation
is required to issue a diagnostic for it.  Thus both Splint and GCC are
conformant in this case.

While it might be nice if Splint warned you about this, Splint is not
perfect.

-- 
Michael Wojcik



More information about the splint-discuss mailing list