]> andersk Git - splint.git/blobdiff - src/exprChecks.c
*** empty log message ***
[splint.git] / src / exprChecks.c
index 9612a7cfcd0965dfc62a5afa4dda98dd6ee82c85..4beef3aff84af32725768a5c935e22fc1efd1bcb 100644 (file)
@@ -638,7 +638,7 @@ void exprNode_checkMacroBody (/*@only@*/ exprNode e)
       uentry hdr;
 
       if (!(context_inFunctionLike () || context_inMacroConstant ()
-           || context_inMacroUnknown ()))
+           || context_inUnknownMacro ()))
        {
          llcontbug 
            (message 
@@ -732,7 +732,7 @@ void exprNode_checkMacroBody (/*@only@*/ exprNode e)
                }
            }
        }
-      else if (context_inMacroFunction () || context_inMacroUnknown ())
+      else if (context_inMacroFunction () || context_inUnknownMacro ())
        {
          ctype rettype = context_getRetType ();
 
@@ -1087,7 +1087,7 @@ void exprChecks_checkEmptyMacroBody (void)
   uentry hdr;
   
   if (!(context_inFunctionLike () || context_inMacroConstant ()
-       || context_inMacroUnknown ()))
+       || context_inUnknownMacro ()))
     {
       llcontbug 
        (message ("exprNode_checkEmptyMacroBody: not in macro function or constant: %q", 
@@ -1523,6 +1523,16 @@ static void checkSafeReturnExpr (/*@notnull@*/ exprNode e)
   ctype tr = ctype_getReturnType (context_currentFunctionType ());
   ctype te = exprNode_getType (e);
 
+  /* evans 2001-08-21: added test to warn about void returns from void functions */
+  if (ctype_isVoid (tr))
+    {
+      (void) gentypeerror
+       (te, e, tr, exprNode_undefined,
+        message ("Return expression from function declared void: %s", exprNode_unparse (e)),
+        e->loc);
+      return;
+    }
+
   if (!ctype_forceMatch (tr, te) && !exprNode_matchLiteral (tr, e))
     {
       (void) gentypeerror
This page took 0.03455 seconds and 4 git commands to generate.