NetBSD Problem Report #1557

From gnats  Mon Oct  2 15:38:54 1995
Received: from mn3.swip.net (mn3.swip.net [192.71.180.33]) by sun-lamp.pc.cs.cmu.edu (8.6.11/8.6.10) with ESMTP id PAA00234 for <gnats-bugs@gnats.netbsd.org>; Mon, 2 Oct 1995 15:38:45 -0400
Message-Id: <199510011316.OAA10260@linda.appli.se>
Date: Sun, 1 Oct 1995 14:16:04 +0100
From: niklas@appli.se
Reply-To: niklas@appli.se
To: gnats-bugs@gnats.netbsd.org
Subject: some GCC 2.7.x patches
X-Send-Pr-Version: 3.2

>Number:         1557
>Category:       bin
>Synopsis:       Make NetBSD more friendly to newer GCC versions
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          closed
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Mon Oct 02 15:50:11 +0000 1995
>Closed-Date:    Thu Feb 08 03:54:38 +0000 1996
>Last-Modified:  Thu Feb 08 03:56:29 +0000 1996
>Originator:     Niklas Hallqvist
>Release:        950930
>Organization:
	Applitron Datasystem AB
>Environment:
System: NetBSD nettan.appli.se 1.0A NetBSD 1.0A (NETTAN) #13: Fri Aug 25 11:45:40 PDT 1995 niklas@nettan.appli.se:/u6/NetBSD/src/sys/arch/i386/compile/NETTAN i386


>Description:
	Today NetBSD cannot be entirely built with a recent GCC due to
	code not conformant with recent ANSI draft standard changes to
	C++, for example.  Another problem is that ld.so requires function
	CSE to not be done due to it's very special function.  Yet another
	is that traditional K&R varargs support is broken.

>How-To-Repeat:
	Try to build NetBSD with a recent version of GCC

>Fix:
	The patchfile below fixes libg++ & groff to be ANSI draft conformant.
	A better fix would be to merge newer versions of these.  Our libg++
	is also changed to recognize newer name manglings.  Other fixes
	include requiring GCC to not do function CSE on ld.so (which is
	automatically disabled with -fpic in "our" GCC, an overkill).  The
	special case for alpha using -fno-for-scope is removed.  A special
	sys.mk variable LINK is also introduced so Makefiles can override
	the compiler driver invoked when doing the link editing.  This is so
	C++ programmes can be linked via another command than C ones.  The
	last fix in this patch concerns varargs, GCC has an extension to
	be used in va_dcl macros in order to tell the compiler that this
	is a traditional varargs function.  We need to use that one (an
	ellipsis in the argument decls) in our va_dcl definition.

*** old-NetBSD/src/gnu/lib/libg++/iostream/stdstrbufs.C
--- NetBSD/src/gnu/lib/libg++/iostream/stdstrbufs.C
***************
*** 53,62 ****
--- 53,70 ----
  #define vt_filebuf __vtbl__7filebuf
  extern char vt_filebuf[1];
  #elif _G_DOLLAR_IN_LABEL
+ #if __GNUC_MINOR__ >= 5		// XXX I'm not sure it was introduced in 2.5
+ extern char vt_filebuf[1] asm(UNDERSCORE "_vt$7filebuf");
+ #else
  extern char vt_filebuf[1] asm(UNDERSCORE "_vt$filebuf");
+ #endif
+ #else
+ #if __GNUC_MINOR__ >= 5		// XXX I'm not sure it was introduced in 2.5
+ extern char vt_filebuf[1] asm(UNDERSCORE "_vt.7filebuf");
  #else
  extern char vt_filebuf[1] asm(UNDERSCORE "_vt.filebuf");
  #endif
+ #endif
  #endif /* !defined(vt_filebuf) */

  struct _fake_filebuf {
***************
*** 85,93 ****
--- 93,109 ----
  #define vt_stdiobuf __vtbl__8stdiobuf
  extern char vt_stdiobuf[1];
  #elif _G_DOLLAR_IN_LABEL
+ #if __GNUC_MINOR__ >= 5		// XXX I'm not sure it was introduced in 2.5
+ extern char vt_stdiobuf[1] asm(UNDERSCORE "_vt$8stdiobuf");
+ #else
  extern char vt_stdiobuf[1] asm(UNDERSCORE "_vt$stdiobuf");
+ #endif
+ #else
+ #if __GNUC_MINOR__ >= 5		// XXX I'm not sure it was introduced in 2.5
+ extern char vt_stdiobuf[1] asm(UNDERSCORE "_vt.8stdiobuf");
  #else
  extern char vt_stdiobuf[1] asm(UNDERSCORE "_vt.stdiobuf");
+ #endif
  #endif
  #endif /* !defined(vt_stdiobuf) */

*** old-NetBSD/src/gnu/lib/libg++/iostream/strstream.C
--- NetBSD/src/gnu/lib/libg++/iostream/strstream.C
***************
*** 144,150 ****
  	// This can lose in pathological cases (ptr near the end
  	// of the address space).  A better solution might be to
  	// adjust the size on underflow/overflow.  FIXME.
! 	for (int s; s = 2*size, s > 0 && ptr + s > ptr && s < 0x4000000L; )
  	    size = s;
  	size = s;
  #else
--- 144,151 ----
  	// This can lose in pathological cases (ptr near the end
  	// of the address space).  A better solution might be to
  	// adjust the size on underflow/overflow.  FIXME.
! 	int s;
! 	for (; s = 2*size, s > 0 && ptr + s > ptr && s < 0x4000000L; )
  	    size = s;
  	size = s;
  #else
*** old-NetBSD/src/gnu/lib/libg++/libg++/ACG.cc
--- NetBSD/src/gnu/lib/libg++/libg++/ACG.cc
***************
*** 188,194 ****
      //	Determine the size of the state table
      //

!     for (register int l = 0;
  	 randomStateTable[l][0] != -1 && randomStateTable[l][1] < size;
  	 l++);

--- 188,195 ----
      //	Determine the size of the state table
      //

!     register int l;
!     for (l = 0;
  	 randomStateTable[l][0] != -1 && randomStateTable[l][1] < size;
  	 l++);

*** old-NetBSD/src/gnu/lib/libg++/libg++/Fix.cc
--- NetBSD/src/gnu/lib/libg++/libg++/Fix.cc
***************
*** 225,231 ****
      longer = y, shorter = x;
    if ( r == NULL )
      r = new_Fix(longer->len);
!   for ( int i=r->siz-1; i >= longer->siz; i-- )
      r->s[i] = 0;
    for ( ; i >= shorter->siz; i-- )
      r->s[i] = longer->s[i];
--- 225,232 ----
      longer = y, shorter = x;
    if ( r == NULL )
      r = new_Fix(longer->len);
!   int i;
!   for ( i=r->siz-1; i >= longer->siz; i-- )
      r->s[i] = 0;
    for ( ; i >= shorter->siz; i-- )
      r->s[i] = longer->s[i];
***************
*** 251,257 ****
      longer = y, shorter = x;
    if ( r == NULL )
      r = new_Fix(longer->len);
!   for ( int i=r->siz-1; i >= longer->siz; i-- )
      r->s[i] = 0;
    for ( ; i >= shorter->siz; i-- )
      r->s[i] = (longer == x ? x->s[i] : -y->s[i]);
--- 252,259 ----
      longer = y, shorter = x;
    if ( r == NULL )
      r = new_Fix(longer->len);
!   int i;
!   for ( i=r->siz-1; i >= longer->siz; i-- )
      r->s[i] = 0;
    for ( ; i >= shorter->siz; i-- )
      r->s[i] = (longer == x ? x->s[i] : -y->s[i]);
***************
*** 279,285 ****
      x = negate(x,X.rep);
    if ( ysign )
      y = negate(y,Y.rep);
!   for ( int i=0; i < r->siz; i++ )
      r->s[i] = 0;
    for ( i=x->siz-1; i >= 0; i-- )
    {
--- 281,288 ----
      x = negate(x,X.rep);
    if ( ysign )
      y = negate(y,Y.rep);
!   int i;
!   for ( i=0; i < r->siz; i++ )
      r->s[i] = 0;
    for ( i=x->siz-1; i >= 0; i-- )
    {
***************
*** 310,316 ****
      (*Fix_range_error_handler)("multiply by int -- int too large");
    if ( r == NULL )
      r = new_Fix(x->len);
!   for ( int i=r->siz-1; i >= x->siz; i-- )
      r->s[i] = 0;
    int32 a, carry = 0;
    for ( ; i > 0; i-- )
--- 313,320 ----
      (*Fix_range_error_handler)("multiply by int -- int too large");
    if ( r == NULL )
      r = new_Fix(x->len);
!   int i;
!   for ( i=r->siz-1; i >= x->siz; i-- )
      r->s[i] = 0;
    int32 a, carry = 0;
    for ( ; i > 0; i-- )
***************
*** 418,424 ****

    int xr = 16 - xl;
    uint16 xrmask = 0xffffL >> xr;
!   for ( int i=0; i < ilow; i++, rs+=u, xsl+=u, xsr+=u )
      *rs = 0;
    for ( ; i < ihigh; i++, rs+=u, xsl+=u, xsr+=u )
      *rs = (*xsl << xl) + ((*xsr >> xr) & xrmask);
--- 422,429 ----

    int xr = 16 - xl;
    uint16 xrmask = 0xffffL >> xr;
!   int i;
!   for ( i=0; i < ilow; i++, rs+=u, xsl+=u, xsr+=u )
      *rs = 0;
    for ( ; i < ihigh; i++, rs+=u, xsl+=u, xsr+=u )
      *rs = (*xsl << xl) + ((*xsr >> xr) & xrmask);
***************
*** 434,440 ****
    if ( r == NULL )
      r = new_Fix(x->len);
    uint32 carry = 1;
!   for ( int i=r->siz-1; i >= x->siz; i-- )
      r->s[i] = 0;
    for ( ; i >= 0; i-- )
    {
--- 439,446 ----
    if ( r == NULL )
      r = new_Fix(x->len);
    uint32 carry = 1;
!   int i;
!   for ( i=r->siz-1; i >= x->siz; i-- )
      r->s[i] = 0;
    for ( ; i >= 0; i-- )
    {
*** old-NetBSD/src/gnu/lib/libg++/libg++/Fix.h
--- NetBSD/src/gnu/lib/libg++/libg++/Fix.h
***************
*** 54,60 ****

  public:
  		  Fix();
!                   Fix(Fix&);
  		  Fix(double);
                    Fix(int);
                    Fix(int, const Fix&);
--- 54,60 ----

  public:
  		  Fix();
!                   Fix(const Fix&);
  		  Fix(double);
                    Fix(int);
                    Fix(int, const Fix&);
***************
*** 199,205 ****
  {
    uint16 *ts = to->s, *fs = from->s;
    int ilim = to->siz < from->siz ? to->siz : from->siz;
!   for ( int i=0; i < ilim; i++ )
      *ts++ = *fs++;
    for ( ; i < to->siz; i++ )
      *ts++ = 0;
--- 199,206 ----
  {
    uint16 *ts = to->s, *fs = from->s;
    int ilim = to->siz < from->siz ? to->siz : from->siz;
!   int i;
!   for ( i=0; i < ilim; i++ )
      *ts++ = *fs++;
    for ( ; i < to->siz; i++ )
      *ts++ = 0;
***************
*** 229,235 ****
    rep = new_Fix(Fix_default_length,d);
  }

! inline Fix::Fix(Fix&  y)
  {
    rep = y.rep; rep->ref++;
  }
--- 230,236 ----
    rep = new_Fix(Fix_default_length,d);
  }

! inline Fix::Fix(const Fix&  y)
  {
    rep = y.rep; rep->ref++;
  }
*** old-NetBSD/src/gnu/lib/libg++/libg++/Fix24.h
--- NetBSD/src/gnu/lib/libg++/libg++/Fix24.h
***************
*** 355,361 ****

  inline Fix24 operator>>(const Fix24& a, int b) 	
  { 
!   return (a.m >> b) & 0xffffff00L; 
  }

  inline  Fix24&  Fix24:: operator+=(const Fix24&  f)
--- 355,361 ----

  inline Fix24 operator>>(const Fix24& a, int b) 	
  { 
!   return (a.m >> b) & (long)0xffffff00L; 
  }

  inline  Fix24&  Fix24:: operator+=(const Fix24&  f)
*** old-NetBSD/src/gnu/lib/libg++/libg++/Integer.cc
--- NetBSD/src/gnu/lib/libg++/libg++/Integer.cc
***************
*** 1882,1888 ****
    long k = 0;
    int l = (ul <= vl)? ul : vl;
    int cont = 1;
!   for (int i = 0;  i < l && cont; ++i)
    {
      unsigned long a =  (i < ul)? u->s[i] : 0;
      unsigned long b =  (i < vl)? v->s[i] : 0;
--- 1882,1889 ----
    long k = 0;
    int l = (ul <= vl)? ul : vl;
    int cont = 1;
!   int i;
!   for (i = 0;  i < l && cont; ++i)
    {
      unsigned long a =  (i < ul)? u->s[i] : 0;
      unsigned long b =  (i < vl)? v->s[i] : 0;
*** old-NetBSD/src/gnu/lib/libg++/libg++/Obstack.cc
--- NetBSD/src/gnu/lib/libg++/libg++/Obstack.cc
***************
*** 85,91 ****

  int Obstack::contains(void* obj) // true if obj somewhere in Obstack
  {
!   for (_obstack_chunk* ch = chunk; 
         ch != 0 && (obj < (void*)ch || obj >= (void*)(ch->limit)); 
         ch = ch->prev);

--- 85,92 ----

  int Obstack::contains(void* obj) // true if obj somewhere in Obstack
  {
!   _obstack_chunk* ch;
!   for (ch = chunk; 
         ch != 0 && (obj < (void*)ch || obj >= (void*)(ch->limit)); 
         ch = ch->prev);

*** old-NetBSD/src/gnu/lib/libg++/libg++/String.cc
--- NetBSD/src/gnu/lib/libg++/libg++/String.cc
***************
*** 965,971 ****
  {
    String sep = separator;
    int xlen = 0;
!   for (int i = 0; i < n; ++i)
      xlen += src[i].length();
    xlen += (n - 1) * sep.length();

--- 965,972 ----
  {
    String sep = separator;
    int xlen = 0;
!   int i;
!   for (i = 0; i < n; ++i)
      xlen += src[i].length();
    xlen += (n - 1) * sep.length();

***************
*** 1117,1123 ****
    const char* topx = &(xchars[x.length()]);
    const char* ys = &(ychars[startpos]);
    const char* topy = &(ychars[y.length()]);
!   for (int l = 0; xs < topx && ys < topy && *xs++ == *ys++; ++l);
    r.rep = Salloc(r.rep, ss, l, l);
  }

--- 1118,1125 ----
    const char* topx = &(xchars[x.length()]);
    const char* ys = &(ychars[startpos]);
    const char* topy = &(ychars[y.length()]);
!   int l;
!   for (l = 0; xs < topx && ys < topy && *xs++ == *ys++; ++l);
    r.rep = Salloc(r.rep, ss, l, l);
  }

***************
*** 1129,1135 ****
    const char* botx = xchars;
    const char* ys = &(ychars[y.length() + startpos]);
    const char* boty = ychars;
!   for (int l = 0; xs >= botx && ys >= boty && *xs == *ys ; --xs, --ys, ++l);
    r.rep = Salloc(r.rep, ++xs, l, l);
  }

--- 1131,1138 ----
    const char* botx = xchars;
    const char* ys = &(ychars[y.length() + startpos]);
    const char* boty = ychars;
!   int l;
!   for (l = 0; xs >= botx && ys >= boty && *xs == *ys ; --xs, --ys, ++l);
    r.rep = Salloc(r.rep, ++xs, l, l);
  }

*** old-NetBSD/src/gnu/lib/libg++/libg++/dtoa.cc
--- NetBSD/src/gnu/lib/libg++/libg++/dtoa.cc
***************
*** 179,185 ****
            if (ch > '5') // properly round: unavoidable propagation
            {
              int carry = 1;
!             for (char* p = f - 1; p >= fwork && carry; --p)
              {
                ++*p;
                if (*p > '9')
--- 179,186 ----
            if (ch > '5') // properly round: unavoidable propagation
            {
              int carry = 1;
! 	    char *p;
!             for (p = f - 1; p >= fwork && carry; --p)
              {
                ++*p;
                if (*p > '9')
***************
*** 313,319 ****
    char* fmtbase = (char *) _libgxx_fmtq.alloc(fmtwidth + pad + 1);
    char* fmt = fmtbase;

!   for (int i = 0; i < pad; ++i) *fmt++ = ' ';

    if (is_neg) *fmt++ = '-';

--- 314,321 ----
    char* fmtbase = (char *) _libgxx_fmtq.alloc(fmtwidth + pad + 1);
    char* fmt = fmtbase;

!   int i;
!   for (i = 0; i < pad; ++i) *fmt++ = ' ';

    if (is_neg) *fmt++ = '-';

*** old-NetBSD/src/gnu/lib/libg++/libg++/error.cc
--- NetBSD/src/gnu/lib/libg++/libg++/error.cc
***************
*** 20,26 ****
  #endif
  #include <builtin.h>

! extern "C" _VOLATILE_VOID abort();

  _VOLATILE_VOID default_one_arg_error_handler(const char* msg)
  {
--- 20,26 ----
  #endif
  #include <builtin.h>

! extern "C" void abort();

  _VOLATILE_VOID default_one_arg_error_handler(const char* msg)
  {
*** old-NetBSD/src/gnu/usr.bin/groff/Makefile.cfg
--- NetBSD/src/gnu/usr.bin/groff/Makefile.cfg
***************
*** 36,46 ****
  		-DHAVE_MKSTEMP=1\
  		-DHAVE_SYS_SIGLIST=1

- # XXX actually, >= 2.7.0 gcc's; for scoping rules changed.
- .if (${MACHINE_ARCH} == "alpha")
- CXXFLAGS+=	-fno-for-scope
- .endif
- 
  .y.cc:
  	$(YACC) $(YFLAGS) $(.IMPSRC)
  	mv y.tab.c $(.PREFIX).cc
--- 36,41 ----
*** /dev/null
--- NetBSD/src/gnu/usr.bin/groff/Makefile.inc
***************
*** 0 ****
--- 1,3 ----
+ #	$NetBSD: Makefile.inc,v 1.1 1995/08/10 09:08:54 niklas Exp $
+ 
+ LINK=		$(CXX)
*** old-NetBSD/src/gnu/usr.bin/groff/addftinfo/addftinfo.cc
--- NetBSD/src/gnu/usr.bin/groff/addftinfo/addftinfo.cc
***************
*** 89,102 ****
    param.comma_depth = DEFAULT_COMMA_DEPTH;
    param.desc_depth = DEFAULT_DESC_DEPTH;
    param.body_depth = DEFAULT_BODY_DEPTH;
!   for (int i = 1; i < argc && argv[i][0] == '-'; i++) {
      if (argv[i][1] == '-' && argv[i][2] == '\0') {
        i++;
        break;
      }
      if (i + 1 >= argc)
        usage();
!     for (int j = 0;; j++) {
        if (j >= sizeof(param_table)/sizeof(param_table[0]))
  	fatal("parameter `%1' not recognized", argv[i] + 1);
        if (strcmp(param_table[j].name, argv[i] + 1) == 0)
--- 89,104 ----
    param.comma_depth = DEFAULT_COMMA_DEPTH;
    param.desc_depth = DEFAULT_DESC_DEPTH;
    param.body_depth = DEFAULT_BODY_DEPTH;
!   int i;
!   for (i = 1; i < argc && argv[i][0] == '-'; i++) {
      if (argv[i][1] == '-' && argv[i][2] == '\0') {
        i++;
        break;
      }
      if (i + 1 >= argc)
        usage();
!     int j;
!     for (j = 0;; j++) {
        if (j >= sizeof(param_table)/sizeof(param_table[0]))
  	fatal("parameter `%1' not recognized", argv[i] + 1);
        if (strcmp(param_table[j].name, argv[i] + 1) == 0)
*** old-NetBSD/src/gnu/usr.bin/groff/eqn/delim.cc
--- NetBSD/src/gnu/usr.bin/groff/eqn/delim.cc
***************
*** 276,282 ****
    printf(".ds " DELIM_STRING "\n");
    delimiter *d = delim_table;
    int delim_len = strlen(delim);
!   for (int i = 0; i < DELIM_TABLE_SIZE; i++, d++)
      if (strncmp(delim, d->name, delim_len) == 0 
  	&& (left_or_right & d->flags) != 0)
        break;
--- 276,283 ----
    printf(".ds " DELIM_STRING "\n");
    delimiter *d = delim_table;
    int delim_len = strlen(delim);
!   int i;
!   for (i = 0; i < DELIM_TABLE_SIZE; i++, d++)
      if (strncmp(delim, d->name, delim_len) == 0 
  	&& (left_or_right & d->flags) != 0)
        break;
*** old-NetBSD/src/gnu/usr.bin/groff/eqn/lex.cc
--- NetBSD/src/gnu/usr.bin/groff/eqn/lex.cc
***************
*** 251,257 ****

  void init_table(const char *device)
  {
!   for (int i = 0; i < sizeof(token_table)/sizeof(token_table[0]); i++) {
      definition *def = new definition;
      def->is_macro = 0;
      def->tok = token_table[i].token;
--- 251,258 ----

  void init_table(const char *device)
  {
!   int i;
!   for (i = 0; i < sizeof(token_table)/sizeof(token_table[0]); i++) {
      definition *def = new definition;
      def->is_macro = 0;
      def->tok = token_table[i].token;
***************
*** 472,478 ****
  					   char **av, input *x)
  : input(x), argc(ac), ap(0)
  {
!   for (int i = 0; i < argc; i++)
      argv[i] = av[i];
    p = s = strsave(body);
    int j = 0;
--- 473,480 ----
  					   char **av, input *x)
  : input(x), argc(ac), ap(0)
  {
!   int i;
!   for (i = 0; i < argc; i++)
      argv[i] = av[i];
    p = s = strsave(body);
    int j = 0;
***************
*** 687,693 ****
  {
    char *argv[9];
    int argc = 0;
!   for (int i = 0; i < 9; i++)
      argv[i] = 0;
    int level = 0;
    int c;
--- 689,696 ----
  {
    char *argv[9];
    int argc = 0;
!   int i;
!   for (i = 0; i < 9; i++)
      argv[i] = 0;
    int level = 0;
    int c;
*** old-NetBSD/src/gnu/usr.bin/groff/eqn/list.cc
--- NetBSD/src/gnu/usr.bin/groff/eqn/list.cc
***************
*** 174,180 ****
  void list_box::compute_sublist_width(int n)
  {
    int total_spacing = 0;
!   for (int i = 1; i < n + 1 && i < list.len; i++)
      total_spacing += compute_spacing(is_script, list.p[i-1]->spacing_type,
  				     list.p[i]->spacing_type);
    printf(".nr " TEMP_REG " %dM", total_spacing);
--- 174,181 ----
  void list_box::compute_sublist_width(int n)
  {
    int total_spacing = 0;
!   int i;
!   for (i = 1; i < n + 1 && i < list.len; i++)
      total_spacing += compute_spacing(is_script, list.p[i-1]->spacing_type,
  				     list.p[i]->spacing_type);
    printf(".nr " TEMP_REG " %dM", total_spacing);
*** old-NetBSD/src/gnu/usr.bin/groff/grodvi/dvi.cc
--- NetBSD/src/gnu/usr.bin/groff/grodvi/dvi.cc
***************
*** 305,311 ****
    if (env->size != cur_point_size || f != cur_font) {
      cur_font = f;
      cur_point_size = env->size;
!     for (int i = 0;; i++) {
        if (i >= FONTS_MAX) {
  	fatal("too many output fonts required");
        }
--- 305,312 ----
    if (env->size != cur_point_size || f != cur_font) {
      cur_font = f;
      cur_point_size = env->size;
!     int i;
!     for (i = 0;; i++) {
        if (i >= FONTS_MAX) {
  	fatal("too many output fonts required");
        }
*** old-NetBSD/src/gnu/usr.bin/groff/groff/groff.cc
--- NetBSD/src/gnu/usr.bin/groff/groff/groff.cc
***************
*** 54,60 ****
  /* defined in <string.h> in NetBSD */
  const char *strsignal(int);
  #endif
! 
  const int SOELIM_INDEX = 0;
  const int REFER_INDEX = SOELIM_INDEX + 1;
  const int PIC_INDEX = REFER_INDEX + 1;
--- 54,60 ----
  /* defined in <string.h> in NetBSD */
  const char *strsignal(int);
  #endif
!   
  const int SOELIM_INDEX = 0;
  const int REFER_INDEX = SOELIM_INDEX + 1;
  const int PIC_INDEX = REFER_INDEX + 1;
***************
*** 284,290 ****
    commands[TROFF_INDEX].append_arg("-T", device);
    commands[EQN_INDEX].append_arg("-T", device);

!   for (int first_index = 0; first_index < TROFF_INDEX; first_index++)
      if (commands[first_index].get_name() != 0)
        break;
    if (optind < argc) {
--- 284,291 ----
    commands[TROFF_INDEX].append_arg("-T", device);
    commands[EQN_INDEX].append_arg("-T", device);

!   int first_index;
!   for (first_index = 0; first_index < TROFF_INDEX; first_index++)
      if (commands[first_index].get_name() != 0)
        break;
    if (optind < argc) {
***************
*** 352,358 ****

  void print_commands()
  {
!   for (int last = SPOOL_INDEX; last >= 0; last--)
      if (commands[last].get_name() != 0)
        break;
    for (int i = 0; i <= last; i++)
--- 353,360 ----

  void print_commands()
  {
!   int last;
!   for (last = SPOOL_INDEX; last >= 0; last--)
      if (commands[last].get_name() != 0)
        break;
    for (int i = 0; i <= last; i++)
***************
*** 466,472 ****
    str += ' ';
    int needs_quoting = 0;
    int contains_single_quote = 0;
!   for (const char *p = arg; *p != '\0'; p++)
      switch (*p) {
      case ';':
      case '&':
--- 468,475 ----
    str += ' ';
    int needs_quoting = 0;
    int contains_single_quote = 0;
!   const char *p;
!   for (p = arg; *p != '\0'; p++)
      switch (*p) {
      case ';':
      case '&':
*** old-NetBSD/src/gnu/usr.bin/groff/grops/ps.cc
--- NetBSD/src/gnu/usr.bin/groff/grops/ps.cc
***************
*** 172,178 ****
  ps_output &ps_output::put_string(const char *s, int n)
  {
    int len = 0;
!   for (int i = 0; i < n; i++) {
      char c = s[i];
      if (isascii(c) && isprint(c)) {
        if (c == '(' || c == ')' || c == '\\')
--- 172,179 ----
  ps_output &ps_output::put_string(const char *s, int n)
  {
    int len = 0;
!   int i;
!   for (i = 0; i < n; i++) {
      char c = s[i];
      if (isascii(c) && isprint(c)) {
        if (c == '(' || c == ')' || c == '\\')
***************
*** 646,652 ****
  void ps_printer::define_encoding(const char *encoding, int encoding_index)
  {
    char *vec[256];
!   for (int i = 0; i < 256; i++)
      vec[i] = 0;
    char *path;
    FILE *fp = font::open_file(encoding, &path);
--- 647,654 ----
  void ps_printer::define_encoding(const char *encoding, int encoding_index)
  {
    char *vec[256];
!   int i;
!   for (i = 0; i < 256; i++)
      vec[i] = 0;
    char *path;
    FILE *fp = font::open_file(encoding, &path);
***************
*** 1193,1199 ****
      "invis", &ps_printer::do_invis,
      "endinvis", &ps_printer::do_endinvis,
    };
!   for (char *p = arg; *p == ' ' || *p == '\n'; p++)
      ;
    char *tag = p;
    for (; *p != '\0' && *p != ':' && *p != ' ' && *p != '\n'; p++)
--- 1195,1202 ----
      "invis", &ps_printer::do_invis,
      "endinvis", &ps_printer::do_endinvis,
    };
!   char *p;
!   for (p = arg; *p == ' ' || *p == '\n'; p++)
      ;
    char *tag = p;
    for (; *p != '\0' && *p != ':' && *p != ' ' && *p != '\n'; p++)
***************
*** 1340,1346 ****
    flush_sbuf();
    while (*arg == ' ' || *arg == '\n')
      arg++;
!   for (char *p = arg; *p != '\0' && *p != ' ' && *p != '\n'; p++)
      ;
    if (*p != '\0')
      *p++ = '\0';
--- 1343,1350 ----
    flush_sbuf();
    while (*arg == ' ' || *arg == '\n')
      arg++;
!   char *p;
!   for (p = arg; *p != '\0' && *p != ' ' && *p != '\n'; p++)
      ;
    if (*p != '\0')
      *p++ = '\0';
*** old-NetBSD/src/gnu/usr.bin/groff/grops/psrm.cc
--- NetBSD/src/gnu/usr.bin/groff/grops/psrm.cc
***************
*** 121,127 ****
  					    string &version,
  					    unsigned revision)
  {
!   for (resource *r = resource_list; r; r = r->next)
      if (r->type == type
  	&& r->name == name
  	&& r->version == version
--- 121,128 ----
  					    string &version,
  					    unsigned revision)
  {
!   resource *r;
!   for (r = resource_list; r; r = r->next)
      if (r->type == type
  	&& r->name == name
  	&& r->version == version
***************
*** 137,143 ****

  resource *resource_manager::lookup_font(const char *name)
  {
!   for (resource *r = resource_list; r; r = r->next)
      if (r->type == RESOURCE_FONT
  	&& strlen(name) == r->name.length()
  	&& memcmp(name, r->name.contents(), r->name.length()) == 0)
--- 138,145 ----

  resource *resource_manager::lookup_font(const char *name)
  {
!   resource *r;
!   for (r = resource_list; r; r = r->next)
      if (r->type == RESOURCE_FONT
  	&& strlen(name) == r->name.length()
  	&& memcmp(name, r->name.contents(), r->name.length()) == 0)
***************
*** 159,172 ****
  void resource_manager::document_setup(ps_output &out)
  {
    int nranks = 0;
!   for (resource *r = resource_list; r; r = r->next)
      if (r->rank >= nranks)
        nranks = r->rank + 1;
    if (nranks > 0) {
      // Sort resource_list in reverse order of rank.
      Presource *head = new Presource[nranks + 1];
      Presource **tail = new Presource *[nranks + 1];
!     for (int i = 0; i < nranks + 1; i++) {
        head[i] = 0;
        tail[i] = &head[i];
      }
--- 161,176 ----
  void resource_manager::document_setup(ps_output &out)
  {
    int nranks = 0;
!   resource *r;
!   for (r = resource_list; r; r = r->next)
      if (r->rank >= nranks)
        nranks = r->rank + 1;
    if (nranks > 0) {
      // Sort resource_list in reverse order of rank.
      Presource *head = new Presource[nranks + 1];
      Presource **tail = new Presource *[nranks + 1];
!     int i;
!     for (i = 0; i < nranks + 1; i++) {
        head[i] = 0;
        tail[i] = &head[i];
      }
***************
*** 510,516 ****
      error("missing resource type");
      return 0;
    }
!   for (int ri = 0; ri < NRESOURCES; ri++)
      if (strlen(resource_table[ri]) == *ptr - name
  	&& memcmp(resource_table[ri], name, *ptr - name) == 0)
        break;
--- 514,521 ----
      error("missing resource type");
      return 0;
    }
!   int ri;
!   for (ri = 0; ri < NRESOURCES; ri++)
      if (strlen(resource_table[ri]) == *ptr - name
  	&& memcmp(resource_table[ri], name, *ptr - name) == 0)
        break;
***************
*** 833,839 ****
      do {
        ++ptr;
      } while (*ptr != '\0' && !white_space(*ptr));
!     for (int i = 0; i < NEXTENSIONS; i++)
        if (strlen(extension_table[i]) == ptr - name
  	  && memcmp(extension_table[i], name, ptr - name) == 0) {
  	flags |= (1 << i);
--- 838,845 ----
      do {
        ++ptr;
      } while (*ptr != '\0' && !white_space(*ptr));
!     int i;
!     for (i = 0; i < NEXTENSIONS; i++)
        if (strlen(extension_table[i]) == ptr - name
  	  && memcmp(extension_table[i], name, ptr - name) == 0) {
  	flags |= (1 << i);
***************
*** 932,938 ****
        if (buf[0] == '%') {
  	if (buf[1] == '%') {
  	  const char *ptr;
! 	  for (int i = 0; i < NCOMMENTS; i++)
  	    if (ptr = matches_comment(buf, comment_table[i].name)) {
  	      copy_this_line
  		= (this->*(comment_table[i].proc))(ptr, rank, fp, outfp);
--- 938,945 ----
        if (buf[0] == '%') {
  	if (buf[1] == '%') {
  	  const char *ptr;
! 	  int i;
! 	  for (i = 0; i < NCOMMENTS; i++)
  	    if (ptr = matches_comment(buf, comment_table[i].name)) {
  	      copy_this_line
  		= (this->*(comment_table[i].proc))(ptr, rank, fp, outfp);
***************
*** 1028,1034 ****
      return;
    }
    int level = 0;
!   for (int i = 0; i < len; i++)
      if (str[i] == '(')
        level++;
      else if (str[i] == ')' && --level < 0)
--- 1035,1042 ----
      return;
    }
    int level = 0;
!   int i;
!   for (i = 0; i < len; i++)
      if (str[i] == '(')
        level++;
      else if (str[i] == ')' && --level < 0)
*** old-NetBSD/src/gnu/usr.bin/groff/grotty/tty.cc
--- NetBSD/src/gnu/usr.bin/groff/grotty/tty.cc
***************
*** 218,224 ****
    // characters before normal characters at each hpos, and otherwise
    // in order of occurrence.

!   for (glyph **pp = lines + (vpos - 1); *pp; pp = &(*pp)->next)
      if (int((*pp)->hpos) < hpos
  	|| ((*pp)->hpos == hpos && (*pp)->draw_mode() >= g->draw_mode()))
        break;
--- 218,225 ----
    // characters before normal characters at each hpos, and otherwise
    // in order of occurrence.

!   glyph **pp;
!   for (pp = lines + (vpos - 1); *pp; pp = &(*pp)->next)
      if (int((*pp)->hpos) < hpos
  	|| ((*pp)->hpos == hpos && (*pp)->draw_mode() >= g->draw_mode()))
        break;
***************
*** 270,276 ****
    if (page_length % font::vert != 0)
      error("vertical position at end of page not multiple of vertical resolution");
    int lines_per_page = page_length / font::vert;
!   for (int last_line = nlines; last_line > 0; last_line--)
      if (lines[last_line - 1])
        break;
  #if 0
--- 271,278 ----
    if (page_length % font::vert != 0)
      error("vertical position at end of page not multiple of vertical resolution");
    int lines_per_page = page_length / font::vert;
!   int last_line;
!   for (last_line = nlines; last_line > 0; last_line--)
      if (lines[last_line - 1])
        break;
  #if 0
*** old-NetBSD/src/gnu/usr.bin/groff/include/ptable.h
--- NetBSD/src/gnu/usr.bin/groff/include/ptable.h
***************
*** 96,102 ****
  {									      \
    assert(key != 0);							      \
    unsigned long h = hash_string(key);					      \
!   for (unsigned n = unsigned(h % size);					      \
         v[n].key != 0;							      \
         n = (n == 0 ? size - 1 : n - 1))					      \
      if (strcmp(v[n].key, key) == 0) {					      \
--- 96,103 ----
  {									      \
    assert(key != 0);							      \
    unsigned long h = hash_string(key);					      \
!   unsigned n;                                                                 \
!   for (n = unsigned(h % size);					              \
         v[n].key != 0;							      \
         n = (n == 0 ? size - 1 : n - 1))					      \
      if (strcmp(v[n].key, key) == 0) {					      \
***************
*** 116,122 ****
  	if (oldv[i].val == 0)						      \
  	  a_delete oldv[i].key;						      \
  	else {								      \
! 	  for (unsigned j = unsigned(hash_string(oldv[i].key) % size);	      \
  	       v[j].key != 0;						      \
  	       j = (j == 0 ? size - 1 : j - 1))				      \
  		 ;							      \
--- 117,124 ----
  	if (oldv[i].val == 0)						      \
  	  a_delete oldv[i].key;						      \
  	else {								      \
! 	  unsigned j;						              \
! 	  for (j = unsigned(hash_string(oldv[i].key) % size);	              \
  	       v[j].key != 0;						      \
  	       j = (j == 0 ? size - 1 : j - 1))				      \
  		 ;							      \
*** old-NetBSD/src/gnu/usr.bin/groff/indxbib/indxbib.cc
--- NetBSD/src/gnu/usr.bin/groff/indxbib/indxbib.cc
***************
*** 242,248 ****
      string path;
      int lineno = 1;
      for (;;) {
!       for (int c = getc(fp); c != '\n' && c != EOF; c = getc(fp)) {
  	if (c == '\0')
  	  error_with_file_and_line(foption, lineno,
  				   "nul character in pathname ignored");
--- 242,249 ----
      string path;
      int lineno = 1;
      for (;;) {
!       int c;
!       for (c = getc(fp); c != '\n' && c != EOF; c = getc(fp)) {
  	if (c == '\0')
  	  error_with_file_and_line(foption, lineno,
  				   "nul character in pathname ignored");
*** old-NetBSD/src/gnu/usr.bin/groff/libbib/index.cc
--- NetBSD/src/gnu/usr.bin/groff/libbib/index.cc
***************
*** 506,512 ****
      return first_list;
    if (*second_list < 0)
      return second_list;
!   for (const int *p = first_list; *p >= 0; p++)
      ;
    int len = p - first_list;
    for (p = second_list; *p >= 0; p++)
--- 506,513 ----
      return first_list;
    if (*second_list < 0)
      return second_list;
!   const int *p;
!   for (p = first_list; *p >= 0; p++)
      ;
    int len = p - first_list;
    for (p = second_list; *p >= 0; p++)
***************
*** 586,592 ****
  void index_search_item::add_out_of_date_file(int fd, const char *filename,
  					     int fid)
  {
!   for (search_item **pp = &out_of_date_files; *pp; pp = &(*pp)->next)
      if ((*pp)->is_named(filename))
        return;
    *pp = make_linear_search_item(fd, filename, fid);
--- 587,594 ----
  void index_search_item::add_out_of_date_file(int fd, const char *filename,
  					     int fid)
  {
!   search_item **pp;
!   for (pp = &out_of_date_files; *pp; pp = &(*pp)->next)
      if ((*pp)->is_named(filename))
        return;
    *pp = make_linear_search_item(fd, filename, fid);
*** old-NetBSD/src/gnu/usr.bin/groff/libbib/linear.cc
--- NetBSD/src/gnu/usr.bin/groff/libbib/linear.cc
***************
*** 58,64 ****

  map_init::map_init()
  {
!   for (int i = 0; i < 256; i++)
      map[i] = csalnum(i) ? cmlower(i) : '\0';
    for (i = 0; i < 256; i++) {
      if (cslower(i)) {
--- 58,65 ----

  map_init::map_init()
  {
!   int i;
!   for (i = 0; i < 256; i++)
      map[i] = csalnum(i) ? cmlower(i) : '\0';
    for (i = 0; i < 256; i++) {
      if (cslower(i)) {
***************
*** 175,181 ****
      if (*p++ == '\n') {
        if (p == end || *p == '%')
  	break;
!       for (const char *q = p; *q == ' ' || *q == '\t'; q++)
  	;
        if (*q == '\n')
  	break;
--- 176,183 ----
      if (*p++ == '\n') {
        if (p == end || *p == '%')
  	break;
!       const char *q;
!       for (q = p; *q == ' ' || *q == '\t'; q++)
  	;
        if (*q == '\n')
  	break;
***************
*** 190,196 ****
      if (*p++ == '\n') {
        if (p == bufend)
  	break;
!       for (const char *q = p; *q == ' ' || *q == '\t'; q++)
  	;
        if (*q == '\n')
  	break;
--- 192,199 ----
      if (*p++ == '\n') {
        if (p == bufend)
  	break;
!       const char *q;
!       for (q = p; *q == ' ' || *q == '\t'; q++)
  	;
        if (*q == '\n')
  	break;
***************
*** 262,268 ****
  	  *start = p + 1;
  	return 1;
        }
!       for (const char *q = p - 1; *q == ' ' || *q == '\t'; q--)
  	;
        if (*q == '\n') {
  	if (start)
--- 265,272 ----
  	  *start = p + 1;
  	return 1;
        }
!       const char *q;
!       for (q = p - 1; *q == ' ' || *q == '\t'; q--)
  	;
        if (*q == '\n') {
  	if (start)
***************
*** 392,398 ****
      if (!found)
        break;
      const char *refend = find_end(bufend, found + keys[0]->length());
!     for (int i = 1; i < nkeys; i++)
        if (!search_and_check(keys[i], refstart, refend))
  	break;
      if (i >= nkeys) {
--- 396,403 ----
      if (!found)
        break;
      const char *refend = find_end(bufend, found + keys[0]->length());
!     int i;
!     for (i = 1; i < nkeys; i++)
        if (!search_and_check(keys[i], refstart, refend))
  	break;
      if (i >= nkeys) {
*** old-NetBSD/src/gnu/usr.bin/groff/libbib/search.cc
--- NetBSD/src/gnu/usr.bin/groff/libbib/search.cc
***************
*** 62,68 ****
        p = make_linear_search_item(fd, filename, next_fid);
    }
    if (p) {
!     for (search_item **pp = &list; *pp; pp = &(*pp)->next)
        ;
      *pp = p;
      next_fid = p->next_filename_id();
--- 62,69 ----
        p = make_linear_search_item(fd, filename, next_fid);
    }
    if (p) {
!     search_item **pp;
!     for (pp = &list; *pp; pp = &(*pp)->next)
        ;
      *pp = p;
      next_fid = p->next_filename_id();
*** old-NetBSD/src/gnu/usr.bin/groff/libdriver/input.cc
--- NetBSD/src/gnu/usr.bin/groff/libdriver/input.cc
***************
*** 268,274 ****
  	int n;
  	int *p = 0;
  	int szp = 0;
! 	for (int np = 0; possibly_get_integer(&n); np++) {
  	  if (np >= szp) {
  	    if (szp == 0) {
  	      szp = 16;
--- 268,275 ----
  	int n;
  	int *p = 0;
  	int szp = 0;
! 	int np;
! 	for (np = 0; possibly_get_integer(&n); np++) {
  	  if (np >= szp) {
  	    if (szp == 0) {
  	      szp = 16;
***************
*** 290,296 ****
  	    env.hpos += p[0];
  	}
  	else { 
! 	  for (int i = 0; i < np/2; i++) {
  	    env.hpos += p[i*2];
  	    env.vpos += p[i*2 + 1];
  	  }
--- 291,298 ----
  	    env.hpos += p[0];
  	}
  	else { 
! 	  int i;
! 	  for (i = 0; i < np/2; i++) {
  	    env.hpos += p[i*2];
  	    env.vpos += p[i*2 + 1];
  	  }
*** old-NetBSD/src/gnu/usr.bin/groff/libdriver/printer.cc
--- NetBSD/src/gnu/usr.bin/groff/libdriver/printer.cc
***************
*** 64,70 ****
        if (n >= nfonts)
  	nfonts = n + 1;
        font_table = new font *[nfonts];
!       for (int i = 0; i < old_nfonts; i++)
  	font_table[i] = old_font_table[i];
        for (i = old_nfonts; i < nfonts; i++)
  	font_table[i] = 0;
--- 64,71 ----
        if (n >= nfonts)
  	nfonts = n + 1;
        font_table = new font *[nfonts];
!       int i;
!       for (i = 0; i < old_nfonts; i++)
  	font_table[i] = old_font_table[i];
        for (i = old_nfonts; i < nfonts; i++)
  	font_table[i] = 0;
*** old-NetBSD/src/gnu/usr.bin/groff/libgroff/font.cc
--- NetBSD/src/gnu/usr.bin/groff/libgroff/font.cc
***************
*** 246,252 ****
    if (!widths_cache)
      widths_cache = new font_widths_cache(point_size, ch_size);
    else if (widths_cache->point_size != point_size) {
!     for (font_widths_cache **p = &widths_cache; *p; p = &(*p)->next)
        if ((*p)->point_size == point_size)
  	break;
      if (*p) {
--- 246,253 ----
    if (!widths_cache)
      widths_cache = new font_widths_cache(point_size, ch_size);
    else if (widths_cache->point_size != point_size) {
!     font_widths_cache **p;
!     for (p = &widths_cache; *p; p = &(*p)->next)
        if ((*p)->point_size == point_size)
  	break;
      if (*p) {
***************
*** 398,404 ****

  void font::compact()
  {
!   for (int i = nindices - 1; i >= 0; i--)
      if (ch_index[i] >= 0)
        break;
    i++;
--- 399,406 ----

  void font::compact()
  {
!   int i;
!   for (i = nindices - 1; i >= 0; i--)
      if (ch_index[i] >= 0)
        break;
    i++;
***************
*** 728,734 ****
    while (t.next()) {
      char *p = strtok(t.buf, WS);
      int found = 0;
!     for (int i = 0; !found && i < sizeof(table)/sizeof(table[0]); i++)
        if (strcmp(table[i].command, p) == 0)
  	found = 1;
      if (found) {
--- 730,737 ----
    while (t.next()) {
      char *p = strtok(t.buf, WS);
      int found = 0;
!     int i;
!     for (i = 0; !found && i < sizeof(table)/sizeof(table[0]); i++)
        if (strcmp(table[i].command, p) == 0)
  	found = 1;
      if (found) {
***************
*** 830,836 ****
      else if (strcmp("styles", p) == 0) {
        int style_table_size = 5;
        style_table = (const char **)new char *[style_table_size];
!       for (int j = 0; j < style_table_size; j++)
  	style_table[j] = 0;
        int i = 0;
        for (;;) {
--- 833,840 ----
      else if (strcmp("styles", p) == 0) {
        int style_table_size = 5;
        style_table = (const char **)new char *[style_table_size];
!       int j;
!       for (j = 0; j < style_table_size; j++)
  	style_table[j] = 0;
        int i = 0;
        for (;;) {
*** old-NetBSD/src/gnu/usr.bin/groff/libgroff/lf.cc
--- NetBSD/src/gnu/usr.bin/groff/libgroff/lf.cc
***************
*** 45,51 ****
      change_lineno(ln);
      return 1;
    }
!   for (const char *q = p;
         *q != '\0' && *q != ' ' && *q != '\n' && *q != '\\';
         q++)
      ;
--- 45,52 ----
      change_lineno(ln);
      return 1;
    }
!   const char *q;
!   for (q = p;
         *q != '\0' && *q != ' ' && *q != '\n' && *q != '\\';
         q++)
      ;
*** old-NetBSD/src/gnu/usr.bin/groff/libgroff/nametoindex.cc
--- NetBSD/src/gnu/usr.bin/groff/libgroff/nametoindex.cc
***************
*** 51,57 ****
  character_indexer::character_indexer()
  : next_index(0)
  {
!   for (int i = 0; i < 256; i++)
      ascii_index[i] = -1;
    for (i = 0; i < NSMALL; i++)
      small_number_index[i] = -1;
--- 51,58 ----
  character_indexer::character_indexer()
  : next_index(0)
  {
!   int i;
!   for (i = 0; i < 256; i++)
      ascii_index[i] = -1;
    for (i = 0; i < NSMALL; i++)
      small_number_index[i] = -1;
*** old-NetBSD/src/gnu/usr.bin/groff/libgroff/ptable.cc
--- NetBSD/src/gnu/usr.bin/groff/libgroff/ptable.cc
***************
*** 44,50 ****

  unsigned next_ptable_size(unsigned n)
  {
!   for (const unsigned *p = table_sizes; *p <= n; p++)
      if (*p == 0)
        fatal("cannot expand table");
    return *p;
--- 44,51 ----

  unsigned next_ptable_size(unsigned n)
  {
!   const unsigned *p;
!   for (p = table_sizes; *p <= n; p++)
      if (*p == 0)
        fatal("cannot expand table");
    return *p;
*** old-NetBSD/src/gnu/usr.bin/groff/libgroff/string.cc
--- NetBSD/src/gnu/usr.bin/groff/libgroff/string.cc
***************
*** 281,287 ****
    char *p = ptr;
    int n = len;
    int nnuls = 0;
!   for (int i = 0; i < n; i++)
      if (p[i] == '\0')
        nnuls++;
    char *q = new char[n + 1 - nnuls];
--- 281,288 ----
    char *p = ptr;
    int n = len;
    int nnuls = 0;
!   int i;
!   for (i = 0; i < n; i++)
      if (p[i] == '\0')
        nnuls++;
    char *q = new char[n + 1 - nnuls];
*** old-NetBSD/src/gnu/usr.bin/groff/lkbib/lkbib.cc
--- NetBSD/src/gnu/usr.bin/groff/lkbib/lkbib.cc
***************
*** 96,102 ****
    if (list.nfiles() == 0)
      fatal("no databases");
    int total_len = 0;
!   for (int i = optind; i < argc; i++)
      total_len += strlen(argv[i]);
    total_len += argc - optind - 1 + 1; // for spaces and '\0'
    char *buffer = new char[total_len];
--- 96,103 ----
    if (list.nfiles() == 0)
      fatal("no databases");
    int total_len = 0;
!   int i;
!   for (i = optind; i < argc; i++)
      total_len += strlen(argv[i]);
    total_len += argc - optind - 1 + 1; // for spaces and '\0'
    char *buffer = new char[total_len];
***************
*** 110,116 ****
    search_list_iterator iter(&list, buffer);
    const char *start;
    int len;
!   for (int count = 0; iter.next(&start, &len); count++) {
      if (fwrite(start, 1, len, stdout) != len)
        fatal("write error on stdout: %1", strerror(errno));
      // Can happen for last reference in file.
--- 111,118 ----
    search_list_iterator iter(&list, buffer);
    const char *start;
    int len;
!   int count;
!   for (count = 0; iter.next(&start, &len); count++) {
      if (fwrite(start, 1, len, stdout) != len)
        fatal("write error on stdout: %1", strerror(errno));
      // Can happen for last reference in file.
*** old-NetBSD/src/gnu/usr.bin/groff/lookbib/lookbib.cc
--- NetBSD/src/gnu/usr.bin/groff/lookbib/lookbib.cc
***************
*** 106,112 ****
      search_list_iterator iter(&list, line);
      const char *start;
      int len;
!     for (int count = 0; iter.next(&start, &len); count++) {
        if (fwrite(start, 1, len, stdout) != len)
  	fatal("write error on stdout: %1", strerror(errno));
        // Can happen for last reference in file.
--- 106,113 ----
      search_list_iterator iter(&list, line);
      const char *start;
      int len;
!     int count;
!     for (count = 0; iter.next(&start, &len); count++) {
        if (fwrite(start, 1, len, stdout) != len)
  	fatal("write error on stdout: %1", strerror(errno));
        // Can happen for last reference in file.
*** old-NetBSD/src/gnu/usr.bin/groff/pic/lex.cc
--- NetBSD/src/gnu/usr.bin/groff/pic/lex.cc
***************
*** 361,367 ****
  {
    char *argv[9];
    int argc = 0;
!   for (int i = 0; i < 9; i++)
      argv[i] = 0;
    int level = 0;
    int c;
--- 361,368 ----
  {
    char *argv[9];
    int argc = 0;
!   int i;
!   for (i = 0; i < 9; i++)
      argv[i] = 0;
    int level = 0;
    int c;
*** old-NetBSD/src/gnu/usr.bin/groff/pic/object.cc
--- NetBSD/src/gnu/usr.bin/groff/pic/object.cc
***************
*** 512,518 ****

  void object_list::wrap_up_block(object_list *ol)
  {
!   for (object *p = tail; p && p->type() != MARK_OBJECT; p = p->prev)
      ;
    assert(p != 0);
    ol->head = p->next;
--- 512,519 ----

  void object_list::wrap_up_block(object_list *ol)
  {
!   object *p;
!   for (p = tail; p && p->type() != MARK_OBJECT; p = p->prev)
      ;
    assert(p != 0);
    ol->head = p->next;
***************
*** 595,601 ****
  {
    aligned = a;
    int len = 0;
!   for (text_item *p = t; p; p = p->next)
      len++;
    if (len == 0)
      text = 0;
--- 596,603 ----
  {
    aligned = a;
    int len = 0;
!   text_item *p;
!   for (p = t; p; p = p->next)
      len++;
    if (len == 0)
      text = 0;
***************
*** 1341,1347 ****
    // Absolutise all movements
    position endpos = startpos;
    int nsegments = 0;
!   for (segment *s = segment_list; s; s = s->next, nsegments++)
      if (s->is_absolute)
        endpos = s->pos;
      else {
--- 1343,1350 ----
    // Absolutise all movements
    position endpos = startpos;
    int nsegments = 0;
!   segment *s;
!   for (s = segment_list; s; s = s->next, nsegments++)
      if (s->is_absolute)
        endpos = s->pos;
      else {
***************
*** 1767,1773 ****

  void path::append(char *s)
  {
!   for (string_list **p = &label_list; *p; p = &(*p)->next)
      ;
    *p = new string_list(s);
  }
--- 1770,1777 ----

  void path::append(char *s)
  {
!   string_list **p;
!   for (p = &label_list; *p; p = &(*p)->next)
      ;
    *p = new string_list(s);
  }
*** old-NetBSD/src/gnu/usr.bin/groff/pic/pic.y
--- NetBSD/src/gnu/usr.bin/groff/pic/pic.y
***************
*** 940,946 ****
  	| object_spec text   %prec TEXT
  		{
  		  $$ = $1;
! 		  for (text_item **p = & $$->text; *p; p = &(*p)->next)
  		    ;
  		  *p = new text_item($2.str, $2.filename, $2.lineno);
  		}
--- 940,947 ----
  	| object_spec text   %prec TEXT
  		{
  		  $$ = $1;
! 		  text_item **p;
! 		  for (p = & $$->text; *p; p = &(*p)->next)
  		    ;
  		  *p = new text_item($2.str, $2.filename, $2.lineno);
  		}
***************
*** 948,954 ****
  		{
  		  $$ = $1;
  		  if ($$->text) {
! 		    for (text_item *p = $$->text; p->next; p = p->next)
  		      ;
  		    p->adj.h = LEFT_ADJUST;
  		  }
--- 949,956 ----
  		{
  		  $$ = $1;
  		  if ($$->text) {
! 		    text_item *p;
! 		    for (p = $$->text; p->next; p = p->next)
  		      ;
  		    p->adj.h = LEFT_ADJUST;
  		  }
***************
*** 957,963 ****
  		{
  		  $$ = $1;
  		  if ($$->text) {
! 		    for (text_item *p = $$->text; p->next; p = p->next)
  		      ;
  		    p->adj.h = RIGHT_ADJUST;
  		  }
--- 959,966 ----
  		{
  		  $$ = $1;
  		  if ($$->text) {
! 		    text_item *p;
! 		    for (p = $$->text; p->next; p = p->next)
  		      ;
  		    p->adj.h = RIGHT_ADJUST;
  		  }
***************
*** 966,972 ****
  		{
  		  $$ = $1;
  		  if ($$->text) {
! 		    for (text_item *p = $$->text; p->next; p = p->next)
  		      ;
  		    p->adj.v = ABOVE_ADJUST;
  		  }
--- 969,976 ----
  		{
  		  $$ = $1;
  		  if ($$->text) {
! 		    text_item *p;
! 		    for (p = $$->text; p->next; p = p->next)
  		      ;
  		    p->adj.v = ABOVE_ADJUST;
  		  }
***************
*** 975,981 ****
  		{
  		  $$ = $1;
  		  if ($$->text) {
! 		    for (text_item *p = $$->text; p->next; p = p->next)
  		      ;
  		    p->adj.v = BELOW_ADJUST;
  		  }
--- 979,986 ----
  		{
  		  $$ = $1;
  		  if ($$->text) {
! 		    text_item *p;
! 		    for (p = $$->text; p->next; p = p->next)
  		      ;
  		    p->adj.v = BELOW_ADJUST;
  		  }
***************
*** 1162,1168 ****
  	ordinal object_type
  		{
  		  int count = 0;
! 		  for (object *p = olist.head; p != 0; p = p->next)
  		    if (p->type() == $2 && ++count == $1) {
  		      $$ = p;
  		      break;
--- 1167,1174 ----
  	ordinal object_type
  		{
  		  int count = 0;
! 		  object *p;
! 		  for (p = olist.head; p != 0; p = p->next)
  		    if (p->type() == $2 && ++count == $1) {
  		      $$ = p;
  		      break;
***************
*** 1176,1182 ****
  	| optional_ordinal_last object_type
  		{
  		  int count = 0;
! 		  for (object *p = olist.tail; p != 0; p = p->prev)
  		    if (p->type() == $2 && ++count == $1) {
  		      $$ = p;
  		      break;
--- 1182,1189 ----
  	| optional_ordinal_last object_type
  		{
  		  int count = 0;
! 		  object *p;
! 		  for (p = olist.tail; p != 0; p = p->prev)
  		    if (p->type() == $2 && ++count == $1) {
  		      $$ = p;
  		      break;
*** old-NetBSD/src/gnu/usr.bin/groff/refer/label.y
--- NetBSD/src/gnu/usr.bin/groff/refer/label.y
***************
*** 872,878 ****
    if (v[0]->get_number() != num + 1
        || v[1]->get_number() != num + 2)
      return 0;
!   for (int i = 2; i < n; i++)
      if (v[i]->get_number() != num + i + 1)
        break;
    result = get_label(type);
--- 872,879 ----
    if (v[0]->get_number() != num + 1
        || v[1]->get_number() != num + 2)
      return 0;
!   int i;
!   for (i = 2; i < n; i++)
      if (v[i]->get_number() != num + i + 1)
        break;
    result = get_label(type);
***************
*** 945,951 ****
        label_table[i] = 0;
    }
    unsigned h = hash_string(label.contents(), label.length()) % label_table_size;
!   for (label_info **ptr = label_table + h;
         *ptr != 0;
         (ptr == label_table)
         ? (ptr = label_table + label_table_size - 1)
--- 946,953 ----
        label_table[i] = 0;
    }
    unsigned h = hash_string(label.contents(), label.length()) % label_table_size;
!   label_info **ptr;
!   for (ptr = label_table + h;
         *ptr != 0;
         (ptr == label_table)
         ? (ptr = label_table + label_table_size - 1)
***************
*** 970,976 ****
        if (old_table[i]) {
  	unsigned h = hash_string(label_pool.contents() + old_table[i]->start,
  				 old_table[i]->length);
! 	for (label_info **p = label_table + (h % label_table_size);
  	     *p != 0;
  	     (p == label_table)
  	     ? (p = label_table + label_table_size - 1)
--- 972,979 ----
        if (old_table[i]) {
  	unsigned h = hash_string(label_pool.contents() + old_table[i]->start,
  				 old_table[i]->length);
! 	label_info **p;
! 	for (p = label_table + (h % label_table_size);
  	     *p != 0;
  	     (p == label_table)
  	     ? (p = label_table + label_table_size - 1)
***************
*** 1165,1171 ****
  {
    if (nauthors < 0) {
      const char *dummy;
!     for (int na = 0; get_author(na, &dummy) != 0; na++)
        ;
      ((reference *)this)->nauthors = na;
    }
--- 1168,1175 ----
  {
    if (nauthors < 0) {
      const char *dummy;
!     int na;
!     for (na = 0; get_author(na, &dummy) != 0; na++)
        ;
      ((reference *)this)->nauthors = na;
    }
*** old-NetBSD/src/gnu/usr.bin/groff/refer/ref.cc
--- NetBSD/src/gnu/usr.bin/groff/refer/ref.cc
***************
*** 54,60 ****
  : no(-1), field(0), nfields(0), h(0), merged(0), label_ptr(0),
    computed_authors(0), last_needed_author(-1), nauthors(-1)
  {
!   for (int i = 0; i < 256; i++)
      field_index[i] = NULL_FIELD_INDEX;
    if (ridp)
      rid = *ridp;
--- 54,61 ----
  : no(-1), field(0), nfields(0), h(0), merged(0), label_ptr(0),
    computed_authors(0), last_needed_author(-1), nauthors(-1)
  {
!   int i;
!   for (i = 0; i < 256; i++)
      field_index[i] = NULL_FIELD_INDEX;
    if (ridp)
      rid = *ridp;
***************
*** 199,205 ****
    string *old_field = field;
    field = new string[nfields + 1];
    int pos = 0;
!   for (int i = 0; i < int(c); i++)
      if (field_index[i] != NULL_FIELD_INDEX)
        pos++;
    for (i = 0; i < pos; i++)
--- 200,207 ----
    string *old_field = field;
    field = new string[nfields + 1];
    int pos = 0;
!   int i;
!   for (i = 0; i < int(c); i++)
      if (field_index[i] != NULL_FIELD_INDEX)
        pos++;
    for (i = 0; i < pos; i++)
***************
*** 222,228 ****
      return;
    string *old_field = field;
    field = new string[nfields - 1];
!   for (int i = 0; i < int(field_index[c]); i++)
      field[i].move(old_field[i]);
    for (i = field_index[c]; i < nfields - 1; i++)
      field[i].move(old_field[i + 1]);
--- 224,231 ----
      return;
    string *old_field = field;
    field = new string[nfields - 1];
!   int i;
!   for (i = 0; i < int(field_index[c]); i++)
      field[i].move(old_field[i]);
    for (i = field_index[c]; i < nfields - 1; i++)
      field[i].move(old_field[i + 1]);
***************
*** 330,336 ****
  	 a < ae;
  	 a = strchr(a, '\0') + 1)
        if (first_word_len == strlen(a)) {
! 	for (int j = 0; j < first_word_len; j++)
  	  if (a[j] != cmlower(s[j]))
  	    break;
  	if (j >= first_word_len) {
--- 333,340 ----
  	 a < ae;
  	 a = strchr(a, '\0') + 1)
        if (first_word_len == strlen(a)) {
! 	int j;
! 	for (j = 0; j < first_word_len; j++)
  	  if (a[j] != cmlower(s[j]))
  	    break;
  	if (j >= first_word_len) {
***************
*** 395,401 ****
  {
    const char *end = s + len;
    for (;;) {
!     for (const char *ptr = s;
  	 ptr < end && *ptr != SORT_SUB_SEP && *ptr != SORT_SUB_SUB_SEP;
  	 ptr++)
        ;
--- 399,406 ----
  {
    const char *end = s + len;
    for (;;) {
!     const char *ptr;
!     for (ptr = s;
  	 ptr < end && *ptr != SORT_SUB_SEP && *ptr != SORT_SUB_SUB_SEP;
  	 ptr++)
        ;
***************
*** 692,698 ****
    const char *ptr = f.contents();
    int len = f.length();
    int nfield_seps = 0;
!   for (int j = 0; j < len; j++)
      if (ptr[j] == FIELD_SEPARATOR)
        nfield_seps++;
    if (nfield_seps == 0)
--- 697,704 ----
    const char *ptr = f.contents();
    int len = f.length();
    int nfield_seps = 0;
!   int j;
!   for (j = 0; j < len; j++)
      if (ptr[j] == FIELD_SEPARATOR)
        nfield_seps++;
    if (nfield_seps == 0)
*** old-NetBSD/src/gnu/usr.bin/groff/refer/refer.cc
--- NetBSD/src/gnu/usr.bin/groff/refer/refer.cc
***************
*** 179,185 ****
  	    num = opt;
  	    opt = 0;
  	  }
! 	  for (const char *ptr = num; *ptr; ptr++)
  	    if (!csdigit(*ptr)) {
  	      error("bad character `%1' in argument to -f option", *ptr);
  	      break;
--- 179,186 ----
  	    num = opt;
  	    opt = 0;
  	  }
! 	  const char *ptr;
! 	  for (ptr = num; *ptr; ptr++)
  	    if (!csdigit(*ptr)) {
  	      error("bad character `%1' in argument to -f option", *ptr);
  	      break;
***************
*** 227,233 ****
  	break;
        case 'a':
  	{
! 	  for (const char *ptr = ++opt; *ptr; ptr++)
  	    if (!csdigit(*ptr)) {
  	      error("argument to `a' option not a number");
  	      break;
--- 228,235 ----
  	break;
        case 'a':
  	{
! 	  const char *ptr;
! 	  for (ptr = ++opt; *ptr; ptr++)
  	    if (!csdigit(*ptr)) {
  	      error("argument to `a' option not a number");
  	      break;
***************
*** 697,703 ****
    reference *ref = make_reference(str, &flags);
    ref->compute_hash_code();
    unsigned h = ref->hash();
!   for (reference **ptr = reference_hash_table + (h % hash_table_size);
         *ptr != 0;
         ((ptr == reference_hash_table)
  	? (ptr = reference_hash_table + hash_table_size - 1)
--- 699,706 ----
    reference *ref = make_reference(str, &flags);
    ref->compute_hash_code();
    unsigned h = ref->hash();
!   reference **ptr;
!   for (ptr = reference_hash_table + (h % hash_table_size);
         *ptr != 0;
         ((ptr == reference_hash_table)
  	? (ptr = reference_hash_table + hash_table_size - 1)
***************
*** 727,733 ****
  	reference_hash_table[i] = 0;
        for (i = 0; i < old_size; i++)
  	if (old_table[i]) {
! 	  for (reference **p = (reference_hash_table
  				+ (old_table[i]->hash() % hash_table_size));
  	       *p;
  	       ((p == reference_hash_table)
--- 730,737 ----
  	reference_hash_table[i] = 0;
        for (i = 0; i < old_size; i++)
  	if (old_table[i]) {
! 	  reference **p;
! 	  for (p = (reference_hash_table
  				+ (old_table[i]->hash() % hash_table_size));
  	       *p;
  	       ((p == reference_hash_table)
***************
*** 785,791 ****
      for (int i = 1; i < n; i++) {
        int num = v[i]->get_number();
        reference *temp = v[i];
!       for (int j = i - 1; j >= 0 && v[j]->get_number() > num; j--)
  	v[j + 1] = v[j];
        v[j + 1] = temp;
      }
--- 789,796 ----
      for (int i = 1; i < n; i++) {
        int num = v[i]->get_number();
        reference *temp = v[i];
!       int j;
!       for (j = i - 1; j >= 0 && v[j]->get_number() > num; j--)
  	v[j + 1] = v[j];
        v[j + 1] = temp;
      }
***************
*** 1213,1219 ****
      16000057, 32000011, 64000031, 128000003, 0 
    };

!   for (const int *p = table_sizes; *p <= n && *p != 0; p++)
      ;
    assert(*p != 0);
    return *p;
--- 1218,1225 ----
      16000057, 32000011, 64000031, 128000003, 0 
    };

!   const int *p;
!   for (p = table_sizes; *p <= n && *p != 0; p++)
      ;
    assert(*p != 0);
    return *p;
*** old-NetBSD/src/gnu/usr.bin/groff/refer/token.cc
--- NetBSD/src/gnu/usr.bin/groff/refer/token.cc
***************
*** 190,196 ****

  static void init_ascii()
  {
!   for (const char *p = "abcdefghijklmnopqrstuvwxyz"; *p; p++) {
      char buf[2];
      buf[0] = *p;
      buf[1] = '\0';
--- 190,197 ----

  static void init_ascii()
  {
!   const char *p;
!   for (p = "abcdefghijklmnopqrstuvwxyz"; *p; p++) {
      char buf[2];
      buf[0] = *p;
      buf[1] = '\0';
***************
*** 296,302 ****

  static void init_special_chars()
  {
!   for (const char *p = "':^`~"; *p; p++)
      for (const char *q = "aeiouy"; *q; q++) {
        // Use a variable to work around bug in gcc 2.0
        char c = cmupper(*q);
--- 297,304 ----

  static void init_special_chars()
  {
!   const char *p;
!   for (p = "':^`~"; *p; p++)
      for (const char *q = "aeiouy"; *q; q++) {
        // Use a variable to work around bug in gcc 2.0
        char c = cmupper(*q);
*** old-NetBSD/src/gnu/usr.bin/groff/tbl/main.cc
--- NetBSD/src/gnu/usr.bin/groff/tbl/main.cc
***************
*** 690,696 ****

  void input_entry_format::debug_print()
  {
!   for (int i = 0; i < pre_vline; i++)
      putc('|', stderr);
    entry_format::debug_print();
    if (!width.empty()) {
--- 690,697 ----

  void input_entry_format::debug_print()
  {
!   int i;
!   for (i = 0; i < pre_vline; i++)
      putc('|', stderr);
    entry_format::debug_print();
    if (!width.empty()) {
***************
*** 1174,1180 ****
  	  format_index = f->nrows - 1;
  	// A format row that is all lines doesn't use up a data line.
  	while (format_index < f->nrows - 1) {
! 	  for (int c = 0; c < ncolumns; c++) {
  	    entry_format *e = f->entry[format_index] + c;
  	    if (e->type != FORMAT_HLINE
  		&& e->type != FORMAT_DOUBLE_HLINE
--- 1175,1182 ----
  	  format_index = f->nrows - 1;
  	// A format row that is all lines doesn't use up a data line.
  	while (format_index < f->nrows - 1) {
! 	  int c;
! 	  for (c = 0; c < ncolumns; c++) {
  	    entry_format *e = f->entry[format_index] + c;
  	    if (e->type != FORMAT_HLINE
  		&& e->type != FORMAT_DOUBLE_HLINE
***************
*** 1393,1399 ****
    }
    // Do this here rather than at the beginning in case continued formats
    // change it.
!   for (int i = 0; i < ncolumns - 1; i++)
      if (f->separation[i] >= 0)
        tbl->set_column_separation(i, f->separation[i]);
    for (i = 0; i < ncolumns; i++)
--- 1395,1402 ----
    }
    // Do this here rather than at the beginning in case continued formats
    // change it.
!   int i;
!   for (i = 0; i < ncolumns - 1; i++)
      if (f->separation[i] >= 0)
        tbl->set_column_separation(i, f->separation[i]);
    for (i = 0; i < ncolumns; i++)
*** old-NetBSD/src/gnu/usr.bin/groff/tbl/table.cc
--- NetBSD/src/gnu/usr.bin/groff/tbl/table.cc
***************
*** 663,669 ****
    prints(".if \\n[" SAVED_FILL_REG "] .fi\n"
  	 ".in 0\n");
    prints(".ll ");
!   for (int i = start_col; i <= end_col; i++)
      if (mw[i].empty())
        break;
    if (i > end_col) {
--- 663,670 ----
    prints(".if \\n[" SAVED_FILL_REG "] .fi\n"
  	 ".in 0\n");
    prints(".ll ");
!   int i;
!   for (i = start_col; i <= end_col; i++)
      if (mw[i].empty())
        break;
    if (i > end_col) {
***************
*** 1274,1280 ****

  void table::add_stuff(stuff *p)
  {
!   for (stuff **pp = &stuff_list; *pp; pp = &(*pp)->next)
      ;
    *pp = p;
  }
--- 1275,1282 ----

  void table::add_stuff(stuff *p)
  {
!   stuff **pp;
!   for (pp = &stuff_list; *pp; pp = &(*pp)->next)
      ;
    *pp = p;
  }
***************
*** 1324,1330 ****
      assert(allocated_rows > r);
      while (nrows <= r) {
        entry[nrows] = new table_entry*[ncolumns];
!       for (int i = 0; i < ncolumns; i++)
  	entry[nrows][i] = 0;
        vline[nrows] = new char[ncolumns+1];
        for (i = 0; i < ncolumns+1; i++)
--- 1326,1333 ----
      assert(allocated_rows > r);
      while (nrows <= r) {
        entry[nrows] = new table_entry*[ncolumns];
!       int i;
!       for (i = 0; i < ncolumns; i++)
  	entry[nrows][i] = 0;
        vline[nrows] = new char[ncolumns+1];
        for (i = 0; i < ncolumns+1; i++)
***************
*** 1590,1596 ****
        e->input_filename = fn;
        e->start_row = e->end_row = r;
        e->start_col = e->end_col = c;
!       for (table_entry **p = &entry_list; *p; p = &(*p)->next)
  	;
        *p = e;
        entry[r][c] = e;
--- 1593,1600 ----
        e->input_filename = fn;
        e->start_row = e->end_row = r;
        e->start_col = e->end_col = c;
!       table_entry **p;
!       for (p = &entry_list; *p; p = &(*p)->next)
  	;
        *p = e;
        entry[r][c] = e;
***************
*** 1924,1930 ****
    printfs(".nr " NEEDED_REG " \\n[%1]-(\\n[%2]", 
  	  span_width_reg(start_col, end_col),
  	  span_width_reg(start_col, start_col));
!   for (int i = start_col + 1; i <= end_col; i++) {
      // The column separation may shrink with the expand option.
      if (!(flags & EXPAND))
        printfs("+%1n", as_string(column_separation[i - 1]));
--- 1928,1935 ----
    printfs(".nr " NEEDED_REG " \\n[%1]-(\\n[%2]", 
  	  span_width_reg(start_col, end_col),
  	  span_width_reg(start_col, start_col));
!   int i;
!   for (i = start_col + 1; i <= end_col; i++) {
      // The column separation may shrink with the expand option.
      if (!(flags & EXPAND))
        printfs("+%1n", as_string(column_separation[i - 1]));
***************
*** 1975,1981 ****
    table_entry *p = entry_list;
    while (p) {
      if (p->end_col != p->start_col) {
!       for (horizontal_span *q = span_list; q; q = q->next)
  	if (q->start_col == p->start_col
  	    && q->end_col == p->end_col)
  	  break;
--- 1980,1987 ----
    table_entry *p = entry_list;
    while (p) {
      if (p->end_col != p->start_col) {
!       horizontal_span *q;
!       for (q = span_list; q; q = q->next)
  	if (q->start_col == p->start_col
  	    && q->end_col == p->end_col)
  	  break;
***************
*** 1990,1996 ****
    horizontal_span *unsorted = span_list;
    span_list = 0;
    while (unsorted) {
!     for (horizontal_span **pp = &span_list; *pp; pp = &(*pp)->next)
        if (unsorted->end_col < (*pp)->end_col
  	  || (unsorted->end_col == (*pp)->end_col
  	      && (unsorted->start_col > (*pp)->start_col)))
--- 1996,2003 ----
    horizontal_span *unsorted = span_list;
    span_list = 0;
    while (unsorted) {
!     horizontal_span **pp;
!     for (pp = &span_list; *pp; pp = &(*pp)->next)
        if (unsorted->end_col < (*pp)->end_col
  	  || (unsorted->end_col == (*pp)->end_col
  	      && (unsorted->start_col > (*pp)->start_col)))
***************
*** 2017,2023 ****
    }
    if (flags & EXPAND) {
      int total_sep = left_separation + right_separation;
!     for (int i = 0; i < ncolumns - 1; i++)
        total_sep += column_separation[i];
      if (total_sep != 0) {
        // Don't let the separation factor be negative.
--- 2024,2031 ----
    }
    if (flags & EXPAND) {
      int total_sep = left_separation + right_separation;
!     int i;
!     for (i = 0; i < ncolumns - 1; i++)
        total_sep += column_separation[i];
      if (total_sep != 0) {
        // Don't let the separation factor be negative.
***************
*** 2035,2041 ****
    printfs(".nr %1 %2*\\n[" SEPARATION_FACTOR_REG "]\n",
  	  column_start_reg(0),
  	  as_string(left_separation));
!   for (int i = 1;; i++) {
      printfs(".nr %1 \\n[%2]+\\n[%3]\n",
  	    column_end_reg(i-1),
  	    column_start_reg(i-1),
--- 2043,2050 ----
    printfs(".nr %1 %2*\\n[" SEPARATION_FACTOR_REG "]\n",
  	  column_start_reg(0),
  	  as_string(left_separation));
!   int i;
!   for (i = 1;; i++) {
      printfs(".nr %1 \\n[%2]+\\n[%3]\n",
  	    column_end_reg(i-1),
  	    column_start_reg(i-1),
***************
*** 2066,2072 ****
  void table::make_columns_equal()
  {
    int first = -1;		// index of first equal column
!   for (int i = 0; i < ncolumns; i++)
      if (equal[i]) {
        if (first < 0) {
  	printfs(".nr %1 \\n[%1]", span_width_reg(i, i));
--- 2075,2082 ----
  void table::make_columns_equal()
  {
    int first = -1;		// index of first equal column
!   int i;
!   for (i = 0; i < ncolumns; i++)
      if (equal[i]) {
        if (first < 0) {
  	printfs(".nr %1 \\n[%1]", span_width_reg(i, i));
***************
*** 2149,2155 ****
  	     && entry[r][start_col] != 0
  	     && entry[r][start_col]->start_row != r)
  	start_col++;
!       for (int end_col = start_col;
  	   end_col < ncolumns
  	   && (entry[r][end_col] == 0
  	       || entry[r][end_col]->start_row == r);
--- 2159,2166 ----
  	     && entry[r][start_col] != 0
  	     && entry[r][start_col]->start_row != r)
  	start_col++;
!       int end_col;
!       for (end_col = start_col;
  	   end_col < ncolumns
  	   && (entry[r][end_col] == 0
  	       || entry[r][end_col]->start_row == r);
***************
*** 2197,2203 ****
  	     && entry[r][start_col] != 0
  	     && entry[r][start_col]->start_row != r)
  	start_col++;
!       for (int end_col = start_col;
  	   end_col < ncolumns
  	   && (entry[r][end_col] == 0
  	       || entry[r][end_col]->start_row == r);
--- 2208,2215 ----
  	     && entry[r][start_col] != 0
  	     && entry[r][start_col]->start_row != r)
  	start_col++;
!       int end_col;
!       for (end_col = start_col;
  	   end_col < ncolumns
  	   && (entry[r][end_col] == 0
  	       || entry[r][end_col]->start_row == r);
***************
*** 2305,2311 ****
      result = "";
    }
    else {
!     for (stuff *p = stuff_list; p && p->row < end_row + 1; p = p->next)
        ;
      if (p && p->row == end_row + 1 && p->is_double_line()) {
        result = "-" DOUBLE_LINE_SEP;
--- 2317,2324 ----
      result = "";
    }
    else {
!     stuff *p;
!     for (p = stuff_list; p && p->row < end_row + 1; p = p->next)
        ;
      if (p && p->row == end_row + 1 && p->is_double_line()) {
        result = "-" DOUBLE_LINE_SEP;
***************
*** 2399,2405 ****
  	  && (end_row == nrows - 1 
  	      || vline[end_row+1][col] != vline[end_row][col]
  	      || vline_spanned(end_row+1, col))) {
! 	for (int start_row = end_row - 1;
  	     start_row >= 0
  	     && vline[start_row][col] == vline[end_row][col]
  	     && !vline_spanned(start_row, col);
--- 2412,2419 ----
  	  && (end_row == nrows - 1 
  	      || vline[end_row+1][col] != vline[end_row][col]
  	      || vline_spanned(end_row+1, col))) {
! 	int start_row;
! 	for (start_row = end_row - 1;
  	     start_row >= 0
  	     && vline[start_row][col] == vline[end_row][col]
  	     && !vline_spanned(start_row, col);
***************
*** 2498,2504 ****
    if (!(flags & NOKEEP) && row_begins_section(r))
      prints("." KEEP_MACRO_NAME "\n");
    int had_line = 0;
!   for (stuff *p = stuff_list; p && p->row < r; p = p->next)
      ;
    for (stuff *p1 = p; p1 && p1->row == r; p1 = p1->next)
      if (!p1->printed && (p1->is_single_line() || p1->is_double_line())) {
--- 2512,2519 ----
    if (!(flags & NOKEEP) && row_begins_section(r))
      prints("." KEEP_MACRO_NAME "\n");
    int had_line = 0;
!   stuff *p;
!   for (p = stuff_list; p && p->row < r; p = p->next)
      ;
    for (stuff *p1 = p; p1 && p1->row == r; p1 = p1->next)
      if (!p1->printed && (p1->is_single_line() || p1->is_double_line())) {
*** old-NetBSD/src/gnu/usr.bin/groff/tfmtodit/tfmtodit.cc
--- NetBSD/src/gnu/usr.bin/groff/tfmtodit/tfmtodit.cc
***************
*** 825,831 ****
        m[4] = g.get_left_adjustment(i);
        m[5] = g.get_right_adjustment(i);
        printf("%s\t%d", p->ch, m[0]*MULTIPLIER);
!       for (int j = int(sizeof(m)/sizeof(m[0])) - 1; j > 0; j--)
  	if (m[j] != 0)
  	  break;
        for (int k = 1; k <= j; k++)
--- 825,832 ----
        m[4] = g.get_left_adjustment(i);
        m[5] = g.get_right_adjustment(i);
        printf("%s\t%d", p->ch, m[0]*MULTIPLIER);
!       int j;
!       for (j = int(sizeof(m)/sizeof(m[0])) - 1; j > 0; j--)
  	if (m[j] != 0)
  	  break;
        for (int k = 1; k <= j; k++)
*** old-NetBSD/src/gnu/usr.bin/groff/troff/dictionary.cc
--- NetBSD/src/gnu/usr.bin/groff/troff/dictionary.cc
***************
*** 28,34 ****
  static int is_good_size(int p)
  {
    const int SMALL = 10;
!   for (unsigned i = 2; i <= p/2; i++)
      if (p % i == 0)
        return 0;
    for (i = 0x100; i != 0; i <<= 8)
--- 28,35 ----
  static int is_good_size(int p)
  {
    const int SMALL = 10;
!   unsigned i;
!   for (i = 2; i <= p/2; i++)
      if (p % i == 0)
        return 0;
    for (i = 0x100; i != 0; i <<= 8)
***************
*** 49,55 ****

  void *dictionary::lookup(symbol s, void *v)
  {
!   for (int i = int(s.hash() % size); 
         table[i].v != 0;
         i == 0 ? i = size - 1: --i)
      if (s == table[i].s) {
--- 50,57 ----

  void *dictionary::lookup(symbol s, void *v)
  {
!   int i;
!   for (i = int(s.hash() % size); 
         table[i].v != 0;
         i == 0 ? i = size - 1: --i)
      if (s == table[i].s) {
***************
*** 96,102 ****
  void *dictionary::remove(symbol s)
  {
    // this relies on the fact that we are using linear probing
!   for (int i = int(s.hash() % size);
         table[i].v != 0 && s != table[i].s;
         i == 0 ? i = size - 1: --i)
      ;
--- 98,105 ----
  void *dictionary::remove(symbol s)
  {
    // this relies on the fact that we are using linear probing
!   int i;
!   for (i = int(s.hash() % size);
         table[i].v != 0 && s != table[i].s;
         i == 0 ? i = size - 1: --i)
      ;
*** old-NetBSD/src/gnu/usr.bin/groff/troff/div.cc
--- NetBSD/src/gnu/usr.bin/groff/troff/div.cc
***************
*** 446,452 ****
  void top_level_diversion::add_trap(symbol nm, vunits pos)
  {
    trap *first_free_slot = 0;
!   for (trap **p = &page_trap_list; *p; p = &(*p)->next) {
      if ((*p)->nm.is_null()) {
        if (first_free_slot == 0)
  	first_free_slot = *p;
--- 446,453 ----
  void top_level_diversion::add_trap(symbol nm, vunits pos)
  {
    trap *first_free_slot = 0;
!   trap **p;
!   for (p = &page_trap_list; *p; p = &(*p)->next) {
      if ((*p)->nm.is_null()) {
        if (first_free_slot == 0)
  	first_free_slot = *p;
*** old-NetBSD/src/gnu/usr.bin/groff/troff/div.h
--- NetBSD/src/gnu/usr.bin/groff/troff/div.h
***************
*** 145,148 ****
  void handle_first_page_transition();
  void blank_line();

! extern volatile void cleanup_and_exit(int);
--- 145,154 ----
  void handle_first_page_transition();
  void blank_line();

! #ifdef __GNUC__
! #define NO_RETURN volatile
! #else
! #define NO_RETURN
! #endif
! 
! extern NO_RETURN void cleanup_and_exit(int);
*** old-NetBSD/src/gnu/usr.bin/groff/troff/env.cc
--- NetBSD/src/gnu/usr.bin/groff/troff/env.cc
***************
*** 136,142 ****
        )
      curdiv->output(nd, no_fill, vs, ls, width);
    else {
!     for (pending_output_line **p = &pending_lines; *p; p = &(*p)->next)
        ;
      *p = new pending_output_line(nd, no_fill, vs, ls, width);
    }
--- 136,143 ----
        )
      curdiv->output(nd, no_fill, vs, ls, width);
    else {
!     pending_output_line **p;
!     for (p = &pending_lines; *p; p = &(*p)->next)
        ;
      *p = new pending_output_line(nd, no_fill, vs, ls, width);
    }
***************
*** 1586,1592 ****
    if (line == 0)
      return;
    hyphenation_type prev_type = line->get_hyphenation_type();
!   for (node **startp = &line->next; *startp != 0; startp = &(*startp)->next) {
      hyphenation_type this_type = (*startp)->get_hyphenation_type();
      if (prev_type == HYPHEN_BOUNDARY && this_type == HYPHEN_MIDDLE)
        break;
--- 1587,1594 ----
    if (line == 0)
      return;
    hyphenation_type prev_type = line->get_hyphenation_type();
!   node **startp;
!   for (startp = &line->next; *startp != 0; startp = &(*startp)->next) {
      hyphenation_type this_type = (*startp)->get_hyphenation_type();
      if (prev_type == HYPHEN_BOUNDARY && this_type == HYPHEN_MIDDLE)
        break;
***************
*** 1705,1711 ****
      space_total = 0;
      width_total = 0;
      node *first_non_discardable = 0;
!     for (node *tem = line; tem != 0; tem = tem->next)
        if (!tem->discardable())
  	first_non_discardable = tem;
      node *to_be_discarded;
--- 1707,1714 ----
      space_total = 0;
      width_total = 0;
      node *first_non_discardable = 0;
!     node *tem;
!     for (tem = line; tem != 0; tem = tem->next)
        if (!tem->discardable())
  	first_non_discardable = tem;
      node *to_be_discarded;
***************
*** 2025,2031 ****
  tab_type tab_stops::distance_to_next_tab(hunits curpos, hunits *distance)
  {
    hunits lastpos = 0;
!   for (tab *tem = initial_list; tem && tem->pos <= curpos; tem = tem->next)
      lastpos = tem->pos;
    if (tem) {
      *distance = tem->pos - curpos;
--- 2028,2035 ----
  tab_type tab_stops::distance_to_next_tab(hunits curpos, hunits *distance)
  {
    hunits lastpos = 0;
!   tab *tem;
!   for (tem = initial_list; tem && tem->pos <= curpos; tem = tem->next)
      lastpos = tem->pos;
    if (tem) {
      *distance = tem->pos - curpos;
***************
*** 2053,2059 ****
    static int buf_size = 0;
    // figure out a maximum on the amount of space we can need
    int count = 0;
!   for (tab *p = initial_list; p; p = p->next)
      ++count;
    for (p = repeated_list; p; p = p->next)
      ++count;
--- 2057,2064 ----
    static int buf_size = 0;
    // figure out a maximum on the amount of space we can need
    int count = 0;
!   tab *p;
!   for (p = initial_list; p; p = p->next)
      ++count;
    for (p = repeated_list; p; p = p->next)
      ++count;
***************
*** 2149,2155 ****

  void tab_stops::add_tab(hunits pos, tab_type type, int repeated)
  {
!   for (tab **p = repeated ? &repeated_list : &initial_list; *p; p = &(*p)->next)
      ;
    *p = new tab(pos, type);
  }
--- 2154,2161 ----

  void tab_stops::add_tab(hunits pos, tab_type type, int repeated)
  {
!   tab **p;
!   for (p = repeated ? &repeated_list : &initial_list; *p; p = &(*p)->next)
      ;
    *p = new tab(pos, type);
  }
***************
*** 2282,2288 ****
      field_spaces += tab_field_spaces;
    }
    if (tab_contents != 0) {
!     for (node *tem = tab_contents; tem->next != 0; tem = tem->next)
        ;
      tem->next = line;
      line = tab_contents;
--- 2288,2295 ----
      field_spaces += tab_field_spaces;
    }
    if (tab_contents != 0) {
!     node *tem;
!     for (tem = tab_contents; tem->next != 0; tem = tem->next)
        ;
      tem->next = line;
      line = tab_contents;
***************
*** 2390,2396 ****
  	    current_tab = TAB_NONE;
  	  }
  	  if (tab_contents != 0) {
! 	    for (node *tem = tab_contents; tem->next != 0; tem = tem->next)
  	      ;
  	    tem->next = line;
  	    line = tab_contents;
--- 2397,2404 ----
  	    current_tab = TAB_NONE;
  	  }
  	  if (tab_contents != 0) {
! 	    node *tem;
! 	    for (tem = tab_contents; tem->next != 0; tem = tem->next)
  	      ;
  	    tem->next = line;
  	    line = tab_contents;
***************
*** 2901,2907 ****

  void hyphen_trie::hyphenate(const char *word, int len, int *hyphens)
  {
!   for (int j = 0; j < len+1; j++)
      hyphens[j] = 0;
    for (j = 0; j < len - 1; j++) {
      h = hyphens + j;
--- 2909,2916 ----

  void hyphen_trie::hyphenate(const char *word, int len, int *hyphens)
  {
!   int j;
!   for (j = 0; j < len+1; j++)
      hyphens[j] = 0;
    for (j = 0; j < len - 1; j++) {
      h = hyphens + j;
***************
*** 2986,2992 ****
    int len = 0;
    char hbuf[WORD_MAX+2];
    char *buf = hbuf + 1;
!   for (hyphen_list *tem = h; tem && len < WORD_MAX; tem = tem->next) {
      if (tem->hyphenation_code != 0)
        buf[len++] = tem->hyphenation_code;
      else
--- 2995,3002 ----
    int len = 0;
    char hbuf[WORD_MAX+2];
    char *buf = hbuf + 1;
!   hyphen_list *tem;
!   for (tem = h; tem && len < WORD_MAX; tem = tem->next) {
      if (tem->hyphenation_code != 0)
        buf[len++] = tem->hyphenation_code;
      else
*** old-NetBSD/src/gnu/usr.bin/groff/troff/input.cc
--- NetBSD/src/gnu/usr.bin/groff/troff/input.cc
***************
*** 513,519 ****

  void input_stack::next_file(FILE *fp, const char *s)
  {
!   for (input_iterator **pp = &top; *pp != &nil_iterator; pp = &(*pp)->next)
      if ((*pp)->next_file(fp, s))
        return;
    if (++level > limit && limit > 0)
--- 513,520 ----

  void input_stack::next_file(FILE *fp, const char *s)
  {
!   input_iterator **pp;
!   for (pp = &top; *pp != &nil_iterator; pp = &(*pp)->next)
      if ((*pp)->next_file(fp, s))
        return;
    if (++level > limit && limit > 0)
***************
*** 1400,1406 ****
  	  symbol s = read_escape_name();
  	  if (s.is_null())
  	    break;
! 	  for (const char *p = s.contents(); *p != '\0'; p++)
  	    if (!csdigit(*p))
  	      break;
  	  if (*p)
--- 1401,1408 ----
  	  symbol s = read_escape_name();
  	  if (s.is_null())
  	    break;
! 	  const char *p;
! 	  for (p = s.contents(); *p != '\0'; p++)
  	    if (!csdigit(*p))
  	      break;
  	  if (*p)
***************
*** 2730,2736 ****

  void macro_iterator::add_arg(const macro &m)
  {
!   for (arg_list **p = &args; *p; p = &((*p)->next))
      ;
    *p = new arg_list(m);
    ++argc;
--- 2732,2739 ----

  void macro_iterator::add_arg(const macro &m)
  {
!   arg_list **p;
!   for (p = &args; *p; p = &((*p)->next))
      ;
    *p = new arg_list(m);
    ++argc;
***************
*** 3107,3113 ****
      }
    }
    else {
!     for (const char *p = s; *p && csdigit(*p); p++)
        ;
      if (*p)
        error("bad argument name `%1'", s);
--- 3110,3117 ----
      }
    }
    else {
!     const char *p;
!     for (p = s; *p && csdigit(*p); p++)
        ;
      if (*p)
        error("bad argument name `%1'", s);
***************
*** 3245,3251 ****
        const char *s = term.contents();
        int d;
        // see if it matches term
!       for (int i = 0; s[i] != 0; i++) {
  	d = get_copy(&n);
  	if ((unsigned char)s[i] != d)
  	  break;
--- 3249,3256 ----
        const char *s = term.contents();
        int d;
        // see if it matches term
!       int i;
!       for (i = 0; s[i] != 0; i++) {
  	d = get_copy(&n);
  	if ((unsigned char)s[i] != d)
  	  break;
*** old-NetBSD/src/gnu/usr.bin/groff/troff/node.cc
--- NetBSD/src/gnu/usr.bin/groff/troff/node.cc
***************
*** 610,616 ****
    next = tfont_list;
    tfont_list = this;
    tfont_spec plain_spec = plain();
!   for (tfont *p = tfont_list; p; p = p->next)
      if (*p == plain_spec) {
        plain_version = p;
        break;
--- 610,617 ----
    next = tfont_list;
    tfont_list = this;
    tfont_spec plain_spec = plain();
!   tfont *p;
!   for (p = tfont_list; p; p = p->next)
      if (*p == plain_spec) {
        plain_version = p;
        break;
***************
*** 2374,2380 ****
    hunits w = n->width();
    if (w > max_width)
      max_width = w;
!   for (node **p = &list; *p; p = &(*p)->next)
      ;
    n->next = 0;
    *p = n;
--- 2375,2382 ----
    hunits w = n->width();
    if (w > max_width)
      max_width = w;
!   node **p;
!   for (p = &list; *p; p = &(*p)->next)
      ;
    n->next = 0;
    *p = n;
***************
*** 2968,2974 ****
      if (pre == 0)
        *prep = next;
      else {
!       for (node *tem = pre; tem->next != 0; tem = tem->next)
  	;
        tem->next = next;
        *prep = pre;
--- 2970,2977 ----
      if (pre == 0)
        *prep = next;
      else {
!       node *tem;
!       for (tem = pre; tem->next != 0; tem = tem->next)
  	;
        tem->next = next;
        *prep = pre;
***************
*** 3519,3525 ****
    if (list == 0)
      return;
    int npieces = 0;
!   for (node *tem = list; tem; tem = tem->next)
      ++npieces;
    vunits h = list->size();
    vunits totalh = h*npieces;
--- 3522,3529 ----
    if (list == 0)
      return;
    int npieces = 0;
!   node *tem;
!   for (tem = list; tem; tem = tem->next)
      ++npieces;
    vunits h = list->size();
    vunits totalh = h*npieces;
***************
*** 4552,4558 ****

  int next_available_font_position()
  {
!   for (int i = 1; i < font_table_size && font_table[i] != 0; i++)
      ;
    return i;
  }
--- 4556,4563 ----

  int next_available_font_position()
  {
!   int i;
!   for (i = 1; i < font_table_size && font_table[i] != 0; i++)
      ;
    return i;
  }
*** old-NetBSD/src/gnu/usr.bin/groff/troff/symbol.cc
--- NetBSD/src/gnu/usr.bin/groff/troff/symbol.cc
***************
*** 82,88 ****
      table_used = 0;
    }
    unsigned int hc = hash_string(p);
!   for (const char **pp  = table + hc % table_size; 
         *pp != 0; 
         (pp == table ? pp = table + table_size - 1 : --pp))
      if (strcmp(p, *pp) == 0) {
--- 82,89 ----
      table_used = 0;
    }
    unsigned int hc = hash_string(p);
!   const char **pp;
!   for (pp  = table + hc % table_size; 
         *pp != 0; 
         (pp == table ? pp = table + table_size - 1 : --pp))
      if (strcmp(p, *pp) == 0) {
***************
*** 96,102 ****
    if (table_used  >= table_size - 1 || table_used >= table_size*FULL_MAX) {
      const char **old_table = table;
      unsigned int old_table_size = table_size;
!     for (int i = 1; table_sizes[i] <= old_table_size; i++)
        if (table_sizes[i] == 0)
  	fatal("too many symbols");
      table_size = table_sizes[i];
--- 97,104 ----
    if (table_used  >= table_size - 1 || table_used >= table_size*FULL_MAX) {
      const char **old_table = table;
      unsigned int old_table_size = table_size;
!     int i;
!     for (i = 1; table_sizes[i] <= old_table_size; i++)
        if (table_sizes[i] == 0)
  	fatal("too many symbols");
      table_size = table_sizes[i];
*** old-NetBSD/src/gnu/usr.bin/ld/rtld/Makefile
--- NetBSD/src/gnu/usr.bin/ld/rtld/Makefile
***************
*** 6,12 ****
  MAN= rtld.1
  LDDIR?= $(.CURDIR)/..
  #PICFLAG=-pic
! PICFLAG=-fpic
  CFLAGS+=-I$(LDDIR) -I$(.CURDIR) -I$(LDDIR)/$(MACHINE_ARCH) $(PICFLAG) -DRTLD -DLIBC_SCCS
  LDFLAGS+=-Bshareable -Bsymbolic -assert nosymbolic
  ASFLAGS+=-k
--- 6,12 ----
  MAN= rtld.1
  LDDIR?= $(.CURDIR)/..
  #PICFLAG=-pic
! PICFLAG=-fpic -fno-function-cse
  CFLAGS+=-I$(LDDIR) -I$(.CURDIR) -I$(LDDIR)/$(MACHINE_ARCH) $(PICFLAG) -DRTLD -DLIBC_SCCS
  LDFLAGS+=-Bshareable -Bsymbolic -assert nosymbolic
  ASFLAGS+=-k
*** old-NetBSD/src/share/mk/bsd.prog.mk
--- NetBSD/src/share/mk/bsd.prog.mk
***************
*** 20,25 ****
--- 20,26 ----
  LIBDES?=	${DESTDIR}/usr/lib/libdes.a
  LIBEDIT?=	${DESTDIR}/usr/lib/libedit.a
  LIBGCC?=	${DESTDIR}/usr/lib/libgcc.a
+ LIBGNUMALLOC?=	${DESTDIR}/usr/lib/libgnumalloc.a
  LIBL?=		${DESTDIR}/usr/lib/libl.a
  LIBKDB?=	${DESTDIR}/usr/lib/libkdb.a
  LIBKRB?=	${DESTDIR}/usr/lib/libkrb.a
***************
*** 66,77 ****
  .if defined(DESTDIR)

  ${PROG}: ${LIBCRT0} ${OBJS} ${LIBC} ${DPADD}
! 	${CC} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} -nostdlib -L${DESTDIR}/usr/lib ${LIBCRT0} ${OBJS} ${LDADD} -lgcc -lc -lgcc

  .else

  ${PROG}: ${LIBCRT0} ${OBJS} ${LIBC} ${DPADD}
! 	${CC} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} ${OBJS} ${LDADD}

  .endif	# defined(DESTDIR)
  .endif	# defined(OBJS) && !empty(OBJS)
--- 67,78 ----
  .if defined(DESTDIR)

  ${PROG}: ${LIBCRT0} ${OBJS} ${LIBC} ${DPADD}
! 	${LINK} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} -nostdlib -L${DESTDIR}/usr/lib ${LIBCRT0} ${OBJS} ${LDADD} -lgcc -lc -lgcc

  .else

  ${PROG}: ${LIBCRT0} ${OBJS} ${LIBC} ${DPADD}
! 	${LINK} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} ${OBJS} ${LDADD}

  .endif	# defined(DESTDIR)
  .endif	# defined(OBJS) && !empty(OBJS)
*** old-NetBSD/src/share/mk/sys.mk
--- NetBSD/src/share/mk/sys.mk
***************
*** 34,40 ****
  .endif

  FC?=		f77
! FFLAGS?=		-O
  RFLAGS?=
  COMPILE.f?=	${FC} ${FFLAGS} -c
  LINK.f?=	${FC} ${FFLAGS} ${LDFLAGS}
--- 34,40 ----
  .endif

  FC?=		f77
! FFLAGS?=	-O
  RFLAGS?=
  COMPILE.f?=	${FC} ${FFLAGS} -c
  LINK.f?=	${FC} ${FFLAGS} ${LDFLAGS}
***************
*** 49,54 ****
--- 49,56 ----

  LD?=		ld
  LDFLAGS?=
+ 
+ LINK?=		$(CC)

  LINT?=		lint
  LINTFLAGS?=	-chapbx
*** old-NetBSD/src/sys/arch/m68k/include/varargs.h
--- NetBSD/src/sys/arch/m68k/include/varargs.h
***************
*** 47,53 ****
--- 47,57 ----

  typedef _BSD_VA_LIST_	va_list;

+ #if __GNUC__ > 1
+ #define	va_dcl	int va_alist; ...
+ #else
  #define	va_dcl	int va_alist;
+ #endif

  #define	__va_promote(type) \
  	(((sizeof(type) + sizeof(int) - 1) / sizeof(int)) * sizeof(int))
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->analyzed 
State-Changed-By: thorpej 
State-Changed-When: Tue Jan 2 00:52:13 PST 1996 
State-Changed-Why:  
Applied ld.so patch.  Other patches have been checked in that also appeared 
in other PRs.  I'll run the $LINK stuff by core, and get a consensus. 
State-Changed-From-To: analyzed->closed 
State-Changed-By: mycroft 
State-Changed-When: Wed Feb 7 22:54:38 EST 1996 
State-Changed-Why:  
Fixed. 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.