V3147. MISRA. OWASP. The variable was utilized in the logical expression before it was verified against null in the same logical expression. V5623. V2517. Variable is used after it is moved. V743. There is a probability of logical error presence. V3188. Methods returning a value: Object slicing. V588. It is odd that the body of 'Foo_1' function is fully equivalent to the body of 'Foo_2' function. V3125. MISRA. Expressions with pointer type should not be used in the '+', '-', '+=' and '-=' operations. The Ctor(SerializationInfo, StreamingContext) constructor is missing. The variable is incremented in the loop. V3166. To subscribe to this RSS feed, copy and paste this URL into your RSS reader. Examine the substrings "abc" and "abcd". Possibly, it was intended to be escaped. I recently fixed something similar in #2898 which is not yet merged. V799. ** By clicking this button you agree to our, * By clicking this button you agree to our, Free PVS-Studio license for Microsoft MVP specialists, To get the licence for your open-source project, please fill out this form. V1092. The 'else' keyword may be missing. Only the first member of enumerator list should be explicitly initialized, unless all members are explicitly initialized. Make sure the expression is correct. Consider inspecting the expression. V735. MISRA. AUTOSAR. V3057. The 'std::uncaught_exception' function is deprecated since C++17 and is removed in C++20. Expression was implicitly cast from integer type to real type. V2622. AUTOSAR. V612. Function returns pointer/reference to temporary local object. MISRA. V3186. A switch-label should only appear at the top level of the compound statement forming the body of a 'switch' statement. This is unexpected behavior. Unexpected uint64 behaviour 0xFFFF'FFFF'FFFF'FFFF - 1 = 0? Two or more case-branches perform the same actions. A switch-expression should not have Boolean type. ", "!"? V201. V2532. This may be a potential error. MISRA. Asking for help, clarification, or responding to other answers. Pseudo random sequence is the same at every program run. Two 'if' statements with identical conditional expressions. Nonsensical comparison: pointer < 0. Unchecked tainted data is used in expression. The line contains control character 0x0B (vertical tabulation). Perhaps this is a mistake. It's possible that the loop will be executed incorrectly or won't be executed at all. Check the shift operator. NullReferenceException is possible. OWASP. Calling the 'SingleOrDefault' method may lead to 'InvalidOperationException'. V3514. V726. V6054. Parameter of 'std::stop_token' type is not used inside function's body. V5001. Calling method or accessing property of potentially disposed object may result in exception. V6093. V689. V1033. V5608. The address of an object with local scope should not be passed out of its scope. V1040. Functions should not be declared at block scope. The object of non-passive (non-PDS) type cannot be used with the function. NullReferenceException is possible. V597. V2009. Extending 'std' or 'posix' namespace may result in undefined behavior. Extracting arguments from a list of function calls. V518. V2525. The '? V540. Consider inspecting the expression. The 'x' variable is assigned values twice successively. Site design / logo 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA. Arrays should not be partially initialized. V2520. What's the cheapest way to buy out a sibling's share of our parents house if I have no cash and want to pay less than the appraised value? MISRA. Checking value for null will always return false when generic type is instantiated with a value type. It is possible that a call to 'Start' method is missing. AUTOSAR. Identical sub-expressions to the left and to the right of 'foo' operator. 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). Consider using the 'int' type. Potential incorrect use of item 'X'. P.S. V2564. If the function has a void return type, this behavior is okay, but may be considered poor style. Inconsistent synchronization of a field. 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. V559. [Serializable] attribute is missing. So far, we never make a pedantic check with exceptions switched off. Decreased performance. Code contains invisible characters that may alter its logic. Incorrect format. Please check projects and solution configurations. AUTOSAR. As report_square takes no parameters and returns void, we don't assign its result to a variable. Ineffective use of the 'count' function. Do not use real-type variables as loop counters. Consider replacing methods: 'insert' -> 'emplace', 'push_*' -> 'emplace_*'. The 'Foo' function receives the pointer and its size as arguments. V3550. Maximum size of a vector is known at compile time. V768. Thus, these functionsdo not result inundefined behavior. V5615. Identifiers declared in the same scope and name space should be distinct. OWASP. If no value is provided, the compiler will produce a syntax error. It is suspicious that a char or string literal is added to a pointer. String literal contains potential interpolated expression. The 'ThreadStatic' attribute is applied to a non-static 'A' field and will be ignored. The conditional expressions of the 'if' statements situated alongside each other are identical. MISRA. V573. V2552. Modification of variable is unsequenced relative to another operation on the same variable. V3534. Unsigned value is compared to the NN number. V3540. Number of iterations in loop equals size of a pointer. Consider inspecting the 'T foo = foo = x;' expression. V1034. In such a context, we can only call value-returning functions. Every 'switch' statement should have a 'default' label, which, in addition to the terminating 'break' statement, should contain either a statement or a comment. V2565. Array size should be specified explicitly when array declaration uses designated initialization. Making statements based on opinion; back them up with references or personal experience. V3124. V507. The identifier 'main' should not be used for a function other than the global function 'main'. If a return type isn't specified, the C compiler assumes a default return type of int. V3036. This may lead to undefined behavior. The value is assigned to the 'x' variable but is not used. Consider inspecting usage of 'Y' counter. Consider checking for misprints. V2602. Variable 'foo' was assigned the same value. V109. Explicit conversion from 32-bit integer type to memsize type. :' operation: implicit type conversion to memsize type. Youll need to comment out this line of code in order to make your code compile. V3012. V1079. Why does flowing off the end of a non-void function without returning a value not produce a compiler error? AUTOSAR. Possible incorrect initialization of variable. Are there any canonical examples of the Prime Directive being broken that aren't shown on screen? AUTOSAR. V3542. V2573. V582. Potential logical error is present. V3025. V752. use custom JSON_THROW_USER without exceptions. OWASP. The standard input/output functions should not be used. Dereferencing the result of 'as' operator can lead to NullReferenceException. Possible incorrect order of arguments passed to function. V774. V3516. Cyclomatic complexity: NN. To determine the length of a string by 'strlen' function correctly, use a string ending with a null terminator in the first place. Suspicious bitwise operation was detected. V3543. Virtual table pointer will be damaged. 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. Non-zero value can become 'FALSE'. V782. We will email you at. V128. operator should have 'bool' type. V2591. It is highly probable that the semicolon ';' is missing after 'return' keyword. Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support. The field will have default value on different threads. V532. V792. A 32-bit variable is utilized as a reference to a pointer. V3162. . : .' should be used here instead of 'foo = bar = baz ? 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. Consider inspecting the expression. V2570. AUTOSAR. Consider assigning value to 'foo' variable instead of declaring it anew. All memory or resources allocated dynamically should be explicitly released. Conversions should not be performed between pointer to function and any other type. Uninitialized variables are used when initializing the 'A' variable. Return value of function is written to N-bit variable. Odd semicolon ';' after 'if/for/while' operator. Identifiers that start with '__' or '_[A-Z]' are reserved. V002. Variable should be declared in a scope that minimizes its visibility. Expression 'A = B == C' is calculated as 'A = (B == C)'. V2529. Void functions are created and used just like value-returning functions except they do not return a value after the function executes. V515. V3116. V3104. V3120. Not the answer you're looking for? V642. There is no point to declare constant reference to a number. The compiler has been asked to warn when a function has a control path that doesn't return a value (although not mentioned in the message, throwing a value and possibly calling a non-returning function may also be considered acceptable). V3071. V3050. Suspicious precise comparison. What is an early return, and what is its behavior? V118. V106. Argument of sizeof() is a macro, which expands to a number. Consider inspecting the loop expression. V2610. Unsafe invocation of event, NullReferenceException is possible. An exception handling block does not contain any code. Consider reviewing this value. Ignored InterruptedException could lead to delayed thread shutdown. Consider checking the first actual argument of the 'Foo' method. C-style and functional notation casts should not be performed. Exception caught by handler for base class. Use volatile variable(s) or synchronization primitives to avoid this. MISRA. V563. Consider inspecting the expression. operator works in a different way than it was expected. Consider inspecting the statement of '*pointer++' pattern. The other function parameter expects a file path instead. Therefore, printHi is given a void return type. File cannot be processed. Declaring virtual methods in a class marked as 'final' is pointless. Code contains collection of similar blocks. Connect and share knowledge within a single location that is structured and easy to search. V6066. V1052. IDisposable object is not disposed before method returns. Buffer needs to be securely cleared on all execution paths. Consider a case where the vector is empty. AUTOSAR. The value of uninitialized variable should not be used. The return value of non-void function should be used. V3548. There is nothing we can do in this situation - there are no default values to return in case of exceptions. It is pointless to compute the distance between the elements of different arrays. Recurring check. V3139. Variable is not used after memory is allocated for it. Possible typo in the spelling of a pre-defined macro name. Incorrect index type: 'foo[not a memsize-type]'. Class defines a custom new or delete operator. V1047. The expression is excessive or contains a logical error. Both operands of an operator should be of the same type category. V650. Expression of the 'A =- B' kind is used. Potentially tainted data is used to create OS command. V3076. V1038. Analysis aborted by timeout. Condition of a loop is always true/false. V2005. V3184. V2513. V6085. Then the ',' operator returns a resulting value from the right side of the expression. The use of 'if (A) {} else if (A) {}' pattern was detected. The switch statement does not cover all values of the enum. :' operator uses constants from different enums. The '#pragma warning(push/pop)' should be used instead. This way, you won't miss messages from our team in the future. Odd semicolon ';' after 'if/for/while' operator. MISRA. V623. It may be an error. The 'continue' operator will terminate 'do { } while (false)' loop because the condition is always false. This way, you won't miss messages from our team in the future. V524. V2515. V6031. V1036. A pattern was detected: A || (A && ). Such a pointer will become invalid. Notice that BSTR strings store their length before start of the text. Possible SQL injection. AUTOSAR. V732. You signed in with another tab or window. Otherwise, the integer division operator would be used, and the fractional part would be lost. Pointer is dereferenced on the initialization list before its check for null inside the body of a constructor function. "Not Spam" button for our message. But, do are you sure you want your return statement inside your loop to begin with? The '? Declaration should contain no more than two levels of pointer nesting. Incorrect type of a loop variable. Quoting from gcc warning options page: -Wno-unused-result. Consider restricting the type parameter to reference types. Generic Doubly-Linked-Lists C implementation. V760. A switch-expression should not have Boolean type. Consider using the extended version of the 'foo' function here. V6072. MISRA. Suspicious sequence of types castings: pointer -> memsize -> 32-bit integer. V3509. V652. The argument's value is greater than the size of the collection. V5627. Consider using 'i + 1' instead. V3153. Comparing objects of incompatible types. It's probably an error or un-optimized code. Decreased performance. Function should not be declared implicitly. Function printHi has a void return type, meaning it doesnt return a value. The 'zero' value is assigned to pointer. V1009. V673. From what I can gather online, this means that I am not returning a value from my function? MISRA. MISRA. V3173. Consider inspecting the '? V3552. Dangerous widening type conversion from an array of derived-class objects to a base-class pointer. Possibly meant: 'A += B'. Do not use old versions of SSL/TLS protocols as it may cause security issues. V701. V2607. V124. The '&' or '|' operator is applied to bool type value. MISRA. To subscribe to this RSS feed, copy and paste this URL into your RSS reader. The global namespace should only contain 'main', namespace declarations and 'extern "C"' declarations. Thus, the analyzer will not issue a warning for the following code fragment: You can look at examples of errors detected by the V591 diagnostic. String literal is identical to variable name. AUTOSAR. V635. V829. V617. V571. Use memsize type instead. OWASP. What if I write return statement in constructor? Consider inspecting the loop expression. Variables are initialized through the call to the same function. V613. Early returns can be used in value-returning functions too: First, print() is called. MISRA. It is possible literal was intended to belong to '??' V1028. By clicking Post Your Answer, you agree to our terms of service, privacy policy and cookie policy. A pointer/reference parameter in a function should be declared as pointer/reference to const if the corresponding object was not modified. V6004. V1050. The compiler makes no such assumptions, so you need to make sure that there is a return path that will be followed if the return statement inside your loop is never reached. It is likely that a wrong variable is being incremented inside the 'for' operator. Consider checking for typos. Potentially infinite loop. 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. It is suspicious that it is used as a variable of a Boolean-type. MISRA. V6065. V553. ", "? That's because exit is marked as [[noreturn]]. It is possible that different variables are used inside initializer and iterator. The 'throw' keyword could be missing. The pointer is cast to an integer type of a larger size. V514. It is possible that type name was omitted: throw MyException(a, b);. V6051. Anonymous function is used to unsubscribe from event. Its representation is implementation-defined. Consider inspecting the condition for mistakes. MISRA. OWASP. compareTo()-like methods can return not only the values -1, 0 and 1, but any values. V509. V3172. V536. V1083. V1008. V2538. This file is marked with copyleft license, which requires you to open the derived source code.

Jim Nantz Nashville House, Why Was Johnny Ringo Afraid Of Doc Holliday, Ballarat Police Station, Articles W

warning non void function does not return a value

warning non void function does not return a value

Scroll to top