You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@trafficserver.apache.org by GitBox <gi...@apache.org> on 2022/05/14 23:21:31 UTC

[GitHub] [trafficserver] bneradt commented on a diff in pull request #8850: Fix Rocky Linux 8 arm64 GCC Compiler Warnings

bneradt commented on code in PR #8850:
URL: https://github.com/apache/trafficserver/pull/8850#discussion_r873084665


##########
iocore/eventsystem/I_Continuation.h:
##########
@@ -71,7 +71,7 @@ constexpr ContinuationHandler
 continuation_handler_void_ptr(int (C::*fp)(int, T *))
 {
   auto fp2 = reinterpret_cast<int (C::*)(int, void *)>(fp);
-  return static_cast<ContinuationHandler>(fp2);
+  return reinterpret_cast<ContinuationHandler>(fp2);

Review Comment:
   @ywkaras : Let me know whether you have thoughts about what I'm doing here. This patch is modifying code you updated to get better compile time checks (#6996). The compiler warning I'm addressing is the rather unobvious:
   
   ```
        In file included from src/ts_asf_master_test_build/iocore/eventsystem/I_Action.h:29,
                         from src/ts_asf_master_test_build/iocore/eventsystem/I_EventSystem.h:32,
                         from src/ts_asf_master_test_build/iocore/eventsystem/I_VConnection.h:29,
                         from QUICStreamVCAdapter.cc:24:
        src/ts_asf_master_test_build/iocore/eventsystem/I_Continuation.h: In instantiation of _constexpr int (Continuation::* continuation_handler_void_ptr(int (C::*)(int, T*)))(int, void*) [with C = QUICStreamVCAdapter; T = void; ContinuationHandler = int (Continuation:
        :*)(int, void*)]_:
        QUICStreamVCAdapter.cc:29:3:   required from here
        src/ts_asf_master_test_build/iocore/eventsystem/I_Continuation.h:74:10: error: left shift of negative value [-Werror=shift-negative-value]
           74 |   return static_cast<ContinuationHandler>(fp2);
              |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   ```
   
   Changing to a reinterpret_cast from static_cast makes it happy, but if you have other ideas about how to address this, let me know.



-- 
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: github-unsubscribe@trafficserver.apache.org

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