TaiJuWu commented on code in PR #10776:
URL: https://github.com/apache/nuttx/pull/10776#discussion_r1354283729


##########
include/nuttx/spinlock.h:
##########
@@ -32,6 +32,14 @@
 
 #include <nuttx/irq.h>
 
+#ifdef CONFIG_RW_SPINLOCK
+#include <stdatomic.h>
+typedef atomic_int rwlock_t;

Review Comment:
   It can't.
   There will be a error if we use normal type on Build / macOS (sim-02) 
   ```
   Error: semaphore/spinlock.c:484:48: error: incompatible pointer types 
passing 'rwlock_t *' (aka '_Atomic(int) *') to parameter of type 'int *' 
[-Werror,-Wincompatible-pointer-types]
   
[1306](https://github.com/apache/nuttx/actions/runs/6485231606/job/17611025912#step:7:1307)
             atomic_compare_exchange_strong(lock, &old, old + 1))
   
[1307](https://github.com/apache/nuttx/actions/runs/6485231606/job/17611025912#step:7:1308)
                                                  ^~~~```
   
   So I used atomic type in the second commit of this PR but it seems not to 
work.
   
   Can anyone help this part?
   Maybe there is a related issue 
[here](https://lists.gnu.org/archive/html/bug-guile/2017-03/msg00084.html).



##########
include/nuttx/spinlock.h:
##########
@@ -32,6 +32,14 @@
 
 #include <nuttx/irq.h>
 
+#ifdef CONFIG_RW_SPINLOCK
+#include <stdatomic.h>
+typedef atomic_int rwlock_t;

Review Comment:
   It can't.
   There will be a error if we use normal type on Build / macOS (sim-02) 
   ```
   Error: semaphore/spinlock.c:484:48: error: incompatible pointer types 
passing 'rwlock_t *' (aka '_Atomic(int) *') to parameter of type 'int *' 
[-Werror,-Wincompatible-pointer-types]
   
[1306](https://github.com/apache/nuttx/actions/runs/6485231606/job/17611025912#step:7:1307)
             atomic_compare_exchange_strong(lock, &old, old + 1))
   
[1307](https://github.com/apache/nuttx/actions/runs/6485231606/job/17611025912#step:7:1308)
                                                  ^~~~
   ```
   
   So I used atomic type in the second commit of this PR but it seems not to 
work.
   
   Can anyone help this part?
   Maybe there is a related issue 
[here](https://lists.gnu.org/archive/html/bug-guile/2017-03/msg00084.html).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to