summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Henriksen <insertinterestingnamehere@gmail.com>2016-04-12 13:29:51 -0600
committerStefan Behnel <stefan_ml@behnel.de>2016-07-15 08:18:14 +0200
commitf62074e2083ff37613af1dd876ae8f99e86cd054 (patch)
treedd3aed7a9ea4bf51486fe5fc80655518b751cee9
parent3573565a256b9463a4f388da573de3b06b37661c (diff)
downloadcython-f62074e2083ff37613af1dd876ae8f99e86cd054.tar.gz
Add test for passing in define macro without a value to distutils
via distutils comment directives in a Cython source file.
-rw-r--r--tests/run/define_macro.pyx11
-rw-r--r--tests/run/define_macro_helper.h6
2 files changed, 17 insertions, 0 deletions
diff --git a/tests/run/define_macro.pyx b/tests/run/define_macro.pyx
new file mode 100644
index 000000000..08f192c43
--- /dev/null
+++ b/tests/run/define_macro.pyx
@@ -0,0 +1,11 @@
+#distutils: define_macros = DEFINE_NO_VALUE, DEFINE_WITH_VALUE=0
+
+cdef extern from "define_macro_helper.h" nogil:
+ int VAL;
+
+def test():
+ """
+ >>> test()
+ 1
+ """
+ return VAL
diff --git a/tests/run/define_macro_helper.h b/tests/run/define_macro_helper.h
new file mode 100644
index 000000000..488dd1657
--- /dev/null
+++ b/tests/run/define_macro_helper.h
@@ -0,0 +1,6 @@
+#pragma once
+#ifdef DEFINE_NO_VALUE
+#define VAL (DEFINE_WITH_VALUE + 1)
+#else
+#define VAL DEFINE_WITH_VALUE
+#endif