Skip to content

Commit cc9f8aa

Browse files
authored
Merge pull request numpy#27235 from mdavidsaver/fix-msvc-warning-directive
MAINT: MSVC does not support #warning directive
2 parents f64e2da + 863f151 commit cc9f8aa

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

numpy/_core/include/numpy/numpyconfig.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,14 @@
130130
#error "NPY_TARGET_VERSION higher than NumPy headers!"
131131
#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)