]> granicus.if.org Git - python/commitdiff
Fixed few compiler warnings.
authorSerhiy Storchaka <storchaka@gmail.com>
Mon, 16 Feb 2015 07:40:12 +0000 (09:40 +0200)
committerSerhiy Storchaka <storchaka@gmail.com>
Mon, 16 Feb 2015 07:40:12 +0000 (09:40 +0200)
Modules/cjkcodecs/_codecs_iso2022.c
Modules/faulthandler.c
Python/ceval_gil.h
Python/pylifecycle.c
Python/pystate.c

index 5c401aaf8e93164c74e9549393a8d06b0a1f025c..1ce4218f3089d082ed9816933039c02d078d505b 100644 (file)
@@ -292,7 +292,7 @@ iso2022processesc(const void *config, MultibyteCodec_State *state,
                   const unsigned char **inbuf, Py_ssize_t *inleft)
 {
     unsigned char charset, designation;
-    Py_ssize_t i, esclen;
+    Py_ssize_t i, esclen = 0;
 
     for (i = 1;i < MAX_ESCSEQLEN;i++) {
         if (i >= *inleft)
@@ -307,10 +307,9 @@ iso2022processesc(const void *config, MultibyteCodec_State *state,
         }
     }
 
-    if (i >= MAX_ESCSEQLEN)
-        return 1; /* unterminated escape sequence */
-
     switch (esclen) {
+    case 0:
+        return 1; /* unterminated escape sequence */
     case 3:
         if (INBYTE2 == '$') {
             charset = INBYTE3 | CHARSET_DBCS;
index 6f7c71de1e1d7eb975e6459b27342f3694b7e175..4643c0ede53cea1b4071710b5e9b58d0ef8cc734 100644 (file)
@@ -458,7 +458,7 @@ faulthandler_thread(void *unused)
         assert(st == PY_LOCK_FAILURE);
 
         /* get the thread holding the GIL, NULL if no thread hold the GIL */
-        current = _Py_atomic_load_relaxed(&_PyThreadState_Current);
+        current = (PyThreadState*)_Py_atomic_load_relaxed(&_PyThreadState_Current);
 
         write(thread.fd, thread.header, (int)thread.header_len);
 
index 2702d5cbddb2e0e76ccb9ed7fd0556730bcc06a6..4db56b6f5cb1346996f169d0c90fd0ad6033bf67 100644 (file)
@@ -191,7 +191,7 @@ static void drop_gil(PyThreadState *tstate)
     if (_Py_atomic_load_relaxed(&gil_drop_request) && tstate != NULL) {
         MUTEX_LOCK(switch_mutex);
         /* Not switched yet => wait */
-        if (_Py_atomic_load_relaxed(&gil_last_holder) == tstate) {
+        if ((PyThreadState*)_Py_atomic_load_relaxed(&gil_last_holder) == tstate) {
         RESET_GIL_DROP_REQUEST();
             /* NOTE: if COND_WAIT does not atomically start waiting when
                releasing the mutex, another thread can run through, take
@@ -239,7 +239,7 @@ _ready:
     _Py_atomic_store_relaxed(&gil_locked, 1);
     _Py_ANNOTATE_RWLOCK_ACQUIRED(&gil_locked, /*is_write=*/1);
 
-    if (tstate != _Py_atomic_load_relaxed(&gil_last_holder)) {
+    if (tstate != (PyThreadState*)_Py_atomic_load_relaxed(&gil_last_holder)) {
         _Py_atomic_store_relaxed(&gil_last_holder, tstate);
         ++gil_switch_number;
     }
index 25a4a60f2ed2f31b76c8ac18f367b5b0d8426b97..2a36b53bd08b8deb98018f24bad7da486247445d 100644 (file)
@@ -1258,7 +1258,7 @@ Py_FatalError(const char *msg)
         PyErr_PrintEx(0);
     }
     else {
-        tstate = _Py_atomic_load_relaxed(&_PyThreadState_Current);
+        tstate = (PyThreadState*)_Py_atomic_load_relaxed(&_PyThreadState_Current);
         if (tstate != NULL) {
             fputc('\n', stderr);
             fflush(stderr);
index 2ac2fd5274d4059a4a765dac87f0e5cf9ad685bd..32a635c789eaf7ef4f8d965577c298e7b55cc7e6 100644 (file)
@@ -403,7 +403,7 @@ tstate_delete_common(PyThreadState *tstate)
 void
 PyThreadState_Delete(PyThreadState *tstate)
 {
-    if (tstate == _Py_atomic_load_relaxed(&_PyThreadState_Current))
+    if (tstate == (PyThreadState*)_Py_atomic_load_relaxed(&_PyThreadState_Current))
         Py_FatalError("PyThreadState_Delete: tstate is still current");
 #ifdef WITH_THREAD
     if (autoInterpreterState && PyThread_get_key_value(autoTLSkey) == tstate)
@@ -662,7 +662,7 @@ PyThreadState_IsCurrent(PyThreadState *tstate)
 {
     /* Must be the tstate for this thread */
     assert(PyGILState_GetThisThreadState()==tstate);
-    return tstate == _Py_atomic_load_relaxed(&_PyThreadState_Current);
+    return tstate == (PyThreadState*)_Py_atomic_load_relaxed(&_PyThreadState_Current);
 }
 
 /* Internal initialization/finalization functions called by