Skip to content

Commit

Permalink
Windows: Improve msvc warning suppression
Browse files Browse the repository at this point in the history
  • Loading branch information
kkoopa committed Apr 12, 2015
1 parent 80eab78 commit 207a62d
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 19 deletions.
3 changes: 2 additions & 1 deletion nan.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@
#include <cstring>
#include <climits>
#if defined(_MSC_VER)
# pragma warning( push )
# pragma warning( disable : 4530 )
# include <string>
# pragma warning( default : 4530 )
# pragma warning( pop )
#else
# include <string>
#endif
Expand Down
3 changes: 2 additions & 1 deletion nan_implementation_12_inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
//==============================================================================

#if defined(_MSC_VER)
# pragma warning( push )
# pragma warning( disable : 4530 )
# include <string>
# pragma warning( default : 4530 )
# pragma warning( pop )
#else
# include <string>
#endif
Expand Down
3 changes: 2 additions & 1 deletion nan_implementation_pre_12_inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@
#include <algorithm>

#if defined(_MSC_VER)
# pragma warning( push )
# pragma warning( disable : 4530 )
# include <string>
# include <vector>
# pragma warning( default : 4530 )
# pragma warning( pop )
#else
# include <string>
# include <vector>
Expand Down
11 changes: 10 additions & 1 deletion nan_new.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
#define NAN_NEW_H_

#if defined(_MSC_VER)
# pragma warning( push )
# pragma warning( disable : 4530 )
# include <string>
# pragma warning( default : 4530 )
# pragma warning( pop )
#else
# include <string>
#endif
Expand Down Expand Up @@ -201,11 +202,19 @@ NanNew() {
return NanIntern::Factory<T>::New();
}

#if defined(_MSC_VER)
# pragma warning( push )
# pragma warning( disable : 4800 )
#endif
template <typename T, typename A0>
typename NanIntern::Factory<T>::return_t
NanNew(A0 arg0) {
return NanIntern::Factory<T>::New(arg0);
}
#if defined(_MSC_VER)
# pragma warning( pop )
#endif


template <typename T, typename A0, typename A1>
typename NanIntern::Factory<T>::return_t
Expand Down
10 changes: 2 additions & 8 deletions test/cpp/nannew.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@
#include <cmath>
#include <ctime>
#if defined(_MSC_VER)
# pragma warning( push )
# pragma warning( disable : 4530 )
# include <string>
# pragma warning( default : 4530 )
# pragma warning( pop )
#else
# include <string>
#endif
Expand Down Expand Up @@ -383,14 +384,7 @@ NAN_METHOD(testRegression212) {

typedef int gint;
typedef gint gboolean;
#if defined(_MSC_VER)
# pragma warning( disable : 4800 )
#endif
t.ok(_( assertType<Boolean>( NanNew<Boolean>(gboolean(23)))));
#if defined(_MSC_VER)
# pragma warning( default : 4800 )
#endif

return_NanUndefined();
}

Expand Down
9 changes: 2 additions & 7 deletions test/cpp/news.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@

#include <nan.h>
#if defined(_MSC_VER)
# pragma warning( push )
# pragma warning( disable : 4530 )
# include <string>
# pragma warning( default : 4530 )
# pragma warning( pop )
#else
# include <string>
#endif
Expand Down Expand Up @@ -163,13 +164,7 @@ NAN_METHOD(NewBoolean) {
// #212
NAN_METHOD(NewBoolean2) {
NanScope();
#if defined(_MSC_VER)
# pragma warning( disable : 4800 )
#endif
NanReturnValue(NanNew<v8::Boolean>(1));
#if defined(_MSC_VER)
# pragma warning( default : 4800 )
#endif
}

void Init(v8::Handle<v8::Object> target) {
Expand Down

0 comments on commit 207a62d

Please sign in to comment.