From: gnu@pdv2.fmr.maschinenbau.th-darmstadt.de (GNU - Mutter aller PDVSoftNummern)
Newsgroups: gnu.utils.bug
Subject: indent-1.6 -troff : character constants
Date: 14 Sep 92 01:06:43 GMT
Distribution: gnu
Organization: /usr/users/gnu/.organization

GNU-indent-1.6 has been configured for SUN3 and was compiled
with GCC-2.2.2 for SUN3. 

GNU-indent-1.6 does not handle character constants in a correct manner
using "-troff" option. It generates wrong constants, or keeps sequence
of characters with special meaning to "troff", which will generate
everything else than desired.

Below follows a short C text, its translation to troff,
and "config.status" of GNU-indent-1.6.


best adams

Reply to "gnu@pdv2.fmr.maschinenbau.th-darmstadt.de"
 
============================== log ============================================
22:43:10 pdv3 > cat stupid.c
/* 
 * A simple C - program to show
 * bugs in indent-1.6 by FSF.
 *
 * It will generate bad 
 * troff code both for 
 * char constants 
 * and quote ( "'", ascii code 0x24).
 *
 */

char digits[]={'1','2','3','4','5'};


/* 
 * control characters
 */

char control_chars[]={'\n', '\r'};

/* 
 * more tricky ones
 */

char tricky_chars[]={'\000', '\007'};

/* 
 * even more tricky
 */

char more_tricky_chars[]={'\\', '\'', '\"'}; 
22:46:26 pdv3 > indent-1.6 -version
GNU indent 1.6
22:46:40 pdv3 > indent-1.6 -v -troff -st stupid.c > stupid.nroff
option: troff
option: st
22:47:08 pdv3 > cat stupid.nroff
.ds fB R
.nr sB 11
.ds fC I
.nr sC 11
.ds fL I
.nr sL 13
.ds fX I
.nr sX 13
.ds fS L
.nr sS 11
.ds fK B
.nr sK 11
.Fn "stupid.c"
.*/

./* 7p -1 0p
A simple C - program to show
bugs in indent-1.6 by FSF.
It will generate bad
troff code both for
char constants
and quote ( "'", ascii code 0x24).

.*/
\h'|0p'\fBCHAR\fR 
.De 14p+7p
digits[] =
\h'|0p'{`\f\fR, `\f\fR, `\f\fR, `\f\fR, `\f\fR};


.*/

./* 7p -1 0p
Control characters

.*/
\h'|0p'\fBCHAR\fR 
.De 14p+7p
control_chars[] =
\h'|0p'{`\fL\\\fR, `\fL\\\fR};

.*/

./* 7p -1 0p
More tricky ones

.*/
\h'|0p'\fBCHAR\fR 
.De 14p+7p
tricky_chars[] =
\h'|0p'{`\fL\\\fR, `\fL\\\fR};

.*/

./* 7p -1 0p
Even more tricky

.*/
\h'|0p'\fBCHAR\fR 
.De 14p+7p
more_tricky_chars[] =
\h'|0p'{`\fL\\\\fR, `\fL\\\fR, `\fL\\\fR};
There were 27 output lines and 4 comments
(Lines with comments)/(Lines with code):  0.000
22:47:14 pdv3 > 

================================= config.status ===============================
#!/bin/sh
# Generated automatically by configure.
# Run this file to recreate the current configuration.
# This directory was configured as follows:
# configure --prefix=/usr/local/ --exec_prefix=/usr/local/

case "$1" in
  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
  exec /bin/sh configure --prefix=/usr/local/ --exec_prefix=/usr/local/ ;;
esac

trap 'rm -f zmakefile; exit 1' 1 3 15
CC='gcc -O'
CPP='${CC-cc} -E'
INSTALL='/bin/install -c'
INSTALL_PROGRAM='$(INSTALL)'
INSTALL_DATA='$(INSTALL) -m 644'
LIBOBJS=''
LIBS=''
srcdir='.'
DEFS=' -DHAVE_UNISTD_H=1 -DDIRENT=1'
prefix='/usr/local/'
exec_prefix='/usr/local/'
prsub='s,^prefix[ 	]*=.*$,prefix = /usr/local/,
s,^exec_prefix[ 	]*=.*$,exec_prefix = /usr/local/,'

top_srcdir=$srcdir
for file in zmakefile; do
  srcdir=$top_srcdir
  # Remove last slash and all that follows it.  Not all systems have dirname.
  dir=`echo $file|sed 's,/[^/][^/]*$,,'`
  if test "$dir" != "$file"; then
    test "$top_srcdir" != . && srcdir=$top_srcdir/$dir
    test ! -d $dir && mkdir $dir
  fi
  echo creating $file
  rm -f $file
  echo "# Generated automatically from `basename $file`.in by configure." > $file
  sed -e "
$prsub
s,@CC@,$CC,g
s,@CPP@,$CPP,g
s,@INSTALL@,$INSTALL,g
s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,g
s,@INSTALL_DATA@,$INSTALL_DATA,g
s,@LIBOBJS@,$LIBOBJS,g
s,@LIBS@,$LIBS,g
s,@srcdir@,$srcdir,g
s,@DEFS@,$DEFS," $top_srcdir/${file}.in >> $file
done