return statements without expressions in non-void functions revisited

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)?

-------------------- type1_test.c -----------------------
#define TRUE (1)
typedef double DOUBLE; /* 64 bits */
int currentchar = -1; /* for error reporting */
static int errflag;

#define MAXPSFAKESTACK 32 /* Max depth of fake PostScript stack (local) */
static DOUBLE PSFakeStack[MAXPSFAKESTACK];

#define CC IfTrace1(TRUE, "'%03o ", currentchar)

#define Error {errflag = TRUE; return;}

#define Error0(errmsg) { CC; IfTrace0(TRUE, errmsg); Error;}

#define Error1(errmsg,arg) { CC; IfTrace1(TRUE, errmsg, arg); Error;}

static DOUBLE PSFakePop(void);
static int PSFakeTop;

/* PSFakePop: Removes a number from the top of the fake PostScript stack */
static DOUBLE PSFakePop ()
{
  if (PSFakeTop >= 0) return(PSFakeStack[PSFakeTop--]);
  else Error0("PSFakePop: Stack empty\n");
  /*NOTREACHED*/
}

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

  - Doug

Doug,
   Is there any documentation of the full set of warnings which are treated
as errors that can be suppressed with -Wno-error in this manner?
                      Jack

There isn't a complete list anywhere (outside the source), but if
you're seeing some particular warning, and there is such a flag, it
will be listed after the warning (like -Wreturn-type is listed in the
given example).

-Eli

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

Doug,
  Is there any documentation of the full set of warnings which are treated
as errors that can be suppressed with -Wno-error in this manner?

No documentation per se. However, every warning/error that is remappable displays the corresponding flag as part of the diagnostic. Note the [-Wreturn-type] in the diagnostic you pasted.

  -Doug