mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Check function declarations in Caffe2 code (#134925)
Fixes #ISSUE_NUMBER Pull Request resolved: https://github.com/pytorch/pytorch/pull/134925 Approved by: https://github.com/ezyang
This commit is contained in:
@ -781,7 +781,7 @@ if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" AND NOT USE_IOS AND NOT USE_COREML
|
||||
set_source_files_properties(${source_file} PROPERTIES COMPILE_OPTIONS "-Wno-missing-prototypes;-Wno-error=missing-prototypes")
|
||||
continue()
|
||||
endif()
|
||||
string(FIND "${source_file}" "caffe2" res)
|
||||
string(FIND "${source_file}" "embedding_lookup_idx_avx2.cc" res)
|
||||
if(res GREATER -1)
|
||||
set_source_files_properties(${source_file} PROPERTIES COMPILE_OPTIONS "-Wno-missing-prototypes;-Wno-error=missing-prototypes")
|
||||
endif()
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include <c10/util/irange.h>
|
||||
#include "caffe2/perfkernels/common.h"
|
||||
|
||||
C10_DIAGNOSTIC_PUSH_AND_IGNORED_IF_DEFINED("-Wmissing-prototypes")
|
||||
namespace caffe2 {
|
||||
|
||||
/**
|
||||
@ -125,7 +126,7 @@ static bool EmbeddingLookupGenericSlowIdx(
|
||||
const float* scale_bias, \
|
||||
bool normalize_by_lengths, \
|
||||
OutType* out) { \
|
||||
if (std::is_same<InType, uint8_t>::value) { \
|
||||
if constexpr (std::is_same<InType, uint8_t>::value) { \
|
||||
CAFFE_ENFORCE(scale_bias != nullptr, "scale_bias must not be nullptr"); \
|
||||
} else { \
|
||||
CAFFE_ENFORCE(scale_bias == nullptr, "scale_bias must be nullptr"); \
|
||||
@ -231,3 +232,4 @@ EMBEDDING_IDX_SPECIALIZATION(int64_t, uint8_t, uint8_t, float, true);
|
||||
#undef EMBEDDING_IDX_SPECIALIZATION
|
||||
|
||||
} // namespace caffe2
|
||||
C10_DIAGNOSTIC_POP()
|
||||
|
@ -1,5 +1,4 @@
|
||||
#include "miniz.h"
|
||||
#include <iostream>
|
||||
|
||||
#include "caffe2/serialize/crc_alt.h"
|
||||
|
||||
|
@ -9,6 +9,29 @@ namespace caffe2 {
|
||||
// testing and valgrind cases to avoid protobuf appearing to "leak" memory).
|
||||
TORCH_API void ShutdownProtobufLibrary();
|
||||
|
||||
// Caffe2 wrapper functions for protobuf's GetEmptyStringAlreadyInited()
|
||||
// function used to avoid duplicated global variable in the case when protobuf
|
||||
// is built with hidden visibility.
|
||||
TORCH_API const ::std::string& GetEmptyStringAlreadyInited();
|
||||
} // namespace caffe2
|
||||
|
||||
namespace ONNX_NAMESPACE {
|
||||
|
||||
// ONNX wrapper functions for protobuf's GetEmptyStringAlreadyInited() function
|
||||
// used to avoid duplicated global variable in the case when protobuf
|
||||
// is built with hidden visibility.
|
||||
TORCH_API const ::std::string& GetEmptyStringAlreadyInited();
|
||||
|
||||
} // namespace ONNX_NAMESPACE
|
||||
|
||||
namespace torch {
|
||||
|
||||
// Caffe2 wrapper functions for protobuf's GetEmptyStringAlreadyInited()
|
||||
// function used to avoid duplicated global variable in the case when protobuf
|
||||
// is built with hidden visibility.
|
||||
TORCH_API const ::std::string& GetEmptyStringAlreadyInited();
|
||||
|
||||
void ShutdownProtobufLibrary();
|
||||
|
||||
} // namespace torch
|
||||
#endif // CAFFE2_UTILS_PROTO_WRAP_H_
|
||||
|
Reference in New Issue
Block a user