changeset 9311:0ad3dde83947

Events: fixed warnings with -Wpedantic in epoll notify. Added casts through uintptr_t to suppress "ISO C forbids assignment between function pointer and 'void *'" warnings as seen with -Wpedantic in ngx_epoll_notify() and ngx_epoll_notify_handler(). Additionally, it resolves "assignment type mismatch" warnings as seen with Sun Studio on Linux, "pointer to function... "=" pointer to void" and "pointer to void "=" pointer to function...".
author Maxim Dounin <mdounin@mdounin.ru>
date Wed, 07 Aug 2024 03:56:31 +0300
parents ebebc1d68046
children 098019656024
files src/event/modules/ngx_epoll_module.c
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/event/modules/ngx_epoll_module.c
+++ b/src/event/modules/ngx_epoll_module.c
@@ -452,7 +452,7 @@ ngx_epoll_notify_handler(ngx_event_t *ev
         }
     }
 
-    handler = ev->data;
+    handler = (ngx_event_handler_pt) (uintptr_t) ev->data;
     handler(ev);
 }
 
@@ -766,7 +766,7 @@ ngx_epoll_notify(ngx_event_handler_pt ha
 {
     static uint64_t inc = 1;
 
-    notify_event.data = handler;
+    notify_event.data = (void *) (uintptr_t) handler;
 
     if ((size_t) write(notify_fd, &inc, sizeof(uint64_t)) != sizeof(uint64_t)) {
         ngx_log_error(NGX_LOG_ALERT, notify_event.log, ngx_errno,