Skip to content

Commit 863f151

Browse files
committed
Emit MSVC style warning
1 parent 129860d commit 863f151

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

numpy/_core/include/numpy/numpyconfig.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,16 @@
128128
/* Sanity check the (requested) feature version */
129129
#if NPY_FEATURE_VERSION > NPY_API_VERSION
130130
#error "NPY_TARGET_VERSION higher than NumPy headers!"
131-
#elif NPY_FEATURE_VERSION < NPY_1_15_API_VERSION && !defined(_WIN32)
131+
#elif NPY_FEATURE_VERSION < NPY_1_15_API_VERSION
132132
/* No support for irrelevant old targets, no need for error, but warn. */
133-
#warning "Requested NumPy target lower than supported NumPy 1.15."
133+
#ifndef _MSC_VER
134+
#warning "Requested NumPy target lower than supported NumPy 1.15."
135+
#else
136+
#define _WARN___STR2__(x) #x
137+
#define _WARN___STR1__(x) _WARN___STR2__(x)
138+
#define _WARN___LOC__ __FILE__ "(" _WARN___STR1__(__LINE__) ") : Warning Msg: "
139+
#pragma message(_WARN___LOC__"Requested NumPy target lower than supported NumPy 1.15.")
140+
#endif
134141
#endif
135142

136143
/*

0 commit comments

Comments
 (0)