guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Avoid warnings in threads.c when building without threads


From: Eli Zaretskii
Subject: Avoid warnings in threads.c when building without threads
Date: Sat, 16 Jul 2016 20:12:22 +0300

     CC       libguile_2.0_la-threads.lo
   In file included from ../libguile/threads.h:40:0,
                    from ../libguile/gc.h:30,
                    from ../libguile/_scm.h:76,
                    from threads.c:28:
   threads.c: In function 'scm_call_with_new_thread':
   ../libguile/null-threads.h:74:53: warning: right-hand operand of comma 
expression has no effect [-Wunused-value]
    #define scm_i_pthread_cond_wait(c,m)        (abort(), 0)
                                                        ^
   ../libguile/null-threads.h:102:45: note: in expansion of macro 
'scm_i_pthread_cond_wait'
    #define scm_i_scm_pthread_cond_wait         scm_i_pthread_cond_wait
                                                ^
   threads.c:1061:5: note: in expansion of macro 'scm_i_scm_pthread_cond_wait'
        scm_i_scm_pthread_cond_wait (&data.cond, &data.mutex);
        ^

The patch to shut up these warnings is below.  OK to commit?

--- libguile/null-threads.h~0   2016-01-02 13:32:40.000000000 +0200
+++ libguile/null-threads.h     2016-07-15 17:47:37.101375000 +0300
@@ -43,7 +43,7 @@
 #define scm_i_pthread_create(t,a,f,d)       (*(t)=0, (void)(f), ENOSYS)
 #define scm_i_pthread_detach(t)             do { } while (0)
 #define scm_i_pthread_exit(v)               exit (EXIT_SUCCESS)
-#define scm_i_pthread_cancel(t)             0
+#define scm_i_pthread_cancel(t)             (void)0
 #define scm_i_pthread_cleanup_push(t,v)     0
 #define scm_i_pthread_cleanup_pop(e)        0
 #define scm_i_sched_yield()                 0


--- libguile/threads.c~ 2016-06-20 23:35:06.000000000 +0300
+++ libguile/threads.c  2016-07-15 17:48:20.757625000 +0300
@@ -1058,7 +1058,7 @@ SCM_DEFINE (scm_call_with_new_thread, "c
     }
 
   while (scm_is_false (data.thread))
-    scm_i_scm_pthread_cond_wait (&data.cond, &data.mutex);
+    (void)scm_i_scm_pthread_cond_wait (&data.cond, &data.mutex);
 
   scm_i_pthread_mutex_unlock (&data.mutex);
 
@@ -1138,7 +1138,7 @@ scm_spawn_thread (scm_t_catch_body body,
     }
 
   while (scm_is_false (data.thread))
-    scm_i_scm_pthread_cond_wait (&data.cond, &data.mutex);
+    (void)scm_i_scm_pthread_cond_wait (&data.cond, &data.mutex);
 
   scm_i_pthread_mutex_unlock (&data.mutex);
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]