make-w32
[Top][All Lists]
Advanced

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

Compile warning fixes


From: J. Grant
Subject: Compile warning fixes
Date: Mon, 01 Mar 2004 00:33:22 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5b) Gecko/20030824

Hello

I attach a single patch (I can create individual file patches if
necessary for review) to correct quite a few of the code warnings
present which affect the Windows32 port.  Most of these issues will be
noticeable on other platforms I expect too.


2004-02-28  Jonathan R. Grant  <address@hidden>

        * arscan.c: Change "while(1)" to "for(;;)" to correct "condition
        expression is constant warning. (line 425)

        Add "(void)hdr;" to correct unused variable warning. (Line 724)


        * dir.c: Change "while (1)" to "for (;;)" to correct "conditional
        expression is constant" warning. (Line 655)


        * expand.c: Change "while (1)" to "for (;;)" to correct "conditional
        expression is constant" warning. (Line 199)


        * job.c: Add preprocessor definition check so that "WAIT_T
        status;" and "int reap_more = 1;" are only declared on
        non-(__MSDOS__, _AMIGA, WINDOWS32) builds to avoid having a
        warning "'status' : unreferenced local variable" warning when
        compiling (identified on Windows32 build). (Line 450)

        Change "register int pid" to "pid_t pid".  As it is only
        compared with the "struct child" element "pid_t pid"; so it is
        more appropriate that they are both the same type. (Line 472)

        Stop definition of remote_status_lose branch on builds
        that do not use this. (__MSDOS__, _AMIGA, WINDOWS32).  (Line 533)

        Initalise exit_code, exit_sig and coredump to -1, to correct
        warning about possible use without being initalised.  (Line 619)

        Move function call and assignment to variable (hPID =
        process_wait_for_any()) to before "if" to stop MSVC compile
        warning.  (Line 621)

        "error:" branch target only declared on on-(__MSDOS__, _AMIGA,
        WINDOWS32) to correct unreferenced branch target warning. (Line
        1352)

        Revise if(hWaitPID = process_wait_for_any() by moving the function
        call/assignment out of the "if" to avoid compile warning.
        (Line 2498)


        * main.c: Add "#include <io.h>", to the WINDOWS32 include block,
        to correct "'close' undefined; assuming extern returning int"
        compile warning.  (Line 38)

        Add check on debug_signal_handler function implementation to
        match the prototype, SIGUSR1 macro definition check.  To
        correct "debug_signal_handler local function is unused" compile
        warning.  (Line 548)

        Change "while (1)" to "for (;;)" to stop "conditional expression is
        constant" warning. (Line 568)

        Add preprocessor definition check for HAVE_MKSTEMP || defined
        HAVE_FDOPEN.  As these are the only two cases when "int fd;" is
        used.  (Line 794)

        
        * read.c: "while (1)" to "for (;;)" to correct "conditional
        expression is constant" warnings. Seven instances, (Lines 505,
        932, 1275, 2171, 2257, 2499, 2716)


        * variable.c: "while (1)" to "for (;;)" to stop "conditional
        expression is constant" warning. (Line 1152)


        * glob/fnmatch.c: fnmatch() change "const" to "__const" to match that of
        the prototype in <fnmatch.h>.  "__const" which resolves to "const" on
        C++ compilers and "" on C compilers I believe.  (Line 481)


        * glob/fnmatch.h: Check HAVE_FNMATCH and give an error if this file
        included by accident.

        Change fnmatch __const char * arguments to match that of the
        "fnmatch.c" file which follows the standard version argument convention.


        * glob/glob.c: Check HAVE_FNMATCH to ensure that the correct header
        file is included.  Either the system include <fnmatch.h>, or the local
        "fnmatch.h".  (Line 268)

        Add WINDOWS32 define check to create a "__glob_pattern_p"
        function definition.  Otherwise there is a "'__glob_pattern_p'
        undefined; assuming extern returning int" warning when compiling. (line
        302)

        Change "while(1)" to "for(;;)" to correct compiler warning about
        constant expression. Several (Lines 329, 460, 1320)

        In glob() change "oldcount" to be "size_t" it is a backup of an a
        struct member which is "size_t".  This corrects the signed/unsigned
        comparison mismatch compile warning.  (Line 373)

        Change "firstc" to be "size_t" as it is a backup of a "size_t" struct
        member.  This corrects the unsigned/signed compile warning.  (line 388)

        
        Change "ignore" to be "size_t" as it is a backup of a "size_t struct
        member. This corrects the unsigned/signed compile warning.  (Line 1016)

        glob(): Loop variable "int i" changed to "size_t i" as it is never
        negative and is compared against "pglob->gl_pathc" which is also
        of type "size_t".  (Line 1027)

        Change "register int i;" to "size_t i;". This loop variable will only
        ever be positive.  The comparison is with a size_t struct member.  This
        corrects the signed/unsigned comparison mismatch compile warning.
        (line 859)
        
        In globfree(): Change "register int i;" to "size_t i;". This loop
        variable will only ever be positive.  The comparison is with a size_t
        struct member.  This corrects the signed/unsigned comparison mismatch
        compile warning.  (line 1071)



These changes were tested on Windows32 build.  I did not use the
testsuite on Windows32 build as I could not get it working (I tested on
GNU/Linux after upgrading automake, autoconf and gettext).  Review of
these revisions for addition very welcome.  Let me know if anything is
needed of me.

$ ./run_make_tests
------------------------------------------------------------------------------
          Running tests for GNU make on Linux now1g 2.4.19-16mdk i686
                                GNU Make 3.81rc1
------------------------------------------------------------------------------
<snip>
functions/origin ........................................ FAILED


$ cat origin.diff
*** work/functions/origin.base  Mon Mar  1 00:19:21 2004
--- work/functions/origin.log   Mon Mar  1 00:19:21 2004
***************
*** 1,4 ****
! undefined default environment default file command line override automatic
   undefined
   default
   environment
--- 1,4 ----
! undefined default default file command line override automatic
   undefined
   default
   environment


This will not have been caused by my warning fixes.  Is anyone looking
into this test failure?  (I could not spot this on the savanah bug list)


Best regards

JG








Attachment: w32_fixes_07.patch.gz
Description: application/gzip


reply via email to

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