Keep gcc -Wall happy.

This commit is contained in:
Guido van Rossum 1996-12-05 23:43:35 +00:00
parent 60fca2c90f
commit a376cc5cc8
27 changed files with 93 additions and 56 deletions

View File

@ -168,9 +168,13 @@ typedef struct {
WINDOW *pad;
} PyCursesPadObject;
#if 0
staticforward PyTypeObject PyCursesScreen_Type;
#endif
staticforward PyTypeObject PyCursesWindow_Type;
#if 0
staticforward PyTypeObject PyCursesPad_Type;
#endif
#define PyCursesScreen_Check(v) ((v)->ob_type == &PyCursesScreen_Type)
#define PyCursesWindow_Check(v) ((v)->ob_type == &PyCursesWindow_Type)
@ -386,7 +390,7 @@ PyCursesWindow_AddCh(self,arg)
int rtn;
int x, y;
int ch;
int attr, attr_old;
int attr, attr_old = 0;
int use_xy = FALSE, use_attr = FALSE;
switch (ARG_COUNT(arg)) {
@ -436,7 +440,7 @@ PyCursesWindow_InsCh(self,arg)
int rtn;
int x, y;
int ch;
int attr, attr_old;
int attr, attr_old = 0;
int use_xy = TRUE, use_attr = FALSE;
switch (ARG_COUNT(arg)) {
@ -542,7 +546,7 @@ PyCursesWindow_AddStr(self,arg)
int rtn;
int x, y;
char *str;
int attr, attr_old;
int attr, attr_old = 0;
int use_xy = FALSE, use_attr = FALSE;
switch (ARG_COUNT(arg)) {
@ -1116,6 +1120,7 @@ PyCursesPad_New(pad)
/* -------------------------------------------------------*/
#if 0
static PyTypeObject PyCursesScreen_Type = {
PyObject_HEAD_INIT(&PyType_Type)
0, /*ob_size*/
@ -1134,6 +1139,7 @@ static PyTypeObject PyCursesScreen_Type = {
0, /*tp_as_mapping*/
0, /*tp_hash*/
};
#endif
static PyTypeObject PyCursesWindow_Type = {
PyObject_HEAD_INIT(&PyType_Type)
@ -1154,6 +1160,7 @@ static PyTypeObject PyCursesWindow_Type = {
0, /*tp_hash*/
};
#if 0
static PyTypeObject PyCursesPad_Type = {
PyObject_HEAD_INIT(&PyType_Type)
0, /*ob_size*/
@ -1172,6 +1179,7 @@ static PyTypeObject PyCursesPad_Type = {
0, /*tp_as_mapping*/
0, /*tp_hash*/
};
#endif
/* -------------------------------------------------------*/

View File

@ -1051,7 +1051,7 @@ Tktt_Print (self, fp, flags)
{
TkttObject *v = (TkttObject *) self;
fprintf(fp, "<tktimertoken at 0x%x%s>", v,
fprintf(fp, "<tktimertoken at 0x%lx%s>", (long)v,
v->func == NULL ? ", handler deleted" : "");
return 0;
}
@ -1139,6 +1139,7 @@ Tkapp_MainLoop (self, args)
quitMainLoop = 0;
while (Tk_GetNumMainWindows() > threshold && !quitMainLoop && !errorInCmd)
{
/* XXX Ought to check for other signals! */
if (PyOS_InterruptOccurred ())
{
PyErr_SetNone (PyExc_KeyboardInterrupt);

View File

@ -366,7 +366,6 @@ al_writesamps (self, args)
portobject *self;
object *args;
{
long count;
char *buf;
int size, width;
ALconfig c;
@ -623,7 +622,6 @@ al_queryparams(self, args)
long *PVbuffer;
long PVdummy[2];
object *v;
object *w;
if (!getlongarg (args, &device))
return NULL;

View File

@ -64,11 +64,15 @@ staticforward typeobject Arraytype;
/* Forward */
static object *newarrayobject PROTO((int, struct arraydescr *));
#if 0
static int getarraysize PROTO((object *));
#endif
static object *getarrayitem PROTO((object *, int));
static int setarrayitem PROTO((object *, int, object *));
#if 0
static int insarrayitem PROTO((object *, int, object *));
static int addarrayitem PROTO((object *, object *));
#endif
static object *
c_getitem(ap, i)
@ -278,6 +282,7 @@ newarrayobject(size, descr)
return (object *) op;
}
#if 0
static int
getarraysize(op)
object *op;
@ -288,6 +293,7 @@ getarraysize(op)
}
return ((arrayobject *)op) -> ob_size;
}
#endif
static object *
getarrayitem(op, i)
@ -338,6 +344,7 @@ ins1(self, where, v)
return (*self->ob_descr->setitem)(self, where, v);
}
#if 0
static int
insarrayitem(op, where, newitem)
object *op;
@ -363,6 +370,7 @@ addarrayitem(op, newitem)
return ins1((arrayobject *)op,
(int) ((arrayobject *)op)->ob_size, newitem);
}
#endif
/* Methods */

View File

@ -175,7 +175,7 @@ audioop_getsample(self, args)
object *args;
{
signed char *cp;
int len, size, val;
int len, size, val = 0;
int i;
if ( !getargs(args, "(s#ii)", &cp, &len, &size, &i) )
@ -200,7 +200,7 @@ audioop_max(self, args)
object *args;
{
signed char *cp;
int len, size, val;
int len, size, val = 0;
int i;
int max = 0;
@ -226,7 +226,7 @@ audioop_minmax(self, args)
object *args;
{
signed char *cp;
int len, size, val;
int len, size, val = 0;
int i;
int min = 0x7fffffff, max = -0x7fffffff;
@ -252,7 +252,7 @@ audioop_avg(self, args)
object *args;
{
signed char *cp;
int len, size, val;
int len, size, val = 0;
int i;
float avg = 0.0;
@ -281,7 +281,7 @@ audioop_rms(self, args)
object *args;
{
signed char *cp;
int len, size, val;
int len, size, val = 0;
int i;
float sum_squares = 0.0;
@ -493,7 +493,7 @@ audioop_avgpp(self, args)
object *args;
{
signed char *cp;
int len, size, val, prevval, prevextremevalid = 0, prevextreme;
int len, size, val = 0, prevval = 0, prevextremevalid = 0, prevextreme = 0;
int i;
float avg = 0.0;
int diff, prevdiff, extremediff, nextreme = 0;
@ -551,7 +551,7 @@ audioop_maxpp(self, args)
object *args;
{
signed char *cp;
int len, size, val, prevval, prevextremevalid = 0, prevextreme;
int len, size, val = 0, prevval = 0, prevextremevalid = 0, prevextreme = 0;
int i;
int max = 0;
int diff, prevdiff, extremediff;
@ -605,7 +605,7 @@ audioop_cross(self, args)
object *args;
{
signed char *cp;
int len, size, val;
int len, size, val = 0;
int i;
int prevval, ncross;
@ -634,7 +634,7 @@ audioop_mul(self, args)
object *args;
{
signed char *cp, *ncp;
int len, size, val;
int len, size, val = 0;
double factor, fval, maxval;
object *rv;
int i;
@ -677,7 +677,7 @@ audioop_tomono(self, args)
object *args;
{
signed char *cp, *ncp;
int len, size, val1, val2;
int len, size, val1 = 0, val2 = 0;
double fac1, fac2, fval, maxval;
object *rv;
int i;
@ -723,7 +723,7 @@ audioop_tostereo(self, args)
object *args;
{
signed char *cp, *ncp;
int len, size, val1, val2, val;
int len, size, val1, val2, val = 0;
double fac1, fac2, fval, maxval;
object *rv;
int i;
@ -777,7 +777,7 @@ audioop_add(self, args)
object *args;
{
signed char *cp1, *cp2, *ncp;
int len1, len2, size, val1, val2;
int len1, len2, size, val1 = 0, val2 = 0;
object *rv;
int i;
@ -823,7 +823,7 @@ audioop_bias(self, args)
object *args;
{
signed char *cp, *ncp;
int len, size, val;
int len, size, val = 0;
object *rv;
int i;
int bias;
@ -862,7 +862,7 @@ audioop_reverse(self, args)
{
signed char *cp;
unsigned char *ncp;
int len, size, val;
int len, size, val = 0;
object *rv;
int i, j;
@ -901,7 +901,7 @@ audioop_lin2lin(self, args)
{
signed char *cp;
unsigned char *ncp;
int len, size, size2, val;
int len, size, size2, val = 0;
object *rv;
int i, j;
@ -939,7 +939,7 @@ audioop_lin2ulaw(self, args)
{
signed char *cp;
unsigned char *ncp;
int len, size, val;
int len, size, val = 0;
object *rv;
int i;
@ -1011,9 +1011,9 @@ audioop_lin2adpcm(self, args)
{
signed char *cp;
signed char *ncp;
int len, size, val, step, valpred, delta, index, sign, vpdiff, diff;
int len, size, val = 0, step, valpred, delta, index, sign, vpdiff, diff;
object *rv, *state, *str;
int i, outputbuffer, bufferstep;
int i, outputbuffer = 0, bufferstep;
if ( !getargs(args, "(s#iO)",
&cp, &len, &size, &state) )
@ -1123,7 +1123,7 @@ audioop_adpcm2lin(self, args)
signed char *ncp;
int len, size, valpred, step, delta, index, sign, vpdiff;
object *rv, *str, *state;
int i, inputbuffer, bufferstep;
int i, inputbuffer = 0, bufferstep;
if ( !getargs(args, "(s#iO)",
&cp, &len, &size, &state) )

View File

@ -532,7 +532,7 @@ CD_callback(arg, type, data)
CDDATATYPES type;
void *data;
{
object *result, *args, *v;
object *result, *args, *v = NULL;
char *p;
int i;
cdparserobject *self;

View File

@ -90,7 +90,6 @@ static int
param_type_is_float(clobject *self, int param)
{
int bufferlength;
int ret;
if (self->ob_paramtypes == NULL) {
error_handler_called = 0;

View File

@ -33,8 +33,10 @@ static Py_complex c_1 = {1., 0.};
static Py_complex c_half = {0.5, 0.};
static Py_complex c_i = {0., 1.};
static Py_complex c_i2 = {0., 0.5};
#if 0
static Py_complex c_mi = {0., -1.};
static Py_complex c_pi2 = {M_PI/2., 0.};
#endif
/* forward declarations */
staticforward Py_complex c_log();

View File

@ -15,7 +15,6 @@ static object *crypt_crypt(self, args)
char *word, *salt;
extern char * crypt();
struct passwd *p;
if (!getargs(args, "(ss)", &word, &salt)) {
return NULL;
}

View File

@ -105,7 +105,6 @@ dbm_subscript(dp, key)
dbmobject *dp;
register object *key;
{
object *v;
datum drec, krec;
if (!getargs(key, "s#", &krec.dptr, &krec.dsize) )

View File

@ -34,6 +34,14 @@ PERFORMANCE OF THIS SOFTWARE.
#include "allobjects.h"
#include "modsupport.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_SYS_FILE_H
#include <sys/file.h>
#endif
#include <fcntl.h>
@ -147,7 +155,6 @@ fcntl_flock(self, args)
int fd;
int code;
int ret;
FILE *f;
if (!getargs(args, "(ii)", &fd, &code))
return NULL;
@ -195,7 +202,6 @@ fcntl_lockf(self, args)
object *args;
{
int fd, code, len = 0, start = 0, whence = 0, ret;
FILE *f;
if (!PyArg_ParseTuple(args, "ii|iii", &fd, &code, &len,
&start, &whence))

View File

@ -134,7 +134,6 @@ fh_getfontinfo(self, args)
object *args;
{
fmfontinfo info;
object *v;
if (!getnoarg(args))
return NULL;
if (fmgetfontinfo(self->fh_fh, &info) < 0) {

View File

@ -458,7 +458,7 @@ imageop_grey22grey(self, args)
int x, y, len, nlen;
unsigned char *cp, *ncp;
object *rv;
int i, pos, value, nvalue;
int i, pos, value = 0, nvalue;
if ( !getargs(args, "(s#ii)", &cp, &len, &x, &y) )
return 0;
@ -495,7 +495,7 @@ imageop_grey42grey(self, args)
int x, y, len, nlen;
unsigned char *cp, *ncp;
object *rv;
int i, pos, value, nvalue;
int i, pos, value = 0, nvalue;
if ( !getargs(args, "(s#ii)", &cp, &len, &x, &y) )
return 0;

View File

@ -61,7 +61,8 @@ static int error_called;
/* The error handler */
static imgfile_error(str)
static void
imgfile_error(str)
char *str;
{
err_setstr(ImgfileError, str);
@ -199,7 +200,7 @@ static IMAGE *glob_image;
static long *glob_datap;
static int glob_width, glob_z, glob_ysize;
static
static void
xs_get(buf, y)
short *buf;
int y;
@ -210,7 +211,7 @@ xs_get(buf, y)
getrow(glob_image, buf, y, glob_z);
}
static
static void
xs_put_c(buf, y)
short *buf;
int y;
@ -222,7 +223,7 @@ xs_put_c(buf, y)
*datap++ = (*buf++) & 0xff;
}
static
static void
xs_put_0(buf, y)
short *buf;
int y;
@ -233,7 +234,7 @@ xs_put_0(buf, y)
while ( width-- )
*datap++ = (*buf++) & 0xff;
}
static
static void
xs_put_12(buf, y)
short *buf;
int y;
@ -291,7 +292,7 @@ imgfile_readscaled(self, args)
char *filter;
double blur;
int extended;
int fmode;
int fmode = 0;
int yfirst, ylast, ystep;
/*

View File

@ -174,7 +174,7 @@ main(argc, argv)
filename = argv[optind];
if (Py_VerboseFlag ||
command == NULL && filename == NULL && isatty((int)fileno(fp)))
(command == NULL && filename == NULL && isatty((int)fileno(fp))))
fprintf(stderr, "Python %s\n%s\n",
Py_GetVersion(), Py_GetCopyright());
@ -222,7 +222,7 @@ main(argc, argv)
sts = PyRun_AnyFile(stdin, "<stdin>") != 0;
Py_Exit(sts);
/*NOTREACHED*/
return 0; /* Make gcc -Wall happy */
}

View File

@ -566,7 +566,7 @@ parser_tuple2ast(self, args)
PyObject *tuple = 0;
PyObject *temp = 0;
int ok;
int start_sym;
int start_sym = 0;
if (!PyArg_ParseTuple(args, "O:tuple2ast", &tuple))
return (0);
@ -1829,7 +1829,7 @@ validate_comp_op(tree)
break;
}
}
else if (res = validate_numnodes(tree, 2, "comp_op")) {
else if ((res = validate_numnodes(tree, 2, "comp_op")) != 0) {
res = (validate_ntype(CHILD(tree, 0), NAME)
&& validate_ntype(CHILD(tree, 1), NAME)
&& (((strcmp(STR(CHILD(tree, 0)), "is") == 0)

View File

@ -52,6 +52,10 @@ PERFORMANCE OF THIS SOFTWARE.
#include <sys/wait.h> /* For WNOHANG */
#endif
#ifdef HAVE_SIGNAL_H
#include <signal.h>
#endif
#include "mytime.h" /* For clock_t on some systems */
#ifdef HAVE_FCNTL_H
@ -574,7 +578,7 @@ posix_listdir(self, args)
while ((ep = readdir(dirp)) != NULL) {
if (ep->d_name[0] == '.' &&
(NAMLEN(ep) == 1 ||
ep->d_name[1] == '.' && NAMLEN(ep) == 2))
(ep->d_name[1] == '.' && NAMLEN(ep) == 2)))
continue;
v = newsizedstringobject(ep->d_name, NAMLEN(ep));
if (v == NULL) {
@ -709,7 +713,6 @@ posix_uname(self, args)
object *args;
{
struct utsname u;
object *v;
int res;
if (!getnoarg(args))
return NULL;
@ -776,7 +779,7 @@ posix__exit(self, args)
if (!getintarg(args, &sts))
return NULL;
_exit(sts);
/* NOTREACHED */
return NULL; /* Make gcc -Wall happy */
}
#ifdef HAVE_EXECV

View File

@ -40,6 +40,8 @@ PERFORMANCE OF THIS SOFTWARE.
#include "Python.h"
#include <ctype.h>
#include "regexpr.h"
static PyObject *RegexError; /* Exception */

View File

@ -281,10 +281,10 @@ int size;
regexp_t bufp;
{
int a, pos, op, current_level, level, opcode;
int pattern_offset, alloc;
int pattern_offset = 0, alloc;
int starts[NUM_LEVELS * MAX_NESTING], starts_base;
int future_jumps[MAX_NESTING], num_jumps;
unsigned char ch;
unsigned char ch = '\0';
char *pattern, *translate;
int next_register, paren_depth, num_open_registers, open_registers[RE_NREGS];
int beginning_context;

View File

@ -204,7 +204,7 @@ FILE *outf;
/*unsigned*/ long *tab;
int len;
{
int r;
int r = 0;
while(len) {
r = putlong(outf,*tab++);

View File

@ -39,6 +39,10 @@ have any value except INVALID_SOCKET.
#include "modsupport.h"
#include "ceval.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <sys/types.h>
#ifdef MS_WINDOWS

View File

@ -34,6 +34,10 @@ PERFORMANCE OF THIS SOFTWARE.
#include "Python.h"
#include "intrcheck.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <signal.h>
#ifndef SIG_ERR

View File

@ -85,6 +85,10 @@ Socket methods:
#include "Python.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <sys/types.h>
#include "mytime.h"
@ -259,6 +263,7 @@ BUILD_FUNC_DEF_2(setipaddr, char*,name, struct sockaddr_in *,addr_ret)
int errnop;
#endif /* HAVE_GETHOSTBYNAME_R */
memset((void *) addr_ret, '\0', sizeof(*addr_ret));
if (name[0] == '\0') {
addr_ret->sin_addr.s_addr = INADDR_ANY;
return 4;

View File

@ -538,7 +538,7 @@ strop_atoi(self, args)
if (args != NULL && is_tupleobject(args)) {
if (!getargs(args, "(si)", &s, &base))
return NULL;
if (base != 0 && base < 2 || base > 36) {
if ((base != 0 && base < 2) || base > 36) {
err_setstr(ValueError, "invalid base for atoi()");
return NULL;
}
@ -585,7 +585,7 @@ strop_atol(self, args)
if (args != NULL && is_tupleobject(args)) {
if (!getargs(args, "(si)", &s, &base))
return NULL;
if (base != 0 && base < 2 || base > 36) {
if ((base != 0 && base < 2) || base > 36) {
err_setstr(ValueError, "invalid base for atol()");
return NULL;
}
@ -701,7 +701,7 @@ strop_translate(self, args)
trans_table[i]=Py_CHARMASK(table[i]);
if (delete!=NULL) {
for(i=0; i<dellen; i++)
trans_table[delete[i]]=-1;
trans_table[(int)delete[i]]=-1;
}
result = PyString_FromStringAndSize((char *)NULL, inlen);

View File

@ -71,7 +71,7 @@ syslog_syslog(self, args)
PyObject * self;
PyObject * args;
{
char *message, *s;
char *message;
int priority = LOG_INFO | LOG_USER;
if (!PyArg_ParseTuple(args, "is;[priority,] message string",

View File

@ -313,7 +313,7 @@ static struct methodlist thread_methods[] = {
void
initthread()
{
object *m, *d, *x;
object *m, *d;
/* Create the module and add the functions */
m = initmodule("thread", thread_methods);

View File

@ -175,7 +175,6 @@ xx_new(self, args)
PyObject *self; /* Not used */
PyObject *args;
{
int i, j;
XxoObject *rv;
if (!PyArg_ParseTuple(args, ""))