Quantcast
Channel: Intel® Software - Intel® C++ Compiler
Viewing all articles
Browse latest Browse all 1175

unexpected warning #1011: missing return statement at end of non-void function

$
0
0

Looks like in some cases ICC doesn't notice a noreturn attribute of the called function. Below is a simple example that illustrates the problem.
(In practice, in my program abort() is called from ASSERT() macro that does something more, but the key point is the usage of comma operator).

#include <stdlib.h>

int noret1(void) {
        abort(), 0; /* warning #1011 */
        abort(), abort(); /* warning #1011 */
}
int noret2(void) {
        abort(); /* ok - no warning */
}

int main(int argc, const char *argv[]) {
        return noret1() + noret2();
}

 


Viewing all articles
Browse latest Browse all 1175

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>