[llvm] 0b01b21 - [LLVMgold] Suppress -Wcast-function-type-mismatch diagnostic

via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 25 11:25:41 PDT 2024


Author: Fangrui Song
Date: 2024-04-25T11:25:37-07:00
New Revision: 0b01b2143735a0becf2ed09825ddd33b98b1c5b5

URL: https://github.com/llvm/llvm-project/commit/0b01b2143735a0becf2ed09825ddd33b98b1c5b5
DIFF: https://github.com/llvm/llvm-project/commit/0b01b2143735a0becf2ed09825ddd33b98b1c5b5.diff

LOG: [LLVMgold] Suppress -Wcast-function-type-mismatch diagnostic

llvm/cmake/modules/HandleLLVMOptions.cmake adds -Wextra.
-Wcast-function-type-mismatch was recently added to -Wextra, leading to
a warning for the `get_wrap_symbols` code (https://reviews.llvm.org/D44235).

Suppress the diagnostic.

Pull Request: https://github.com/llvm/llvm-project/pull/89994

Added: 
    

Modified: 
    llvm/tools/gold/gold-plugin.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/tools/gold/gold-plugin.cpp b/llvm/tools/gold/gold-plugin.cpp
index b8a33f74bd570f..5503f7343cb672 100644
--- a/llvm/tools/gold/gold-plugin.cpp
+++ b/llvm/tools/gold/gold-plugin.cpp
@@ -434,8 +434,10 @@ ld_plugin_status onload(ld_plugin_tv *tv) {
       // FIXME: When binutils 2.31 (containing gold 1.16) is the minimum
       // required version, this should be changed to:
       // get_wrap_symbols = tv->tv_u.tv_get_wrap_symbols;
-      get_wrap_symbols =
-          (ld_plugin_get_wrap_symbols)tv->tv_u.tv_message;
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wcast-function-type"
+      get_wrap_symbols = (ld_plugin_get_wrap_symbols)tv->tv_u.tv_message;
+#pragma GCC diagnostic pop
       break;
     default:
       break;


        


More information about the llvm-commits mailing list