diff --git a/CMakeLists.txt b/CMakeLists.txt index 32d2f361884..9ce082f2079 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -809,6 +809,7 @@ if(NOT MSVC) append_cxx_flag_if_supported("-Wno-strict-overflow" CMAKE_CXX_FLAGS) append_cxx_flag_if_supported("-Wno-strict-aliasing" CMAKE_CXX_FLAGS) append_cxx_flag_if_supported("-Wvla-extension" CMAKE_CXX_FLAGS) + append_cxx_flag_if_supported("-Wnewline-eof" CMAKE_CXX_FLAGS) if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") string(APPEND CMAKE_CXX_FLAGS " -Wno-range-loop-analysis") string(APPEND CMAKE_CXX_FLAGS " -Wno-pass-failed") diff --git a/aten/src/ATen/native/transformers/cuda/flash_attn/fmha_utils.h b/aten/src/ATen/native/transformers/cuda/flash_attn/fmha_utils.h index 3bdcad3c058..668891b8394 100644 --- a/aten/src/ATen/native/transformers/cuda/flash_attn/fmha_utils.h +++ b/aten/src/ATen/native/transformers/cuda/flash_attn/fmha_utils.h @@ -97,4 +97,4 @@ static inline size_t get_size_in_bytes( size_t n, Data_type dtype ) { } } -//////////////////////////////////////////////////////////////////////////////////////////////////// \ No newline at end of file +//////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/aten/src/ATen/native/transformers/sdp_utils_cpp.h b/aten/src/ATen/native/transformers/sdp_utils_cpp.h index 03b2ea6c69c..2af2ba1b814 100644 --- a/aten/src/ATen/native/transformers/sdp_utils_cpp.h +++ b/aten/src/ATen/native/transformers/sdp_utils_cpp.h @@ -23,4 +23,4 @@ inline c10::SymFloat calculate_scale( return c10::SymFloat(softmax_scale); } -} // namespace sdp \ No newline at end of file +} // namespace sdp diff --git a/torch/csrc/jit/passes/onnx/constant_map.h b/torch/csrc/jit/passes/onnx/constant_map.h index 85dda1d553c..218c23aacc9 100644 --- a/torch/csrc/jit/passes/onnx/constant_map.h +++ b/torch/csrc/jit/passes/onnx/constant_map.h @@ -3,8 +3,10 @@ #include C10_DIAGNOSTIC_PUSH_AND_IGNORED_IF_DEFINED("-Wsuggest-override") +C10_DIAGNOSTIC_PUSH_AND_IGNORED_IF_DEFINED("-Wnewline-eof") #include C10_DIAGNOSTIC_POP() +C10_DIAGNOSTIC_POP() #include #include diff --git a/torch/csrc/jit/serialization/export.cpp b/torch/csrc/jit/serialization/export.cpp index b69ad78f7a4..9aeea5718a3 100644 --- a/torch/csrc/jit/serialization/export.cpp +++ b/torch/csrc/jit/serialization/export.cpp @@ -21,7 +21,9 @@ #include #include +C10_DIAGNOSTIC_PUSH_AND_IGNORED_IF_DEFINED("-Wnewline-eof") #include +C10_DIAGNOSTIC_POP() #include #include C10_DIAGNOSTIC_PUSH_AND_IGNORED_IF_DEFINED("-Wsuggest-override") diff --git a/torch/csrc/jit/serialization/mobile_bytecode_generated.h b/torch/csrc/jit/serialization/mobile_bytecode_generated.h index 0fdb0fe8560..ec750cf9bc1 100644 --- a/torch/csrc/jit/serialization/mobile_bytecode_generated.h +++ b/torch/csrc/jit/serialization/mobile_bytecode_generated.h @@ -4,7 +4,9 @@ #ifndef FLATBUFFERS_GENERATED_MOBILEBYTECODE_TORCH_JIT_MOBILE_SERIALIZATION_H_ #define FLATBUFFERS_GENERATED_MOBILEBYTECODE_TORCH_JIT_MOBILE_SERIALIZATION_H_ +C10_DIAGNOSTIC_PUSH_AND_IGNORED_IF_DEFINED("-Wnewline-eof") #include "flatbuffers/flatbuffers.h" +C10_DIAGNOSTIC_POP() namespace torch { namespace jit { diff --git a/torch/csrc/utils/pythoncapi_compat.h b/torch/csrc/utils/pythoncapi_compat.h index c601fbcca11..d91a22e28bd 100644 --- a/torch/csrc/utils/pythoncapi_compat.h +++ b/torch/csrc/utils/pythoncapi_compat.h @@ -572,4 +572,4 @@ PyCode_GetCellvars(PyCodeObject *code) #ifdef __cplusplus } #endif -#endif // PYTHONCAPI_COMPAT \ No newline at end of file +#endif // PYTHONCAPI_COMPAT