Skip to content

Commit b726fb9

Browse files
committed
Make slightly less clever use of token pasting to make gcc happy
1 parent feea0f5 commit b726fb9

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

ctest/base_ctest.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ void tearDown(void) {}
1313
/**
1414
* @brief Tests _pg_is_int_tuple when passed a tuple of ints
1515
*/
16-
PG_CTEST(test__pg_is_int_tuple_nominal) {
16+
PG_CTEST(test__pg_is_int_tuple_nominal)(PyObject *self, PyObject *_null) {
1717
PyObject *arg1 = Py_BuildValue("(iii)", 1, 2, 3);
1818
PyObject *arg2 = Py_BuildValue("(iii)", -1, -2, -3);
1919
PyObject *arg3 = Py_BuildValue("(iii)", 1, -2, -3);
@@ -28,7 +28,7 @@ PG_CTEST(test__pg_is_int_tuple_nominal) {
2828
/**
2929
* @brief Tests _pg_is_int_tuple when passed a tuple of non-numeric values
3030
*/
31-
PG_CTEST(test__pg_is_int_tuple_failureModes) {
31+
PG_CTEST(test__pg_is_int_tuple_failureModes)(PyObject *self, PyObject *_null) {
3232
PyObject *arg1 =
3333
Py_BuildValue("(sss)", (char *)"Larry", (char *)"Moe", (char *)"Curly");
3434
PyObject *arg2 = Py_BuildValue("(sss)", (char *)NULL, (char *)NULL,
@@ -45,7 +45,7 @@ PG_CTEST(test__pg_is_int_tuple_failureModes) {
4545
/**
4646
* @brief Tests _pg_is_int_tuple when passed a tuple of floats
4747
*/
48-
PG_CTEST(test__pg_is_int_tuple_floats) {
48+
PG_CTEST(test__pg_is_int_tuple_floats)(PyObject *self, PyObject *_null) {
4949
PyObject *arg1 = Py_BuildValue("(ddd)", 1.0, 2.0, 3.0);
5050
PyObject *arg2 = Py_BuildValue("(ddd)", -1.1, -2.2, -3.3);
5151
PyObject *arg3 = Py_BuildValue("(ddd)", 1.0, -2.0, -3.1);

ctest/test_common.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,14 @@ struct TestCase {
2121
The RUN_TEST_PG_INTERNAL macro then references that struct for each test
2222
case that we tell it about and automatically populates the unity fields
2323
with the requisite data.
24+
25+
Note that the arguments to the test function must be *exactly*
26+
(PyObject * self, PyObject * _null), but due to gcc throwing a fit, I
27+
cannot just use token pasting to have the macro generate that part for me
2428
*/
2529
#define PG_CTEST(TestFunc) \
2630
static struct TestCase meta_##TestFunc = {#TestFunc, __LINE__}; \
27-
static PyObject *TestFunc##(PyObject * self, PyObject * _null)
31+
static PyObject *TestFunc
2832

2933
#define RUN_TEST_PG_INTERNAL(TestFunc) \
3034
{ \

0 commit comments

Comments
 (0)