lint warning

Discussion in 'C Programming' started by somenath, Sep 18, 2007.

  1. somenath

    somenath Guest

    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
     
    somenath, Sep 18, 2007
    #1
    1. Advertising

  2. somenath

    Chris Hills Guest

    In article <>,
    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 \/\/\
    \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
     
    Chris Hills, Sep 18, 2007
    #2
    1. Advertising

  3. somenath

    user923005 Guest

    On Sep 18, 5:01 am, somenath <> 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;
    }
     
    user923005, Sep 19, 2007
    #3
  4. somenath

    jaysome Guest

    On Tue, 18 Sep 2007 13:26:49 +0100, Chris Hills <>
    wrote:

    >In article <>,
    >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
     
    jaysome, Sep 19, 2007
    #4
  5. somenath

    Army1987 Guest

    On Tue, 18 Sep 2007 17:27:03 -0700, user923005 wrote:

    > On Sep 18, 5:01 am, somenath <> 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
     
    Army1987, Sep 19, 2007
    #5
  6. somenath

    Tor Rustad Guest

    On 19 Sep, 12:42, Army1987 <> 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.
     
    Tor Rustad, Sep 19, 2007
    #6
  7. somenath

    user923005 Guest

    On Sep 19, 12:59 am, jaysome <> wrote:
    > On Tue, 18 Sep 2007 13:26:49 +0100, Chris Hills <>
    > wrote:
    >
    >
    >
    >
    >
    > >In article <>,
    > >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 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.
     
    user923005, Sep 19, 2007
    #7
  8. somenath

    somenath Guest

    On Sep 19, 5:27 am, user923005 <> wrote:
    > On Sep 18, 5:01 am, somenath <> 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 ?
     
    somenath, Sep 19, 2007
    #8
  9. somenath

    Army1987 Guest

    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
     
    Army1987, Sep 20, 2007
    #9
  10. somenath

    jaysome Guest

    On Wed, 19 Sep 2007 09:06:45 -0700, user923005 <>
    wrote:

    >On Sep 19, 12:59 am, jaysome <> wrote:
    >> On Tue, 18 Sep 2007 13:26:49 +0100, Chris Hills <>
    >> wrote:
    >>
    >>
    >>
    >>
    >>
    >> >In article <>,
    >> >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 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
     
    jaysome, Sep 20, 2007
    #10
  11. somenath

    Tor Rustad Guest

    Army1987 wrote:
    > 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.



    Oooops, I should have replied to user923005 instead. <g>


    --
    Tor <torust [at] online [dot] no>
     
    Tor Rustad, Sep 20, 2007
    #11
  12. somenath

    user923005 Guest

    On Sep 19, 10:35 pm, jaysome <> wrote:
    > On Wed, 19 Sep 2007 09:06:45 -0700, user923005 <>
    > wrote:
    >
    >
    >
    >
    >
    > >On Sep 19, 12:59 am, jaysome <> wrote:
    > >> On Tue, 18 Sep 2007 13:26:49 +0100, Chris Hills <>
    > >> wrote:

    >
    > >> >In article <>,
    > >> >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 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?


    Yes. I have found real problems with splint that pc-lint missed.

    With both tools you have to wade through a mountain of rubbish to find
    any real diamonds, but after a while you get used to what is worthless
    and what is worthwhile.

    I tend to search for keywords that I know are valuable in the output
    files like 'bounds' , 'null' , etc.
     
    user923005, Sep 20, 2007
    #12
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Vincent Cate
    Replies:
    14
    Views:
    1,677
    Chris Smith
    Dec 22, 2003
  2. Replies:
    0
    Views:
    412
  3. Captain Dondo

    css 'lint'

    Captain Dondo, Jun 24, 2005, in forum: HTML
    Replies:
    1
    Views:
    1,080
    Spartanicus
    Jun 24, 2005
  4. myName

    C++ .. Lint warning

    myName, May 17, 2004, in forum: C++
    Replies:
    4
    Views:
    584
    myName
    May 17, 2004
  5. David Sudolcan
    Replies:
    7
    Views:
    2,082
    Eric Sosman
    Apr 4, 2011
Loading...

Share This Page