bug-groff
[Top][All Lists]
Advanced

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

groff: C vs. C++ vs. Version_string


From: Bruce Lilly
Subject: groff: C vs. C++ vs. Version_string
Date: Fri, 20 Apr 2001 00:34:07 -0400

                           Groff Bug Report

Please read the PROBLEMS file before sending in a bug report.

Please fill in all fields, even if you think they are not relevant.

Please delete the text in brackets before sending it in.

Please report separate bugs separately.

Send the completed form to address@hidden

GROFF VERSION:
1.17

MACHINE:
Sony PCV-J100

OS:
Microsoft Windows 2000 SP1 with UWIN 2.9
(see http://www.research.att.com/sw/tools/uwin/)

COMPILER:
Microsoft VC++ 6.0 SP5 with UWIN front end

INPUT FILES:
none required

COMMAND LINE:
./configure && make

DESCRIPTION OF INCORRECT BEHAVIOUR:
Version_string as C++ object is not visible to linker
from C object files.

make output:

cc -I. -I/y/groff/groff-current/src/utils/pfbtops 
-I/y/groff/groff-current/src/include -I/y/groff/groff-current/src/include 
-DHAVE_STDLIB_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DIRENT_H=1 -DHAVE_LIMITS_H=1 
-DHAVE_SYS_DIR_H=1 -DHAVE_STRING_H=1 -DHAVE_STRINGS_H=1 -DHAVE_MATH_H=1 
-DRET_TYPE_SRAND_IS_VOID=1 -DHAVE_SYS_NERR=1 -DHAVE_SYS_ERRLIST=1 
-DHAVE_CC_LIMITS_H=1 -DRETSIGTYPE=void -DHAVE_UNISTD_H=1 -DHAVE_GETPAGESIZE=1 
-DHAVE_FMOD=1 -DHAVE_STRTOL=1 -DHAVE_GETCWD=1 -DHAVE_STRERROR=1 -DHAVE_PUTENV=1 
-DHAVE_RENAME=1 -DHAVE_MKSTEMP=1 -DHAVE_STRCASECMP=1 -DHAVE_STRNCASECMP=1 
-DHAVE_STRDUP=1  -g   -c pfbtops.c
pfbtops.c(19) : warning C4013: 'exit' undefined; assuming extern returning int
cc -g  -o pfbtops pfbtops.o /y/groff/groff-current/src/libs/libgroff/libgroff.a 
 -lm
pfbtops.o : error LNK2001: unresolved external symbol _Version_string
pfbtops.exe : fatal error LNK1120: 1 unresolved externals
make[2]: *** [pfbtops] Error 1
make[2]: Leaving directory `/Y/groff/groff-current/src/utils/pfbtops'
make[1]: Entering directory `/Y/groff/groff-current'
make[1]: *** [src/utils/pfbtops] Error 2
make[1]: Leaving directory `/Y/groff/groff-current'
make: *** [all] Error 2

SUGGESTED FIX [optional]:
*** src/utils/pfbtops/pfbtops.c.orig    Thu Apr 19 23:43:08 2001
--- src/utils/pfbtops/pfbtops.c Thu Apr 19 23:43:52 2001
***************
*** 42,48 ****
      switch (opt) {
      case 'v':
        {
!       extern char *Version_string;
        printf("GNU pfbtops (groff) version %s\n", Version_string);
        exit(0);
        break;
--- 42,48 ----
      switch (opt) {
      case 'v':
        {
!       extern const char *Version_string;
        printf("GNU pfbtops (groff) version %s\n", Version_string);
        exit(0);
        break;
*** src/libs/libgroff/version.cc.orig   Thu Apr 19 23:49:42 2001
--- src/libs/libgroff/version.cc        Thu Apr 19 23:50:57 2001
***************
*** 1,3 ****
  const char *version_string = "1.17";
  const char *revision_string = "0";
! const char *Version_string = "1.17";
--- 1,3 ----
  const char *version_string = "1.17";
  const char *revision_string = "0";
! extern "C" const char *Version_string = "1.17";       // referenced from C 
source files as well as C++
*** src/roff/groff/groff.cc.orig        Thu Apr 19 23:52:34 2001
--- src/roff/groff/groff.cc     Thu Apr 19 23:54:06 2001
***************
*** 82,87 ****
--- 82,89 ----
    void print(int is_last, FILE *fp);
  };
  
+ extern "C" const char *Version_string;
+ 
  int lflag = 0;
  char *spooler = 0;
  char *postdriver = 0;
***************
*** 175,181 ****
      case 'v':
        vflag = 1;
        {
-       extern const char *Version_string;
        printf("GNU groff version %s\n", Version_string);
        printf("Copyright (C) 1989-2001 Free Software Foundation, Inc.\n"
               "GNU groff comes with ABSOLUTELY NO WARRANTY.\n"
--- 177,182 ----
*** src/roff/troff/input.cc.orig        Thu Apr 19 23:55:55 2001
--- src/roff/troff/input.cc     Thu Apr 19 23:56:49 2001
***************
*** 73,78 ****
--- 73,80 ----
  // initial size of buffer for reading names; expanded as necessary
  #define ABUF_SIZE 16
  
+ extern "C" const char *Version_string;
+ 
  #ifdef COLUMN
  void init_column_requests();
  #endif /* COLUMN */
***************
*** 6097,6103 ****
      switch(c) {
      case 'v':
        {
-       extern const char *Version_string;
        printf("GNU troff (groff) version %s\n", Version_string);
        exit(0);
        break;
--- 6099,6104 ----
*** src/preproc/tbl/main.cc.orig        Thu Apr 19 23:58:59 2001
--- src/preproc/tbl/main.cc     Thu Apr 19 23:59:23 2001
***************
*** 25,30 ****
--- 25,32 ----
  #define MAX_POINT_SIZE 99
  #define MAX_VERTICAL_SPACING 72
  
+ extern "C" const char *Version_string;
+ 
  static int compatible_flag = 0;
  
  class table_input {
***************
*** 1470,1476 ****
        break;
      case 'v':
        {
-       extern const char *Version_string;
        printf("GNU tbl (groff) version %s\n", Version_string);
        exit(0);
        break;
--- 1472,1477 ----
*** src/preproc/pic/main.cc.orig        Fri Apr 20 00:00:18 2001
--- src/preproc/pic/main.cc     Fri Apr 20 00:00:50 2001
***************
*** 21,26 ****
--- 21,27 ----
  #include "pic.h"
  
  extern int yyparse();
+ extern "C" const char *Version_string;
  
  output *out;
  
***************
*** 568,574 ****
        break;
      case 'v':
        {
-       extern const char *Version_string;
        printf("GNU pic (groff) version %s\n", Version_string);
        exit(0);
        break;
--- 569,574 ----
*** src/preproc/eqn/main.cc.orig        Fri Apr 20 00:01:55 2001
--- src/preproc/eqn/main.cc     Fri Apr 20 00:02:16 2001
***************
*** 30,35 ****
--- 30,36 ----
  #define STARTUP_FILE "eqnrc"
  
  extern int yyparse();
+ extern "C" const char *Version_string;
  
  static char *delim_search    (char *, int);
  static int   inline_equation (FILE *, string &, string &);
***************
*** 303,309 ****
        break;
      case 'v':
        {
-       extern const char *Version_string;
        printf("GNU eqn (groff) version %s\n", Version_string);
        exit(0);
        break;
--- 304,309 ----
*** src/preproc/grn/main.cc.orig        Fri Apr 20 00:05:26 2001
--- src/preproc/grn/main.cc     Fri Apr 20 00:06:13 2001
***************
*** 82,87 ****
--- 82,89 ----
  #include "error.h"
  #include "defs.h"
  
+ extern "C" const char *Version_string;
+ 
  /* database imports */
  
  extern void HGPrintElt(ELT *element, int baseline);
***************
*** 282,288 ****
        case '-':
        if (strcmp(*argv,"--version")==0) {
        case 'v':
-         extern const char *Version_string;
          printf("GNU grn (groff) version %s\n", Version_string);
          exit(0);
          break;
--- 284,289 ----
*** src/preproc/refer/refer.cc.orig     Fri Apr 20 00:07:07 2001
--- src/preproc/refer/refer.cc  Fri Apr 20 00:07:25 2001
***************
*** 25,30 ****
--- 25,32 ----
  #include "search.h"
  #include "command.h"
  
+ extern "C" const char *Version_string;
+ 
  const char PRE_LABEL_MARKER = '\013';
  const char POST_LABEL_MARKER = '\014';
  const char LABEL_MARKER = '\015'; // label_type is added on
***************
*** 344,350 ****
        }
        if (strcmp(opt,"-version")==0) {
        case 'v':
-         extern const char *Version_string;
          printf("GNU refer (groff) version %s\n", Version_string);
          exit(0);
          break;
--- 346,351 ----
*** src/preproc/soelim/soelim.cc.orig   Fri Apr 20 00:08:35 2001
--- src/preproc/soelim/soelim.cc        Fri Apr 20 00:08:51 2001
***************
*** 36,41 ****
--- 36,42 ----
  int compatible_flag = 0;
  
  extern int interpret_lf_args(const char *);
+ extern "C" const char *Version_string;
  
  int do_file(const char *filename);
  
***************
*** 77,83 ****
      switch (opt) {
      case 'v':
        {
-       extern const char *Version_string;
        printf("GNU soelim (groff) version %s\n", Version_string);
        exit(0);
        break;
--- 78,83 ----
*** src/preproc/html/pre-html.cc.orig   Fri Apr 20 00:09:48 2001
--- src/preproc/html/pre-html.cc        Fri Apr 20 00:11:02 2001
***************
*** 23,29 ****
  #include <stdio.h>
  #include <signal.h>
  #include <ctype.h>
! #include <string.h>
  #include <assert.h>
  #include <stdlib.h>
  #include <errno.h>
--- 23,29 ----
  #include <stdio.h>
  #include <signal.h>
  #include <ctype.h>
! #include <string.h>   /* declares strerror per ANSI/ISO 9899-1990, section 
7.11.6.2 */
  #include <assert.h>
  #include <stdlib.h>
  #include <errno.h>
***************
*** 47,53 ****
  #define PID_T int
  #endif /* not _POSIX_VERSION */
  
! extern char *strerror();
  
  #include "pre-html.h"
  #include "pushbackbuffer.h"
--- 47,53 ----
  #define PID_T int
  #endif /* not _POSIX_VERSION */
  
! extern "C" const char *Version_string;
  
  #include "pre-html.h"
  #include "pushbackbuffer.h"
***************
*** 1008,1014 ****
        vertical_offset = atoi((char *)(argv[i]+2));
      } else if ((strcmp(argv[i], "-v") == 0)
               || (strcmp(argv[i], "--version") == 0)) {
-       extern const char *Version_string;
        printf("GNU pre-grohtml (groff) version %s\n", Version_string);
        exit(0);
      } else if ((strcmp(argv[i], "-h") == 0)
--- 1008,1013 ----
*** src/devices/grops/ps.cc.orig        Fri Apr 20 00:12:16 2001
--- src/devices/grops/ps.cc     Fri Apr 20 00:12:32 2001
***************
*** 33,38 ****
--- 33,40 ----
  }
  #endif /* NEED_DECLARATION_PUTENV */
  
+ extern "C" const char *Version_string;
+ 
  static int landscape_flag = 0;
  static int manual_feed_flag = 0;
  static int ncopies = 1;
***************
*** 1119,1125 ****
    putchar('\n');
    out.set_file(stdout);
    {
-     extern const char *Version_string;
      out.begin_comment("Creator:")
         .comment_arg("groff")
         .comment_arg("version")
--- 1121,1126 ----
*** src/devices/grotty/tty.cc.orig      Fri Apr 20 00:13:41 2001
--- src/devices/grotty/tty.cc   Fri Apr 20 00:14:02 2001
***************
*** 21,26 ****
--- 21,28 ----
  #include "driver.h"
  #include "device.h"
  
+ extern "C" const char *Version_string;
+ 
  #ifndef SHRT_MIN
  #define SHRT_MIN (-32768)
  #endif
***************
*** 442,448 ****
      switch(c) {
      case 'v':
        {
-       extern const char *Version_string;
        printf("GNU grotty (groff) version %s\n", Version_string);
        exit(0);
        break;
--- 444,449 ----
*** src/devices/grodvi/dvi.cc.orig      Fri Apr 20 00:14:56 2001
--- src/devices/grodvi/dvi.cc   Fri Apr 20 00:15:11 2001
***************
*** 22,27 ****
--- 22,29 ----
  #include "driver.h"
  #include "nonposix.h"
  
+ extern "C" const char *Version_string;
+ 
  #define DEFAULT_LINEWIDTH 40
  static int linewidth = DEFAULT_LINEWIDTH;
  
***************
*** 863,869 ****
      switch(c) {
      case 'v':
        {
-       extern const char *Version_string;
        printf("GNU grodvi (groff) version %s\n", Version_string);
        exit(0);
        break;
--- 865,870 ----
*** src/devices/grolj4/lj4.cc.orig      Fri Apr 20 00:16:03 2001
--- src/devices/grolj4/lj4.cc   Fri Apr 20 00:16:20 2001
***************
*** 35,40 ****
--- 35,42 ----
  #include "driver.h"
  #include "nonposix.h"
  
+ extern "C" const char *Version_string;
+ 
  static struct {
    const char *name;
    int code;
***************
*** 647,653 ****
        }
      case 'v':
        {
-       extern const char *Version_string;
        printf("GNU grolj4 (groff) version %s\n", Version_string);
        exit(0);
        break;
--- 649,654 ----
*** src/devices/grohtml/post-html.cc.orig       Fri Apr 20 00:17:35 2001
--- src/devices/grohtml/post-html.cc    Fri Apr 20 00:18:01 2001
***************
*** 39,44 ****
--- 39,46 ----
  #include <stdio.h>
  #include <fcntl.h>
  
+ extern "C" const char *Version_string;
+ 
  #if !defined(TRUE)
  #   define TRUE  (1==1)
  #endif
***************
*** 2771,2777 ****
    header.write_headings(stdout, FALSE);
    write_rule();
    {
-     extern const char *Version_string;
      html.begin_comment("Creator     : ")
         .put_string("groff ")
         .put_string("version ")
--- 2773,2778 ----
*** src/devices/grolbp/lbp.cc.orig      Fri Apr 20 00:19:11 2001
--- src/devices/grolbp/lbp.cc   Fri Apr 20 00:19:28 2001
***************
*** 33,38 ****
--- 33,40 ----
  
  #include "nonposix.h"
  
+ extern "C" const char *Version_string;
+ 
  static short int papersize = -1,  // papersize
                 orientation = -1 , // orientation
                 paperlength = 0, // Custom Paper size
***************
*** 715,721 ****
                  case 'l'  :   orientation = 1;
                                break;
                  case 'v'  :   {
-                               extern const char *Version_string;
                                printf("GNU grolbp (groff) version %s\n",
                                       Version_string);
                                exit(0);
--- 717,722 ----
*** src/utils/tfmtodit/tfmtodit.cc.orig Fri Apr 20 00:20:33 2001
--- src/utils/tfmtodit/tfmtodit.cc      Fri Apr 20 00:20:54 2001
***************
*** 59,64 ****
--- 59,66 ----
  #include "cset.h"
  #include "nonposix.h"
  
+ extern "C" const char *Version_string;
+ 
  /* Values in the tfm file should be multiplied by this. */
  
  #define MULTIPLIER 1
***************
*** 717,723 ****
        }
      case 'v':
        {
-       extern const char *Version_string;
        printf("GNU tfmtodit (groff) version %s\n", Version_string);
        exit(0);
        break;
--- 719,724 ----
*** src/utils/hpftodit/hpftodit.cc.orig Fri Apr 20 00:22:07 2001
--- src/utils/hpftodit/hpftodit.cc      Fri Apr 20 00:22:19 2001
***************
*** 41,46 ****
--- 41,48 ----
  #include "cset.h"
  #include "nonposix.h"
  
+ extern "C" const char *Version_string;
+ 
  #define SIZEOF(v) (sizeof(v)/sizeof(v[0]))
  
  const int MULTIPLIER = 3;
***************
*** 226,232 ****
        break;
      case 'v':
        {
-       extern const char *Version_string;
        printf("GNU hpftodit (groff) version %s\n", Version_string);
        exit(0);
        }
--- 228,233 ----
*** src/utils/lookbib/lookbib.cc.orig   Fri Apr 20 00:23:17 2001
--- src/utils/lookbib/lookbib.cc        Fri Apr 20 00:23:37 2001
***************
*** 34,39 ****
--- 34,40 ----
  
  extern "C" {
    int isatty(int);
+   const char *Version_string;
  }
  
  static void usage(FILE *stream)
***************
*** 76,82 ****
        }
      case 'v':
        {
-       extern const char *Version_string;
        printf("GNU lookbib (groff) version %s\n", Version_string);
        exit(0);
        break;
--- 77,82 ----
*** src/utils/indxbib/indxbib.cc.orig   Fri Apr 20 00:24:47 2001
--- src/utils/indxbib/indxbib.cc        Fri Apr 20 00:25:06 2001
***************
*** 38,43 ****
--- 38,44 ----
  #include "nonposix.h"
  
  extern "C" {
+   const char *Version_string;
    // Solaris 2.5.1 has these functions,
    // but its stdlib.h fails to declare them.
    char *mktemp(char *);
***************
*** 180,186 ****
        break;
      case 'v':
        {
-       extern const char *Version_string;
        printf("GNU indxbib (groff) version %s\n", Version_string);
        exit(0);
        break;
--- 181,186 ----
*** src/utils/lkbib/lkbib.cc.orig       Fri Apr 20 00:26:01 2001
--- src/utils/lkbib/lkbib.cc    Fri Apr 20 00:26:18 2001
***************
*** 32,37 ****
--- 32,39 ----
  #include "refid.h"
  #include "search.h"
  
+ extern "C" const char *Version_string;
+ 
  static void usage(FILE *stream)
  {
    fprintf(stream, "usage: %s [-nv] [-p database] [-i XYZ] [-t N] keys ...\n",
***************
*** 78,84 ****
        }
      case 'v':
        {
-       extern const char *Version_string;
        printf("GNU lkbib (groff) version %s\n", Version_string);
        exit(0);
        break;
--- 80,85 ----
*** src/utils/addftinfo/addftinfo.cc.orig       Fri Apr 20 00:27:10 2001
--- src/utils/addftinfo/addftinfo.cc    Fri Apr 20 00:27:28 2001
***************
*** 31,36 ****
--- 31,38 ----
  #include "cset.h"
  #include "guess.h"
  
+ extern "C" const char *Version_string;
+ 
  static void usage(FILE *stream);
  static void usage();
  static void version();
***************
*** 142,148 ****
  
  static void version()
  {
-   extern const char *Version_string;
    printf("GNU addftinfo (groff) version %s\n", Version_string);
    exit(0);
  }
--- 144,149 ----



reply via email to

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