Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > lint warning

Reply
Thread Tools

lint warning

 
 
somenath
Guest
Posts: n/a
 
      09-18-2007

























Hi All,

I was trying to learn the use of "lint" (A tool for statically
checking C programs)
So that I wrote simple c program as mentioned bellow

#include<stdio.h>
int main(void)
{
printf("\n Hello World\n");
return 0;
}

But when I use lint to check my code I get the bellow mentioned
warning

helloWorld.c: (in function main)
helloWorld.c:4:2: Called procedure printf may access file system
state, but
globals list does not include globals fileSystem
A called function uses internal state, but the globals list for the
function
being checked does not include internalState (Use -internalglobs to
inhibit
warning)
helloWorld.c:4:2: Undocumented modification of file system state
possible from
call to printf: printf("\n Hello World\n")
report undocumented file system modifications (applies to
unspecified
functions if modnomods is set) (Use -modfilesys to inhibit warning)

Could you please let me know what is the warning is all about ?
How can I fix this warning ?

Regards,
Somenath

 
Reply With Quote
 
 
 
 
Chris Hills
Guest
Posts: n/a
 
      09-18-2007
In article <. com>,
somenath <> writes
>Hi All,
>
>I was trying to learn the use of "lint" (A tool for statically
>checking C programs)
>So that I wrote simple c program as mentioned bellow
>
>#include<stdio.h>
>int main(void)
>{
> printf("\n Hello World\n");
> return 0;
>}
>
>But when I use lint to check my code I get the bellow mentioned
>warning
>
>helloWorld.c: (in function main)
>helloWorld.c:4:2: Called procedure printf may access file system
>state, but
> globals list does not include globals fileSystem
> A called function uses internal state, but the globals list for the
>function
> being checked does not include internalState (Use -internalglobs to
>inhibit
> warning)
>helloWorld.c:4:2: Undocumented modification of file system state
>possible from
> call to printf: printf("\n Hello World\n")
> report undocumented file system modifications (applies to
>unspecified
> functions if modnomods is set) (Use -modfilesys to inhibit warning)
>
>Could you please let me know what is the warning is all about ?
>How can I fix this warning ?



Try asking at www.gimpel.com


--
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
\/\/\/\/\ Chris Hills Staffs England /\/\/\/\/
/\/\/ www.phaedsys.org \/\/\
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/



 
Reply With Quote
 
 
 
 
user923005
Guest
Posts: n/a
 
      09-19-2007
On Sep 18, 5:01 am, somenath <somenath...@gmail.com> wrote:
> Hi All,
>
> I was trying to learn the use of "lint" (A tool for statically
> checking C programs)
> So that I wrote simple c program as mentioned bellow
>
> #include<stdio.h>
> int main(void)
> {
> printf("\n Hello World\n");
> return 0;
>
> }
>
> But when I use lint to check my code I get the bellow mentioned
> warning
>
> helloWorld.c: (in function main)
> helloWorld.c:4:2: Called procedure printf may access file system
> state, but
> globals list does not include globals fileSystem
> A called function uses internal state, but the globals list for the
> function
> being checked does not include internalState (Use -internalglobs to
> inhibit
> warning)
> helloWorld.c:4:2: Undocumented modification of file system state
> possible from
> call to printf: printf("\n Hello World\n")
> report undocumented file system modifications (applies to
> unspecified
> functions if modnomods is set) (Use -modfilesys to inhibit warning)
>
> Could you please let me know what is the warning is all about ?
> How can I fix this warning ?


Get a calmer version of lint. Lint is known to be a little neurotic,
but that one seems to be on the verge of psychotic. Some output from
two different versions of lint that I use:

C:\tmp>lin foo.c

C:\tmp>"C:\Lint\Lint-nt" +v -i"C:\Lint" std.lnt -os(_LINT.TMP)
foo.c
PC-lint for C/C++ (NT) Vers. 8.00u, Copyright Gimpel Software
1985-2006

--- Module: foo.c (C)

C:\tmp>type _LINT.TMP | more

--- Module: foo.c (C)

---
output placed in _LINT.TMP

C:\tmp>splint foo.c
Splint 3.1.1 --- 12 Mar 2007

Finished checking --- no warnings

C:\tmp>type foo.c
#include<stdio.h>
int main(void)
{
printf("\n Hello World\n");
return 0;
}

 
Reply With Quote
 
jaysome
Guest
Posts: n/a
 
      09-19-2007
On Tue, 18 Sep 2007 13:26:49 +0100, Chris Hills <>
wrote:

>In article <. com>,
>somenath <> writes
>>Hi All,
>>
>>I was trying to learn the use of "lint" (A tool for statically
>>checking C programs)
>>So that I wrote simple c program as mentioned bellow
>>
>>#include<stdio.h>
>>int main(void)
>>{
>> printf("\n Hello World\n");
>> return 0;
>>}
>>
>>But when I use lint to check my code I get the bellow mentioned
>>warning
>>
>>helloWorld.c: (in function main)
>>helloWorld.c:4:2: Called procedure printf may access file system
>>state, but
>> globals list does not include globals fileSystem
>> A called function uses internal state, but the globals list for the
>>function
>> being checked does not include internalState (Use -internalglobs to
>>inhibit
>> warning)
>>helloWorld.c:4:2: Undocumented modification of file system state
>>possible from
>> call to printf: printf("\n Hello World\n")
>> report undocumented file system modifications (applies to
>>unspecified
>> functions if modnomods is set) (Use -modfilesys to inhibit warning)
>>
>>Could you please let me know what is the warning is all about ?
>>How can I fix this warning ?

>
>
>Try asking at www.gimpel.com


That's bad advice, since Gimpel's product is PC-lint, which has
nothing to do with the options the OP described. A fairly simple
Google search for the options mentioned in the OP's post shows that he
or she is using splint.

Silly warnings such as the one the OP described are what you'll have
to put up with in splint. You get what you pay for with lint tools in
the real world. PC-lint is worth the money if you are serious about
software quality, even if your license plate does read "CODEGOD" :^)

Regards
--
jay
 
Reply With Quote
 
Army1987
Guest
Posts: n/a
 
      09-19-2007
On Tue, 18 Sep 2007 17:27:03 -0700, user923005 wrote:

> On Sep 18, 5:01 am, somenath <somenath...@gmail.com> wrote:
>> Hi All,
>>
>> I was trying to learn the use of "lint" (A tool for statically
>> checking C programs)
>> So that I wrote simple c program as mentioned bellow
>>
>> #include<stdio.h>
>> int main(void)
>> {
>> printf("\n Hello World\n");
>> return 0;
>>
>> }
>>
>> But when I use lint to check my code I get the bellow mentioned
>> warning
>>
>> helloWorld.c: (in function main)
>> helloWorld.c:4:2: Called procedure printf may access file system
>> state, but
>> globals list does not include globals fileSystem
>> A called function uses internal state, but the globals list for the
>> function
>> being checked does not include internalState (Use -internalglobs to
>> inhibit
>> warning)
>> helloWorld.c:4:2: Undocumented modification of file system state
>> possible from
>> call to printf: printf("\n Hello World\n")
>> report undocumented file system modifications (applies to
>> unspecified
>> functions if modnomods is set) (Use -modfilesys to inhibit warning)
>>
>> Could you please let me know what is the warning is all about ?
>> How can I fix this warning ?

>
> Get a calmer version of lint. Lint is known to be a little neurotic,
> but that one seems to be on the verge of psychotic. Some output from
> two different versions of lint that I use:

[snip]
> C:\tmp>splint foo.c
> Splint 3.1.1 --- 12 Mar 2007
>
> Finished checking --- no warnings

That's because you used it with its default strictness (-standard).
Try using -checks or -strict...
From man splint:

-strict
Absurdly strict checking. All checking done by checks, plus modi‐
fications and global variables used in unspecified functions,
strict standard library, and strict typing of C operators. A spe‐
cial reward will be presented to the first person to produce a
real program that produces no errors with strict checking.

--
Army1987 (Replace "NOSPAM" with "email")
If you're sending e-mail from a Windows machine, turn off Microsoft's
stupid “Smart Quotes” feature. This is so you'll avoid sprinkling garbage
characters through your mail. -- Eric S. Raymond and Rick Moen

 
Reply With Quote
 
Tor Rustad
Guest
Posts: n/a
 
      09-19-2007
On 19 Sep, 12:42, Army1987 <army1...@NOSPAM.it> wrote:

[...]

> That's because you used it with its default strictness (-standard).
> Try using -checks or -strict...


No, OP ran splint at "strict" mode, the default splint mode is
"standard". The "internalglobs" and "modfilesys" checks are only done
at strict mode.

The splint modes are:

weak -> standard -> checks -> strict

and I never go above "standard" mode, and like man page said, the
strict mode isn't for *real* programs.

 
Reply With Quote
 
user923005
Guest
Posts: n/a
 
      09-19-2007
On Sep 19, 12:59 am, jaysome <jays...@hotmail.com> wrote:
> On Tue, 18 Sep 2007 13:26:49 +0100, Chris Hills <ch...@phaedsys.org>
> wrote:
>
>
>
>
>
> >In article <1190116870.291027.198...@w3g2000hsg.googlegroups. com>,
> >somenath <somenath...@gmail.com> writes
> >>Hi All,

>
> >>I was trying to learn the use of "lint" (A tool for statically
> >>checking C programs)
> >>So that I wrote simple c program as mentioned bellow

>
> >>#include<stdio.h>
> >>int main(void)
> >>{
> >> printf("\n Hello World\n");
> >> return 0;
> >>}

>
> >>But when I use lint to check my code I get the bellow mentioned
> >>warning

>
> >>helloWorld.c: (in function main)
> >>helloWorld.c:4:2: Called procedure printf may access file system
> >>state, but
> >> globals list does not include globals fileSystem
> >> A called function uses internal state, but the globals list for the
> >>function
> >> being checked does not include internalState (Use -internalglobs to
> >>inhibit
> >> warning)
> >>helloWorld.c:4:2: Undocumented modification of file system state
> >>possible from
> >> call to printf: printf("\n Hello World\n")
> >> report undocumented file system modifications (applies to
> >>unspecified
> >> functions if modnomods is set) (Use -modfilesys to inhibit warning)

>
> >>Could you please let me know what is the warning is all about ?
> >>How can I fix this warning ?

>
> >Try asking atwww.gimpel.com

>
> That's bad advice, since Gimpel's product is PC-lint, which has
> nothing to do with the options the OP described. A fairly simple
> Google search for the options mentioned in the OP's post shows that he
> or she is using splint.
>
> Silly warnings such as the one the OP described are what you'll have
> to put up with in splint. You get what you pay for with lint tools in
> the real world. PC-lint is worth the money if you are serious about
> software quality, even if your license plate does read "CODEGOD" :^)


You will notice that I checked the code both with pc-lint 8 and splint
3.1.1.

 
Reply With Quote
 
somenath
Guest
Posts: n/a
 
      09-19-2007
On Sep 19, 5:27 am, user923005 <dcor...@connx.com> wrote:
> On Sep 18, 5:01 am, somenath <somenath...@gmail.com> wrote:
>
>
>
>
>
> > Hi All,

>
> > I was trying to learn the use of "lint" (A tool for statically
> > checking C programs)
> > So that I wrote simple c program as mentioned bellow

>
> > #include<stdio.h>
> > int main(void)
> > {
> > printf("\n Hello World\n");
> > return 0;

>
> > }

>
> > But when I use lint to check my code I get the bellow mentioned
> > warning

>
> > helloWorld.c: (in function main)
> > helloWorld.c:4:2: Called procedure printf may access file system
> > state, but
> > globals list does not include globals fileSystem
> > A called function uses internal state, but the globals list for the
> > function
> > being checked does not include internalState (Use -internalglobs to
> > inhibit
> > warning)
> > helloWorld.c:4:2: Undocumented modification of file system state
> > possible from
> > call to printf: printf("\n Hello World\n")
> > report undocumented file system modifications (applies to
> > unspecified
> > functions if modnomods is set) (Use -modfilesys to inhibit warning)

>
> > Could you please let me know what is the warning is all about ?
> > How can I fix this warning ?

>
> Get a calmer version of lint. Lint is known to be a little neurotic,
> but that one seems to be on the verge of psychotic. Some output from
> two different versions of lint that I use:
>
> C:\tmp>lin foo.c
>
> C:\tmp>"C:\Lint\Lint-nt" +v -i"C:\Lint" std.lnt -os(_LINT.TMP)
> foo.c
> PC-lint for C/C++ (NT) Vers. 8.00u, Copyright Gimpel Software
> 1985-2006
>
> --- Module: foo.c (C)
>
> C:\tmp>type _LINT.TMP | more
>
> --- Module: foo.c (C)
>
> ---
> output placed in _LINT.TMP
>
> C:\tmp>splint foo.c
> Splint 3.1.1 --- 12 Mar 2007
>
> Finished checking --- no warnings
>
> C:\tmp>type foo.c
> #include<stdio.h>
> int main(void)
> {
> printf("\n Hello World\n");
> return 0;
>
>
>


Does it mean that lint does not always throws valid warnings ?


 
Reply With Quote
 
Army1987
Guest
Posts: n/a
 
      09-19-2007
On Wed, 19 Sep 2007 09:00:08 -0700, Tor Rustad wrote:
> No, OP ran splint at "strict" mode, the default splint mode is
> "standard". The "internalglobs" and "modfilesys" checks are only done
> at strict mode.

By 'you' I meant user923005, not somenath.
--
Army1987 (Replace "NOSPAM" with "email")
If you're sending e-mail from a Windows machine, turn off Microsoft's
stupid “Smart Quotes” feature. This is so you'll avoid sprinkling garbage
characters through your mail. -- Eric S. Raymond and Rick Moen

 
Reply With Quote
 
jaysome
Guest
Posts: n/a
 
      09-20-2007
On Wed, 19 Sep 2007 09:06:45 -0700, user923005 <>
wrote:

>On Sep 19, 12:59 am, jaysome <jays...@hotmail.com> wrote:
>> On Tue, 18 Sep 2007 13:26:49 +0100, Chris Hills <ch...@phaedsys.org>
>> wrote:
>>
>>
>>
>>
>>
>> >In article <1190116870.291027.198...@w3g2000hsg.googlegroups. com>,
>> >somenath <somenath...@gmail.com> writes
>> >>Hi All,

>>
>> >>I was trying to learn the use of "lint" (A tool for statically
>> >>checking C programs)
>> >>So that I wrote simple c program as mentioned bellow

>>
>> >>#include<stdio.h>
>> >>int main(void)
>> >>{
>> >> printf("\n Hello World\n");
>> >> return 0;
>> >>}

>>
>> >>But when I use lint to check my code I get the bellow mentioned
>> >>warning

>>
>> >>helloWorld.c: (in function main)
>> >>helloWorld.c:4:2: Called procedure printf may access file system
>> >>state, but
>> >> globals list does not include globals fileSystem
>> >> A called function uses internal state, but the globals list for the
>> >>function
>> >> being checked does not include internalState (Use -internalglobs to
>> >>inhibit
>> >> warning)
>> >>helloWorld.c:4:2: Undocumented modification of file system state
>> >>possible from
>> >> call to printf: printf("\n Hello World\n")
>> >> report undocumented file system modifications (applies to
>> >>unspecified
>> >> functions if modnomods is set) (Use -modfilesys to inhibit warning)

>>
>> >>Could you please let me know what is the warning is all about ?
>> >>How can I fix this warning ?

>>
>> >Try asking atwww.gimpel.com

>>
>> That's bad advice, since Gimpel's product is PC-lint, which has
>> nothing to do with the options the OP described. A fairly simple
>> Google search for the options mentioned in the OP's post shows that he
>> or she is using splint.
>>
>> Silly warnings such as the one the OP described are what you'll have
>> to put up with in splint. You get what you pay for with lint tools in
>> the real world. PC-lint is worth the money if you are serious about
>> software quality, even if your license plate does read "CODEGOD" :^)

>
>You will notice that I checked the code both with pc-lint 8 and splint
>3.1.1.


I commend you for that. The more compilers and tools you can use on
code the better, IMHO.

I gave up on splint a while ago, because of (1) the hassles I
experienced to get it working (I don't think I ever really got it
working like I expected it to work), and (2) splint doesn't do C++,
whereas PC-lint does, and I do both C and C++, and (3) given the
above, I assumed that any potential serious warnings or errors flagged
by splint would also be flagged by PC-lint; I could be wrong on this.

The question I have for you is ... Have you have found splint to be of
any use on top of PC-lint?

Thanks
--
jay
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
PC-Lint complains about this code, but I don't know what's wrong withit (PC-Lint error #145) David Sudolcan C Programming 7 04-04-2011 02:58 AM
Re: LF Java Lint tools gimme_this_gimme_that@yahoo.com Java 0 01-15-2005 05:45 AM
Re: LF Java Lint tools Stefan Reich Java 0 01-11-2005 02:30 AM
C++ .. Lint warning myName C++ 4 05-17-2004 10:22 AM
Target VM Microsoft? or Java Lint to check for MS VM compatibility? Vincent Cate Java 14 12-22-2003 04:59 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57