Skip to content

Commit

Permalink
忽略4191告警
Browse files Browse the repository at this point in the history
  • Loading branch information
chexiongsheng committed Oct 24, 2024
1 parent 097e304 commit af581ca
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 11 deletions.
3 changes: 3 additions & 0 deletions unreal/Puerts/Source/JsEnv/Private/CppObjectMapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ static void CDataNew(const v8::FunctionCallbackInfo<v8::Value>& Info)
}
}

MSVC_PRAGMA(warning(push))
MSVC_PRAGMA(warning(disable : 4191))
v8::Local<v8::FunctionTemplate> FCppObjectMapper::GetTemplateOfClass(v8::Isolate* Isolate, const JSClassDefinition* ClassDefinition)
{
auto Iter = TypeIdToTemplateMap.find(ClassDefinition->TypeId);
Expand Down Expand Up @@ -293,6 +295,7 @@ v8::Local<v8::FunctionTemplate> FCppObjectMapper::GetTemplateOfClass(v8::Isolate
return v8::Local<v8::FunctionTemplate>::New(Isolate, Iter->second);
}
}
MSVC_PRAGMA(warning(pop))

static void CDataGarbageCollectedWithFree(const v8::WeakCallbackInfo<JSClassDefinition>& Data)
{
Expand Down
11 changes: 0 additions & 11 deletions unreal/Puerts/Source/JsEnv/Private/PesapiV8Impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,6 @@
#include <vector>
#include <cstring>

#ifndef MSVC_PRAGMA
#if !defined(__clang__) && defined(_MSC_VER)
#define MSVC_PRAGMA(Pragma) __pragma(Pragma)
#else
#define MSVC_PRAGMA(...)
#endif
#endif

struct pesapi_env_ref__
{
explicit pesapi_env_ref__(v8::Local<v8::Context> context)
Expand Down Expand Up @@ -964,8 +956,6 @@ static void free_property_descriptor(pesapi_property_descriptor properties, size
// set module name here during loading, set nullptr after module loaded
const char* GPesapiModuleName = nullptr;

MSVC_PRAGMA(warning(push))
MSVC_PRAGMA(warning(disable : 4191))
void pesapi_define_class(const void* type_id, const void* super_type_id, const char* type_name, pesapi_constructor constructor,
pesapi_finalize finalize, size_t property_count, pesapi_property_descriptor properties, void* data)
{
Expand Down Expand Up @@ -1035,7 +1025,6 @@ void pesapi_define_class(const void* type_id, const void* super_type_id, const c

puerts::RegisterJSClass(classDef);
}
MSVC_PRAGMA(warning(pop))

void* pesapi_get_class_data(const void* type_id, bool force_load)
{
Expand Down
3 changes: 3 additions & 0 deletions unreal/Puerts/Source/JsEnv/Private/StructWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ void FStructWrapper::RefreshMethod(UFunction* InFunction)
}
}

MSVC_PRAGMA(warning(push))
MSVC_PRAGMA(warning(disable : 4191))
void FStructWrapper::InitTemplateProperties(
v8::Isolate* Isolate, UStruct* InStruct, v8::Local<v8::FunctionTemplate> Template, bool IsReuseTemplate)
{
Expand Down Expand Up @@ -456,6 +458,7 @@ v8::Local<v8::FunctionTemplate> FStructWrapper::ToFunctionTemplate(v8::Isolate*

return Result;
}
MSVC_PRAGMA(warning(pop))

void FStructWrapper::StaticClass(const v8::FunctionCallbackInfo<v8::Value>& Info)
{
Expand Down
4 changes: 4 additions & 0 deletions unreal/Puerts/Source/JsEnv/Public/JSClassRegister.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ static const FAnsiStringView EditorOnlyPropertySuffix = "_EditorOnly";
namespace PUERTS_NAMESPACE
{
class CFunctionInfo;

MSVC_PRAGMA(warning(push))
MSVC_PRAGMA(warning(disable : 4191))
struct JSENV_API JSFunctionInfo
{
JSFunctionInfo() : Name(nullptr), Callback(nullptr)
Expand Down Expand Up @@ -92,6 +95,7 @@ struct JSENV_API JSPropertyInfo
void* GetterData = nullptr;
void* SetterData = nullptr;
};
MSVC_PRAGMA(warning(pop))

struct NamedFunctionInfo;
struct NamedPropertyInfo;
Expand Down
8 changes: 8 additions & 0 deletions unreal/Puerts/Source/JsEnv/Public/PuertsNamespaceDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,11 @@
#define PRAGMA_ENABLE_UNDEFINED_IDENTIFIER_WARNINGS _Pragma("GCC diagnostic pop")
#endif
#endif // PRAGMA_ENABLE_UNDEFINED_IDENTIFIER_WARNINGS

#ifndef MSVC_PRAGMA
#if !defined(__clang__) && defined(_MSC_VER)
#define MSVC_PRAGMA(Pragma) __pragma(Pragma)
#else
#define MSVC_PRAGMA(...)
#endif
#endif

0 comments on commit af581ca

Please sign in to comment.