From: eks@vki68.aar-vki.DK (Eigil Krogh Sorensen)
Subject: Error while making groff-1.06 (cpp outp. included).
Organization: GNUs Not Usenet
Distribution: gnu
Date: Thu, 7 Jan 1993 17:06:32 GMT

System: Motorola sysV68 R3V5.1

Hardware: mvme147/68030 based.

Compiler: gcc-2.3.3

Program: groff-1.06

Problem: gcc-2.3.3 repports error when libgroff/errarg.cc is
         compiled.



---------------------------------------------------------------
cpp output
----------
cat mke*
gcc -v -O2 -E  -I../include -o errarg.E errarg.cc
vki68 eks $ mke*
Reading specs from /usr/local/lib/gcc-lib/3300/2.3.3/specs
gcc version 2.3.3
 /usr/local/lib/gcc-lib/3300/2.3.3/cpp -lang-c++ -v -I../include -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -Dm68k -Dunix -DsysV68 -D__m68k__ -D__unix__ -D__sysV68__ -D__m68k -D__unix -D__sysV68 -D__OPTIMIZE__ -D__HAVE_68881__ errarg.cc -o errarg.E
GNU CPP version 2.3.3 (68k, SGS/AT&T sysV68 syntax)
vki68 eks $ cat errarg.E
# 1 "errarg.cc"
 
 


















# 1 "/usr/local/lib/g++-include/stdio.h" 1 3
 
 


















#pragma interface







 
 
 

# 1 "/usr/local/lib/g++-include/_G_config.h" 1 3
  






typedef int   _G_clock_t;
typedef short _G_dev_t;
typedef long   _G_fpos_t;
typedef int   _G_gid_t;
typedef unsigned short _G_ino_t;
typedef int   _G_mode_t;
typedef int   _G_nlink_t;
typedef long _G_off_t;
typedef int   _G_pid_t;
typedef long int _G_ptrdiff_t;
typedef int   _G_sigset_t;
typedef unsigned int _G_size_t;
typedef long _G_time_t;
typedef int   _G_uid_t;
typedef long int _G_wchar_t;
typedef  int   _G_ssize_t;
typedef void * _G_va_list;


















 
 

# 33 "/usr/local/lib/g++-include/stdio.h" 2 3


extern "C" {

































# 1 "/usr/local/lib/gcc-lib/3300/2.3.3/include/stdio.h" 1 3

# 1 "/usr/local/lib/g++-include/stdarg.h" 1 3
extern "C" {
# 1 "/usr/local/lib/gcc-lib/3300/2.3.3/include/stdarg.h" 1 3
 







































 






typedef void *__gnuc_va_list;



 

# 85 "/usr/local/lib/gcc-lib/3300/2.3.3/include/stdarg.h" 3










# 137 "/usr/local/lib/gcc-lib/3300/2.3.3/include/stdarg.h" 3





# 2 "/usr/local/lib/g++-include/stdarg.h" 2 3

}
# 2 "/usr/local/lib/gcc-lib/3300/2.3.3/include/stdio.h" 2 3

#ident "@(#)stdio.h     35.2"













 


typedef struct {

        int     _cnt;
        unsigned char   *_ptr;




        unsigned char   *_base;
        char    _flag;
        char    _file;
} FILE;

 















                


























extern FILE     _iob[80         ];
extern FILE     *__hide_fopen (), *__hide_fdopen (), *__hide_freopen (), *__hide_popen (), *tmpfile();
extern long     __hide_ftell ();
extern void     __hide_rewind (), __hide_setbuf ();
extern char     *ctermid(), *cuserid(), *fgets(), *gets(), *__hide_tempnam (), *tmpnam();
extern unsigned char *_bufendtab[];

extern int      fclose(), fflush(), __hide_fread (), __hide_fwrite (), fseek(), fgetc(),
                getw(), pclose(), __hide_printf (), __hide_fprintf (), __hide_sprintf (),
                __hide_vprintf (), __hide_vfprintf (), __hide_vsprintf (), fputc(), __hide_putw (),
                __hide_puts (), __hide_fputs (), __hide_scanf (), __hide_fscanf (), __hide_sscanf (),
                __hide_setvbuf (), system(), ungetc();






# 69 "/usr/local/lib/g++-include/stdio.h" 2 3







































}

extern "C" {

int    fclose(FILE*);
FILE*  fdopen(int, const char*);
int    fflush(FILE*);
int    fgetc(FILE*);
char*  fgets(char*, int, FILE *);
FILE*  fopen(const char*, const char*);
int    fprintf(FILE*, const char* ...);
int    fputc(int, FILE*);
int    fputs(const char*, FILE*);
_G_size_t  fread(void*, _G_size_t , _G_size_t , FILE*);



FILE*  freopen(const char*, const char*, FILE*);

int    fscanf(FILE*, const char* ...);
int    fseek(FILE*, long, int);
long   ftell(FILE *);
_G_size_t  fwrite(const void*, _G_size_t , _G_size_t , FILE*);
char*  gets(char*);
int    getw(FILE*);
int    pclose(FILE*);
void   perror(const char*);
FILE*  popen(const char*, const char*);
int    printf(const char* ...);
int    puts(const char*);
int    putw(int, FILE*);
int    rewind(FILE*);
int    scanf(const char* ...);
void   setbuf(FILE*, char*);
void   setbuffer(FILE*, char*, int);
int    setlinebuf(FILE*);
int    setvbuf(FILE*, char*, int, _G_size_t );
int    sscanf(char*, const char* ...);
FILE*  tmpfile();
int    ungetc(int, FILE*);
int    vfprintf (...) ;
int    vprintf (...) ;
int  sprintf (...) ;
int  vsprintf (...) ;

extern int _filbuf (...) ;
extern int _flsbuf (...) ;

}


















# 21 "errarg.cc" 2

# 1 "../include/assert.h" 1
 
 





















volatile

void assertion_failed(int, const char *);

inline void do_assert(int expr, int line, const char *file)
{
  if (!expr)
    assertion_failed(line, file);
}









# 22 "errarg.cc" 2

# 1 "../include/errarg.h" 1
 
 


















class errarg {
  enum { EMPTY, STRING, CHAR, INTEGER, DOUBLE } type;
  union {
    const char *s;
    int n;
    char c;
    double d;
  };
 public:
  errarg();
  errarg(const char *);
  errarg(char);
  errarg(unsigned char);
  errarg(int);
  errarg(double);
  int empty() const;
  void print() const;
};

extern errarg empty_errarg;

extern void errprint(const char *,
                     const errarg &arg1 = empty_errarg,
                     const errarg &arg2 = empty_errarg,
                     const errarg &arg3 = empty_errarg);

# 23 "errarg.cc" 2


errarg::errarg(const char *p) : s(p ? p : "(null)"), type(STRING)
{
}

errarg::errarg() : type(EMPTY)
{
}

errarg::errarg(unsigned char cc) : type(CHAR)
{
  c = cc;
}

errarg::errarg(int nn) : type(INTEGER), n(nn)
{
}

errarg::errarg(char cc) : type(CHAR), c(cc)
{
}

errarg::errarg(double dd) : type(DOUBLE), d(dd)
{
}

int errarg::empty() const
{
  return type == EMPTY;
}

extern "C" {
  const char *itoa(int);
}
            
void errarg::print() const
{
  switch (type) {
  case INTEGER:
    fputs(itoa(n),      (&_iob[2]) );
    break;
  case CHAR:
    (--(        (&_iob[2]) )->_cnt < 0 ? _flsbuf((unsigned char) (c), (         (&_iob[2]) )) : (int) (*(       (&_iob[2]) )->_ptr++ = (unsigned char) (c))) ;
    break;
  case STRING:
    fputs(s,    (&_iob[2]) );
    break;
  case DOUBLE:
    fprintf(    (&_iob[2]) , "%g", d);
    break;
  case EMPTY:
    break;
  }
}

errarg empty_errarg;

void errprint(const char *format, 
              const errarg &arg1,
              const errarg &arg2,
              const errarg &arg3)
{
  do_assert(format != 0, 86, "errarg.cc") ;
  char c;
  while ((c = *format++) != '\0') {
    if (c == '%') {
      c = *format++;
      switch(c) {
      case '%':
        fputc('%',      (&_iob[2]) );
        break;
      case '1':
        do_assert(!arg1.empty(), 96, "errarg.cc") ;
        arg1.print();
        break;
      case '2':
        do_assert(!arg2.empty(), 100, "errarg.cc") ;
        arg2.print();
        break;
      case '3':
        do_assert(!arg3.empty(), 104, "errarg.cc") ;
        arg3.print();
        break;
      default:
        do_assert(0, 108, "errarg.cc") ;
      }
    }
    else
      (--(      (&_iob[2]) )->_cnt < 0 ? _flsbuf((unsigned char) (c), (         (&_iob[2]) )) : (int) (*(       (&_iob[2]) )->_ptr++ = (unsigned char) (c))) ;
  }
}
vki68 eks $ pwd
/usr/eks/gnu/ftp.denet.dk/groff-1.06/groff-1.06/libgroff
vki68 eks $



--------------------------------------------------------------------
Compilererror.
--------------
make
Making all in include
Making all in libgroff

.........(stuff deleted

        gcc -O2 -v -I. -I. -I../include -I./../include -DHAVE_UNISTD_H=1 -DHAVE_DIRENT_H=1 -DHAVE_LIMITS_H=1 -DHAVE_SYS_DIR_H=1 -DHAVE_CC_LIMITS_H=1 -DHAVE_CC_UNISTD_H=1 -DSTDLIB_H_DECLARES_GETOPT=1 -DSTDLIB_H_DECLARES_PUTENV=1 -DLONG_FOR_TIME_T=1 -Dvfork=fork   -c errarg.cc
Reading specs from /usr/local/lib/gcc-lib/3300/2.3.3/specs
gcc version 2.3.3
 /usr/local/lib/gcc-lib/3300/2.3.3/cpp -lang-c++ -v -I. -I. -I../include -I./../include -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -Dm68k -Dunix -DsysV68 -D__m68k__ -D__unix__ -D__sysV68__ -D__m68k -D__unix -D__sysV68 -D__OPTIMIZE__ -D__HAVE_68881__ -DHAVE_UNISTD_H=1 -DHAVE_DIRENT_H=1 -DHAVE_LIMITS_H=1 -DHAVE_SYS_DIR_H=1 -DHAVE_CC_LIMITS_H=1 -DHAVE_CC_UNISTD_H=1 -DSTDLIB_H_DECLARES_GETOPT=1 -DSTDLIB_H_DECLARES_PUTENV=1 -DLONG_FOR_TIME_T=1 -Dvfork=fork errarg.cc /usr/tmp/cca20817.i
GNU CPP version 2.3.3 (68k, SGS/AT&T sysV68 syntax)
 /usr/local/lib/gcc-lib/3300/2.3.3/cc1plus /usr/tmp/cca20817.i -quiet -dumpbase errarg.cc -O2 -version -o /usr/tmp/cca20817.s
GNU C++ version 2.3.3 (68k, SGS/AT&T sysV68 syntax) compiled by GNU C version 2.3.3.
errarg.cc: In method `errarg::errarg (const char *)':
errarg.cc:25: class `errarg' does not have any field named `s'
errarg.cc: In method `errarg::errarg (unsigned char)':
errarg.cc:35: `c' undeclared (first use this function)
errarg.cc:35: (Each undeclared identifier is reported only once
errarg.cc:35: for each function it appears in.)
errarg.cc: In method `errarg::errarg (int)':
errarg.cc:38: class `errarg' does not have any field named `n'
errarg.cc: In method `errarg::errarg (char)':
errarg.cc:42: class `errarg' does not have any field named `c'
errarg.cc: In method `errarg::errarg (double)':
errarg.cc:46: class `errarg' does not have any field named `d'
errarg.cc: In method `void  errarg::print ()const ':
errarg.cc:63: `n' undeclared (first use this function)
errarg.cc:56: too few arguments to function `const char * itoa (int)'
errarg.cc:63: at this point in file
errarg.cc:66: `c' undeclared (first use this function)
errarg.cc:69: `s' undeclared (first use this function)
errarg.cc:69: incompatible pointer types for argument 1 of `int  fputs (const char *, struct _%_0*)'
/usr/local/lib/g++-include/stdio.h:120: too few arguments to function `int  fputs (const char *, struct _%_0*)'
errarg.cc:69: at this point in file
errarg.cc:72: `d' undeclared (first use this function)
*** Error code 1

Stop.
*** Error code 1

Stop.
*** Error code 1

Stop.

Newsgroups: gnu.g++.bug