Code Analysis for C/C++ Warnings
This section lists C/C++ Code Analysis warnings. For information about Code Analysis, see /analyze (Code Analysis) and Quick Start: Code Analysis for C/C++.
In This Section
Warning Number |
Description |
---|---|
warning C1250: Unable to load plug-in |
|
warning C1252: Circular or missing dependency between plugins: requires GUID |
|
warning C1253: Unable to load model file |
|
warning C1254: Plugin version mismatch : version doesn't match the version of the PREfast driver |
|
warning C1255: PCH data for plugin has incorrect length |
|
warning C1256: PCH must be both written and read |
|
warning C1257: Plugin Initialization Failure |
|
warning C6001: using uninitialized memory <variable> |
|
warning C6011: dereferencing NULL pointer <name> |
|
warning C6029: possible buffer overrun in call to <function>: use of unchecked value |
|
warning C6031: return value ignored: <function> could return unexpected value |
|
warning C6053: call to <function> may not zero-terminate string <variable> |
|
warning C6054: string <variable> may not be zero-terminated |
|
warning C6059: Incorrect length parameter in call to <function>. Pass the number of remaining characters, not the buffer size of <variable> |
|
warning C6063: missing string argument to <function> corresponding to conversion specifier <number> |
|
warning C6064: missing integer argument to <function> corresponding to conversion specifier <number> |
|
warning C6066: non-pointer passed as parameter <number> when pointer is required in call to <function> |
|
warning C6067: parameter <number> in call to <function> must be the address of the string |
|
warning C6101: Returning uninitialized memory |
|
warning C6200: index <name> is out of valid index range <min> to <max> for non-stack buffer <variable> |
|
warning C6201: buffer overrun for <variable>, which is possibly stack allocated: index <name> is out of valid index range <min> to <max> |
|
warning C6211: Leaking memory <pointer> due to an exception. Consider using a local catch block to clean up memory |
|
warning C6214: cast between semantically different integer types: HRESULT to a Boolean type |
|
warning C6215: cast between semantically different integer types: a Boolean type to HRESULT |
|
warning C6216: compiler-inserted cast between semantically different integral types: a Boolean type to HRESULT |
|
warning C6217: Implicit cast between semantically different integer types: testing HRESULT with 'not'. Consider using SUCCEEDED or FAILED macro instead |
|
warning C6219: Implicit cast between semantically different integer types: comparing HRESULT to 1 or TRUE. Consider using SUCCEEDED or FAILED macro instead |
|
warning C6220 - Implicit cast between semantically different integer types: comparing HRESULT to -1. Consider using SUCCEEDED or FAILED macro instead |
|
warning C6221: Implicit cast between semantically different integer types: comparing HRESULT to an integer. Consider using SUCCEEDED or FAILED macros instead |
|
warning C6225: Implicit cast between semantically different integer types: assigning 1 or TRUE to HRESULT. Consider using S_FALSE instead |
|
warning C6226: Implicit cast between semantically different integer types: assigning -1 to HRESULT. Consider using E_FAIL instead |
|
warning C6230: implicit cast between semantically different integer types: using HRESULT in a Boolean context |
|
warning C6235: (<non-zero constant> || <expression>) is always a non-zero constant |
|
warning C6236: (<expression> || <non-zero constant>) is always a non-zero constant |
|
warning C6237: (<zero> && <expression>) is always zero. <expression> is never evaluated and may have side effects |
|
warning C6239: (<non-zero constant> && <expression>) always evaluates to the result of <expression>. Did you intend to use the bitwise-and operator? |
|
warning C6240: (<expression> && <non-zero constant>) always evaluates to the result of <expression>. Did you intend to use the bitwise-and operator? |
|
warning C6242: A jump out of this try-block forces local unwind. Incurs severe performance penalty |
|
warning C6244: local declaration of <variable> hides previous declaration at <line> of <file> |
|
warning C6246: Local declaration of <variable> hides declaration of same name in outer scope. Additional Information: See previous declaration at <location>. |
|
warning C6248: setting a SECURITY_DESCRIPTOR’s DACL to NULL will result in an unprotected object |
|
warning C6250: Calling <function> VirtualFree without the MEM_RELEASE flag may free memory but not address descriptors (VADs); results in address space leaks |
|
warning C6255: _alloca indicates failure by raising a stack overflow exception. Consider using _alloca_s instead |
|
warning C6258: using TerminateThread does not allow proper thread clean up |
|
warning C6259: labeled code is unreachable: (<expression> & <constant>) in switch-expr cannot evaluate to <case-label> |
|
warning C6260: sizeof * sizeof is almost always wrong, did you intend to use a character count or a byte count? |
|
warning C6262: Function uses <constant> bytes of stack: exceeds /analyze:stacksize<constant>. Consider moving some data to heap |
|
warning C6263: using _alloca in a loop; this can quickly overflow stack |
|
warning C6268: Incorrect order of operations: (<TYPE1>)(<TYPE2>)x + y. Possible missing parentheses in (<TYPE1>)((<TYPE2>)x + y) |
|
warning C6269: possible incorrect order of operations: dereference ignored |
|
warning C6270: missing float argument to <function>: add a float argument corresponding to conversion specifier <number> |
|
warning C6271: extra argument passed to <function>: parameter <number> is not used by the format string |
|
warning C6272: non-float passed as argument <number> when float is required in call to <function> |
|
warning 6273 - non-integer passed as parameter <number> when integer is required in call to <function>: if a pointer value is being passed, %p should be used |
|
warning C6274: non-character passed as parameter <number> when character is required in call to <function> |
|
warning C6276: Cast between semantically different string types: char* to wchar_t*. Use of invalid string can lead to undefined behavior |
|
warning C6277: NULL application name with an unquoted path in call to <function>: results in a security vulnerability if the path contains spaces |
|
warning C6278: <variable> is allocated with array new [], but deleted with scalar delete. Destructors will not be called |
|
warning C6279: <variable> is allocated with scalar new, deleted with array delete [] |
|
warning C6280: <variable> is allocated with <function>, but deleted with <function> |
|
warning 6281 - incorrect order of operations: relational operators have higher precedence than bitwise operators |
|
warning C6282: Incorrect operator: assignment of constant in Boolean context. Consider using '==' instead |
|
warning C6283: <variable> is allocated with array new [], but deleted with scalar delete |
|
warning C6284: object passed as parameter '%d' when string is required in call to <function>. |
|
warning C6285: (<non-zero constant> || <non-zero constant>) is always a non-zero constant. Did you intend to use the bitwise-and operator? |
|
warning C6286: (<non-zero constant> || <expression>) is always a non-zero constant. <expression> is never evaluated and may have side effects |
|
warning C6287: redundant code: the left and right sub-expressions are identical |
|
warning C6288: Incorrect operator: mutual inclusion over && is always zero. Did you intent to use || instead? |
|
warning C6289: Incorrect operator: mutual exclusion over || is always a non-zero constant. Did you intend to use && instead? |
|
warning C6290: Bitwise operation on logical result: ! has higher precedence than &. Use && or (!(x & y)) instead |
|
warning C6291: Bitwise operation on logical result: ! has higher precedence than |. Use || or (!(x | y)) instead |
|
warning C6292: ill-defined for-loop: counts up from maximum |
|
warning C6293: Ill-defined for-loop: counts down from minimum |
|
warning C6294: Ill-defined for-loop: initial condition does not satisfy test. Loop body not executed |
|
warning C6295: Ill-defined for-loop: <variable> values are of the range "min" to "max". Loop executed indefinitely |
|
warning C6296: Ill-defined for-loop: Loop body only executed once |
|
warning C6297: Arithmetic overflow: 32-bit value is shifted, then cast to 64-bit value. Result may not be an expected value |
|
warning C6298: using a read-only string <pointer> as a writable string argument: this will attempt to write into static read-only memory and cause random crashes |
|
warning C6299: explicitly comparing a bit field to a Boolean type will yield unexpected results |
|
warning C6302: format string mismatch: character string passed as parameter <number> when wide character string is required in call to <function>s |
|
warning C6303: format string mismatch: wide character string passed as parameter <number> when character string is required in call to <function> |
|
warning C6305: potential mismatch between sizeof and countof quantities |
|
warning C6306: incorrect call to <function>: consider using <function> which accepts a va_list as an argument |
|
warning C6308: 'realloc' may return null pointer: assigning a null pointer to <variable>, which is passed as an argument to 'realloc', will cause the original memory block to be leaked |
|
warning C6310: illegal constant in exception filter can cause unexpected behavior |
|
warning C6312: Possible infinite loop: use of the constant EXCEPTION_CONTINUE_EXECUTION in the exception-filter expression of a try-except |
|
warning C6313: Incorrect operator: Zero-valued flag cannot be tested with bitwise-and. Use an equality test to look for zero-valued flags |
|
warning C6314: Incorrect order of operations: bitwise-or has higher precedence than the conditional-expression operator. Add parentheses to clarify intent |
|
warning C6315: Incorrect order of operations: bitwise-and has higher precedence than bitwise-or. Add parentheses to clarify intent |
|
warning C6316: Incorrect operator: tested expression is constant and non-zero. Use bitwise-and to determine whether bits are set |
|
warning C6317: incorrect operator: logical-not (!) is not interchangeable with ones-complement (~) |
|
warning C6318: Ill-defined __try/__except: use of the constant EXCEPTION_CONTINUE_SEARCH or another constant that evaluates to zero in the exception-filter expression. The code in the exception handler block is not executed |
|
warning C6319: use of the comma-operator in a tested expression causes the left argument to be ignored when it has no side-effects |
|
warning C6320: exception-filter expression is the constant EXCEPTION_EXECUTE_HANDLER. This may mask exceptions that were not intended to be handled |
|
warning C6322: empty _except block |
|
warning 6323 - use of arithmetic operator on Boolean type(s) |
|
warning C6324: potential incorrect use of <function1>: Did you intend to use <function2>? |
|
warning C6326: potential comparison of a constant with another constant |
|
warning C6328:<type> passed as parameter <number> when <type> is required in call to <function> |
|
warning C6330: Incorrect type passed as parameter in call to function |
|
warning C6331: Invalid parameter: passing MEM_RELEASE and MEM_DECOMMIT in conjunction to <function> is not allowed. This results in the failure of this call |
|
warning C6332: Invalid parameter: passing zero as the dwFreeType parameter to <function> is not allowed. This results in the failure of this call |
|
warning C6333: Invalid parameter: passing MEM_RELEASE and a non-zero dwSize parameter to <function> is not allowed. This results in the failure of this call |
|
warning C6334: sizeof operator applied to an expression with an operator may yield unexpected results |
|
warning C6335: leaking process information handle <handlename> |
|
warning C6336: arithmetic operator has precedence over question operator, use parentheses to clarify intent |
|
warning C6340: Incorrect type passed as parameter in call to function |
|
warning C6381: Shutdown API <function> requires a valid dwReason or lpMessage |
|
warning C6383: buffer overrun due to conversion of an element count into a byte count: an element count is expected for parameter <number> in call to <function> |
|
warning C6384: dividing sizeof a pointer by another value |
|
warning C6385: invalid data: accessing <buffer name>, the readable size is <size1> bytes, but <size2> bytes may be read: Lines: x, y |
|
warning C6386: buffer overrun: accessing <buffer name>, the writable size is <size1> bytes, but <size2> bytes may be written: Lines: x, y |
|
warning C6387: <argument> may be <value>: this does not adhere to the specification for the function <function name>: Lines: x, y |
|
warning C6388: <argument> may not be <value>: this does not adhere to the specification for the function <function name>: Lines: x, y |
|
warning C6400: Using <function name> to perform a case-insensitive compare to constant string <string name>. Yields unexpected results in non-English locales |
|
warning C6401: Using <function name> in a default locale to perform a case-insensitive compare to constant string < string name>. Yields unexpected results in non-English locales |
|
warning C6500: invalid annotation: value for <name> property is invalid |
|
warning C6501: annotation conflict: <name> property conflicts with previously specified property |
|
warning C6503: annotation conflict: references may not be marked Null=Yes or Null=Maybe |
|
warning C6504: invalid annotation: property may only be used on values of pointer, pointer-to-member, or array type |
|
warning C6505: invalid annotation: MustCheck property may not be used on values of void type |
|
warning C6506: invalid annotation: <name> property may only be used on values of pointer or array types |
|
warning C6508: invalid annotation: write access is not allowed on const values |
|
warning C6509: invalid annotation: 'return' cannot be referenced from a precondition |
|
warning C6510: invalid annotation: NullTerminated property may only be used on values of pointer or array type |
|
warning C6511: invalid annotation: MustCheck property must be Yes or No |
|
warning C6513: invalid annotation: ElementSizeConst requires additional size properties |
|
warning C6514: invalid annotation: value of the <name> property exceeds the size of the array |
|
warning C6515 - invalid annotation: <name> property may only be used on values of pointer type |
|
warning C6516: invalid annotation: no properties specified for <name> attribute |
|
warning C6517: annotation conflict: ValidElementsConst and ValidBytesConst may not be specified on the buffers that are not readable |
|
warning C6518: annotation conflict: WriteableElementsConst and WriteableBytesConst may not be specified on buffers that are not writable |
|
warning C6522: invalid size specification: expression must be of integral type |
|
warning C6525: invalid size specification: property value may not be valid |
|
warning C6526 - invalid size specification: expression must be of array or pointer type |
|
warning C6527: Invalid annotation: “NeedsRelease” property may not be used on values of void type |
|
warning 6530: unrecognized format string style <name> |
|
warning C6540: The use of attribute annotations on this function will invalidate all of its existing __declspec annotations |
|
warning C6551: Invalid size specification: expression not parsable |
|
warning C6552: Invalid Deref= or Notref=: expression not parsable |
|
warning C6701: The value is not a valid Yes/No/Maybe value: <string> |
|
warning C6702: The value is not a string value: <string> |
|
warning C6703: The value is not a number: <string> |
|
warning C6704: Unexpected Annotation Expression Error: <annotation> [<why>] |
|
warning C6705: Annotation error expected <expected_number> arguments for annotation <parameter> found <actual_number>. |
|
warning C6706: Unexpected Annotation Error for annotation <annotation>: <why> |
|
warning C6707: Unexpected Model Error: <why> |
|
warning C26100: Race condition. Variable <var> should be protected by lock <lock>. |
|
warning C26101: Failing to use interlocked operation properly for variable <var>. |
|
warning C26105: Lock order violation. Acquiring lock <lock> with level <level> causes order inversion. |
|
warning C26110: Caller failing to hold lock <lock> before calling function <func>. |
|
warning C26111: Caller failing to release lock <lock> before calling function <func>. |
|
warning C26112: Caller cannot hold any lock before calling <func>. |
|
warning C26115: Failing to release lock <lock> in function <func>. |
|
warning C26116: Failing to acquire or to hold <lock> in <func>. |
|
warning C26117: Releasing unheld lock <lock> in function <func>. |
|
warning C26130: Missing annotation _Requires_lock_held_(<lock>) or _No_competing_thread_ at function <func>. Otherwise it could be a race condition. Variable <var> should be protected by lock <lock>. |
|
warning C26135: Missing annotation <annotation> at function <func>. |
|
warning C26140: Concurrency SAL annotation error. |
|
warning C26160: Caller possibly failing to hold lock <lock> before calling function <func>. |
|
warning C26165: Possibly failing to release lock <lock> in function <func>. |
|
warning C26166: Possibly failing to acquire or to hold lock <lock> in function <func>. |
|
warning C26167: Possibly releasing unheld lock <lock> in function <func>. |
|
warning C28020: The expression <expr> is not true at this call |
|
warning C28021: The parameter <param> being annotated with <anno> must be a pointer |
|
warning C28022: The function class(es) <classlist1> on this function do not match the function class(es) <classlist2> on the typedef used to define it. |
|
warning C28023: The function being assigned or passed should have a _Function_class_ annotation for at least one of the class(es) in: <classlist> |
|
warning C28024: The function pointer being assigned to is annotated with the function class <class>, which is not contained in the function class(es) <classlist>. |
|
warning C28039: The type of actual parameter <operand> should exactly match the type <typename> |
|
warning C28103: Leaking resource |
|
warning C28104: Resource that should have been acquired before function exit was not acquired |
|
warning C28105: Leaking resource due to an exception |
|
warning C28106: Variable already holds resource possibly causing leak |
|
warning C28107: Resource must be held when calling function |
|
warning C28108: Variable holds an unexpected resource |
|
warning C28109: Variable cannot be held at the time function is called |
|
warning C28112: A variable which is accessed via an Interlocked function must always be accessed via an Interlocked function |
|
warning C28113: Accessing a local variable via an Interlocked function |
|
warning C28125: The function must be called from within a try/except block |
|
warning C28137: The variable argument should instead be a (literal) constant |
|
warning C28138: The constant argument should instead be variable |
|
warning C28159: Consider using another function instead. |
|
warning C28160: Error annotation |
|
warning C28163: The function should never be called from within a try/except block |
|
warning C28164: The argument is being passed to a function that expects a pointer to an object (not a pointer to a pointer) |
|
Dereferencing NULL pointer |
|
warning C28183: The argument could be one value, and is a copy of the value found in the pointer |
|
warning C28193: The variable holds a value that must be examined |
|
warning C28194: The function was declared as aliasing the value in variable and exited without doing so |
|
warning C28195: The function was declared as acquiring memory in a variable and exited without doing so |
|
warning C28196: The requirement is not satisfied. (The expression does not evaluate to true.) |
|
warning C28197: Possibly leaking memory |
|
warning C28198: Possibly leaking memory due to an exception. |
|
warning C28199: Using possibly uninitialized memory |
|
warning C28202: Illegal reference to non-static member |
|
warning C28203: Ambiguous reference to class member. Could be <name1> or <name2> |
|
warning C28204: <function> : Only one of this overload and the one at <filename>(<line>) are annotated for <paramname>: both or neither must be annotated. |
|
warning C28205: function> : _Success_ or _On_failure_ used in an illegal context: <why> |
|
warning C28206: <expression> : left operand points to a struct, use -> |
|
warning C28207: <expression>: left operand is a struct, use “.” |
|
warning C28208: Function <function> was previously defined with a different parameter list at <file>(<line>). Some analysis tools will yield incorrect results |
|
warning C28209: The declaration for symbol has a conflicting declaration |
|
warning 28210: Annotations for the _On_failure_ context must not be in explicit pre context |
|
warning C28211: Static context name expected for SAL_context |
|
warning C28212: Pointer expression expected for annotation |
|
warning C28213: The _Use_decl_annotations_ annotation must be used to reference, without modification, a prior declaration. <why> |
|
warning C28214: Attribute parameter names must be p1...p9 |
|
warning C28215: The typefix cannot be applied to a parameter that already has a typefix |
|
warning C28216: The _Check_return_ annotation only applies to post-conditions for the specific function parameter. |
|
warning 28217: For function, the number of parameters to annotation does not match that found at file |
|
warning C28218: For function parameter, the annotation's parameter does not match that found at file |
|
warning C28119: Member of enumeration expected for annotation the parameter in the annotation |
|
warning C28220: Integer expression expected for annotation the parameter in the annotation |
|
warning C28221: String expression expected for the parameter in the annotation |
|
warning 28222: _Yes_, _No_, or _Maybe_ expected for annotation |
|
warning C28223: Did not find expected Token/identifier for annotation, parameter |
|
warning C28224: Annotation requires parameters |
|
warning C28225: Did not find the correct number of required parameters in annotation |
|
warning C28226: Annotation cannot also be a PrimOp (in current declaration) |
|
warning C28227: Annotation cannot also be a PrimOp (see prior declaration) |
|
warning C28228: Annotation parameter: cannot use type in annotations |
|
warning C28229: Annotation does not support parameters |
|
warning C28230: The type of parameter has no member. |
|
warning C28231: Annotation is only valid on array |
|
warning C28232: _Pre_, _Post_, or _Deref_ not applied to any annotation |
|
warning C28233: pre, post, or deref applied to a block |
|
warning C28234: _At_ expression does not apply to current function |
|
warning C28235: The function cannot stand alone as an annotation |
|
warning C28236: The annotation cannot be used in an expression |
|
warning C28237: The annotation on parameter is no longer supported |
|
warning C28238: The annotation on parameter has more than one of value, stringValue, and longValue. Use paramn=xxx |
|
warning 28239: The annotation on parameter has both value, stringValue, or longValue; and paramn=xxx. Use only paramn=xxx |
|
warning 28240: The annotation on parameter has param2 but no param1 |
|
warning C28241: The annotation for function on parameter is not recognized |
|
warning C28343: The annotation for function on parameter requires more dereferences than the actual type annotated allows |
|
warning C28244: The annotation for function has an unparseable parameter/external annotation |
|
warning C28245: The annotation for function annotates 'this' on a non-member-function |
|
warning C28246: The annotation for function '<name>' - parameter '<parameter>' does not match the type of the parameter |
|
warning C28250: Inconsistent annotation for function: the prior instance has an error. |
|
warning C28251: Inconsistent annotation for function: this instance has an error |
|
warning C28252: Inconsistent annotation for function: parameter has another annotation on this instance |
|
warning C28253: Inconsistent annotation for function: parameter has another annotations on this instance |
|
warning C28254: dynamic_cast<>() is not supported in annotations |
|
warning C28262: A syntax error in the annotation was found in function <function> for annotation <name> |
|
warning C28263: A syntax error in a conditional annotation was found for Intrinsic annotation |
|
warning C28267: A syntax error in the annotations was found annotation <name> in the function <function>. |
|
warning C28272: The annotation for function, parameter when examining is inconsistent with the function declaration |
|
warning C28273: For function, the clues are inconsistent with the function declaration |
|
warning C28275: The parameter to _Macro_value_ is null |
|
warning C28278: Function name appears with no prototype in scope. |
|
warning C28279: For symbol, a 'begin' was found without a matching 'end' |
|
warning C28280: For symbol, an 'end' was found without a matching 'begin' |
|
warning C28282: Format Strings must be in preconditions |
|
warning C28283: For symbol, the specified size specification is not yet supported |
|
warning C28284: For symbol, Predicates are currently not supported for non-function symbols |
|
warning C28285: For function, syntax error in parameter |
|
warning C28286: For function, syntax error near the end |
|
warning C28287: For function, syntax Error in _At_() annotation (unrecognized parameter name) |
|
warning C28288: For function, syntax Error in _At_() annotation (invalid parameter name) |
|
warning C28289: For function: ReadableTo or WritableTo did not have a limit-spec as a parameter |
|
warning C28290: the annotation for function contains more Externals than the actual number of parameters |
|
warning C28291: post null/notnull at deref level 0 is meaningless for function <function> parameter <number> |
|
warning C28300: <parameter_name>: Expression operands of incompatible types for operator <operator_name> |
|
warning C28301: No annotations for first declaration of <function>.<note1> See <filename>(<line>). <note2> |
|
warning C28302: For C++ reference-parameter <parameter_name>, an extra _Deref_ operator was found on <annotation>. |
|
warning C28303: For C++ reference-parameter <parameter_name>, an ambiguous _Deref_ operator was found on <annotation>. |
|
warning C28304: For C++ reference-parameter <parameter_name>, an improperly placed _Notref_ operator was found applied to <token>. |
|
warning C28305: An error while parsing <token> was discovered. |
|
warning C28306: The annotation on parameter is obsolescent |
|
warning C28307: The annotation on parameter is obsolescent |
|
warning C28308: The format list argument position specified by the annotation is incorrect. |
|
warning 28309: <parameter_name>: Annotation operands must be integer/enum/pointer types. Void operands and C++ overloaded operators are not supported. Floats are approximated as integers. Types: <typelist>. |
|
warning C28350: The annotation <annotation> describes a situation that is not conditionally applicable. |
|
warning C28351: The annotation <annotation> describes where a dynamic value (a variable) cannot be used in the condition. |