summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorMichael Felt <aixtools@users.noreply.github.com>2018-12-26 03:54:22 (GMT)
committerNick Coghlan <ncoghlan@gmail.com>2018-12-26 03:54:22 (GMT)
commit22462da70c1ae015a60a7b821547bc6d2b5bc265 (patch)
tree5f36abcea8207375e4de8659197473884bcfbb3b /Modules
parent5661459f5f508ea4bd24c13cbc861543f283147e (diff)
downloadcpython-22462da70c1ae015a60a7b821547bc6d2b5bc265.zip
cpython-22462da70c1ae015a60a7b821547bc6d2b5bc265.tar.gz
cpython-22462da70c1ae015a60a7b821547bc6d2b5bc265.tar.bz2
bpo-27643 - skip test_ctypes test case with XLC compiler. (GH-5164)
This test case needs "signed short" bitfields, but the IBM XLC compiler (on AIX) does not support this. Skip the code and test when AIX and XLC are used. Use __xlc__ as identifier to detect the XLC compiler.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_ctypes/_ctypes_test.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/Modules/_ctypes/_ctypes_test.c b/Modules/_ctypes/_ctypes_test.c
index 0152945..f842058 100644
--- a/Modules/_ctypes/_ctypes_test.c
+++ b/Modules/_ctypes/_ctypes_test.c
@@ -414,8 +414,15 @@ EXPORT(long long) last_tf_arg_s = 0;
EXPORT(unsigned long long) last_tf_arg_u = 0;
struct BITS {
- int A: 1, B:2, C:3, D:4, E: 5, F: 6, G: 7, H: 8, I: 9;
- short M: 1, N: 2, O: 3, P: 4, Q: 5, R: 6, S: 7;
+ signed int A: 1, B:2, C:3, D:4, E: 5, F: 6, G: 7, H: 8, I: 9;
+/*
+ * The test case needs/uses "signed short" bitfields, but the
+ * IBM XLC compiler does not support this
+ */
+#ifndef __xlc__
+#define SIGNED_SHORT_BITFIELDS
+ short M: 1, N: 2, O: 3, P: 4, Q: 5, R: 6, S: 7;
+#endif
};
EXPORT(void) set_bitfields(struct BITS *bits, char name, int value)
@@ -430,7 +437,7 @@ EXPORT(void) set_bitfields(struct BITS *bits, char name, int value)
case 'G': bits->G = value; break;
case 'H': bits->H = value; break;
case 'I': bits->I = value; break;
-
+#ifdef SIGNED_SHORT_BITFIELDS
case 'M': bits->M = value; break;
case 'N': bits->N = value; break;
case 'O': bits->O = value; break;
@@ -438,6 +445,7 @@ EXPORT(void) set_bitfields(struct BITS *bits, char name, int value)
case 'Q': bits->Q = value; break;
case 'R': bits->R = value; break;
case 'S': bits->S = value; break;
+#endif
}
}
@@ -454,6 +462,7 @@ EXPORT(int) unpack_bitfields(struct BITS *bits, char name)
case 'H': return bits->H;
case 'I': return bits->I;
+#ifdef SIGNED_SHORT_BITFIELDS
case 'M': return bits->M;
case 'N': return bits->N;
case 'O': return bits->O;
@@ -461,8 +470,9 @@ EXPORT(int) unpack_bitfields(struct BITS *bits, char name)
case 'Q': return bits->Q;
case 'R': return bits->R;
case 'S': return bits->S;
+#endif
}
- return 0;
+ return 999;
}
static PyMethodDef module_methods[] = {