Issue #8914: fix various warnings from the Clang static analyzer v254.

This commit is contained in:
Brett Cannon 2011-02-22 20:15:44 +00:00
parent 79da6b7075
commit b94767ff44
36 changed files with 69 additions and 84 deletions

View file

@ -3231,7 +3231,6 @@ decode_unicode(struct compiling *c, const char *s, size_t len, int rawmode, cons
const char *end;
if (encoding == NULL) {
buf = (char *)s;
u = NULL;
} else {
/* check for integer overflow */

View file

@ -37,7 +37,7 @@ builtin___build_class__(PyObject *self, PyObject *args, PyObject *kwds)
{
PyObject *func, *name, *bases, *mkw, *meta, *prep, *ns, *cell;
PyObject *cls = NULL;
Py_ssize_t nargs, nbases;
Py_ssize_t nargs;
assert(args != NULL);
if (!PyTuple_Check(args)) {
@ -61,7 +61,6 @@ builtin___build_class__(PyObject *self, PyObject *args, PyObject *kwds)
bases = PyTuple_GetSlice(args, 2, nargs);
if (bases == NULL)
return NULL;
nbases = nargs - 2;
if (kwds == NULL) {
meta = NULL;
@ -766,7 +765,6 @@ builtin_exec(PyObject *self, PyObject *args)
{
PyObject *v;
PyObject *prog, *globals = Py_None, *locals = Py_None;
int plain = 0;
if (!PyArg_UnpackTuple(args, "exec", 1, 3, &prog, &globals, &locals))
return NULL;
@ -775,7 +773,6 @@ builtin_exec(PyObject *self, PyObject *args)
globals = PyEval_GetGlobals();
if (locals == Py_None) {
locals = PyEval_GetLocals();
plain = 1;
}
if (!globals || !locals) {
PyErr_SetString(PyExc_SystemError,

View file

@ -2690,7 +2690,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
Py_DECREF(*pfunc);
*pfunc = self;
na++;
n++;
/* n++; */
} else
Py_INCREF(func);
sp = stack_pointer;
@ -3026,7 +3026,7 @@ fast_yield:
PyTrace_RETURN, retval)) {
Py_XDECREF(retval);
retval = NULL;
why = WHY_EXCEPTION;
/* why = WHY_EXCEPTION; */
}
}
}

View file

@ -2055,7 +2055,7 @@ _Py_dg_strtod(const char *s00, char **se)
+ Exp_msk1
;
word1(&rv) = 0;
dsign = 0;
/* dsign = 0; */
break;
}
}
@ -2092,7 +2092,7 @@ _Py_dg_strtod(const char *s00, char **se)
goto undfl;
}
}
dsign = 1 - dsign;
/* dsign = 1 - dsign; */
break;
}
if ((aadj = ratio(delta, bs)) <= 2.) {

View file

@ -966,9 +966,10 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
case 'u': /* raw unicode buffer (Py_UNICODE *) */
case 'Z': /* raw unicode buffer or None */
{
Py_UNICODE **p = va_arg(*p_va, Py_UNICODE **);
if (*format == '#') { /* any buffer-like object */
/* "s#" or "Z#" */
Py_UNICODE **p = va_arg(*p_va, Py_UNICODE **);
FETCH_SIZE;
if (c == 'Z' && arg == Py_None) {
@ -984,8 +985,6 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
format++;
} else {
/* "s" or "Z" */
Py_UNICODE **p = va_arg(*p_va, Py_UNICODE **);
if (c == 'Z' && arg == Py_None)
*p = NULL;
else if (PyUnicode_Check(arg)) {

View file

@ -954,7 +954,7 @@ format_float_short(double d, char format_code,
/* shouldn't get here: Gay's code should always return
something starting with a digit, an 'I', or 'N' */
strncpy(p, "ERR", 3);
p += 3;
/* p += 3; */
assert(0);
}
goto exit;

View file

@ -1176,7 +1176,6 @@ PySys_AddXOption(const wchar_t *s)
PyObject *opts;
PyObject *name = NULL, *value = NULL;
const wchar_t *name_end;
int r;
opts = get_xoptions();
if (opts == NULL)
@ -1194,7 +1193,7 @@ PySys_AddXOption(const wchar_t *s)
}
if (name == NULL || value == NULL)
goto error;
r = PyDict_SetItem(opts, name, value);
PyDict_SetItem(opts, name, value);
Py_DECREF(name);
Py_DECREF(value);
return;