bug-groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug in groff 1.17 with Sun C++ compiler


From: Albert Chin-A-Young
Subject: Re: Bug in groff 1.17 with Sun C++ compiler
Date: Fri, 20 Apr 2001 10:15:05 -0500
User-agent: Mutt/1.1.12i

On Fri, Apr 20, 2001 at 03:38:51PM +0200, Werner LEMBERG wrote:
> > So, does emit_space need to return anything? According to
> > src/devices/grohtml/post-html.cc:
> >       current_paragraph->emit_space();
> >       current_paragraph->emit_space();
> > in html_printer::determine_space which means the return value can
> > safely be discarded. So, should the function prototype above be:
> >     void    emit_space     (void);
> 
> This has already been fixed in the current snapshot.  Thanks for the
> report.

FYI, attached below is our current patch to get groff 1.17 compiled
with Sun C++ 5.2, HP-UX C++ A.03.30, and IRIX C++ 7.3.1.2m. It does
the following:
  1. Provide an autoconf test to determine if mkstemp has
     a prototype. FYI, Solaris 2.5.1 has a function prototype
     for mktemp.
  2. Remove cast of string literals to char * (allowed by C++ but
     not pretty). Use const char * instead.
  3. Use void return type for functions not returning a value.

Next up is #ifdef'ing out the functions in
src/preproc/html/pre-html.cc for abs, min, etc. which are already
provided by the system. I'll send in another patch when I'm done.

Should I be trying to build the latest snapshot instead? Plans for a
1.17.1 or 1.18 any time soon?

-- 
albert chin (address@hidden)

-- snip snip
--- src/libs/libgroff/tmpfile.cc.orig   Fri Apr 20 02:46:15 2001
+++ src/libs/libgroff/tmpfile.cc        Fri Apr 20 02:46:34 2001
@@ -29,12 +29,11 @@
 #include "error.h"
 #include "nonposix.h"
 
+#ifndef HAVE_MKSTEMP_PROTO
 extern "C" {
-  // Solaris 2.5.1 has these functions,
-  // but its stdlib.h fails to declare them.
-  char *mktemp(char *);
-  int mkstemp(char *);
+  extern int mkstemp (char *);
 }
+#endif
 
 // If this is set, create temporary files there
 #define GROFF_TMPDIR_ENVVAR "GROFF_TMPDIR"
--- src/utils/indxbib/indxbib.cc.orig   Fri Apr 20 02:44:41 2001
+++ src/utils/indxbib/indxbib.cc        Fri Apr 20 02:45:54 2001
@@ -37,12 +37,11 @@
 
 #include "nonposix.h"
 
+#ifndef HAVE_MKSTEMP_PROTO
 extern "C" {
-  // Solaris 2.5.1 has these functions,
-  // but its stdlib.h fails to declare them.
-  char *mktemp(char *);
-  int mkstemp(char *);
+  extern int mkstemp (char *);
 }
+#endif
 
 #define DEFAULT_HASH_TABLE_SIZE 997
 #define TEMP_INDEX_TEMPLATE "indxbibXXXXXX"
--- src/xditview/Imakefile.in.orig      Fri Apr 20 02:47:32 2001
+++ src/xditview/Imakefile.in   Fri Apr 20 02:49:37 2001
@@ -19,7 +19,11 @@
   gxditview \
   xtotroff
 DEPLIBS = XawClientDepLibs
+#if defined(HPArchitecture) && (OSMajorVersion > 9)
+LOCAL_LIBRARIES = -L/usr/contrib/X11R6/lib XawClientLibs
+#else
 LOCAL_LIBRARIES = XawClientLibs
+#endif
 SRCS1 = \
   $(srcdir)/xditview.c \
   $(srcdir)/Dvi.c \
@@ -50,9 +54,16 @@
   xtotroff.o \
   XFontName.o \
   DviChar.o
+#if defined(HPArchitecture) && (OSMajorVersion > 9)
 INCLUDES = \
+  -I/usr/contrib/X11R6/include \
   -I$(TOOLKITSRC) \
   -I$(TOP)
+#else
+INCLUDES = \
+  -I$(TOOLKITSRC) \
+  -I$(TOP)
+#endif
 MATHLIB = -lm
 DEFINES = \
   $(SIGNAL_DEFINES) \
--- src/devices/grohtml/html-text.cc.orig       Fri Apr 20 03:14:08 2001
+++ src/devices/grohtml/html-text.cc    Fri Apr 20 03:14:16 2001
@@ -661,7 +661,7 @@
  *  emit_space - writes a space providing that text was written beforehand.
  */
 
-int html_text::emit_space (void)
+void html_text::emit_space (void)
 {
   if (space_emitted) {
     if (is_present(PRE_TAG)) {
--- src/devices/grohtml/html-text.h.orig        Fri Apr 20 03:14:05 2001
+++ src/devices/grohtml/html-text.h     Fri Apr 20 03:14:20 2001
@@ -78,7 +78,7 @@
   void   done_big       (void);
   void   do_indent      (char *arg, int indent, int pageoff, int linelen);
   int    emitted_text   (void);
-  int    emit_space     (void);
+  void   emit_space     (void);
   int    is_in_pre      (void);
   void   remove_tag     (HTML_TAG tag);
   void   remove_sub_sup (void);
--- src/devices/grohtml/html.h.orig     Fri Apr 20 03:17:38 2001
+++ src/devices/grohtml/html.h  Fri Apr 20 03:17:53 2001
@@ -70,10 +70,10 @@
   simple_output &end_line();
   simple_output &put_raw_char(char);
   simple_output &special(const char *);
-  simple_output &enable_newlines(int);
-  simple_output &check_newline(int n);
+  void enable_newlines(int);
+  void check_newline(int n);
   simple_output &nl(void);
-  simple_output &space_or_newline (void);
+  void space_or_newline (void);
   simple_output &begin_tag (void);
   FILE *get_file();
 private:
--- src/devices/grohtml/output.cc.orig  Fri Apr 20 03:16:08 2001
+++ src/devices/grohtml/output.cc       Fri Apr 20 03:16:34 2001
@@ -202,7 +202,7 @@
  *                  a newline and that one is needed.
  */
 
-simple_output &simple_output::check_newline(int n)
+void simple_output::check_newline(int n)
 {
   if ((col + n + last_word.get_length() + 1 > max_line_length) && (newlines)) {
     fputc('\n', fp);
@@ -215,7 +215,7 @@
  *                     depending upon the current column.
  */
 
-simple_output &simple_output::space_or_newline (void)
+void simple_output::space_or_newline (void)
 {
 #if defined(DEBUGGING)
   fflush(fp);   // just for testing
@@ -298,7 +298,7 @@
   return *this;
 }
 
-simple_output &simple_output::enable_newlines (int auto_newlines)
+void simple_output::enable_newlines (int auto_newlines)
 {
   check_newline(0);
   newlines = auto_newlines;
--- src/utils/pfbtops/pfbtops.c.orig    Fri Apr 20 03:21:30 2001
+++ src/utils/pfbtops/pfbtops.c Fri Apr 20 03:21:41 2001
@@ -47,7 +47,7 @@
        exit(0);
        break;
       }
-    case CHAR_MAX + 1: // --help
+    case CHAR_MAX + 1: /* --help */
       usage(stdout);
       exit(0);
       break;
--- src/devices/grolbp/lbp.h.orig       Fri Apr 20 03:24:40 2001
+++ src/devices/grolbp/lbp.h    Fri Apr 20 03:27:51 2001
@@ -36,7 +36,7 @@
 
 
 static inline void 
-lbpprintf(char *format, ... )
+lbpprintf(const char *format, ... )
 { /* Taken from cjet */
   va_list stuff;
 
@@ -46,7 +46,7 @@
 };
 
 static inline void
-lbpputs(char *data)
+lbpputs(const char *data)
 {
        fputs(data,lbpoutput);
 };
@@ -123,7 +123,7 @@
        fprintf(lbpoutput,"\033[9r");
 };
 
-static inline void vdmprintf(char *format, ... );
+static inline void vdmprintf(const char *format, ... );
 
 static inline char *
 vdmnum(int num,char *result)
@@ -179,7 +179,7 @@
 };
 
 static inline void 
-vdmprintf(char *format, ... )
+vdmprintf(const char *format, ... )
 { /* Taken from cjet */
   va_list stuff;
   
--- configure.in.orig   Fri Apr 20 02:40:20 2001
+++ configure.in        Fri Apr 20 03:29:20 2001
@@ -46,7 +46,19 @@
 LIBS="$LIBS -lc $LIBM"
 AC_REPLACE_FUNCS(fmod strtol getcwd strerror putenv)
 LIBS="$saved_libs"
-AC_CHECK_FUNCS(rename mkstemp strcasecmp strncasecmp strsep strdup)
+AC_CHECK_FUNCS(rename strcasecmp strncasecmp strsep strdup)
+
+dnl chk for mkstemp and the function prototype
+AC_CHECK_FUNC(mkstemp,
+  AC_DEFINE(HAVE_MKSTEMP)
+  AC_MSG_CHECKING(for mkstemp prototype in <stdlib.h>)
+  AC_EGREP_CPP(mkstemp,
+    [#include <stdlib.h>],
+    AC_MSG_RESULT(yes)
+    AC_DEFINE(HAVE_MKSTEMP_PROTO), AC_MSG_RESULT(no)))
+
+AC_CHECK_FUNCS(abs)
+
 AC_DECL_SYS_SIGLIST
 dnl checks for compiler characteristics
 GROFF_ARRAY_DELETE



reply via email to

[Prev in Thread] Current Thread [Next in Thread]