[cfe-dev] return statements without expressions in non-void functions revisited
Jack Howarth
howarth at bromo.med.uc.edu
Sun Jul 17 09:04:24 PDT 2011
FYI, the texlive developers recommend the following change to solve the
strictness of clang on this issue...
--- texlive.orig/texk/ps2pkm/type1.c 2011-07-17 10:56:13.000000000 -0400
+++ texlive/texk/ps2pkm/type1.c 2011-07-17 10:57:31.000000000 -0400
@@ -127,6 +127,8 @@
#define Error {errflag = TRUE; return;}
#define Error0(errmsg) { CC; IfTrace0(TRUE, errmsg); Error;}
+
+#define Error01(errmsg) { CC; IfTrace0(TRUE, errmsg); errflag = TRUE; return -1.0;}
#define Error1(errmsg,arg) { CC; IfTrace1(TRUE, errmsg, arg); Error;}
@@ -780,7 +782,7 @@
static DOUBLE PSFakePop ()
{
if (PSFakeTop >= 0) return(PSFakeStack[PSFakeTop--]);
- else Error0("PSFakePop : Stack empty\n");
+ else Error01("PSFakePop : Stack empty\n");
/*NOTREACHED*/
}
With that change, texlive from 20100720 compiles fine against clang3.0svn.
Jack
ps It still would be nice to have the option of -std=c89 converting the
non-void function should return a value error into a warning.
More information about the cfe-dev
mailing list