From: eks@vki68.aar-vki.DK (Eigil Krogh Sorensen)
Subject: gcc-2.3.3 error while making groff-1.06
Organization: GNUs Not Usenet
Distribution: gnu
Date: Wed, 6 Jan 1993 12:50:19 GMT

Now gcc-2.3.3 is installed on this Motorola sysV68 R3V5.1 (mvme147/
68030 based) system. But I still get the error enclosed (screendump)
when makeing groff-1.06. The same error which came when gcc-2.3.2
was used.

The error comes when libgroff/errarg.cc is compiled.

I'm not the best in understanding C++. All the files are
enclosed to so that you can se if something's wrong.

Is it possible to give any hints about what is wrong and what I
can do about it.


Best,
Eigil Krogh Sorensen.



--------------------------------------------------------------------
Screendump of error ("vki68 eks $" is prompt).
-----------------------------------------------

make
Making all in include
Making all in libgroff
        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 assert.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 assert.cc /usr/tmp/cca20792.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/cca20792.i -quiet -dumpbase assert.cc -O2 -version -o /usr/tmp/cca20792.s
GNU C++ version 2.3.3 (68k, SGS/AT&T sysV68 syntax) compiled by GNU C version 2.3.3.
 as -o assert.o /usr/tmp/cca20792.s
        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 change_lf.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 change_lf.cc /usr/tmp/cca20797.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/cca20797.i -quiet -dumpbase change_lf.cc -O2 -version -o /usr/tmp/cca20797.s
GNU C++ version 2.3.3 (68k, SGS/AT&T sysV68 syntax) compiled by GNU C version 2.3.3.
 as -o change_lf.o /usr/tmp/cca20797.s
        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 cmap.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 cmap.cc /usr/tmp/cca20802.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/cca20802.i -quiet -dumpbase cmap.cc -O2 -version -o /usr/tmp/cca20802.s
GNU C++ version 2.3.3 (68k, SGS/AT&T sysV68 syntax) compiled by GNU C version 2.3.3.
 as -o cmap.o /usr/tmp/cca20802.s
        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 cset.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 cset.cc /usr/tmp/cca20807.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/cca20807.i -quiet -dumpbase cset.cc -O2 -version -o /usr/tmp/cca20807.s
GNU C++ version 2.3.3 (68k, SGS/AT&T sysV68 syntax) compiled by GNU C version 2.3.3.
 as -o cset.o /usr/tmp/cca20807.s
        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 device.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 device.cc /usr/tmp/cca20812.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/cca20812.i -quiet -dumpbase device.cc -O2 -version -o /usr/tmp/cca20812.s
GNU C++ version 2.3.3 (68k, SGS/AT&T sysV68 syntax) compiled by GNU C version 2.3.3.
 as -o device.o /usr/tmp/cca20812.s
        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.
vki68 eks $ cat libgroff/errarg.cc
// -*- C++ -*-
/* Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
     Written by James Clark (jjc@jclark.com)

This file is part of groff.

groff is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.

groff is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
for more details.

You should have received a copy of the GNU General Public License along
with groff; see the file COPYING.  If not, write to the Free Software
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */

#include <stdio.h>
#include "assert.h"
#include "errarg.h"

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), stderr);
    break;
  case CHAR:
    putc(c, stderr);
    break;
  case STRING:
    fputs(s, stderr);
    break;
  case DOUBLE:
    fprintf(stderr, "%g", d);
    break;
  case EMPTY:
    break;
  }
}

errarg empty_errarg;

void errprint(const char *format, 
              const errarg &arg1,
              const errarg &arg2,
              const errarg &arg3)
{
  assert(format != 0);
  char c;
  while ((c = *format++) != '\0') {
    if (c == '%') {
      c = *format++;
      switch(c) {
      case '%':
        fputc('%', stderr);
        break;
      case '1':
        assert(!arg1.empty());
        arg1.print();
        break;
      case '2':
        assert(!arg2.empty());
        arg2.print();
        break;
      case '3':
        assert(!arg3.empty());
        arg3.print();
        break;
      default:
        assert(0);
      }
    }
    else
      putc(c, stderr);
  }
}
vki68 eks $ cat include           cat include/errarg.h
// -*- C++ -*-
/* Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
     Written by James Clark (jjc@jclark.com)

This file is part of groff.

groff is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.

groff is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
for more details.

You should have received a copy of the GNU General Public License along
with groff; see the file COPYING.  If not, write to the Free Software
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */

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

vki68 eks $ cay   
vki68 eks $ cat include/assert.h
// -*- C++ -*-
/* Copyright (C) 1989, 1990, 1991, 1992 Free Software Foundation, Inc.
     Written by James Clark (jjc@jclark.com)

This file is part of groff.

groff is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.

groff is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
for more details.

You should have received a copy of the GNU General Public License along
with groff; see the file COPYING.  If not, write to the Free Software
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */

#ifndef ASSERT_H
#define ASSERT_H
#ifdef __GNUG__
volatile
#endif
void assertion_failed(int, const char *);

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

#undef assert

#ifdef NDEBUG
#define assert(ignore) /* as nothing */
#else
#define assert(expr) do_assert(expr, __LINE__, __FILE__)
#endif
vki68 eks $

Newsgroups: gnu.g++.bug