From: eks@vki68.aar-vki.DK (Eigil Krogh Sorensen)
Subject: groff-1.06 make error. (fwd)
Organization: GNUs Not Usenet
Distribution: gnu
Date: Fri, 11 Dec 1992 21:12:03 GMT

Forwarded message:
> From jclark.com!jjc Fri Dec 11 16:03:10 1992
> Date: Fri, 11 Dec 92 19:24:20 GMT
> From: jjc@jclark.com (James Clark)
> Message-Id: <9212111924.AA22124@jclark.com>
> To: eks@vki68.aar-vki.dk
> In-Reply-To: <m0n0Giv-0000tHC@vki68.aar-vki.dk> (eks@vki68.aar-vki.dk)
> Subject: groff-1.06 make error.
> X-Charset: US-DK
> X-Char-Esc: 29
> 
> Your version of g++ is broken in some way.  I don't know whether it's
> misinstalled or whether it simply doesn't work properly on your
> system.  I'm afraid there's not much I can do to help.  It's not a
> groff problem.  You could try sending a bug report to the bug-g++
> list.
> 
So I try bug-gcc.

Here is the bug-report



GROFF VERSION:
1.06

MACHINE:
Motorola 3300 (mvme147 based)

OS:
sysV68 R3V5.1

COMPILER:
gcc-2.3.2


INPUT FILES:
("vki68 eks $ " is prompt)


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 $

vki68 eks $ 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 $ 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 $ cat /usr/local/lib/g++-include/stdio.h
// This may look like C code, but it is really -*- C++ -*-
/* 
Copyright (C) 1988 Free Software Foundation
    written by Doug Lea (dl@rocky.oswego.edu)

This file is part of the GNU C++ Library.  This library is free
software; you can redistribute it and/or modify it under the terms of
the GNU Library General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your
option) any later version.  This library 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 Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free Software
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#ifndef _stdio_h
#ifdef __GNUG__
#pragma interface
#endif

#ifdef __stdio_h_recursive
#include_next <stdio.h>
#else
#define __stdio_h_recursive

// Note:  The #define _stdio_h is at the end of this file,
// in case #include_next <stdio.h> finds an installed version of this
// same file -- we want it to continue until it finds the C version.

#include <_G_config.h>

extern "C" {

#undef NULL

#define fdopen __hide_fdopen
#define fopen __hide_fopen
#define fprintf __hide_fprintf
#define fputs __hide_fputs
#define fread __hide_fread
#define freopen __hide_freopen
#define fscanf __hide_fscanf
#define ftell __hide_ftell
#define fwrite __hide_fwrite
#define new __hide_new /* In case 'new' is used as a parameter name. */
#define perror __hide_perror
#define popen __hide_popen
#define printf __hide_printf
#define puts __hide_puts
#define putw __hide_putw
#define rewind __hide_rewind
#define tempnam __hide_tempnam
#define scanf __hide_scanf
#define setbuf __hide_setbuf
#define setbuffer __hide_setbuffer
#define setlinebuf __hide_setlinebuf
#define setvbuf __hide_setvbuf
#define sprintf __hide_sprintf
#define sscanf __hide_sscanf
#define tempnam __hide_tempnam
#define vfprintf __hide_vfprintf
#define vprintf __hide_vprintf
#define vsprintf __hide_vsprintf
#define _flsbuf __hide__flsbuf

#include_next <stdio.h>

#undef fdopen
#undef fopen
#undef fprintf
#undef fputs
#undef fread
#undef freopen
#undef fscanf
#undef ftell
#undef fwrite
#undef new
#undef perror
#undef popen
#undef printf
#undef puts
#undef putw
#undef rewind
#undef tempnam
#undef scanf
#undef setbuf
#undef setbuffer
#undef setlinebuf
#undef setvbuf
#undef sprintf
#undef sscanf
#undef tempnam
#undef vprintf
#undef vfprintf
#undef vsprintf
#undef _flsbuf

#ifndef NULL
#define NULL _G_NULL
#endif

#ifndef size_t
#define size_t _G_size_t
#endif
}

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*);
size_t fread(void*, size_t, size_t, FILE*);
#ifdef VMS
FILE*  freopen(const char*, const char*, FILE* ...);
#else
FILE*  freopen(const char*, const char*, FILE*);
#endif
int    fscanf(FILE*, const char* ...);
int    fseek(FILE*, long, int);
long   ftell(FILE *);
size_t fwrite(const void*, size_t, 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, size_t);
int    sscanf(char*, const char* ...);
FILE*  tmpfile();
int    ungetc(int, FILE*);
int    vfprintf _G_ARGS((FILE*, const char*, _G_va_list));
int    vprintf _G_ARGS((const char*, _G_va_list));
_G_sprintf_return_type sprintf _G_ARGS((char*, const char* ...));
_G_sprintf_return_type vsprintf _G_ARGS((char*, const char*, _G_va_list));

extern int _filbuf _G_ARGS((FILE*));
extern int _flsbuf _G_ARGS((unsigned, FILE*));

}

#ifndef L_ctermid
#define L_ctermid       9 
#endif
#ifndef L_cuserid
#define L_cuserid       9
#endif
#ifndef P_tmpdir
#define P_tmpdir    "/tmp/"
#endif
#ifndef L_tmpnam
#define L_tmpnam    (sizeof(P_tmpdir) + 15)
#endif

#define _stdio_h 1

#endif
#endif // _stdio_h


DESCRIPTION OF INCORRECT BEHAVIOUR:
(Screendump)

vki68 eks $ make LIBS=-lm88
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 -g  -c errarg.cc
Reading specs from /usr/local/lib/gcc-lib/3300/2.3.2/specs
gcc version 2.3.2
 /usr/local/lib/gcc-lib/3300/2.3.2/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__ -g -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/cca20605.i
GNU CPP version 2.3.2 (68k, SGS/AT&T sysV68 syntax)
 /usr/local/lib/gcc-lib/3300/2.3.2/cc1plus /usr/tmp/cca20605.i -quiet -dumpbase errarg.cc -g -O2 -version -o /usr/tmp/cca20605.s
GNU C++ version 2.3.2 (68k, SGS/AT&T sysV68 syntax) compiled by GNU C version 2.3.2.
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.gcc.bug