Merge pull request #2654 from kugelfuhr/kugelfuhr/fix-2599
Fix missing warning for non void functions without a return statement
This commit is contained in:
@@ -636,7 +636,9 @@ void NewFunc (SymEntry* Func, FuncDesc* D)
|
|||||||
/* If this is the main function in a C99 environment returning an int,
|
/* If this is the main function in a C99 environment returning an int,
|
||||||
** let it always return zero. Otherwise output a warning.
|
** let it always return zero. Otherwise output a warning.
|
||||||
*/
|
*/
|
||||||
if (IS_Get (&Standard) >= STD_C99 && GetUnqualRawTypeCode (ReturnType) == T_INT) {
|
if (F_IsMainFunc (CurrentFunc) &&
|
||||||
|
IS_Get (&Standard) >= STD_C99 &&
|
||||||
|
GetUnqualRawTypeCode (ReturnType) == T_INT) {
|
||||||
g_getimmed (CF_INT | CF_CONST, 0, 0);
|
g_getimmed (CF_INT | CF_CONST, 0, 0);
|
||||||
} else if (IS_Get (&WarnReturnType)) {
|
} else if (IS_Get (&WarnReturnType)) {
|
||||||
Warning ("Control reaches end of non-void function [-Wreturn-type]");
|
Warning ("Control reaches end of non-void function [-Wreturn-type]");
|
||||||
|
|||||||
Reference in New Issue
Block a user