V705. The return value of non-void function should be used. Consider inspecting the expression. V3072. V552. V015. MISRA. Array indexing should be the only form of pointer arithmetic and it should be applied only to objects defined as an array type. Could a subterranean river or aquifer generate enough continuous momentum to power a waterwheel for the purpose of producing electricity? MISRA. V647. Loop break conditions do not depend on the number of iterations. An early return is a return statement that occurs before the last line of a function. V2568. There will be no undefined behavior here. V645. Class destructor should not exit with an exception. The object was used after it was verified against null. The pointer is cast to an integer type of a larger size. V6071. Consider making the project fully compilable and building it before analysis. V703. P.S. Consider wrapping the throw operator in a try..catch block. Possible incorrect initialization of variable. The 'GetObjectData' implementation in unsealed type is not virtual, incorrect serialization of derived type is possible. Consider inspecting the condition. Implicitly specified enumeration constants should be unique consider specifying non-unique constants explicitly. MISRA. V553. V5611. V3142. V628. V6079. V599. Consequently, the function needs to have a statement that returns the object of the corresponding type. Expression is equivalent to moving one unique pointer to another. That's because exit is marked as [[noreturn]]. Expression contains a suspicious mix of integer and real types. Decreased performance. Decreased performance. The 'delete' operator is applied to non-pointer. The opposite operator must also be defined. V3550. Potentially tainted data is processed by regular expression that contains an unsafe pattern. The language standard does not define order in which 'Foo' functions are called during evaluation of arguments. To determine the length of a string by 'strlen' function correctly, use a string ending with a null terminator in the first place. V106. The 'SuspendThread' function is usually used when developing a debugger. V3159. V2593. The value of uninitialized variable should not be used. It was deemed useful to report this warning as it typically results from inadvertent program design rather than intentional coverage of all cases with a redundant test. Thanks for helping to make the site better for everyone. V3534. V3031. How to enter the PVS-Studio license and what's the next move, Release history for previous versions (before 7.00), Getting acquainted with the PVS-Studio static code analyzer on Windows, Build-system independent analysis (C and C++), Direct integration of the analyzer into build automation systems (C and C++), PVS-Studio C# installation on Linux and macOS, How to run PVS-Studio C# on Linux and macOS, Installing and updating PVS-Studio C++ on Linux, Installing and updating PVS-Studio C++ on macOS, How to run PVS-Studio C++ on Linux and macOS, Get started with PVS-Studio in Visual Studio, Using PVS-Studio with JetBrains Rider and CLion, Analyzing Visual Studio / MSBuild / .NET projects from the command line using PVS-Studio, Cross-platform analysis of C and C++ projects in PVS-Studio, How to use the OWASP diagnostic group in PVS-Studio, Analysis of C++ projects based on JSON Compilation Database, How to integrate PVS-Studio into CMake with a CMake module, How to analyze Unity projects with PVS-Studio, Integration of PVS-Studio analysis results into SonarQube, Speeding up the analysis of C and C++ code through distributed build systems (Incredibuild), How to display the analyzer's most interesting warnings, Baselining analysis results (suppressing warnings for existing code), Handling the diagnostic messages list in Visual Studio, How to view and convert analyzer's results, Viewing analysis results with C and C++ Compiler Monitoring UI, Notifying the developer teams (blame-notifier utility), Viewing reports in a SARIF format in Visual Studio Code, Filtering and handling the analyzer output through diagnostic configuration files (.pvsconfig), Excluding files and directories from analysis, Using the PVS-Studio extension for Visual Studio Code, How to use the PVS-Studio extension for Qt Creator, Analysis configuration file (Settings.xml). Incorrect shifting expression. The result should possibly be saved to a temporary variable, which then could be used while calling the 'B' function. V3515. The predefined identifier '__func__' always contains the string 'operator()' inside function body of the overloaded 'operator()'. V3058. V710. V2598. Function 'Foo' writes/reads 'N' bytes. V1088. Consider using a comparison with defined precision: fabs(A - B) < Epsilon or fabs(A - B) > Epsilon. It is suspicious that the BSTR data type is compared using a relational operator. V2510. V3024. V579. Possible null dereference. Otherwise, the integer division operator would be used, and the fractional part would be lost. "Signpost" puzzle from Tatham's collection, QGIS automatic fill of the attribute table by expression, Generating points along line with specifying the origin of point generation in QGIS. V701. Consider inspecting the expression. V3170. The 'foo' local variable has the same name as one of class members. It's possible that the line was commented out improperly, thus altering the program's operation logics. Consider assigning realloc() to a temporary pointer. Potentially tainted data is used to create an object using deserialization. V105. V688. Probably the '!='/'-='/'+=' should be used here. A double memory deallocation will occur. Cast should not remove 'const' / 'volatile' qualification from the type that is pointed to by a pointer or a reference. Number of iterations in loop equals size of a pointer. rev2023.4.21.43403. V113. V3079. V2577. V5619. Potentially tainted data is used in the path toextractthe file. Terminal null is present inside a string. V3549. Potentially tainted data is used in a search filter. V1065. V3012. V836. It's possible that 'else' keyword is missing. V3021. Empirical analysis. The 'Foo' function receives the pointer and its size as arguments. The same sub-expression is present on both sides of the operator. Consider inspecting the loop expression. Possible exception: type marked by [Serializable] contains non-serializable members not marked by [NonSerialized]. Field 'A' is being used before it was initialized. V753. V5005. I will edit. The 'continue' operator will terminate 'do { } while (false)' loop because the condition is always false. A resource is returned from try-with-resources statement. Potentially infinite loop. Unexpected function overloading behavior. V5626. V627. V6081. Pseudo random sequence is the same at every program run. V2575. Consider checking the N format items of the 'Foo' function. Size of array calculated by sizeof() operator was added to a pointer. AUTOSAR. V013. V1050. V3540. MISRA. Subtraction, >, >=, <, <= should be applied only to pointers that address elements of the same array. Function should not be declared implicitly. Shift by N bits is inconsistent with the size of type. It will be closed before the method exits. Expression of the 'A =- B' kind is used. V2544. V696. It is highly probable that the semicolon ';' is missing after 'return' keyword. V3176. V5612. Variable was compared to zero before it was used as a divisor. V6089. Consider inspecting signed and unsigned function arguments. V3044. Functions of strcmp() kind can return any values, not only -1, 0, or 1. It is not advised to declare type 'T' as 32-bit type. First 'case' operator may be missing. This pattern is suspicious. Quoting from gcc warning options page: -Wno-unused-result. WPF: several Dependency Properties are registered with a same name within the owner type. Not all IDisposable members are properly disposed. The variable can be constructed in a lower level scope. V3531. The resulting value may be inaccurate. OWASP. V3010. Memory allocation and deallocation functions should not be used. OWASP. The expression is always false. The behavior is undefined for arithmetic or comparisons with pointers that do not point to members of the same array. Classes that define 'equals' method must also define 'hashCode' method. V2003. V2553. Array is used as pointer to single object. Here's the correct version: The 'main' and 'wmain' functions are the exceptions. V576. V3543. V1092. V5613. Consider inspecting the 'for' operator. V3183. V3097. V1032. Uninitialized class member is used when initializing the base class. Consider inspecting the expression. nlohmann/json.hpp:20877:5: warning: non-void function does not return a value in all control paths [-Wreturn-type]. @Sneftel Good point. V3050. V2508. V613. V6063. Consider verifying the compatibility of 32 and 64 bit versions of the application in the context of a stored data. The 'A' field should probably be returned/assigned instead. V3158. V124. Use filter buttons or 'Don't Check Files' settings to enable message display. Such functions are usually marked '[[noreturn]]'. Destructor of 'Foo' class is not declared as virtual. V2017. OWASP. Then the return statement is executed, returning the value of 5 back to the caller. V3015. The 'Foo' function is called twice in the specified expression to calculate length of the same string. The field (property) is used before it is initialized in constructor. V2617. V3084. Array size should be specified explicitly when array declaration uses designated initialization. C compiling Error: non-void function does not return a value in all control paths - CS50. The expression is excessive or contains a logical error. V3099. V3087. Expression 'A = B == C' is calculated as 'A = (B == C)'. The comma operator should not be used. The function is deprecated in the Win64 system. V622. AUTOSAR. V2616. The reference was used before it was verified against null. V1026. So, the compiler generates an error. V573. V699. The alignment rules and type sizes have been changed. Incorrect index type: 'foo[not a memsize-type]'. Decreased performance. The function with the 'atof/atoi/atol/atoll' name should not be used. Suspicious sequence of types castings: pointer -> memsize -> 32-bit integer. A more efficient way is to check: str[0] != '\0'. MISRA. nlohmann/json.hpp:20925:5: warning: non-void function does not return a value in all control paths [-Wreturn-type], const_reference operator[](const typename object_t::key_type& key) const Value of the essential character type should be used appropriately in the addition/subtraction operations. Expression resulting from the macro expansion should be surrounded by parentheses. Return value is not always used. A smart pointer may not destroy an object correctly. AUTOSAR. Object may be created in-place in a container. V1033. Wrong variable is probably used in the for operator as an index. Then, enable it by default, but also make it be enabled by Wpedantic and Wreturn-type. V5624. V2570. AUTOSAR. Variable length array types are not allowed. great work. V1028. V5601. Declaration should contain no more than two levels of pointer nesting. Remember that 'a == b == c' is not equal to 'a == b && b == c'. Custom declaration of standard type. Browse other questions tagged, Start here for a quick overview of the site, Detailed answers to any questions you might have, Discuss the workings and policies of this site. V2019. He also rips off an arm to use as a sword. V3095. V571. What is the Russian word for the color "teal"? Functions should be declared in prototype form with named parameters. OWASP. V2011. V632. The object was created but it is not being used. V3121. V3077. To tell the compiler that a function does not return a value, a return type of void is used. Content Discovery initiative April 13 update: Related questions using a Review our technical responses for the 2023 Developer Survey. Consider inspecting it. Cast should not remove 'volatile' qualifier from the type that is pointed to by a pointer or a reference. AUTOSAR. During the initial analysis, the code nominally contains three code paths. It is possible that 'else' block was forgotten or commented out, thus altering the program's operation logics. Use of 'Foo' uninitialized variable. V578. Extending 'std' or 'posix' namespace may result in undefined behavior. This leads to undefined behavior. Consider inspecting type casting. OWASP. We and our partners use data for Personalised ads and content, ad and content measurement, audience insights and product development. Many programmers use parentheses to enclose the expression argument of the return statement. V758. Features from
should not be used. Function body contains the 'X' label that is not used by any 'goto' statements. malloc() function accepts a dangerous expression in the capacity of an argument. V687. V3056. Possible path traversal vulnerability. Consider verifying the initializer. The 'then' statement is equivalent to the 'else' statement. V678. V3091. Analysis aborted by timeout. The 'X' counter is not used inside a nested loop. There are identical sub-expressions to the left and to the right of the 'foo' operator. AUTOSAR. If you are treating warnings as errors, you may need to temporary disable that setting in order to compile the example. V775. compareTo()-like methods can return not only the values -1, 0 and 1, but any values. V505. Content Discovery initiative April 13 update: Related questions using a Review our technical responses for the 2023 Developer Survey, Non-void function does not return a value. Variable should be declared in a scope that minimizes its visibility. Does a password policy with a restriction of repeated characters increase security? V3181. Consider inspecting the return statement. Expressions with enum underlying type should have values corresponding to the enumerators of the enumeration. V789. You signed in with another tab or window. V551. I am getting this error when trying to compile the below code. In such a case, the comparison operation can potentially behave unexpectedly. V3136. V128. It is suspicious that the value 'X' of HRESULT type is compared with 'Y'. V3555. If control passes to Exit Function or End Function and you have not assigned any value to the procedure name, the procedure returns the default value of the return data type. V1096. Incorrect format. V538. V1030. The compiler may issue a warning diagnostic message about unreachable code if it finds any statements placed after the return statement. OWASP. Consider adding the 'cin.fail()' function call to the conditional expression. You may or may not use the return . The identifier 'main' should not be used for a function other than the global function 'main'. Are there any canonical examples of the Prime Directive being broken that aren't shown on screen? A switch-expression should not have Boolean type. V1063. V5301. The 'cin.eof()' condition is insufficient to break from the loop. The function argument corresponding to a parameter declared to have an array type should have an appropriate number of elements. Possible NoSQL injection. Member 'x' should point to string terminated by two 0 characters. String literal contains potential interpolated expression. Literal suffixes should not contain lowercase characters. V593. One pair of parentheses is unnecessary or misprint is present. Suspicious use of BigDecimal class. Block of memory should only be freed if it was allocated by a Standard Library function. The function located to the right of the '|' and '&' operators will be called regardless of the value of the left operand. Consider inspecting the expression. V1008. 565), Improving the copy in the close modal and post notices - 2023 edition, New blog post from our CEO Prashanth: Community is the future of AI. It is possible that a typo is present inside the expression. Check the following code block after the 'if' statement. The '+' operation is executed. V1044. V6074. Waiting on this expression is unreliable, as compiler may optimize some of the variables. V3147. Avoid using 'this == 0' comparison. It's better to use '= default;' syntax instead of empty body. V524. The 'if (A) {} else if (A) {}' pattern was detected. V598. V663. MISRA. A value-returning function should include a return statement, containing an expression. V684. V3035. V6099. Generating points along line with specifying the origin of point generation in QGIS. A bool type variable is incremented. Overflow check is incorrect. Consider using the 'Ptr' version of the 'foo' function here. Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support. The function with the 'abort/exit/getenv/system' name should not be used. MIP Model with relaxed integer constraints takes longer to solve than normal model, why? Call of the 'Foo' function will lead to buffer overflow. Possible exception when deserializing type. Consider inspecting 'X'. Interpreting non-statistically significant results: Do we have "no evidence" or "insufficient evidence" to reject the null? The first statement in print() prints A. V1024. Exception classes should be publicly accessible. MISRA. These conditions may be true or false. The initial value of the index in the nested loop equals 'i'. V706. Negative value is implicitly converted to unsigned integer type in arithmetic expression. MISRA. V1094. The switch statement does not cover all values of the enum. What is this brick with a round back and a stud on the side used for? How to force Mathematica to return `NumericQ` as True when aplied to some variable in Mathematica? V2548. V3516. OWASP. V777. Check if program logic handles it correctly. V6077. It is possible that a wrong variable is compared inside the 'for' operator. Thanks for contributing an answer to Stack Overflow! Well occasionally send you account related emails. V667. Function receives an odd argument. A pattern was detected: A || (A && ). Potentially tainted data is used to create OS command. Operand of sizeof() operator should not have other side effects. What risks are you taking when "signing in with Google"? Argument is of the 'T' type. It is possible that 'else' block was forgotten or commented out, thus altering the program's operation logics. The 'while' operator has empty body. V646. Consider inspecting the 'foo' function. V3512. V3161. V512. V2595. Possible server-side request forgery. V3141. The object could have been garbage collected before the 'Target' property was accessed. A boy can regenerate, so demons eat him for years. V3172. Void functions dont need a return statement. V6095. V612. V6039. Void functions are created and used just like value-returning functions except they do not return a value after the function executes. The compiler isn't going to go to very much trouble to detect this situation, because functions like throw_blah which are guaranteed to never return are rare, and because except in the simplest of situations, there's no way for it to reliably do so. But below is not the case so why does it get compile, is there something else expected by Oracle. V823. I did return true and false but its still giving me this error [deleted] 2 yr. ago More posts you may like It is suspicious that the 'foo' field in derived class overwrites field in base class. operator are identical. It is possible that the 'i' variable should be incremented instead of the 'n' variable. V731. An exception should be caught by reference rather than by value. V6028. MISRA. Check for an error or bad coding style. 'else' keyword is probably missing. The "" closing tag was encountered, while the "" tag was expected. An array/object was declared but was not utilized. By clicking Accept all cookies, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy. V3157. Try to avoid many return statements in your code. A compatible declaration should be visible when an object or function with external linkage is defined. The object was created but it is not being used. Example of safe code: printf("%s", str); V619. V1084. AUTOSAR. Does the 500-table limit still apply to the latest version of Cassandra? V3150. MISRA. i'm not sure if this is intentional behavior. warning: non-void function does not return a value Naimur Rahman 44 subscribers Subscribe 1 Share 316 views 6 months ago warning: non-void function does not return a value Show more Show more. V698. The macro with the 'setjmp' name and the function with the 'longjmp' name should not be used. Perhaps, it is a typo and 'X' variable should be used instead of 'Y'. MISRA. MISRA. I compiled a small program containing the following function definition. See documentation for details. Insecure XML parser is used to process potentially tainted data. V3175. Assign the value to the Function procedure name and then perform an Exit Function statement. Possible excessive expression or typo. V3127. V3529. V5304. The method does not override another method from the base class. V3146. The variable 'X' is being used for this loop and for the outer loop. Save the file, and compile it in a Developer command prompt window by using the command: Then, to run the example code, enter C_return_statement.exe at the command prompt. V2571. V822. Trying to return a value from a non-value returning function will result in a compilation error: A return statement that is not the last statement in a function is called an early return. V568. std::cout), a value must be provided. Silent suppression of exceptions can hide errors in source code during testing. Referenced package contains vulnerability. V2012. It is recommended to use the 'make_unique/make_shared' function to create smart pointers. Pointer to FILE should not be dereferenced. The 'x' variable is assigned to itself. Suspicious type conversion: HRESULT -> BOOL (BOOL -> HRESULT). V3174. Function call may lead to buffer overflow. Declaring virtual methods in a class marked as 'final' is pointless. V694. Possible incorrect use of '#pragma warning(default: X)'. Non-atomic modification of volatile variable. There should be no attempt to write to a stream that has been opened for reading. Manage Settings AUTOSAR. V755. The '? Check for missing 'throw' keyword. No locking will be performed. MISRA. As your code stands, if candidate_count is greater than 0 the loop will iterate once and then unconditionally return false, which I don't think is what you want. MISRA. Comparison of arrays, strings, collections by reference. Probably meant: *ptr != zero. The function with the 'atof/atoi/atol/atoll' name should not be used. como endulzar a una persona, sergio garcia driver shaft length,