Conversions between pointers to objects and integer types should not be performed. OWASP. The report_square function has a void return type, so it doesn't have an expression in its return statement. error: non-void function does not return a value in all control paths [-Werror,-Wreturn-type]} bool is_full() { if() { return 1; } else if() { return 0; } else if() { return 1; } } 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 : 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. ", "? V3035. V6067. Incorrect index type: 'foo[not a memsize-type]'. It is possible that '1' should be present instead of '0'. Consider using the 'size()' function. V3555. Consider verifying the compatibility of 32 and 64 bit versions of the application in the context of a stored data. V3145. :' operator, regardless of its conditional expression, always returns one and the same value. Flowing off the end of a non-void function with no 'return' results in undefined behavior. Potentially infinite loop. Passing cheap-to-copy argument by reference may lead to decreased performance. Potential division by zero. There should be no occurrence of undefined or critical unspecified behaviour. V649. V1062. The value is assigned to the 'x' variable but is not used. This may lead to undefined behavior. MISRA. Undefined behavior. Consider inspecting the first parameter of 'getline' function. Consider inspecting the expression. MISRA. V3549. WPF: several Dependency Properties are registered with a same name within the owner type. V625. The same sub-expression is present on both sides of the operator. MISRA. AUTOSAR. The 'throw' keyword could be missing. Expression is equivalent to moving one unique pointer to another. Parameter is always rewritten in function body before being used. V3146. MISRA. V1060. It is possible that an error is present. It is possible that a wrong variable is incremented inside the 'for' operator. V128. Consider inspecting the expression. V795. MISRA. Explicit conversion from 32-bit integer type to pointer type. V604. If you haven't received our response, please do the following: check your Spam/Junk folder and click the Compiler may delete 'memset' function call that is used to clear 'Foo' buffer. To determine the length of a string by 'strlen' function correctly, use a string ending with a null terminator in the first place. The other function parameter expects a file path instead. OWASP. Flowing off the end of thesefunctions is equivalent to a'return 0;'. Consider inspecting the expression. V2613. Decreased performance. V1033. Unreachable code should not be present in the project. OWASP. rev2023.4.21.43403. Consider allocating it on the stack instead. The object is already of the same type. An exception should be caught by reference rather than by value. 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 highly probable that the semicolon ';' is missing after 'return' keyword. V531. Use volatile variable(s) or synchronization primitives to avoid this. V6090. MISRA. The variable 'X' is being used for this loop and for the outer loop. V5605. Consider inspecting the expression. Uninitialized class member is used to initialize another member. The class implements a copy constructor/operator=, but lacks the operator=/copy constructor. V3533. Suspicious assignment inside the condition expression of 'if/while/for' operator. V118. V680. Looking at the assembly GCC 11.2 generates for this with -O3, we see it has in fact recognized that the union of all cases in the if and else if covers all possibilities: It has generated only two code paths, not three. Probably the '!='/'-='/'+=' should be used here. Variable should be declared in a scope that minimizes its visibility. V1091. To subscribe to this RSS feed, copy and paste this URL into your RSS reader. V3104. WPF: the type registered for DependencyProperty does not correspond with the type of the property used to access it. V679. V782. Excessive expression. V2621. Expression under 'throw' is a potential null, which can lead to NullReferenceException. The square function returns the square of its argument, in a wider type to prevent an arithmetic error. OWASP. The '&=' operation always sets a value of 'Foo' variable to zero. Check lines: N1, N2. Empty exception handler. The 'then' statement is equivalent to the 'else' statement. V3148. The expression, if present, is evaluated and then converted to the type returned by the function. operator should have 'bool' type. V2611. The other reason is that void more clearly conveys that the function is supposed to not return a value, rather than return null specifically. V1048. V827. If total energies differ across different software, how do I decide which software to use? (This const / volatile distinction is not important.) V2507. Sign in Potentially tainted data is used to create SQL command. V767. :' operator, regardless of its conditional expression, always returns one and the same value. V5007. Dozens of bugs have been opened for this . Consider checking for typos. Overflow check is incorrect. The 'X' counter is not used inside a nested loop. V5618. Consider a case where the vector is empty. V586. V5607. V6019. Block of memory should only be freed if it was allocated by a Standard Library function. Can you still use Commanders Strike if the only attack available to forego is an attack against an ally? V750. A private Ctor(SerializationInfo, StreamingContext) constructor in unsealed type will not be accessible when deserializing derived types. Constructor contains potentially uninitialized members. Possibly meant: 'A += B'. MISRA. AUTOSAR. See documentation for details. It is suspicious and can possibly be an error. Implementation of 'compareTo' overloads the method from a base class. Consider using of 'if-else' construct. My statement was question specific. V2552. Some of our partners may process your data as a part of their legitimate business interest without asking for consent. OWASP. V3180. @Sneftel Good point. The first call to printHi() is called in a context that does not require a value. Signed integer overflow in arithmetic expression. Such a pointer will become invalid. V579. V5622. Consider inspecting usage of 'Y' counter. Keyword 'nullptr' can be used for 'pointer' type exception. Buffer size is not a multiple of element size. Flowing off the end of a non-void function with no 'return' results in undefined behavior. It causes the function to return to the caller immediately. Why did US v. Assange skip the court of appeal? The 'i' variable should probably be incremented instead of the 'n' variable. Both operands of an operator should be of the same type category. AUTOSAR. Expression can be simplified: check similar operands. V516. V2558. When we call a function by itself (e.g. V505. V3130. Maximum size of a vector is known at compile time. MISRA. V2557. V3150. V1020. V3093. AUTOSAR. V682. The value of a composite expression should not be assigned to an object with wider essential type. Bool type value is compared with value of N. Consider inspecting the expression. V626. V3085. Consider inspecting the statement of '*pointer++' pattern. Size of every element in X array is not equal to divisor. An unconditional 'break/continue/return/goto' within a loop. Browse other questions tagged, Where developers & technologists share private knowledge with coworkers, Reach developers & technologists worldwide, If you are never going to return something, why do you declare the function as doing so? I am interested to try it on V802. It is possible that different variables are used inside initializer and iterator. Possible typo in the spelling of a pre-defined macro name. What "benchmarks" means in "what are benchmarks for?". Then the return statement executes, and control returns back to the caller (main). I forgot it would still issue if all paths don't have a return. "Not Spam" button for our message. To learn more, see our tips on writing great answers. V3167. malloc() function accepts a dangerous expression in the capacity of an argument. Modification of variable is unsequenced relative to another operation on the same variable. Why don't we use the 7805 for car phone chargers? MISRA. V588. V621. V3537. V759. V713. V798. One of the function's arguments has the same name and this argument is a reference. Possible incorrect use of '#pragma warning(default: X)'. V1008. Terminal null is present inside a string. Double negation is present in the expression: !!x. V3182. V614. Operand of sizeof() operator should not have other side effects. V2537. There will be no undefined behavior here. Parameter of 'CancellationToken' type is not used inside function's body. A pointer/reference parameter in a function should be declared as pointer/reference to const if the corresponding object was not modified. Generating points along line with specifying the origin of point generation in QGIS. objToJSON nonvoid function does not return a value #5326 - Github Literal suffixes should not contain lowercase characters. Check for missing parentheses or use the '&&' or '||' operator. What is the Russian word for the color "teal"? V629. V551. The variable was utilized in the logical expression before it was verified against null in the same logical expression. Consider inspecting the 'T foo = foo = x;' expression. V3007. nlohmann/json.hpp:11996:5: warning: non-void function does not return a value in all control paths [-Wreturn-type], static ReferenceType get_ref_impl(ThisType& obj) It is recommended to use the 'make_unique/make_shared' function to create smart pointers. Pointer to local variable 'X' is stored outside the scope of this variable. It only takes a minute to sign up. The 'foo' word is suspicious. MISRA. The return value of non-void function should be used. cs50 - C error: non-void function does not return a value in all Octal constants should not be used. The 'throw' keyword could be missing. An empty container is iterated. The SUCCEEDED or FAILED macro should be used instead. The expression is incorrect or can be simplified. :' operator has a lower priority than the 'foo' operator. Boundary between numeric escape sequence and string is unclear. Three potential reasons for issue the warning (elevated to an error) in spite of this come to mind: Nonetheless, this is easy to work around. V3063. Classes should always be derived from std::exception (and alike) as 'public'. AUTOSAR. V1083. MISRA. Then, enable it by default, but also make it be enabled by Wpedantic and Wreturn-type. Is it safe to publish research papers in cooperation with Russian academics? Replace iterator++ with ++iterator. V719. MISRA. Array element should not be initialized more than once. Undefined behavior will occur in case of signed integer overflow. Find centralized, trusted content and collaborate around the technologies you use most. Flexible array members should not be declared. WPF: the names of the property registered for DependencyProperty, and of the property used to access it, do not correspond with each other. Value of the expression should not be converted to the different essential type or the narrower essential type. V666. V630. Use volatile variable(s) or synchronization primitives to avoid this. Non-void functions are required to have a return type. V690. V631. Property setter / event accessor does not utilize its 'value' parameter. The expression of strlen(MyStr.c_str()) kind can be rewritten as MyStr.length(). Extracting arguments from a list of function calls. V3120. V740. Inappropriate attempt to append a null character to a string. This can quickly overflow stack. The '? V1005. Historically, early returns were frowned upon. Consider inspecting the expression. The object could have been garbage collected before the 'Target' property was accessed. V1022. It may be an error. V3059. The argument should probably be rendered as a constant pointer/reference. Conditional expression of 'if' statement is incorrect for the HRESULT type value 'Foo'. Extracting arguments from a list of function calls. Part of conditional expression is always true/false. MISRA. V3034. Referenced package contains vulnerability. Passing the value into the 'Foo' method will result in an exception. You may or may not use the return . The switch statement does not cover all values of the enum. Call 'Dispose' when disposing 'A' class. The outer type contains static field/property with identical name. V5611. Use 'double.isNaN()' method instead. Check the following code block after the 'if' statement. Consider inspecting signed and unsigned function arguments. V3105. MISRA. Pointer was used unsafely after its check for nullptr. Is it safe to publish research papers in cooperation with Russian academics? V616. V683. C++ | Delft MISRA. Two 'if' statements with identical conditional expressions. V2569. Consider inspecting the expression. MISRA. V615. Parameter is not utilized inside method's body. 'Dispose' will be invoked before exiting method. It is possible that the number of elements should be calculated by sizeof(A)/sizeof(A[0]). WPF: A class containing registered property does not correspond with a type that is passed as the ownerType.type. In such a case, the comparison operation can potentially behave unexpectedly. V2582. V1058. One pair of parentheses is unnecessary or typo is present. V5002. The function with the 'atof/atoi/atol/atoll' name should not be used. MISRA. Perhaps another variable should be incremented instead. The assignment operator should be protected from the case of 'this == &src'. Probably the '!=' should be used here. The result of '&' operator is always '0'. V691. Macro should not be defined with the same name as a keyword. V685. Using this sequence lead to undefined behavior. A function that does not return a value is called a non-value returning function (or a void function ). The compiler has been asked to treat warnings as errors. V2614. V3019. Unchecked tainted data is used in expression. MISRA. It is possible that the 'i' variable should be incremented instead of the 'n' variable. Non-void function must return value. V3094. MISRA. Consider inspecting the NN argument of the 'Foo' function. An odd precise comparison. V644. Consider inspecting the expression. Line splice results in a character sequence that matches the syntax of a universal-character-name. MISRA.