This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: 2.1c1 thread_pthread: unused vrbl clean
Type: Stage:
Components: None Versions:
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: tim.peters Nosy List: mfavas, tim.peters
Priority: normal Keywords: patch

Created on 2001-04-15 11:25 by mfavas, last changed 2022-04-10 16:03 by admin. This issue is now closed.

Messages (3)
msg36372 - (view) Author: Mark Favas (mfavas) Date: 2001-04-15 11:25
Variables set but not used

*** thread_pthread.h.orig       Sun Apr 15 18:30:22
2001
--- thread_pthread.h    Sun Apr 15 18:32:02 2001
***************
*** 273,279 ****
  PyThread_free_lock(PyThread_type_lock lock)
  {
        pthread_lock *thelock = (pthread_lock *)lock;
!       int status, error = 0;
  
        dprintf(("PyThread_free_lock(%p) called\n",
lock));
  
--- 273,279 ----
  PyThread_free_lock(PyThread_type_lock lock)
  {
        pthread_lock *thelock = (pthread_lock *)lock;
!       int status;
  
        dprintf(("PyThread_free_lock(%p) called\n",
lock));
  
***************
*** 328,334 ****
  PyThread_release_lock(PyThread_type_lock lock)
  {
        pthread_lock *thelock = (pthread_lock *)lock;
!       int status, error = 0;
  
        dprintf(("PyThread_release_lock(%p) called\n",
lock));
  
--- 328,334 ----
  PyThread_release_lock(PyThread_type_lock lock)
  {
        pthread_lock *thelock = (pthread_lock *)lock;
!       int status;
  
        dprintf(("PyThread_release_lock(%p) called\n",
lock));
  
***************
*** 386,392 ****
  void 
  PyThread_free_sema(PyThread_type_sema sema)
  {
!       int status, error = 0;
        struct semaphore *thesema = (struct semaphore
*) sema;
  
        dprintf(("PyThread_free_sema(%p) called\n", 
sema));
--- 386,392 ----
  void 
  PyThread_free_sema(PyThread_type_sema sema)
  {
!       int status;
        struct semaphore *thesema = (struct semaphore
*) sema;
  
        dprintf(("PyThread_free_sema(%p) called\n", 
sema));
***************
*** 430,436 ****
  void 
  PyThread_up_sema(PyThread_type_sema sema)
  {
!       int status, error = 0;
        struct semaphore *thesema = (struct semaphore
*) sema;
  
        dprintf(("PyThread_up_sema(%p)\n",  sema));
--- 430,436 ----
  void 
  PyThread_up_sema(PyThread_type_sema sema)
  {
!       int status;
        struct semaphore *thesema = (struct semaphore
*) sema;
  
        dprintf(("PyThread_up_sema(%p)\n",  sema));
msg36373 - (view) Author: Mark Favas (mfavas) Date: 2001-04-15 11:36
Logged In: YES 
user_id=44979

Aaaaaaaaargh! Ignore this one - sorry! I rebuilt after
changing this, but thread.c (which depends on this include
file) was not rebuilt automatically (makefile dependency
needs fixing, I guess). Errors ensued when I recompiled
thread.c - error is set in the macro CHECK_STATUS and
sometimes used and sometimes not - would require making two
macros, so not worth doing.
msg36374 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2001-05-09 19:57
Logged In: YES 
user_id=31435

Rejected as requested.  But you could, e.g., instead change 
the "error = 1" part of the macro to "set_error(&error)" 
and define a

static void
set_error(int* error) {*error = 1;}

function near the top of the file.  Then the unused var 
wngs should go away, and the oost of an extra function call 
in case there *is* an error is insignificant.

If I had a pthreads box with a picky compiler to test it 
on, I'd do that myself.
History
Date User Action Args
2022-04-10 16:03:58adminsetgithub: 34337
2001-04-15 11:25:16mfavascreate