#1556 gcc warnings on FreeBSD

obsolete: 8.3.3
closed-wont-fix
Mo DeJong
5
2001-09-09
2001-07-19
Lloyd Lim
No

Compiling Tcl on FreeBSD 2.x, 3.x, and 4.x gives the following warnings:

./../generic/tclIOSock.c: In function `TclSockMinimumBuffers':
./../generic/tclIOSock.c:103: warning: passing arg 5 of `setsockopt' as signed due to prototype
./../generic/tclIOSock.c:109: warning: passing arg 5 of `setsockopt' as signed due to prototype
./../unix/tclUnixFCmd.c: In function `DoCopyFile':
./../unix/tclUnixFCmd.c:389: warning: passing arg 2 of `mknod' with different width due to
prototype
./../unix/tclUnixFCmd.c:395: warning: passing arg 2 of `mkfifo' with different width due to
prototype
./../unix/tclUnixFCmd.c: In function `DoCreateDirectory':
./../unix/tclUnixFCmd.c:593: warning: passing arg 1 of `umask' with different width due to
prototype
./../unix/tclUnixFCmd.c:594: warning: passing arg 1 of `umask' with different width due to
prototype
./../unix/tclUnixFCmd.c:602: warning: passing arg 2 of `mkdir' with different width due to prototype
./../unix/tclUnixFCmd.c: In function `CopyFileAtts':
./../unix/tclUnixFCmd.c:1038: warning: passing arg 2 of `chmod' with different width due to
prototype
./../unix/tclUnixFCmd.c:1040: warning: passing arg 2 of `chmod' with different width due to
prototype
./../unix/tclUnixFCmd.c: In function `SetPermissionsAttribute':
./../unix/tclUnixFCmd.c:1383: warning: passing arg 2 of `chmod' with different width due to
prototype

(The tclIOSock.c warnings are only on FreeBSD 2.x and 3.x.)

These warnings are caused by the -Wconversion flag. I don't think this warning option is very
useful. The bad thing is that these warnings cannot be eliminated by modifying the code.
Therefore, I would recommend removing -Wconversion.

Here is a patch to remove -Wconversion:

--- tcl.m4.old Thu Jul 19 15:16:21 2001
+++ tcl.m4 Thu Jul 19 15:17:38 2001
@@ -605,7 +605,7 @@
CFLAGS_DEBUG=-g
CFLAGS_OPTIMIZE=-O
if test "$using_gcc" = "yes" ; then
- CFLAGS_WARNING="-Wall -Wconversion -Wno-implicit-int"
+ CFLAGS_WARNING="-Wall -Wno-implicit-int"
else
CFLAGS_WARNING=""
fi

Discussion

    • assigned_to: nobody --> mdejong
     
  • Mo DeJong
    Mo DeJong
    2001-08-12

    Logged In: YES
    user_id=90858

    I don't know about this patch. It removes the -Wconversion
    flag for all systems. I can't help but think that a couple
    of casts could be added to deal with the extra warnings
    instead of just turning off the warnings in the compiler.
    What is your take on adding casts and possible autoconf
    tests to deal with this issue?

     
  • Mo DeJong
    Mo DeJong
    2001-09-09

    • status: open --> closed-wont-fix
     
  • Mo DeJong
    Mo DeJong
    2001-09-09

    Logged In: YES
    user_id=90858

    I just did a build on FreeBSD 4.X and only got warnings
    from tclUnixFCmd.c. It looks like the system .h files
    for functions like mknod() are doing something strange.
    I don't think this is a Tcl problem and removing the
    -W just hides the problem. You might want to check into
    the #ifdefs in system headers like /usr/include/sys/stat.h
    to see if defines like _POSIX_SOURCE would address
    this. Closing this bug report.