未验证 提交 45bc4542 编写于 作者: W Wang Xin 提交者: GitHub

remove hardcoded -Wunused-variable compiler flags (#47706)

上级 75f34bb7
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#include "paddle/fluid/eager/nan_inf_utils.h" #include "paddle/fluid/eager/nan_inf_utils.h"
#include "paddle/fluid/platform/profiler/event_tracing.h" #include "paddle/fluid/platform/profiler/event_tracing.h"
#pragma GCC diagnostic ignored "-Wunused-variable"
DECLARE_bool(check_nan_inf); DECLARE_bool(check_nan_inf);
paddle::experimental::Tensor add_n_ad_func( paddle::experimental::Tensor add_n_ad_func(
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#include "paddle/fluid/eager/nan_inf_utils.h" #include "paddle/fluid/eager/nan_inf_utils.h"
#include "paddle/fluid/platform/profiler/event_tracing.h" #include "paddle/fluid/platform/profiler/event_tracing.h"
#pragma GCC diagnostic ignored "-Wunused-variable"
DECLARE_bool(check_nan_inf); DECLARE_bool(check_nan_inf);
paddle::experimental::Tensor conv2d_ad_func( paddle::experimental::Tensor conv2d_ad_func(
......
...@@ -20,8 +20,6 @@ ...@@ -20,8 +20,6 @@
#include "paddle/fluid/eager/api/utils/global_utils.h" #include "paddle/fluid/eager/api/utils/global_utils.h"
#include "paddle/fluid/platform/profiler/event_tracing.h" #include "paddle/fluid/platform/profiler/event_tracing.h"
#pragma GCC diagnostic ignored "-Wunused-variable"
std::tuple<paddle::experimental::Tensor, std::tuple<paddle::experimental::Tensor,
paddle::experimental::Tensor, paddle::experimental::Tensor,
paddle::experimental::Tensor, paddle::experimental::Tensor,
......
...@@ -19,8 +19,6 @@ ...@@ -19,8 +19,6 @@
#include "paddle/fluid/eager/api/utils/global_utils.h" #include "paddle/fluid/eager/api/utils/global_utils.h"
#include "paddle/fluid/platform/profiler/event_tracing.h" #include "paddle/fluid/platform/profiler/event_tracing.h"
#pragma GCC diagnostic ignored "-Wunused-variable"
std::tuple<paddle::experimental::Tensor, std::tuple<paddle::experimental::Tensor,
paddle::experimental::Tensor, paddle::experimental::Tensor,
paddle::experimental::Tensor, paddle::experimental::Tensor,
......
...@@ -19,8 +19,6 @@ ...@@ -19,8 +19,6 @@
#include "paddle/fluid/eager/api/utils/global_utils.h" #include "paddle/fluid/eager/api/utils/global_utils.h"
#include "paddle/fluid/platform/profiler/event_tracing.h" #include "paddle/fluid/platform/profiler/event_tracing.h"
#pragma GCC diagnostic ignored "-Wunused-variable"
std::tuple<paddle::experimental::Tensor, std::tuple<paddle::experimental::Tensor,
paddle::experimental::Tensor, paddle::experimental::Tensor,
paddle::experimental::Tensor, paddle::experimental::Tensor,
......
...@@ -20,8 +20,6 @@ ...@@ -20,8 +20,6 @@
#include "paddle/fluid/eager/api/utils/global_utils.h" #include "paddle/fluid/eager/api/utils/global_utils.h"
#include "paddle/fluid/platform/profiler/event_tracing.h" #include "paddle/fluid/platform/profiler/event_tracing.h"
#pragma GCC diagnostic ignored "-Wunused-variable"
paddle::experimental::Tensor fused_gemm_epilogue_dygraph_function( paddle::experimental::Tensor fused_gemm_epilogue_dygraph_function(
const paddle::experimental::Tensor& X, const paddle::experimental::Tensor& X,
const paddle::experimental::Tensor& Y, const paddle::experimental::Tensor& Y,
......
...@@ -3028,8 +3028,8 @@ static void GenerateForwardDygraphFile(const std::string& forward_cc_path, ...@@ -3028,8 +3028,8 @@ static void GenerateForwardDygraphFile(const std::string& forward_cc_path,
"#include \"paddle/fluid/eager/api/utils/global_utils.h\"\n" "#include \"paddle/fluid/eager/api/utils/global_utils.h\"\n"
"#include \"paddle/fluid/eager/amp_utils.h\"\n" "#include \"paddle/fluid/eager/amp_utils.h\"\n"
"#include \"paddle/fluid/eager/amp_auto_cast.h\"\n" "#include \"paddle/fluid/eager/amp_auto_cast.h\"\n"
"#include \"paddle/fluid/platform/profiler/event_tracing.h\"\n" "#include \"paddle/fluid/platform/profiler/event_tracing.h\"\n\n";
"#pragma GCC diagnostic ignored \"-Wunused-variable\"\n\n";
std::string forward_cc_include_str = std::string forward_cc_include_str =
paddle::string::Sprintf(FORWARD_INCLUDE_TEMPLATE); paddle::string::Sprintf(FORWARD_INCLUDE_TEMPLATE);
std::ofstream forward_cc_stream(forward_cc_path, std::ios::out); std::ofstream forward_cc_stream(forward_cc_path, std::ios::out);
......
# compile flags # compile flags
set(DLNNE_FLAGS -Wno-error=non-virtual-dtor -Wno-error=unused-variable set(DLNNE_FLAGS -Wno-error=non-virtual-dtor -Wno-error=attributes ${fsanitize})
-Wno-error=attributes ${fsanitize})
foreach(flag ${DLNNE_FLAGS}) foreach(flag ${DLNNE_FLAGS})
safe_set_cflag(CMAKE_C_FLAGS ${flag}) safe_set_cflag(CMAKE_C_FLAGS ${flag})
safe_set_cxxflag(CMAKE_CXX_FLAGS ${flag}) safe_set_cxxflag(CMAKE_CXX_FLAGS ${flag})
......
...@@ -203,7 +203,7 @@ endif() ...@@ -203,7 +203,7 @@ endif()
if(WITH_PSLIB) if(WITH_PSLIB)
set(DISTRIBUTE_COMPILE_FLAGS set(DISTRIBUTE_COMPILE_FLAGS
"-Wno-non-virtual-dtor -Wno-error=non-virtual-dtor -Wno-error=delete-non-virtual-dtor -Wno-error=unused-variable -Wno-error=return-type -Wno-error=unused-but-set-variable -Wno-error=type-limits -Wno-error=unknown-pragmas -Wno-error=parentheses -Wno-error=unused-result" "-Wno-non-virtual-dtor -Wno-error=non-virtual-dtor -Wno-error=delete-non-virtual-dtor -Wno-error=return-type -Wno-error=unused-but-set-variable -Wno-error=type-limits -Wno-error=unknown-pragmas -Wno-error=parentheses -Wno-error=unused-result"
) )
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.0) if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.0)
set(DISTRIBUTE_COMPILE_FLAGS "${DISTRIBUTE_COMPILE_FLAGS} -faligned-new") set(DISTRIBUTE_COMPILE_FLAGS "${DISTRIBUTE_COMPILE_FLAGS} -faligned-new")
...@@ -214,11 +214,11 @@ endif() ...@@ -214,11 +214,11 @@ endif()
if(WITH_PSCORE) if(WITH_PSCORE)
if(WITH_ARM_BRPC) if(WITH_ARM_BRPC)
set(DISTRIBUTE_COMPILE_FLAGS set(DISTRIBUTE_COMPILE_FLAGS
"-faligned-new -Wno-non-virtual-dtor -Wno-error=non-virtual-dtor -Wno-error=delete-non-virtual-dtor -Wno-error=unused-variable -Wno-error=return-type -Wno-error=unused-but-set-variable -Wno-error=unknown-pragmas -Wno-error=parentheses -Wno-error=unused-result" "-faligned-new -Wno-non-virtual-dtor -Wno-error=non-virtual-dtor -Wno-error=delete-non-virtual-dtor -Wno-error=return-type -Wno-error=unused-but-set-variable -Wno-error=unknown-pragmas -Wno-error=parentheses -Wno-error=unused-result"
) )
else() else()
set(DISTRIBUTE_COMPILE_FLAGS set(DISTRIBUTE_COMPILE_FLAGS
"-Wno-non-virtual-dtor -Wno-error=non-virtual-dtor -Wno-error=delete-non-virtual-dtor -Wno-error=unused-variable -Wno-error=return-type -Wno-error=unused-but-set-variable -Wno-error=unknown-pragmas -Wno-error=parentheses -Wno-error=unused-result" "-Wno-non-virtual-dtor -Wno-error=non-virtual-dtor -Wno-error=delete-non-virtual-dtor -Wno-error=return-type -Wno-error=unused-but-set-variable -Wno-error=unknown-pragmas -Wno-error=parentheses -Wno-error=unused-result"
) )
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.0) if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.0)
set(DISTRIBUTE_COMPILE_FLAGS "${DISTRIBUTE_COMPILE_FLAGS} -faligned-new") set(DISTRIBUTE_COMPILE_FLAGS "${DISTRIBUTE_COMPILE_FLAGS} -faligned-new")
...@@ -234,11 +234,11 @@ endif() ...@@ -234,11 +234,11 @@ endif()
if(WITH_RPC) if(WITH_RPC)
if(WITH_ARM_BRPC) if(WITH_ARM_BRPC)
set(DISTRIBUTE_COMPILE_FLAGS set(DISTRIBUTE_COMPILE_FLAGS
"-faligned-new -Wno-non-virtual-dtor -Wno-error=non-virtual-dtor -Wno-error=delete-non-virtual-dtor -Wno-error=unused-variable -Wno-error=return-type -Wno-error=unused-but-set-variable -Wno-error=unknown-pragmas -Wno-error=parentheses -Wno-error=unused-result" "-faligned-new -Wno-non-virtual-dtor -Wno-error=non-virtual-dtor -Wno-error=delete-non-virtual-dtor -Wno-error=return-type -Wno-error=unused-but-set-variable -Wno-error=unknown-pragmas -Wno-error=parentheses -Wno-error=unused-result"
) )
else() else()
set(DISTRIBUTE_COMPILE_FLAGS set(DISTRIBUTE_COMPILE_FLAGS
"-Wno-non-virtual-dtor -Wno-error=non-virtual-dtor -Wno-error=delete-non-virtual-dtor -Wno-error=unused-variable -Wno-error=return-type -Wno-error=unused-but-set-variable -Wno-error=unknown-pragmas -Wno-error=parentheses -Wno-error=unused-result" "-Wno-non-virtual-dtor -Wno-error=non-virtual-dtor -Wno-error=delete-non-virtual-dtor -Wno-error=return-type -Wno-error=unused-but-set-variable -Wno-error=unknown-pragmas -Wno-error=parentheses -Wno-error=unused-result"
) )
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.0) if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.0)
set(DISTRIBUTE_COMPILE_FLAGS "${DISTRIBUTE_COMPILE_FLAGS} -faligned-new") set(DISTRIBUTE_COMPILE_FLAGS "${DISTRIBUTE_COMPILE_FLAGS} -faligned-new")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册