Splint (programming tool): Difference between revisions

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search
imported>JJMC89 bot III
 
imported>Bender the Bot
m top: HTTP to HTTPS for SourceForge
 
Line 5: Line 5:
| screenshot            =
| screenshot            =
| caption                =
| caption                =
| developer              = [http://sourceforge.net/project/memberlist.php?group_id=34302 The Splint Developers]
| developer              = [https://sourceforge.net/project/memberlist.php?group_id=34302 The Splint Developers]
| latest release version = 3.1.2
| latest release version = 3.1.2
| latest release date    = {{Start date and age|2007|07|12}}
| latest release date    = {{Start date and age|2007|07|12}}
Line 21: Line 21:
Splint is [[free software]] released under the terms of the [[GNU General Public License]].
Splint is [[free software]] released under the terms of the [[GNU General Public License]].


Main development activity on Splint stopped in 2010. According to the [[Concurrent Versions System|CVS]] at [[SourceForge]], as of September 2012 the most recent change in the repository was in November 2010.<ref>{{cite web|accessdate=2012-09-11|url=http://sourceforge.net/project/stats/detail.php?group_id=34302&ugn=splint&type=cvs&mode=12months|title=Splint project CVS statistics}}</ref> A [[Git]] repository at [[GitHub]] has more recent changes, starting in July 2019.<ref>{{cite web|accessdate=2020-09-16|url=https://github.com/splintchecker/splint|title=Splint project git history|website=[[GitHub]] }}</ref>
Main development activity on Splint stopped in 2010. According to the [[Concurrent Versions System|CVS]] at [[SourceForge]], as of September 2012 the most recent change in the repository was in November 2010.<ref>{{cite web|accessdate=2012-09-11|url=https://sourceforge.net/project/stats/detail.php?group_id=34302&ugn=splint&type=cvs&mode=12months|title=Splint project CVS statistics}}</ref> A [[Git]] repository at [[GitHub]] has more recent changes, starting in July 2019.<ref>{{cite web|accessdate=2020-09-16|url=https://github.com/splintchecker/splint|title=Splint project git history|website=[[GitHub]] }}</ref>


==Example==
==Example==

Latest revision as of 03:31, 11 August 2025

Template:Refimprove

Script error: No such module "Infobox".Template:Template other Script error: No such module "Check for unknown parameters".Script error: No such module "Check for conflicting parameters".

Splint, short for Secure Programming Lint, is a programming tool for statically checking C programs for security vulnerabilities and coding mistakes. Formerly called LCLint, it is a modern version of the Unix lint tool.

Splint has the ability to interpret special annotations to the source code, which gives it stronger checking than is possible just by looking at the source alone. Splint is used by gpsd as part of an effort to design for zero defects.[1]

Splint is free software released under the terms of the GNU General Public License.

Main development activity on Splint stopped in 2010. According to the CVS at SourceForge, as of September 2012 the most recent change in the repository was in November 2010.[2] A Git repository at GitHub has more recent changes, starting in July 2019.[3]

Example

#include <stdio.h>
int main()
{
    char c;
    while (c != 'x');
    {
        c = getchar();
        if (c = 'x')
            return 0;
        switch (c) {
        case '\n':
        case '\r':
            printf("Newline\n");
        default:
            printf("%c",c);
        }
    }
    return 0;
}

Splint's output:

Variable c used before definition
Suspected infinite loop. No value used in loop test (c) is modified by test or loop body.
Assignment of int to char: c = getchar()
Test expression for if is assignment expression: c = 'x'
Test expression for if not boolean, type char: c = 'x'
Fall through case (no preceding break)

Fixed source:

#include <stdio.h>
int main()
{
    int c = 0;  // Added an initial assignment definition.

    while (c != 'x') {
        c = getchar();  // Corrected type of c to int
        if (c == 'x') // Fixed the assignment error to make it a comparison operator.
            return 0;
        switch (c) {
        case '\n':
        case '\r':
            printf("Newline\n");
            break;  // Added break statement to prevent fall-through.
        default:
            printf("%c",c);
            break;  //Added break statement to default catch, out of good practice.
        }
    }
    return 0;
}

See also

Script error: No such module "Portal".

References

<templatestyles src="Reflist/styles.css" />

  1. Script error: No such module "citation/CS1".
  2. Script error: No such module "citation/CS1".
  3. Script error: No such module "citation/CS1".

Script error: No such module "Check for unknown parameters".

External links


Template:Asbox