首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

pclint 处理 vcxproj 工程文件

Posted on 2013-05-13 13:32  昕旸灿烂  阅读(702)  评论(0)    收藏  举报

http://www.gimpel.com/html/pub90/read90.txt 中提到

 .vcxproj support
       A .vcxproj file is a recent addition to Microsoft's Visual
       Studio.  Like its cousin the .vcproj file, a .vcxproj file
       describes a single project, possibly consisting of multiple
       modules.  We now process such files in a manner similar to
       .vcproj files (as described in the manual).  Thus, if you have a
       file named x.vcxproj you may process it as follows:
       
             lint-nt x.vcxproj >x.lnt
       
       This will capture in x.lnt, the module names that are embedded in
       x.vcxproj.  Unlike .vcproj files, we do not (yet) attempt to
       deduce either -i options or -d options.

一切还得靠自己,看下面一段代码 

1 FOR /F "tokens=1 delims=," %%i IN (%PCLINTFILE%) DO (
2   Lint-nt.exe -b +linebuf +linebuf +linebuf +linebuf +linebuf %CVBUILDIR%\%%i > %CVBUILDIR%\%%i.lnt
3   %WORKSPACE%\utils\xml.exe sel -N x="http://schemas.microsoft.com/developer/msbuild/2003" -t -v "/x:Project/x:ItemDefinitionGroup[contains(@Condition,'RelWithDebInfo')]/x:ClCompile/x:AdditionalIncludeDirectories" %CVBUILDIR%\%%i | %WORKSPACE%\utils\sed.exe "s/;/\n/g" > %CVBUILDIR%\inc.lst
4   %WORKSPACE%\utils\sed.exe "/^%%/d" %CVBUILDIR%\inc.lst > %CVBUILDIR%\incs.lst
5   FOR /F "tokens=1 delims=," %%f IN (%CVBUILDIR%\incs.lst) DO ECHO -i"%%f" >> %CVBUILDIR%\%%i.lnt
6   call :getpath %CVBUILDIR%\%%i
7   CD "!OBJPATH!"
8   Lint-nt.exe -b -i%WORKSPACE%\utils\lint -i%WORKSPACE%\Include -i%CVSRCDIR% -DWIN32 std_msc100.lnt jenkins.lnt %LINTPARAM% %MYPARAM% %CVBUILDIR%\%%i.lnt
9 )

L1:读 vcxproj 列表文件

L2:转换 vcxproj  到 lint 文件

L3:用xml.exe,从指定的配置中读取AdditionalIncludeDirectories信息,并用sed将分号间隔转换为换行

L4:删除掉如%(AdditionalIncludeDirectories)这样的信息

L5:将include路径信息加入到lnt文件中

L6、L7:进入相应的目录(因为很多时候并非使用绝对路径)

L8:pclint检查。