On Wed, 19 Mar 2008, Roland Mainz wrote:

> Keith M Wesolowski wrote:
>> On Sat, Mar 15, 2008 at 04:47:25PM +0100, Roland Mainz wrote:
>
>> One example
>> I can think of that will sneak past is something like:
>>
>> foo.c:
>> int
>> foo(int *x)
>> {
>>         return (0);
>> }
>>
>> bar.c:
>> extern int foo(int *);
>>
>> int bar(void)
>> {
>>         int x, y;
>>         ...
>>         y = foo(&x);
>>         ...
>>         do_something_with_x;
>> }
>>
>> Then again, if you give foo the correct signature (extern int
>> foo(const int *)) then the compiler and lint can do the right thing.
>
> Note that this fails if function |foo()| is in a different library and
> cannot be processed by "lint" (Sun Studio's "cc" has "-xipo" which may
> be able to help a bit... but "lint" doesn't have a similar option... ;-(
> ) ...

In fact it has.
You can "link" .ln files effectively making the interprocedural/intermodule 
analysis.
But you need lint2 (or better lint2n, i.e. -Nlevel=...)
To speed up transition from single file to multifile consider using
-erroff=... to switch all the messages lint is complaining about.

*And* make sure to file your idea of the compiler flag for initializations
through bugs.sun.com, I mean it.

*And* have you considered playing with a mapfile or assembly to make bss 
writable
and explicitly filling it with 0xdeadbeef or something like that? no idea
if that is really possible...

Alexander


Reply via email to