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

Jack Howarth howarth at bromo.med.uc.edu
Fri Jul 15 19:30:02 PDT 2011


  A more complete test case of the issue we are faced with in compiling texlive
with the strict treatment of return statements without expressions in non-void	functions
is attached. Any chance that the previously proposed -std=c89 warning behavior will be
implemented for clang 3.0?
              Jack
-------------- next part --------------
#include <stdio.h>
#define IfTrace0(condition,model)                                 \
        {if (condition) printf(model);}
#define IfTrace1(condition,model,arg0)                            \
        {if (condition) printf(model,arg0);}
#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*/
}



More information about the cfe-dev mailing list