Menu

#864 Event cast cleanup for compilation warnings

17.6.1
closed
event (1)
RT
Low
16.1.8
True
2017-11-05
2017-07-10
wild-boar
No

I ran into a minor problem with the declaration of events. Declared with a #define, a compiler warning emerges which requires -fpermissive to clear. I noticed chEvtObjectInit() uses a different cast "event_listerner_t " versus "void ".

This patch against trunk removes the compiler warning and also makes both ways to initialize the object consistent.

Index: os/rt/include/chevents.h
===================================================================
--- os/rt/include/chevents.h    (revision 10325)
+++ os/rt/include/chevents.h    (working copy)
@@ -102,7 +102,7 @@
  *          source that is part of a bigger structure.
  * @param name          the name of the event source variable
  */
-#define _EVENTSOURCE_DATA(name) {(void *)(&name)}
+#define _EVENTSOURCE_DATA(name) {(event_listener_t *)(&name)}

 /**
  * @brief   Static event source initializer.

Discussion

  • Giovanni Di Sirio

    • assigned_to: Giovanni Di Sirio
    • Affected Version: Trunk --> 16.1.8
    • Milestone: trunk --> 17.6.1
    • Fixed in Repository: False --> True
     
  • Giovanni Di Sirio

    Fixed in trunk, 17.6.1 and 16.1.9.

    Thanks,
    Giovanni

     
  • Giovanni Di Sirio

    • status: open --> closed
     

Log in to post a comment.