[cfe-dev] return statements without expressions in non-void functions revisited

Douglas Gregor dgregor at apple.com
Mon Jul 25 12:50:01 PDT 2011


On Jul 15, 2011, at 5:56 PM, Jack Howarth wrote:

>   In porting texlive under clang for fink, we have run into the same issue from this thread...
> 
> http://comments.gmane.org/gmane.comp.compilers.clang.devel/10688
> 
> In that thread it was suggested that -std=c89 might be modified to convert the error into
> a warning for...
> 
> [MacPro:~] howarth% clang -std=gnu89 -c type1_test.c -fno-strict-aliasing 
> type1_test.c:24:8: error: non-void function 'PSFakePop' should return a value [-Wreturn-type]
>  else Error0("PSFakePop: Stack empty\n");
>       ^
> type1_test.c:13:54: note: instantiated from:
> #define Error0(errmsg) { CC; IfTrace0(TRUE, errmsg); Error;}
>                                                     ^
> type1_test.c:11:32: note: instantiated from:
> #define Error {errflag = TRUE; return;}
>                               ^
> 1 error generated.
> 
> This appears to never have been implemented however. Any suggestions on the best approach to
> revise the following testcase to avoid the error under clang (which I also see under icc
> but not gcc trunk even with -std=c90)?

The flag -Wno-error=return-type will downgrade this error to a warning. -Wno-return-type will turn off the warning/error entirely.

	- Doug



More information about the cfe-dev mailing list