• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            S.l.e!ep.¢%

            像打了激速一樣,以四倍的速度運轉(zhuǎn),開心的工作
            簡單、開放、平等的公司文化;尊重個性、自由與個人價值;
            posts - 1098, comments - 335, trackbacks - 0, articles - 1
              C++博客 :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理

            pclint 升級和使用 [2]

            Posted on 2009-09-19 22:12 S.l.e!ep.¢% 閱讀(2620) 評論(1)  編輯 收藏 引用 所屬分類: test
            pclint 升級和使用 [2]
            2007-07-06 23:42

            安裝
            將壓縮包比如pclint8.zip拷貝到c:\,解壓后重命名目錄為c:\pclint

            不用任何配置,直接使用
            準(zhǔn)備待被檢查的文件:
            先在E:\建一個文件:main.cpp,內(nèi)容為:

            void main()
            {???
            }

            最簡單的用法
            在命令行下輸入:D:\>C:\PCLint\Lint-nt E:\main.cpp

            C:\PCLint>C:\PCLint\Lint-nt E:\main.cpp

            PC-lint for C/C++ (NT) Ver. 8.00q, Copyright Gimpel Software 1985-2004

            --- Module:???? E:\main.cpp

            _

            }

            E:\main.cpp??? 3??? Info 783: Line does not end with new-line

            C:\PCLint>

            PCLINT已經(jīng)工作了,是不是簡單的難以讓人相信。

            最簡單的標(biāo)準(zhǔn)用法
            修改被檢查的文件E:\main.cpp,內(nèi)容修改為:
            #include <stdio.h>
            void main()
            {
            ????? printf("hello pclint\n");???
            }

            再次在命令行下輸入:D:\>C:\PCLint\Lint-nt E:\main.cpp
            D:\>lint
            PC-lint for C/C++ (NT) Ver. 8.00q, Copyright Gimpel Software 1985-2004

            --- Module:???? E:\main.cpp
            ?????????? _

            #include <stdio.h>
            E:\main.cpp??? 1??? Error 322: Unable to open include file 'stdio.h'
            D:\>

            報錯誤,“不能找到頭文件stdio.h”
            當(dāng)然PCLINT不可能也不應(yīng)該知道到哪里去找stdio.h,stdio.h所在的路徑需要我們告訴它。
            如何告訴呢?
            通常的做法是在xxx.lnt文件中指定,然后指定使用這個xxx.lnt文件。
            最簡單的是使用 c:\pclint\std.lnt 這個文件。

            std.lnt的配置:
            修改std.lnt
            運行C:\PCLint\CONFIG.EXE(或者直接手工修改std.lnt)

            最后生成的std.lnt內(nèi)容為:

            //??? Microsoft C and Visual C++ 6.x, -si4 -sp4,

            //??? Standard lint options

            co-msc60.lnt

            // options.lnt??? -si4 -sp4

            -i"E:\Program Files\Microsoft Visual Studio\VC98\Include"

            -i"E:\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE"

            -i"E:\Program Files\Microsoft Visual Studio\VC98\ATL\INCLUDE"

            暫時將options.lnt 這行注釋掉。
            注:如果生成的std.lnt內(nèi)容與上面不一樣,可以手工修改成上面那樣。

            使用std.lnt
            再次在命令行下輸入:D:\> C:\PCLint\Lint-nt -i"C:\PCLint" -u std.lnt e:\main.cpp

            C:\PCLint\Lint-nt -i"C:\PCLint" -u std.lnt e:\main.cpp

            -i"C:\PCLint" -u std.lnt 指明使用std.lnt這個選項文件,至于std.lnt在什么目錄,通過-i"C:\PCLint"告知。

            至此,我們已經(jīng)學(xué)會了PCLINT的簡單用法及兩個選項:-i,-u

            -i 指明包含路徑

            -u 指明使用哪些.lnt文件


            前面我們掌握了命令行方式下PCLINT的使用方法,下面介紹在VC下面的配置及使用。

            3.1. VC下的配置
            新建一自定義工具項,名稱為:PCLINT

            其中的Arguments為:-i"C:\PCLint" -u std.lnt env-vc6.lnt "$(FileName)$(FileExt)"

            Q:怎么知道要輸入這樣的參數(shù)了?

            A:從幫助中得知的,見文件env-vc6.lnt

            Q: env-vc6.lnt有什么作用?

            A:指定輸出錯誤報告的格式,這個選項可以去掉,比如修改為:

            Arguments為:-i"C:\PCLint" -u std.lnt "$(FileName)$(FileExt)"

            3.2. 示例
            3.2.1.????? testForPclint1
            新建一個最簡單的Win32 Console Application,工程名testForPclint1,其中的main.cpp為:

            void main()

            {???

            }

            點擊Tools菜單下面的PCLINT菜單項:

            PC-lint for C/C++ (NT) Ver. 8.00q, Copyright Gimpel Software 1985-2004

            --- Module:???? main.cpp

            }

            main.cpp(3): error 783: (Info -- Line does not end with new-line)

            --- Global Wrap-up

            error 900: (Note -- Successful completion, 1 messages produced)

            Press any key to continue

            第三行有個錯誤:error 783: (Info -- Line does not end with new-line)

            意思是說沒有以新行結(jié)束。

            注:如果Arguments為:-i"C:\PCLint" -u std.lnt "$(FileName)$(FileExt)"

            則結(jié)果為:

            PC-lint for C/C++ (NT) Ver. 8.00q, Copyright Gimpel Software 1985-2004


            --- Module:???? main.cpp
            _

            }

            main.cpp(3) : Info 783: Line does not end with new-line

            Press any key to continue

            修改main.cpp為:

            void main()

            {???

            }<---即在這里加一個回車

            再次LINT,結(jié)果沒有任何告警:

            PC-lint for C/C++ (NT) Ver. 8.00q, Copyright Gimpel Software 1985-2004

            --- Module:???? main.cpp
            --- Global Wrap-up
            error 900: (Note -- Successful completion, 0 messages produced)
            Press any key to continue

            3.2.2.????? testForPclint2
            新建一個最簡單的Win32 Console Application,工程名testForPclint2,其中的main.cpp為:

            #include "stdio.h"
            int main(int argc, char* argv[])
            {
            ????? printf("hello\n");
            }

            點擊Tools菜單下面的PCLINT菜單項:

            PC-lint for C/C++ (NT) Ver. 8.00q, Copyright Gimpel Software 1985-2004

            --- Module:???? main.cpp
            _

            }

            main.cpp(6) : Warning 533: function 'main(int, char **)' should return a value

            ????? (see line 3)

            main.cpp(3) : Info 830: Location cited in prior message

            _

            }

            main.cpp(6) : Info 715: Symbol 'argv' (line 3) not referenced

            main.cpp(3) : Info 830: Location cited in prior message

            _

            }

            main.cpp(6) : Info 818: Pointer parameter 'argv' (line 3) could be declared as

            ????? pointing to const

            main.cpp(3) : Info 830: Location cited in prior message

            _

            }

            main.cpp(6) : Info 715: Symbol 'argc' (line 3) not referenced

            main.cpp(3) : Info 830: Location cited in prior message

            Press any key to continue

            有4個告警,修改main.cpp為:

            #include "stdio.h"
            int main(int argc, char* argv[])
            {
            ????? (void)argc; // pc lint
            ????? (void)argv; // pc lint
            ????? printf("hello\n");
            ????? return 0;
            }


            再次LINT,無任何告警了。

            PC-lint for C/C++ (NT) Ver. 8.00q, Copyright Gimpel Software 1985-2004

            --- Module:???? main.cpp
            Press any key to continue

            4.???? 使用批處理方法
            為什么要使用批處理?還不是為了使用更簡單。

            我們在C:\PCLint建一個批處理文件lint.bat,內(nèi)容為:
            @echo off
            C:\PCLint\Lint-nt -i"C:\PCLint" -u std.lnt e:\main.cpp

            為了支持輸入?yún)?shù),修改為:
            @echo off
            C:\PCLint\Lint-nt -i"C:\PCLint" -u std.lnt %1

            這時候我們不能簡單輸入D:\>lint.bat,而必須加上輸入?yún)?shù):

            D:\>lint.bat e:\main.cpp

            ////////////////////////

            二,pc??? lint??? 在幾個編譯器的配置???
            ??????
            ?? 人云亦云實在不是個好行為-----網(wǎng)絡(luò)上都那樣一致的說法讓我走了不少彎路??? 。?????
            ??????
            ??????
            ?? 好了言歸正傳,開始配置pc??? lint??? .?????
            ??????
            ?? 以下假設(shè)您已經(jīng)把pc??? lint??? 安裝在C盤下(c:\pclint)???
            ?? (其他目錄也可以)???
            ??????
            ?? 我們不必要將c:\pclint\lnt??? 下的???
            ?? 3個文件lib-w32.lnt,env-vc6.lnt,co-msc60.lnt拷貝至c:\pclint下,???
            ?? 那樣簡直是擾亂視線,而且還會引起麻煩??? ;???
            ??????
            ?? 也不必在安裝目錄下創(chuàng)建std.lnt和options.lnt兩個文件??? !???
            ??????
            ?? 因為我要設(shè)置VC6,??? Source??? Insight??? 及Keil??? C51等編譯器,???
            ??????
            ?? 所以不是一個std.lnt就能解決問題的??? !???
            ??????
            ?? 我的做法是:??? 一類編譯器一個lnt文件,基本屬于"不動產(chǎn)" .?????
            ?? e.g.??? :?????
            ?? vc6_0.int???????
            ?? //??? vc6_0.int??? content??? for??? VC6??? .???
            ?? //************************************************************************???
            ?? //************************************************************************???
            ??????
            ????
            ?? //??? compile??? environment???
            ?? c:\pclint\lnt\env-vc6.lnt???
            ??????
            ????
            ?? //??? system??? lib??? include??? .???
            ?? c:\pclint\lnt\co-msc60.lnt???
            ?? c:\pclint\lnt\lib-w32.lnt???
            ??????
            ????
            ?? //??? system??? stdio??? hearder??? files??? directory??? .???
            ?? -i"D:\Program??? Files;D:\Program??? Files\Microsoft??? Visual??? Studio\VC98\Include"???
            ??????
            ????
            ?? //??? user's??? defined??? lint??? configure??? file??? .???
            ?? G:\work\eva_skype\eva_skype_pc\vc.lnt??? -si4??? -sp4???

            si3_5.int???????
            ?? //??? si3_5.int??? content??? for??? Source??? Insight??? .???
            ?? //************************************************************************???
            ?? //************************************************************************???
            ??????
            ????
            ?? //??? compile??? environment??? .???
            ?? c:\pclint\lnt\env-si.lnt???
            ??????
            ????
            ?? //??? system??? lib??? include??? .???
            ?? c:\pclint\lnt\co-msc60.lnt???
            ?? c:\pclint\lnt\lib-w32.lnt???
            ??????
            ????
            ?? //??? system??? stdio??? hearder??? files??? directory??? .???
            ?? -i"D:\Program??? Files;D:\Program??? Files\Microsoft??? Visual??? Studio\VC98\Include"???
            ??????
            ????
            ?? //??? user's??? defined??? lint??? configure??? file??? .???
            ?? G:\work\eva_skype\handset\app\si.lnt??? -si4??? -sp4???
            ??????
            ????
            ?? //************************************************************************???
            ?? //************************************************************************???
            ??????
            ??????
            ??????
            ??????
            ?? kc51.lnt???
            ?? //??? kc51.lnt??? content??? for??? Keil??? C51??? .???
            ?? //************************************************************************???
            ?? //************************************************************************???
            ??????
            ????
            ?? //??? compile??? environment??? .???
            ?? -i"c:\pclint\lnt\evn-keil.lnt"???
            ??????
            ????
            ?? //??? system??? lib??? include??? .???
            ?? c:\pclint\lnt\co-kc51.lnt???
            ??????
            ????
            ?? //??? system??? stdio??? hearder??? files??? directory??? .???
            ?? -i"D:\Program??? Files\EVA_KEILC51\C51\INC"???
            ??????
            ????
            ?? //??? user's??? defined??? lint??? configure??? file??? .???
            ?? G:\work\eva_skype\handset\kc.lnt??? -si4??? -sp4???

            久久99亚洲综合精品首页| 一本综合久久国产二区| 亚洲精品无码久久久久去q| 一级做a爰片久久毛片毛片| 色偷偷91久久综合噜噜噜噜| 亚洲国产精品成人AV无码久久综合影院 | 亚洲αv久久久噜噜噜噜噜| 久久久噜噜噜久久熟女AA片| 26uuu久久五月天| 色狠狠久久综合网| 51久久夜色精品国产| 久久精品日日躁夜夜躁欧美| 国产精品美女久久久久网| 精品久久久久久无码不卡| 久久亚洲高清观看| 亚洲国产欧洲综合997久久| 国产一区二区精品久久岳| 久久不见久久见免费视频7| 亚洲人成无码久久电影网站| 国产99久久久国产精免费| 久久亚洲精品人成综合网| 性做久久久久久久久老女人| 99精品伊人久久久大香线蕉| 欧美亚洲色综久久精品国产| 欧美粉嫩小泬久久久久久久 | 色诱久久av| 久久国产精品偷99| 国产成人精品久久免费动漫| 性欧美丰满熟妇XXXX性久久久| 青青热久久国产久精品| 99久久精品无码一区二区毛片 | 国产精品成人99久久久久| 久久精品国产男包| 久久亚洲精品国产精品婷婷| segui久久国产精品| 欧美亚洲国产精品久久蜜芽| 久久99热只有频精品8| 国产午夜福利精品久久2021| 国产精品久久久久久福利漫画 | 精品无码久久久久久久久久| 国产精品久久久久久久久|