[tex-live] tex-live bug with clang compilers

Jack Howarth howarth at bromo.med.uc.edu
Sun Jul 17 01:02:34 CEST 2011

  The fink project is building all of its packages with Apple's clang compilers
with the release of Lion. In the process of porting packages, the following bug
came to our attention from the failed compilation of texk/ps2pkm/type1.c. The
failure occurs with both the icc and clang compilers. It can be testcased as...

-------------- type1_testcase.c  --------------
#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) */

#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");
which fails to compile as...

[MacPro-2:~] howarth% clang -c type1_testcase.c
type1_testcase.c:29:8: error: non-void function 'PSFakePop' should return a
      value [-Wreturn-type]
  else Error0("PSFakePop: Stack empty\n");
type1_testcase.c:18:54: note: instantiated from:
#define Error0(errmsg) { CC; IfTrace0(TRUE, errmsg); Error;}
type1_testcase.c:16:32: note: instantiated from:
#define Error {errflag = TRUE; return;}
1 error generated.

This general issue has been previously described in the clang mailing list...


Is there an easy fix to make this code c90 compliant?
     Thanks in advance.

More information about the tex-live mailing list