make-w32
[Top][All Lists]
Advanced

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

Re: Bug report: Compile with Microsoft and Intel compiler


From: Eli Zaretskii
Subject: Re: Bug report: Compile with Microsoft and Intel compiler
Date: Wed, 27 Apr 2005 01:30:58 +0300

> From: =?iso-8859-1?Q?Jerker_B=E4ck?= <address@hidden>
> Date: Mon, 25 Apr 2005 16:57:01 +0200

Thanks for working on this.  My comments, questions and suggestions
below.

> Missing header:
> #include <direct.h>    (for chdir)
> place in make.h (ie line 364)

Is <direct.h> the only header where chdir's prototype is declared?
doesn't that compiler have it in unistd.h as well?  The latter is
where chdir's prototype lives on Posix platforms, so if we could use
the same with the MS compiler, it'd be better.

If using <direct.h> is the only way, then it will have to be
conditioned on some MS-specific symbol, since this is a non-standard
header which other compilers don't have.

> To support calling conventions:
> #if !defined(__cdecl) && !defined(_MSC_VER)
> #define C_CALLBACK
> #else 
> #define C_CALLBACK __cdecl
> #endif

I'd like to avoid this.  While it's true that some compiler switches
might make this necessary, there's no need for GNU Make to support
every possible switcj of every compiler.  I understand that there's a
way to avoid the need for __cdecl by using or not using specific
compiler switches.  If so, let's set up build_w32.bat and NMakefile so
that the issue with __cdecl never happens.

> Disable some trivial annoying warnings:
> #pragma warning(disable : 4100)               // unreferenced formal parameter
> #pragma warning(disable : 4127)               // conditional expression is
> constant
> #pragma warning(disable : 4131)               // uses old-style declarator

At what level of warnings are those issued?  If this is a maximum
level, it's easier not to use it than introduce pragmas (which are
unportable and could cause trouble with other compilers).  GCC will
also whine if used with all the possible -Wsomething switches, so we
simply don't do that.

> make.h(286) error C2373: redefinition;
> #undef  ANSI_STRING
> #undef  strerror
> #if !defined(ANSI_STRING) && !defined(__DECC)
> extern char *strerror PARAMS ((int errnum));
> #endif
> 
> This will always redefine strerror unless __DECC
> solution:
> #if !defined(__DECC) && !defined(_MSC_VER)

I think the above snippet from make.h is simply a bug, not only with
MSC.  Paul, I suggest the following patch:

--- make.h~1    2005-02-20 21:57:38.000000000 +0200
+++ make.h      2005-04-26 23:16:54.000000000 +0300
@@ -276,16 +276,16 @@ extern void bzero PARAMS ((char *, int))
 extern void bcopy PARAMS ((const char *b1, char *b2, int));
 # endif
 
-#endif  /* ANSI_STRING.  */
-#undef  ANSI_STRING
-
 /* SCO Xenix has a buggy macro definition in <string.h>.  */
 #undef  strerror
 
-#if !defined(ANSI_STRING) && !defined(__DECC)
+#ifndef __DECC
 extern char *strerror PARAMS ((int errnum));
 #endif
 
+#endif  /* ANSI_STRING.  */
+#undef  ANSI_STRING
+
 #if HAVE_INTTYPES_H
 # include <inttypes.h>
 #endif


> make.h(481):error C2373: redefinition; different type modifiers
> #ifdef  HAVE_GETCWD
> # if !defined(VMS) && !defined(__DECC)
> extern char *getcwd ();
> #endif
> #else
> extern char *getwd ();
> # define getcwd(buf, len)       getwd (buf)
> #endif
> 
> solution:
> #include <direct.h> at line 364
> # if !defined(VMS) && !defined(__DECC) && !defined(_MSC_VER)

Again: do you have the prototype of getcwd on unistd.h?

> make.h(490) error C4273: inconsistent dll linkage
> extern char **environ;
> 
> solution:
> #if !defined(_MSC_VER)

On what header is environ defined in that compiler, and what is the
decalration, exactly?

> -----------------------------------
> ar.c(301):error C4113:differs in parameter lists
> ar.c(301):error C2440:cannot convert from __stdcall to __cdecl

Is this problem going to disappear if you invoke the compiler in a way
that makes __cdecl the default?  If so, let's compile that way.

> arscan.c(611) : error C4057: differs in indirection to slightly different
> base types
> sscanf(member_header.ar_mode, "%o", &eltmode);
> 
> solution:
> sscanf((const char*)member_header.ar_mode, "%o", &eltmode);
> 
> likewise in arscan.c line 612,622,623,624 and 793

Paul, I agree with this suggestion, unless somehow using const will
screw other platforms.

> commands.c(36):error C2373:redefinition; different type modifiers
> #ifndef       HAVE_UNISTD_H
> extern int getpid ();
> #endif
> 
> solution:
> #if !defined(getpid) && !defined(_MSC_VER)

Could you please show the MSC declaration of getpid?  I cannot figure
out what is the reason for this error.

> commands.c(355):error C4242: conversion to smaller type, possible loss of
> data
> cmds->lines_flags[idx] = flags;
> 
> solution:
> cmds->lines_flags[idx] = (char)flags;

Okay.

> dir.c(141):error C4242: conversion to smaller type, possible loss of data
> *df++ = tolower((unsigned char)*filename);
> 
> solution:
> *df++ = (char)tolower((unsigned char)*filename);

Okay.

> dir.c(522):error C4057: differs in indirection to slightly different base
> types
> if (GetVolumeInformation(w32_path,
>      fs_label, sizeof (fs_label),
>        &fs_serno, &fs_len,
>        &fs_flags, fs_type, sizeof (fs_type)) == FALSE)
> 
> solution:
> Wrong type - could cause serious errors
> change dir.c line 422
> #ifdef WINDOWS32
>   char* w32_path;
>   char  fs_label[BUFSIZ];
>   char  fs_type[BUFSIZ];
>   unsigned long fs_serno;
>   unsigned long fs_flags;
>   unsigned long fs_len;
> #endif

The difference between long and unsigned long is certainly not going
to cause ``serious errors'', especially since these variables are
never used after the call to GetVolumeInformation.  I don't mind the
change, but could someone who has Windows development environment
installed please recheck that some other version of MSVC doesn't use
long instead of unsigned long?

> dir.c(614):error C4242:conversion to smaller type, possible loss of data
> dirfile_key.length = strlen (filename);
> 
> solution:
> dirfile_key.length = (short)strlen (filename);

Okay.

> likewise dir.c line 679,691,863 and 940

Okay.

> dir.c(1167):error C2373: different type modifiers
> #ifndef stat
> # ifndef VMS
> extern int stat PARAMS ((const char *path, struct stat *sbuf));
> # endif
> 
> solution:
> #if !defined(VMS) && !defined(_MSC_VER)

I think we should actually decrease the number of such ugly tricks,
not increase them.  There's no need for declaring the prototype of
stat here, since make.h already includes <sys/stat.h>.  Paul, how
about the following patch?

--- dir.c~1     2005-02-10 02:10:56.000000000 +0200
+++ dir.c       2005-04-26 23:37:58.000000000 +0300
@@ -1162,12 +1162,7 @@ ansi_free(void *p)
  * macro for stat64().  If stat is a macro, make a local wrapper function to
  * invoke it.
  */
-#ifndef stat
-# ifndef VMS
-extern int stat PARAMS ((const char *path, struct stat *sbuf));
-# endif
-# define local_stat stat
-#else
+#ifdef stat
 static int
 local_stat (const char *path, struct stat *buf)
 {
@@ -1176,6 +1171,8 @@ local_stat (const char *path, struct sta
   EINTRLOOP (e, stat (path, buf));
   return e;
 }
+#else
+# define local_stat stat
 #endif
 
 void


> dir.c(639):error C4701: local variable may be used without having been
> initialized
> 
> solution:
> dir.c(578)
> struct stat st = {0};

No, no, no, the compiler is right here: this is actually a bug, we
cannot use st.st_mtime without calling stat first.  Please try the
following patch:

--- dir.c~1     2005-02-10 02:10:56.000000000 +0200
+++ dir.c       2005-04-26 23:56:38.000000000 +0300
@@ -630,13 +630,13 @@ dir_contents_file_exists_p (struct direc
        * filesystems force a rehash always as mtime does not change
        * on directories (ugh!).
        */
-      if (dir->path_key
-         && (dir->fs_flags & FS_FAT
-             || (stat(dir->path_key, &st) == 0
-                 && st.st_mtime > dir->mtime)))
+      if (dir->path_key)
        {
-         /* reset date stamp to show most recent re-process */
-         dir->mtime = st.st_mtime;
+         if (!(dir->fs_flags & FS_FAT)
+             && (stat(dir->path_key, &st) == 0
+                 && st.st_mtime > dir->mtime))
+           /* reset date stamp to show most recent re-process */
+           dir->mtime = st.st_mtime;
 
          /* make sure directory can still be opened */
          dir->dirstream = opendir(dir->path_key);


> dir.c(1185):error C4113: differs in parameter lists
> dir.c(1186):error C4113: differs in parameter lists
> dir.c(1188):error C2440: cannot convert from __stdcall to __cdecl

This will go away if we force the compiler to use __cdecl by default,
right?  If so, let's do that.

> file.c(553):error C4296: expression is always false
> file.c(553):error C4307: integral constant overflow
> file.c(554):error C4296: expression is always false
> file.c(554):error C4307: integral constant overflow
> file.c(557):error C4296: expression is always false
> file.c(557):error C4307: integral constant overflow
> 
> This is apparently not working at all
> 
> Solution ?????????

I think these are caused by the expansion of the ORDINARY_MTIME_MAX
macro.  Can you show us its expansion by your compiler?

The first error (about expression being always false) is harmless.
It's the second one that bothers me.  What is the definition of
uintmax_t (on the inttypes.h header) for your compiler?

> function.c(270):error C4244: conversion to smaller type, possible loss of
> data
> function_table_entry_key.len = e - s;
> solution:
> function_table_entry_key.len = (unsigned char)(e - s);

Okay.

> ----------------------------------
> function.c(512):error C4130: logical operation on address of string constant
> function.c(536):error C4130: logical operation on address of string constant
> function.c(570):error C4130: logical operation on address of string constant
> function.c(622):error C4130: logical operation on address of string constant
> function.c(910):error C4130: logical operation on address of string constant

Is iAPX286 defined in your build?  If so, I think the funky
definitions of streq and strieq conditioned on iAPX286, which try to
``optimize'' strcmp should be tossed and we should use strcmp and
strcmpi, as the non-iAPX286 branch does.

Paul, do you agree?

> function.c(678):error C4706: assignment within conditional expression
> function.c(2060):error C4706: assignment within conditional expression
> 
> solution:
> coding style
> #pragma warning(disable : 4706)

I prefer to solve this without #pragma.  Paul, how about the
following?

--- function.c~1        2005-02-19 20:07:44.000000000 +0200
+++ function.c  2005-04-27 00:32:54.000000000 +0300
@@ -675,7 +675,7 @@ func_lastword (char *o, char **argv, con
   char *p = 0;
   char *t;
 
-  while ((t = find_next_token (&words, &i)))
+  while ((t = find_next_token (&words, &i)) != 0)
     p = t;
 
   if (p != 0)
@@ -2057,7 +2057,7 @@ handle_function (char **op, char **strin
   *stringp = end;
 
   /* Get some memory to store the arg pointers.  */
-  argvp = argv = (char **) alloca (sizeof (char *) * (nargs + 2));
+  argvp = (argv = (char **) alloca (sizeof (char *) * (nargs + 2)));
 
   /* Chop the string into arguments, then a nul.  As soon as we hit
      MAXIMUM_ARGS (if it's >0) assume the rest of the string is part of the


> function.c(1020):error C4242: conversion to smaller type, possible loss of
> data
> pp->str[pp->length] = pp->save_c;
> 
> solution:
> pp->str[pp->length] = (char)pp->save_c;

Okay.

> ----------------------------------
> function.c(1612):error C4057: differs in indirection to slightly different
> base
> fold_newlines (buffer, &i);
> 
> solution:
> fold_newlines (buffer, (int*)&i);

I prefer to actually fix the problem rather than work around it:

--- function.c~1        2005-02-19 20:07:44.000000000 +0200
+++ function.c  2005-04-27 00:37:40.000000000 +0300
@@ -1255,7 +1255,7 @@ func_value (char *o, char **argv, const 
   \r  is replaced on UNIX as well. Is this desirable?
  */
 void
-fold_newlines (char *buffer, int *length)
+fold_newlines (char *buffer, unsigned *length)
 {
   char *dst = buffer;
   char *src = buffer;
@@ -1641,7 +1641,8 @@ func_shell (char *o, char **argv, const 
   BPTR child_stdout;
   char tmp_output[FILENAME_MAX];
   unsigned int maxlen = 200;
-  int cc, i;
+  int cc;
+  unsigned i;
   char * buffer, * ptr;
   char ** aptr;
   int len = 0;


> fnmatch.c(123): error C2373: redefinition;
> # if !defined _LIBC && !defined getenv
> extern char *getenv ();
> # endif
> 
> solution:
> # if !defined _LIBC && !defined getenv && !defined(_MSC_VER)

Sigh.

> fnmatch.c(176):error C4244: conversion to smaller type, possible loss of
> data
> 
> solution:
> c = FOLD (c);
> c = (unsigned char)FOLD (c);
> 
> likewise in fnmatch.c line 176,198,273,320 and 326

Okay,

> ----------------------------------
> fnmatch.c(484):error C4028: formal parameters different from declaration
> warning #147: declaration is incompatible with
> "int fnmatch(char *, char *, int)" 
> (declared at line 77 of "..\glob\fnmatch.h")
> 
> solution: fnmatch.h(39)
> #ifndef const
> # if (defined __STDC__ && __STDC__) || defined __cplusplus
> #  define __const     const
> # else
> #  define __const
> # endif
> #endif
> 
> change to:
> # if (defined __STDC__ && __STDC__) || defined __cplusplus  || defined 
> WINDOWS32

That's because the compiler doesn't define __STDC__ to a non-zero
value.  Can you find a compiler switch that would force __STDC__ to be
non-zero?

> hash.c(49):error C4115: named type definition in parentheses
> likewise at line 265

I don't understand this one: what's wrong with a typecast?  The code
it is complaining about looks like this (after macro-expansion):

  ht->ht_vec = (void **) ((struct token * *)
                           calloc (sizeof(struct ht->token *), (ht->ht_size);

> hash.c(312):error C2440: cannot convert from __stdcall to __cdecl

__cdecl again...

> implicit.c(279):error C4242: conversion, possible loss of data
> implicit.c(416):error C4242: conversion, possible loss of data
> implicit.c(446):error C4242: conversion, possible loss of data
> 
> solution:
> checked_lastslash[nrules] = (char)check_lastslash;
> found_files_im[deps_found] = (unsigned char)dep->ignore_mtime;

Okay.

> job.c(180):error C2373: redefinition; different type modifiers
> job.c(181):error C2373: redefinition; different type modifiers
> job.c(182):error C2373: redefinition; different type modifiers
> 
> #ifndef       HAVE_UNISTD_H
> extern int dup2 ();
> extern int execve ();
> extern void _exit ();
> # ifndef VMS
> extern int geteuid ();
> extern int getegid ();
> extern int setgid ();
> extern int getgid ();
> # endif
> #endif
> 
> solution:
> #ifndef       HAVE_UNISTD_H
> #if !defined(_MSC_VER)
> extern int dup2 ();
> extern int execve ();
> extern void _exit ();
> #endif

Where (on what system header) in the MSC compiler do you have the
prototypes of dup2, execve and _exit?

> ...
> ----------------------------------
> job.c(540):error C4101: unreferenced local variable
> job.c(542):error C4189: local variable is initialized but not referenced
> job.c(621):error C4102: unreferenced label
> job.c(1441):error C4102: unreferenced label
> 
> solution:
> status, reap_more
> remote_status_lose:, error: 
> 
> ?????
> comment out is not safe - may be needed

These variables and labels should be #ifdef'ed conditioned on the same
macros as the code fragments that use them.

> job.c(750):error C4389: signed/unsigned mismatch
> if(c->remote == remote && c->pid == pid)
> 
> solution:
> if(c->remote == (unsigned int)(remote && c->pid == pid))

This is wrong, you probably meant

  if(c->remote == (unsigned int)remote && c->pid == pid)


> job.c(740):error C4701: local variable may be used without having been
> initialized
> job.c(787):error C4701: local variable may be used without having been
> initialized
> 
> solution: 
> job.c(564)
> int exit_code = 0, exit_sig = 0, coredump = 0;

They are initialized around line 702, so the compiler is wrong.  But
it's okay to initialize in another place, I guess.

> main.c(77):error C2373: redefinition; different type modifiers
> #ifndef       HAVE_UNISTD_H
> extern int chdir ();
> #endif

On what header do you have the prototype of chdir?

> main.c(823):error C2373: redefinition; different type modifiers
> extern char *mktemp PARAMS ((char *template));

On what header do you have the prototype of mktemp?

> main.c(831):error C4101: unreferenced local variable
> 
> solution: comment out
> int fd

No! it is used on some platforms.  It is better to say

  #ifdef HAVE_FDOPEN
  int fd;
  #endif

Btw, doesn't this compiler have fdopen?  If it does, why doesn't it
use the HAVE_FDOPEN branch?

> main.c(873) : error C4007: 'main' : must be '__cdecl'

__cdecl again...

> main.c(953):error C2440: cannot convert from __stdcall to __cdecl

...and again...

> main.c(1481):error C4210: nonstandard extension used : function given file
> scope
> extern RETSIGTYPE child_handler PARAMS ((int sig));
> 
> solution:
> place the prototype outside of function

I don't see any need to do that, the code is perfectly valid as it
is.

> main.c(1725):error C4296: expression is always false
> f->last_mtime = f->mtime_before_update = NEW_MTIME;
> 
> solution: ??

Something is wrong here, the error message doesn't make sense since
the line is not a comparison that yields true or false.  Does the
problem go away if you break that line into two, like below?

   f->mtime_before_update = NEW_MTIME;
   f->last_mtime = f->mtime_before_update;

> main.c(2131):error C4242: conversion, possible loss of data
> *p++ = switches[i].c;
> 
> solution:
> *p++ = (char)switches[i].c;
> 
> likewise at main.c line 2663

Okay.

> read.c(1462):error C4244: conversion, possible loss of data
> = (v != 0 && *v->value != '\0') == notdef;
> 
> solution:
> = (char)((v != 0 && *v->value != '\0') == notdef);

I think the compiler complains about the "v != 0" part, in which case
we could replace it with "v != NULL".

> likewise at read.c line 1558
> = (char)(streq (s1, s2) == notdef);

Okay.

> read.c(1790):error C4130:logical operation on address of string constant
> if (streq (name, ".POSIX"))
> 
> solution:
> coding style
> #pragma warning(disable : 4130)

No, this is due to the same problem with streq as I analyzed above.


> read.c(2484):error C4245: conversion, signed/unsigned mismatch
> static unsigned long
> readstring (struct ebuffer *ebuf)
> {
>   char *eol;
>   if (ebuf->bufnext >= ebuf->bufstart + ebuf->size)
>     return -1;
> 
> solution: (type safe?)
> return (unsigned long)-1;

Okay.

> read.c(2916):error C4210: nonstandard extension used : function given file
> scope
> read.c(2916):error C2373: redefinition; different type modifiers
> #ifndef VMS
>   if (name[1] == '/' || name[1] == '\0')
>     {
>       extern char *getenv ();
> 
> solution:
> #if !defined(_MSC_VER)
>       extern char *getenv ();
> #endif

I think we should use this prototype only if there's no stdlib.h.
Paul, I suggest the following:

--- read.c~1    2004-10-05 18:56:14.000000000 +0200
+++ read.c      2005-04-27 01:14:28.000000000 +0300
@@ -2913,7 +2913,9 @@ tilde_expand (char *name)
 #ifndef VMS
   if (name[1] == '/' || name[1] == '\0')
     {
+#if !defined(STDC_HEADERS) && !defined(HAVE_STDLIB_H)
       extern char *getenv ();
+#endif
       char *home_dir;
       int is_variable;
 
> read.c(2994):error C4210: nonstandard extension used : function given file
> scope
> extern void dir_setup_glob ();
> 
> solution:
> place the prototype outside of function

No need to change anything, the compiler is wrong.

> remake.c(431):error C4296: expression is always false
> remake.c(431):error C4307: integral constant overflow
> 
> solution: ?????

That's the same problem as before with ORDINARY_MTIME_MAX.  Let's
revisit that after you find out what is its expansion.

> remake.c(606):error C4242: conversion, possible loss of data
> remake.c(823):error C4242: conversion, possible loss of data
> file->update_status = dep_status;
> file->update_status = touch_file (file);
> 
> solution:
> file->update_status = (short)dep_status;
> file->update_status = (short)touch_file (file);

Okay.

> remake.c(862):error C4296: expression is always false
> file->last_mtime = i == 0 ? UNKNOWN_MTIME : NEW_MTIME;
> 
> solution: ?????

No solution needed: the compiler is whining about valid code.

> rule.c(396):error C4242: conversion, possible loss of data
> rule.c(514):error C4242: conversion, possible loss of data
> r->terminal = terminal;
> 
> solution:
> r->terminal = (char)terminal;

Okay.

> signame.c(241):error C4242: conversion, possible loss of data
> sig_initted = signame_init ();
> 
> solution:
> sig_initted = (char)signame_init ();

Okay.

> variable.c(285):error C4130: logical operation on address of string constant
> variable.c(868):error C4130: logical operation on address of string constant
> variable.c(1118):error C4130: logical operation on address of string constant

streq strikes again...

> vpath.c(533):error C4701: local variable may be used without having been
> initialized
> *mtime_ptr = (exists_in_cache
>       ? FILE_TIMESTAMP_STAT_MODTIME (name, st)
>         : UNKNOWN_MTIME);
> 
> solution: (good?)
> vpath.c(503)
> if (exists)
> {
>       struct stat st = {0};

Something like that.

> glob.c(500):error C4389: signed/unsigned mismatch
> glob.c(871):error C4018: signed/unsigned mismatch
> glob.c(922):error C4389: signed/unsigned mismatch
> glob.c(949):error C4018: signed/unsigned mismatch
> glob.c(1011):error C4018: signed/unsigned mismatch
> glob.c(1029):error C4018: signed/unsigned mismatch
> glob.c(1052):error C4018: signed/unsigned mismatch
> glob.c(1072):error C4018: signed/unsigned mismatch
> if (pglob->gl_pathc != firstc)
> ...
> 
> solution:
> if (pglob->gl_pathc != (__size_t)firstc)
> for (i = 0; i < (int)dirs.gl_pathc; ++i)
> if ((flags & GLOB_DOOFFS) && ignore < (int)pglob->gl_offs)
> if ((flags & GLOB_DOOFFS) && pglob->gl_offs > (__size_t)oldcount)

Sigh...

> glob.c(570):error C4013: func undefined; assuming extern returning int
> 
> solution:
> glob.c line 302
> #ifdef VMS
> #if !defined _LIBC || !defined NO_GLOB_PATTERN_P
> int __glob_pattern_p (const char *pattern, int quote);
> #endif
> #endif
> 
> change to
> #if defined(VMS) || defined(_MSC_VER)

Can't we use the prototype for all platforms?  Paul?

> glob.c(1057):error C2440:  cannot convert from __stdcall to __cdecl

__cdecl again...

> glob.c(1156):error C4242:  conversion, possible loss of data
> 
> solution:
> new[dirlen] = (char)DIRSEP_CHAR;

Okay.

> dirent.c(117):error C4245: conversion, signed/unsigned mismatch
> 
> solution:
> pDir->dir_sdReturn.d_ino = (ino_t)-1;

Okay.

> sub_proc.c(539) : error C4213: nonstandard extension used : cast on l-value
> sub_proc.c(543) : error C4213: nonstandard extension used : cast on l-value
> sub_proc.c(547) : error C4213: nonstandard extension used : cast on l-value
> sub_proc.c(677) : error C4213: nonstandard extension used : cast on l-value
> sub_proc.c(742) : error C4213: nonstandard extension used : cast on l-value
> sub_proc.c(750) : error C4213: nonstandard extension used : cast on l-value
> sub_proc.c(758) : error C4213: nonstandard extension used : cast on l-value
> (HANDLE)pproc->sv_stdin[1] = 0;
> 
> solution:
> pproc->sv_stdin[1] = 0;
> 
> likewise sub_proc.c line 543,547,677,742,750,758

Okay.

> sub_proc.c(765) : error C4057: differs in indirection to slightly different
> base types
> sub_proc.c(855) : error C4057: differs in indirection to slightly different
> base types
> 
> solution:
> sub_proc.c(26)
> typedef struct sub_process_t {
>       int sv_stdin[2];
>       int sv_stdout[2];
>       int sv_stderr[2];
>       int using_pipes;
>       char *inp;
>       DWORD incnt;
>       char * volatile outp;
>       volatile DWORD outcnt;
>       char * volatile errp;
>       volatile DWORD errcnt;
>       int pid;
>       int exit_code;
>       int signal;
>       long last_err;
>       long lerrno;
> } sub_process;
> 
> change to
> unsigned long exit_code;

Are you sure it's "unsigned long", not "unsigned int"?  I'd be
surprised.

> sub_proc.c(782):error C4701: local variable may be used without having been
> initialized
> sub_proc.c(784):error C4701: local variable may be used without having been
> initialized
> sub_proc.c(786):error C4701: local variable may be used without having been
> initialized
> 
> solution: (good?)
> sub_proc(660)
> HANDLE tStdin, tStdout, tStderr;
> 
> change to
> HANDLE tStdin = 0, tStdout = 0, tStderr = 0;

Better initialize them to -1, since 0 is a valid handle.

> sub_proc.c(575) : error C4702: unreachable code
> sub_proc.c(607) : error C4702: unreachable code
> sub_proc.c(638) : error C4702: unreachable code
> 
> solution:
> coding style
> #pragma warning(disable : 4702)

Okay.

> pathstuff.c(49):error C4706: assignment within conditional expression
> pathstuff.c(91):error C4706: assignment within conditional expression
> 
> solution:
> coding style
> #pragma warning(disable : 4706)

Okay.




reply via email to

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