您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 项目/工程管理 > PClint常见告警整理_20150710
错误说明C(编号)C++(编号)语法错误1-1991001-1199内部错误200-299致命错误300-399告警(Warning)400-6991400-1699消息(Info.)700-8991700-1899可选信息(ElectiveNotes)900-9991900-1999-w0 不产生信息(除了遇到致命的错误)-w1 只生成错误信息没有告警信息和其它提示信息-w2 只有错误和告警信息-w3 生成错误、告警和其它提示信息(这是默认设置)-w4 生成所有信息简要说明指的是一般编译器也会产生的语法错误是PC-Lint程序内部的错误,这类错误不会出现在代码中的指的是由于内存限制等导致的系统致命错误出现的提示信息,是根据隐藏代码问题的可能性进行分类的:其中编号400-699指的是被检查代码中很可能存在问题而产生的告警信息;这些编号中出现的信息,产生错误的可能性相比告警信息来说级别要低,但仍然可能是因为代码问题导致的问题。可选信息,他们不会被默认检查,除非你在选项中指定检查他们。-w0 不产生信息(除了遇到致命的错误)-w1 只生成错误信息没有告警信息和其它提示信息-w2 只有错误和告警信息-w3 生成错误、告警和其它提示信息(这是默认设置)-w4 生成所有信息告警等级100234-w0 不产生信息(除了遇到致命的错误)-w1 只生成错误信息没有告警信息和其它提示信息-w2 只有错误和告警信息-w3 生成错误、告警和其它提示信息(这是默认设置)-w4 生成所有信息编号40config.cpp413415420423429433504506520521522525527529530533534539545550564568569572573578603605603,605613616644650661668673685701702708713714715716717725731734 7377407447477527627667737747757857867947967978018188258268278341065140114111501150915111512154015511554155517071722173217331735173817401746176217631768177317741776177817861788规则说明Undeclaredidentifier'Name'--Withinanexpression,anidentifierwasencounteredthathadnotpreviouslybeendeclaredandwasnotfollowedbyaleftparenthesis.Nameisthenameoftheidentifier.可能使用空指针Likelyuseofnullpointer'Symbol'in[left/right]argumenttooperator'String'ReferenceLikelyAccessofout-of-boundspointer访问越界访问超出范围的内存Apparentaccessbeyondarrayforfunction'Symbol',argumentIntegerexceedsIntegerReference--Thismessageisissuedforseverallibraryfunctions(suchasfwrite,memcmp,etc.)whereinthereisanapparentattempttoaccessmoredatathanexist.Forexample,ifthelengthofdataspecifiedinthefwritecallexceedsthesizeofthedataspecified.ThefunctionisspecifiedbySymbolandtheargumentsareidentifiedbyargumentnumber.SeealsoSection11.1Function在变量'Symbol'赋值时出现内存泄漏分配给一个指针变量,这个指针变量保留有一个分配的目标的地址,还没有释放。指针存储空间未释放或返回Custodialpointer'Symbol'(Location)hasnotbeenfreedorreturned--Apointerofautostorageclasswasallocatedstorage,whichwasneitherfreednorreturnedtothecaller.Thisrepresentsamemoryleak.Apointerisconsideredcustodialifituniquelypointstothestoragearea.Itisnotconsideredcustodialifithasbeencopied.Thus:int*p=newint[20];//pisacustodialpointerint*q=p;//pisnolongercustodialp=newint[20];//pagainbecomescustodialq=p+0;//premainscustodialHerepdoesnotloseitscustodialpropertybymerelyparticipatinginanarithmeticoperation.Apointercanloseitscustodialpropertybypassingthepointertoafunction.Iftheparameterofthefunctionistypedpointertoconstorifthefunctionisalibraryfunction,thatassumptionisnotmade.Forexamplep=malloc(10);strcpy(p,hello);为指针分配的空间不够Allocatedareanotlargeenoughforpointer--Anallocationwasassignedtoapointerwhosereachextendsbeyondtheareathatwasallocated.Thiswouldusuallyhappenonlywithlibraryallocationroutinessuchasmallocandcalloc.Forexample:int*p=malloc(1);Thismessageisalsoprovidedforuser-declaredallocationfunctions.Forexample,ifauser'sownallocationfunctionisprovidedwiththefollowingsemantic:-sem(ouralloc,@P==malloc(1n))Wewouldreportthesamemessage.Pleasenotethatitisnecessarytodesignatethatthe异常的移位固定的Boolean值ConstantvalueBoolean--ABoolean,i.e.,aquantityfoundinacontextthatrequiresaBooleansuchasanargumentto&&or||oranif()orwhile()clauseor!,wasfoundtobeaconstantandhencewillevaluatethesamewayeachtime.for循环的第一个表达式HighestString’Name’lacksside-effects--Thefirstexpressionofaforclauseshouldeitherbeoneoftheprivilegedoperators:assignment,increment,decrementoracalltoanimpurefunctionoronemodifyingitsargument(s).SeeWarning522.for循环的第三个表达式HighestString’Name’lacksside-effects--Thethirdexpressionofaforclauseshouldeitherbeoneoftheprivilegedoperators:assignment,increment,decrementoracalltoanimpurefunctionoronemodifyingitsargument(s).SeeWarning522.指针自加HighestString’Name’lacksside-effects--Ifastatementconsistsonlyofanexpression,itshouldeitherbeoneoftheprivilegedoperators:assignment,increment,decrementoracalltoanimpurefunctionoronemodifyingitsargument(s).Forexample,ifoperator*isthebuilt-inoperator,thestatement*p++;drawsthismessagewithStringequaltooperatorandNameequalto*.Butnotethatp++;doesnot.Thisisbecausethehighestoperatorintheformercaseis'*'whichhasnosideeffectswhereasp++does.Itispossibleforafunctiontohavenoside-effects.Suchafunctioniscalledpure.SeethediscussionofthepuresemanticinSection11.2.1.Forexample:voidf(){intn=3;n++;}voidg(){f();}willtriggerthismessagewithStringinthemessageequaltofunctionandNameequaltof.ThedefinitionofpureandimpurefunctionsandfunctioncallswhichhavesideeffectsaregiveninthediscussionofthepuresemanticinChapter11Semantics.缩排格式错误/未正确缩进NegativeindentationfromLocation--Thecurrentlinewasfoundtobenegativelyindented(i.e.,notindentedasmuch)fromtheindicatedline.Thelattercorrespondstoaclauseintroducingacontrolstructure,andstatementsandothercontrolclausesandbraceswithinitsscopeareexpectedtohavenolessindentation.Iftabswithinyourprogramareotherthan8blanksyoushouldusethe-toption(SeeSection13.3IndentationChecking).无法执行到的语句UnreachablecodeattokenName--Aportionoftheprogramcannotbereached.Thefirsttokenencounteredinthatportionoftheprogramappearsastheparameterinthemessage.BecausetheparameterisdesignatedasNamethemessagemaybesuppressedf
本文标题:PClint常见告警整理_20150710
链接地址:https://www.777doc.com/doc-4344424 .html