]> granicus.if.org Git - libevent/commitdiff
Detech -Wno-unused-functions for GCC too
authorAzat Khuzhin <azat@libevent.org>
Sat, 9 Jul 2022 14:08:21 +0000 (17:08 +0300)
committerAzat Khuzhin <azat@libevent.org>
Sat, 9 Jul 2022 14:17:06 +0000 (17:17 +0300)
Otherwise build fails [1]:

    /home/runner/work/libevent/libevent/dist/libevent-2.2.0-alpha-dev/minheap-internal.h:64:6: error: ‘min_heap_ctor_’ defined but not used [-Werror=unused-function]
     void min_heap_ctor_(min_heap_t* s) { s->p = 0; s->n = 0; s->a = 0; }
          ^~~~~~~~~~~~~~
    In file included from /home/runner/work/libevent/libevent/dist/libevent-2.2.0-alpha-dev/buffer.c:91:0:
    /home/runner/work/libevent/libevent/dist/libevent-2.2.0-alpha-dev/bufferevent-internal.h:414:1: error: ‘bufferevent_trigger_nolock_’ defined but not used [-Werror=unused-function]
     bufferevent_trigger_nolock_(struct bufferevent *bufev, short iotype, int options)
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
    In file included from /home/runner/work/libevent/libevent/dist/libevent-2.2.0-alpha-dev/buffer.c:89:0:
    /home/runner/work/libevent/libevent/dist/libevent-2.2.0-alpha-dev/evthread-internal.h:140:1: error: ‘EVLOCK_TRY_LOCK_’ defined but not used [-Werror=unused-function]
     EVLOCK_TRY_LOCK_(void *lock)

  [1]: https://github.com/libevent/libevent/runs/7263518180?check_suite_focus=true

CMakeLists.txt
configure.ac

index db345b02e0d15ab429bbee68e0794da200c20878..799673deac2ba8a79b1488d4ae6614d095bc3a19 100644 (file)
@@ -314,11 +314,13 @@ if (${GNUC})
          -Wlogical-op
 
          -Wwrite-strings
+
+        # Disable unused-function warnings. These trigger for minheap-internal.h.
+        -Wno-unused-function
     )
 
     if (${CLANG})
         list(APPEND __FLAGS
-            -Wno-unused-function
             # we use this hack in tests
             -Wno-void-pointer-to-enum-cast)
     endif()
index a93f0304e29af0d794c65fc8d372d4da4af707f8..85e02bd4225c0d0760e942ab56fad890ab5a1161 100644 (file)
@@ -775,10 +775,10 @@ if test "$enable_gcc_warnings" != "no" && test "$GCC" = "yes"; then
   #error
   #endif])], have_clang=yes, have_clang=no)
 
-  if test "$have_clang" = "yes"; then
-    dnl Disable unused-function warnings. These trigger for minheap-internal.h.
-    AX_CHECK_COMPILE_FLAG([-Wno-unused-function], [CFLAGS="$CFLAGS -Wno-unused-function"],[],[-Werror])
+   dnl Disable unused-function warnings. These trigger for minheap-internal.h.
+   AX_CHECK_COMPILE_FLAG([-Wno-unused-function], [CFLAGS="$CFLAGS -Wno-unused-function"],[],[-Werror])
 
+  if test "$have_clang" = "yes"; then
     case "$host_os" in
       darwin*)
         dnl Clang on macOS emits warnings for each directory specified which