-
Notifications
You must be signed in to change notification settings - Fork 825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix all warnings & Add option TREAT_WARING_AS_ERROR to cmake #5751
Fix all warnings & Add option TREAT_WARING_AS_ERROR to cmake #5751
Conversation
@@ -1165,7 +1165,7 @@ Maybe<void> InstructionsBuilder::StatefulCall( | |||
}; | |||
|
|||
const auto GetDelegateBlobObject = | |||
[this, &FetchDelegateBlobObject]( | |||
[&FetchDelegateBlobObject]( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里是什么原因需要捕获this的
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不是很清楚,可能之前有用到后来删掉了?不过这个 lambda 应该确实不需要捕获 this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
修改一下 CI,在 .github/workflows/test.yml:137 这些地方加上 -DTREAT_WARNINGS_AS_ERRORS=OFF 吧
@@ -126,10 +127,7 @@ if(WIN32) | |||
#set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS} /DEBUG:FASTLINK") | |||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /D_ITERATOR_DEBUG_LEVEL=0") | |||
else() | |||
set(EXTRA_CXX_FLAGS "-std=c++11 -Wall -Wno-sign-compare -Wno-unused-function -fPIC -Werror=return-type") | |||
if (APPLE) | |||
set(EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} -Wno-deprecated-declarations -Wno-mismatched-tags") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里 -Wno-deprecated-declarations 现在被换成了 -Wno-error=deprecated-declarations?是不是行为不一样
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
是的,-Wno-deprecated-declarations
是不报出 deprecated-declarations 类型的警告,-Wno-error=deprecated-declarations
是报出 deprecated-declarations 类型的警告但不将其视为错误,我感觉这里报出来但不视为错误更合理一些
Done:
unused-const-variable
unused-private-field
unused-variable
unused-local-typedef
unused-lambda-capture
instantiation-after-specialization
: disable unused-* for different compile mode (maybe unused in cpu.cmake, but used in cuda.cmake)deprecated-declarations
: wait for all deprecated calls are fixed, then it will be removedliteral-conversion
: wait foroneflow/user/kernels/upsample_kernel.h:141:9: error: implicit conversion from 'double' to 'int' changes value from -0.75 to 0 [-Wliteral-conversion]
is fixed, then it will be removedNotice:
return std::move(local_var)
is unnecessary because it is guaranteed the returned local variable will be moved in the standard, and the move operation here will prevent a special optimization in compiler called named return value optimization (NRVO).CHECK_OK
is removed because it will prevent RVO and developer is hard to know a macro which will implicitly do rvalue cast. (parameter type ofMaybeIsOK
is a rvalue reference, so for a origin rvalue, likef(x)
, it just works without move, and for an lvalue, a compile error is preferred)Discovered Problems:
In
oneflow/core/job/job_build_and_infer_ctx_mgr.cpp
:In
oneflow/user/kernels/upsample_kernel.h
: