Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 730806d

Browse files
committed
Make new gcc -Wall happy
1 parent 1109fbc commit 730806d

11 files changed

Lines changed: 45 additions & 23 deletions

File tree

Modules/_tkinter.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ Tkapp_New(screenName, baseName, className, interactive)
358358
}
359359

360360
strcpy(argv0, className);
361-
if (isupper(argv0[0]))
361+
if (isupper((int)(argv0[0])))
362362
argv0[0] = tolower(argv0[0]);
363363
Tcl_SetVar(v->interp, "argv0", argv0, TCL_GLOBAL_ONLY);
364364
ckfree(argv0);

Modules/bsddbmodule.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ bsddb_keys(dp, args)
433433
{
434434
PyObject *list, *item;
435435
DBT krec, drec;
436-
char *data,buf[4096];
436+
char *data=NULL,buf[4096];
437437
int status;
438438
int err;
439439

@@ -556,8 +556,8 @@ bsddb_seq(dp, args, sequence_request)
556556
{
557557
int status;
558558
DBT krec, drec;
559-
char *kdata,kbuf[4096];
560-
char *ddata,dbuf[4096];
559+
char *kdata=NULL,kbuf[4096];
560+
char *ddata=NULL,dbuf[4096];
561561
PyObject *result;
562562

563563
if (!PyArg_NoArgs(args))

Modules/parsermodule.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1704,20 +1704,22 @@ validate_try(tree)
17041704
res = (validate_numnodes(tree, 6, "try/finally")
17051705
&& validate_colon(CHILD(tree, 4))
17061706
&& validate_suite(CHILD(tree, 5)));
1707-
else if (res)
1707+
else if (res) {
17081708
if (nch == (pos + 3)) {
17091709
res = ((strcmp(STR(CHILD(tree, pos)), "except") == 0)
17101710
|| (strcmp(STR(CHILD(tree, pos)), "else") == 0));
17111711
if (!res)
17121712
err_string("Illegal trailing triple in try statement.");
17131713
}
1714-
else if (nch == (pos + 6))
1714+
else if (nch == (pos + 6)) {
17151715
res = (validate_name(CHILD(tree, pos), "except")
17161716
&& validate_colon(CHILD(tree, pos + 1))
17171717
&& validate_suite(CHILD(tree, pos + 2))
17181718
&& validate_name(CHILD(tree, pos + 3), "else"));
1719+
}
17191720
else
17201721
res = validate_numnodes(tree, pos + 3, "try/except");
1722+
}
17211723
}
17221724
return (res);
17231725

Modules/readline.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@
1919
/* GNU readline definitions */
2020
#include <readline/readline.h> /* You may need to add an -I option to Setup */
2121

22+
extern int rl_parse_and_bind();
23+
extern int rl_read_init_file();
24+
extern int rl_insert_text();
25+
extern int rl_bind_key();
26+
extern int rl_bind_key_in_map();
27+
extern int rl_initialize();
28+
extern int add_history();
29+
2230
/* Pointers needed from outside (but not declared in a header file). */
2331
extern int (*PyOS_InputHook)();
2432
extern char *(*PyOS_ReadlineFunctionPointer) Py_PROTO((char *));

Modules/regexpr.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1271,11 +1271,12 @@ char *re_compile_pattern(regex, size, bufp)
12711271
}
12721272
case Rbol:
12731273
{
1274-
if (!beginning_context)
1274+
if (!beginning_context) {
12751275
if (regexp_context_indep_ops)
12761276
goto op_error;
12771277
else
12781278
goto normal_char;
1279+
}
12791280
opcode = Cbol;
12801281
goto store_opcode;
12811282
}
@@ -1289,23 +1290,25 @@ char *re_compile_pattern(regex, size, bufp)
12891290
((regexp_syntax & RE_NO_BK_PARENS)?
12901291
(regex[pos] == ')'):
12911292
(pos+1 < size && regex[pos] == '\134' &&
1292-
regex[pos+1] == ')'))))
1293+
regex[pos+1] == ')')))) {
12931294
if (regexp_context_indep_ops)
12941295
goto op_error;
12951296
else
12961297
goto normal_char;
1298+
}
12971299
opcode = Ceol;
12981300
goto store_opcode;
12991301
/* NOTREACHED */
13001302
break;
13011303
}
13021304
case Roptional:
13031305
{
1304-
if (beginning_context)
1306+
if (beginning_context) {
13051307
if (regexp_context_indep_ops)
13061308
goto op_error;
13071309
else
13081310
goto normal_char;
1311+
}
13091312
if (CURRENT_LEVEL_START == pattern_offset)
13101313
break; /* ignore empty patterns for ? */
13111314
ALLOC(3);
@@ -1316,11 +1319,12 @@ char *re_compile_pattern(regex, size, bufp)
13161319
case Rstar:
13171320
case Rplus:
13181321
{
1319-
if (beginning_context)
1322+
if (beginning_context) {
13201323
if (regexp_context_indep_ops)
13211324
goto op_error;
13221325
else
13231326
goto normal_char;
1327+
}
13241328
if (CURRENT_LEVEL_START == pattern_offset)
13251329
break; /* ignore empty patterns for + and * */
13261330
ALLOC(9);
@@ -2061,11 +2065,12 @@ int re_search(bufp,
20612065
else
20622066
dir = 1;
20632067

2064-
if (anchor == 2)
2068+
if (anchor == 2) {
20652069
if (pos != 0)
20662070
return -1;
20672071
else
20682072
range = 0;
2073+
}
20692074

20702075
for (; range >= 0; range--, pos += dir)
20712076
{

Modules/structmodule.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,7 +1008,7 @@ calcsize(fmt, f)
10081008
s = fmt;
10091009
size = 0;
10101010
while ((c = *s++) != '\0') {
1011-
if (isspace(c))
1011+
if (isspace((int)c))
10121012
continue;
10131013
if ('0' <= c && c <= '9') {
10141014
num = c - '0';
@@ -1110,7 +1110,7 @@ struct_pack(self, args)
11101110
res = restart = PyString_AsString(result);
11111111

11121112
while ((c = *s++) != '\0') {
1113-
if (isspace(c))
1113+
if (isspace((int)c))
11141114
continue;
11151115
if ('0' <= c && c <= '9') {
11161116
num = c - '0';
@@ -1242,7 +1242,7 @@ struct_unpack(self, args)
12421242
str = start;
12431243
s = fmt;
12441244
while ((c = *s++) != '\0') {
1245-
if (isspace(c))
1245+
if (isspace((int)c))
12461246
continue;
12471247
if ('0' <= c && c <= '9') {
12481248
num = c - '0';

Python/bltinmodule.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,13 +348,15 @@ builtin_complex(self, args)
348348
}
349349
if (PyComplex_Check(r)) {
350350
cr = ((PyComplexObject*)r)->cval;
351-
if (own_r)
351+
if (own_r) {
352352
Py_DECREF(r);
353+
}
353354
}
354355
else {
355356
tmp = (*nbr->nb_float)(r);
356-
if (own_r)
357+
if (own_r) {
357358
Py_DECREF(r);
359+
}
358360
if (tmp == NULL)
359361
return NULL;
360362
cr.real = PyFloat_AsDouble(tmp);

Python/ceval.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2745,8 +2745,9 @@ build_class(methods, bases, name)
27452745
callable, args);
27462746
Py_DECREF(args);
27472747
}
2748-
if (callable != basetype)
2748+
if (callable != basetype) {
27492749
Py_DECREF(callable);
2750+
}
27502751
return newclass;
27512752
}
27522753
PyErr_SetString(PyExc_TypeError,

Python/getargs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ vgetargs1(args, format, p_va, compat)
257257
}
258258
}
259259

260-
if (*format != '\0' && !isalpha(*format) &&
260+
if (*format != '\0' && !isalpha((int)(*format)) &&
261261
*format != '(' &&
262262
*format != '|' && *format != ':' && *format != ';') {
263263
PyErr_Format(PyExc_SystemError,

Python/marshal.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,15 @@ w_object(v, p)
143143
{
144144
int i, n;
145145

146-
if (v == NULL)
146+
if (v == NULL) {
147147
w_byte(TYPE_NULL, p);
148-
else if (v == Py_None)
148+
}
149+
else if (v == Py_None) {
149150
w_byte(TYPE_NONE, p);
150-
else if (v == Py_Ellipsis)
151-
w_byte(TYPE_ELLIPSIS, p);
151+
}
152+
else if (v == Py_Ellipsis) {
153+
w_byte(TYPE_ELLIPSIS, p);
154+
}
152155
else if (PyInt_Check(v)) {
153156
long x = PyInt_AS_LONG((PyIntObject *)v);
154157
#if SIZEOF_LONG > 4

0 commit comments

Comments
 (0)