Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 7da86115204499325396d59e28ef4509380f7c46
Ticket: 446622ffffffffffffffffffffffffffffffffff
gcc warnings on FreeBSD 2.x
User & Date: lloydlim on 2001-08-01 00:41:14
Changes

  1. assignee changed to: "nobody"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    The following compiler warnings appear on FreeBSD 2.2.x
    with gcc 2.7.2.1:
    
    ./../unix/tclLoadAout.c: In function `TclpLoadFile':
    ./../unix/tclLoadAout.c:227: warning: implicit
    declaration of function `read'
    ./../unix/tclLoadAout.c:284: warning: implicit
    declaration of function `unlink'
    ./../unix/tclLoadAout.c:290: warning: implicit
    declaration of function `close'
    ./../unix/tclLoadAout.c: In function `FindLibraries':
    ./../unix/tclLoadAout.c:334: warning: `c' might be used
    uninitialized in this function
    ./../unix/tclLoadAout.c: In function
    `TclGuessPackageName':
    ./../unix/tclLoadAout.c:475: warning: suggest
    parentheses around assignment used as truth value
    ./../unix/tclLoadAout.c:473: warning: unused variable
    `dstOff'
    ./../unix/tclLoadAout.c:473: warning: unused variable
    `srcOff'
    
    After including unistd.h, the following additional
    problems appear:
    
    ./../unix/tclLoadAout.c:77: conflicting types for `brk'
    /usr/include/unistd.h:107: previous declaration of
    `brk'
    ./../unix/tclLoadAout.c:78: conflicting types for
    `sbrk'
    /usr/include/unistd.h:155: previous declaration of
    `sbrk'
    *** Error code 1
    
    Here are the patches to get it to compile cleanly:
    
    --- tcl.m4.old  Tue Jul 31 14:36:29 2001
    +++ tcl.m4      Tue Jul 31 16:43:08 2001
    @@ -1208,6 +1208,14 @@
                    fi
                fi
            fi
    +
    +       AC_MSG_CHECKING(for brk declaration in
    unistd.h)
    +       AC_EGREP_HEADER(brk, unistd.h, [
    +           AC_DEFINE(BRK_DECLARED)
    +           AC_MSG_RESULT(yes)
    +       ], [
    +           AC_MSG_RESULT(no)
    +       ])
         fi
     
         # Step 5: disable dynamic loading if requested via
    a command-line switch.
    
    --- tclLoadAout.c.old   Tue Jul 31 14:36:49 2001
    +++ tclLoadAout.c       Tue Jul 31 16:44:17 2001
    @@ -19,6 +19,11 @@
     
     #include "tclInt.h"
     #include <fcntl.h>
    +#ifdef HAVE_UNISTD_H
    +#   include <unistd.h>
    +#else
    +#   include "../compat/unistd.h"
    +#endif
     #ifdef HAVE_EXEC_AOUT_H
     #   include <sys/exec_aout.h>
     #endif
    @@ -69,8 +74,10 @@
      * Kernel calls that appear to be missing from the
    system .h files:
      */
     
    +#ifndef BRK_DECLARED
     extern char * brk _ANSI_ARGS_((char *));
     extern char * sbrk _ANSI_ARGS_((size_t));
    +#endif
     
     /*
      * The static variable SymbolTableFile contains the
    file name where the
    @@ -331,7 +338,7 @@
          Tcl_DString * buf;                /* Buffer where
    the -l an -L flags */
     {
       FILE * f;                    /* The load module */
    -  int c;                       /* Byte from the load
    module */
    +  int c = 0;                   /* Byte from the load
    module */
       char * p;
       Tcl_DString ds;
       CONST char *native;
    @@ -470,9 +477,8 @@
                                     * package name to this
    if possible. */
     {
         char *p, *q, *r;
    -    int srcOff, dstOff;
     
    -    if (q = strrchr(fileName,'/')) {
    +    if ((q = strrchr(fileName,'/'))) {
            q++;
         } else {
            q = fileName;
    
    
  4. foundin changed to: "obsolete: 8.3.3"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "lloydlim"
  9. subsystem changed to: "52. Portability Support"
  10. title changed to: "gcc warnings on FreeBSD 2.x"
  11. type changed to: "Bug"