develooper Front page | perl.perl5.porters | Postings from June 2001

Re: [PATCH 5.6.1] OS2 warnings

From:
Ilya Zakharevich
Date:
June 24, 2001 02:37
Subject:
Re: [PATCH 5.6.1] OS2 warnings
Message ID:
20010624053719.A27866@math.ohio-state.edu
This patch pacifies warnings from os2-specific code, and fixes one of
two errors uncovered by the warnings (= instead of ==).  [The other
error is "may be used uninitialized" within a maze of goto's.  Need to
investigate it further.]

Enjoy,
Ilya

--- ./os2/os2ish.h-pre-decl	Sat Jun 23 18:11:02 2001
+++ ./os2/os2ish.h	Sat Jun 23 20:34:52 2001
@@ -1,4 +1,6 @@
 #include <signal.h>
+#include <io.h>
+/* #include <sys/select.h> */
 
 /* HAS_IOCTL:
  *	This symbol, if defined, indicates that the ioctl() routine is
@@ -471,6 +473,14 @@ void init_PMWIN_entries(void);
 char *perllib_mangle(char *, unsigned int);
 
 char *os2error(int rc);
+int os2_stat(const char *name, struct stat *st);
+int setpriority(int which, int pid, int val);
+int getpriority(int which /* ignored */, int pid);
+
+#ifdef PERL_CORE
+int os2_do_spawn(pTHX_ char *cmd);
+int os2_do_aspawn(pTHX_ SV *really, void **vmark, void **vsp);
+#endif
 
 #ifndef LOG_DAEMON
 
--- ./os2/os2.c-pre-decl	Sat Jun 23 18:08:28 2001
+++ ./os2/os2.c	Sat Jun 23 19:40:36 2001
@@ -202,7 +202,7 @@ loadModule(char *modname)
     return h;
 }
 
-APIRET
+void
 loadByOrd(char *modname, ULONG ord)
 {
     if (ExtFCN[ord] == NULL) {
@@ -236,7 +236,6 @@ init_PMWIN_entries(void)
 	753,				/* GetLastError */
 	705,				/* CancelShutdown */
     };
-    BYTE buf[20];
     int i = 0;
     unsigned long rc;
 
@@ -303,10 +302,7 @@ sys_prio(pid)
 int 
 setpriority(int which, int pid, int val)
 {
-  ULONG rc, prio;
-  PQTOPLEVEL psi;
-
-  prio = sys_prio(pid);
+  ULONG rc, prio = sys_prio(pid);
 
   if (!(_emx_env & 0x200)) return 0; /* Nop if not OS/2. */
   if (priors[(32 - val) >> 5] + 1 == (prio >> 8)) {
@@ -346,20 +342,13 @@ setpriority(int which, int pid, int val)
 int 
 getpriority(int which /* ignored */, int pid)
 {
-  TIB *tib;
-  PIB *pib;
-  ULONG rc, ret;
+  ULONG ret;
 
   if (!(_emx_env & 0x200)) return 0; /* Nop if not OS/2. */
-  /* DosGetInfoBlocks has old priority! */
-/*   if (CheckOSError(DosGetInfoBlocks(&tib, &pib))) return -1; */
-/*   if (pid != pib->pib_ulpid) { */
   ret = sys_prio(pid);
   if (ret == PRIO_ERR) {
       return -1;
   }
-/*   } else */
-/*       ret = tib->tib_ptib2->tib2_ulpri; */
   return (1 - priors[((ret >> 8) - 1)])*32 - (ret & 0xFF);
 }
 
@@ -485,14 +474,15 @@ do_spawn_ve(pTHX_ SV *really, U32 flag, 
 	int trueflag = flag;
 	int rc, pass = 1;
 	char *tmps;
-	char buf[256], *s = 0;
+	char buf[256];
 	char *args[4];
 	static char * fargs[4] 
 	    = { "/bin/sh", "-c", "\"$@\"", "spawn-via-shell", };
 	char **argsp = fargs;
-	char nargs = 4;
+	int nargs = 4;
 	int force_shell;
- 	int new_stderr = -1, nostderr = 0, fl_stderr;
+ 	int new_stderr = -1, nostderr = 0;
+	int fl_stderr = 0;		/* Pacify the warning */
 	STRLEN n_a;
 	
 	if (flag == P_WAIT)
@@ -728,7 +718,7 @@ do_spawn_ve(pTHX_ SV *really, U32 flag, 
 				if (inicmd) { /* No spaces at start! */
 				    s = inicmd;
 				    while (*s && !isSPACE(*s)) {
-					if (*s++ = '/') {
+					if (*s++ == '/') {
 					    inicmd = NULL; /* Cannot use */
 					    break;
 					}
@@ -828,10 +818,8 @@ do_spawn3(pTHX_ char *cmd, int execf, in
 {
     register char **a;
     register char *s;
-    char flags[10];
     char *shell, *copt, *news = NULL;
-    int rc, err, seenspace = 0, mergestderr = 0;
-    char fullcmd[MAXNAMLEN + 1];
+    int rc, seenspace = 0, mergestderr = 0;
 
 #ifdef TRYSHELL
     if ((shell = getenv("EMXSHELL")) != NULL)
@@ -951,8 +939,10 @@ do_spawn3(pTHX_ char *cmd, int execf, in
 
 /* Array spawn.  */
 int
-os2_do_aspawn(pTHX_ SV *really, register SV **mark, register SV **sp)
+os2_do_aspawn(pTHX_ SV *really, register void **vmark, register void **vsp)
 {
+    register SV **mark = (SV **)vmark;
+    register SV **sp = (SV **)vsp;
     register char **a;
     int rc;
     int flag = P_WAIT, flag_set = 0;
@@ -1016,13 +1006,11 @@ PerlIO *
 my_syspopen(pTHX_ char *cmd, char *mode)
 {
 #ifndef USE_POPEN
-
     int p[2];
     register I32 this, that, newfd;
-    register I32 pid, rc;
-    PerlIO *res;
+    register I32 pid;
     SV *sv;
-    int fh_fl;
+    int fh_fl = 0;			/* Pacify the warning */
     
     /* `this' is what we use in the parent, `that' in the child. */
     this = (*mode == 'w');
@@ -1195,7 +1183,7 @@ int	setgid(x)	{ errno = EINVAL; return -
        used with 5.001. Now just look for /dev/. */
 
 int
-os2_stat(char *name, struct stat *st)
+os2_stat(const char *name, struct stat *st)
 {
     static int ino = SHRT_MAX;
 
@@ -1287,8 +1275,6 @@ mod2fname(pTHX_ SV *sv)
     static char fname[9];
     int pos = 6, len, avlen;
     unsigned int sum = 0;
-    AV  *av;
-    SV  *svp;
     char *s;
     STRLEN n_a;
 
@@ -1760,8 +1746,8 @@ XS(XS_OS2_Process_Messages)
 	if (items == 2) {
 	    I32 cntr;
 	    SV *sv = ST(1);
-	    int fake = SvIV(sv);	/* Force SvIVX */
-	    
+
+	    (void)SvIV(sv);		/* Force SvIVX */	    
 	    if (!SvIOK(sv))
 		Perl_croak_nocontext("Can't upgrade count to IV");
 	    cntr = SvIVX(sv);
@@ -1954,8 +1940,6 @@ XS(XS_Cwd_sys_abspath)
 		   In all the cases it is safe to drop the drive part
 		   of the path. */
 		if ( !sys_is_relative(path) ) {
-		    int is_drived;
-
 		    if ( ( ( sys_is_absolute(dir)
 			     || (isALPHA(dir[0]) && dir[1] == ':' 
 				 && strnicmp(dir, path,1) == 0)) 
@@ -2192,6 +2176,7 @@ Xs_OS2_init(pTHX)
 	GvMULTI_on(gv);
 	sv_setnv(GvSV(gv), _osmajor + 0.001 * _osminor);
     }
+    return 0;
 }
 
 OS2_Perl_data_t OS2_Perl_data;
@@ -2237,7 +2222,6 @@ char *
 my_tmpnam (char *str)
 {
     char *p = getenv("TMP"), *tpath;
-    int len;
 
     if (!p) p = getenv("TEMP");
     tpath = tempnam(p, "pltmp");
--- ./os2/dl_os2.c-pre-decl	Sat Jun  2 09:11:00 2001
+++ ./os2/dl_os2.c	Sat Jun 23 20:51:34 2001
@@ -1,4 +1,6 @@
 #include "dlfcn.h"
+#include "string.h"
+#include "stdio.h"
 
 #define INCL_BASE
 #include <os2.h>
@@ -67,10 +69,10 @@ dlerror(void)
 			  "OSO001.MSG", &len)) {
 		if (fail[0])
 		  sprintf(buf, 
-"OS/2 system error code %d, possible problematic module: '%s'",
+"OS/2 system error code %lu, possible problematic module: '%s'",
 			  retcode, fail);
 		else
-		  sprintf(buf, "OS/2 system error code %d", retcode);
+		  sprintf(buf, "OS/2 system error code %lu", retcode);
 	} else {
 		buf[len] = '\0';
 		if (len && buf[len - 1] == '\n')



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About