mirror of
https://github.com/saymrwulf/pytorch.git
synced 2026-05-14 20:57:59 +00:00
Promote -Wcast-function-type to an error in builds. (#46356)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/46356 Adding the flag `-Werror=cast-function-type` to ensure we don't allow any invalid casts (ex: PyCFunction casts). For more details see: https://github.com/pytorch/pytorch/issues/45419 ghstack-source-id: 114632980 Test Plan: waitforbuildbot Reviewed By: albanD Differential Revision: D24319759 fbshipit-source-id: 26ce4650c220e8e9dd3550245f214c7e6c21a5dc
This commit is contained in:
parent
42a70dc5a8
commit
cb3c1d17e4
2 changed files with 5 additions and 1 deletions
|
|
@ -642,6 +642,10 @@ if(NOT MSVC)
|
|||
if(HAS_WERROR_FORMAT)
|
||||
string(APPEND CMAKE_CXX_FLAGS " -Werror=format")
|
||||
endif()
|
||||
check_cxx_compiler_flag("-Werror=cast-function-type" HAS_WERROR_CAST_FUNCTION_TYPE)
|
||||
if(HAS_WERROR_CAST_FUNCTION_TYPE)
|
||||
string(APPEND CMAKE_CXX_FLAGS " -Werror=cast-function-type")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(USE_ASAN)
|
||||
|
|
|
|||
|
|
@ -425,7 +425,7 @@ PyObject *THPVariable_get_names(PyObject *self, void *unused)
|
|||
END_HANDLE_TH_ERRORS
|
||||
}
|
||||
|
||||
int THPVariable_set_names(PyObject *self, PyObject *names) {
|
||||
int THPVariable_set_names(PyObject *self, PyObject *names, void *unused) {
|
||||
HANDLE_TH_ERRORS
|
||||
if (check_has_torch_function(self)) {
|
||||
return handle_torch_function_setter((THPVariable*)self, "names", names);
|
||||
|
|
|
|||
Loading…
Reference in a new issue