Skip to content

Commit e529977

Browse files
committed
Compile out unused functions using TODO flags rather then comments
1 parent 2b8dca1 commit e529977

File tree

5 files changed

+19
-16
lines changed

5 files changed

+19
-16
lines changed

tests/TestSuite.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -667,10 +667,6 @@ TestSuite_RunSerial (TestSuite *suite) /* IN */
667667
}
668668

669669

670-
#ifdef __clang__
671-
#pragma clang diagnostic push
672-
#pragma clang diagnostic ignored "-Wcomment"
673-
#endif
674670
static void
675671
TestSuite_RunNamed (TestSuite *suite, /* IN */
676672
const char *testname) /* IN */
@@ -692,7 +688,7 @@ TestSuite_RunNamed (TestSuite *suite, /* IN */
692688
suite->name, test->name);
693689
name [sizeof name - 1] = '\0';
694690
if (star) {
695-
/* e.g. testname is "/Client/*" and name is "/Client/authenticate" */
691+
/* e.g. testname is "/Client*" and name is "/Client/authenticate" */
696692
match = (0 == strncmp (name, testname, strlen (testname) - 1));
697693
} else {
698694
match = (0 == strcmp (name, testname));
@@ -710,9 +706,6 @@ TestSuite_RunNamed (TestSuite *suite, /* IN */
710706

711707
Mutex_Destroy (&mutex);
712708
}
713-
#ifdef __clang__
714-
#pragma clang diagnostic pop
715-
#endif
716709

717710

718711
int

tests/test-bulk.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1623,6 +1623,7 @@ _test_write_concern (bool has_write_commands, bool ordered)
16231623
mock_server_destroy (mock_server);
16241624
}
16251625

1626+
#ifdef TODO_CDRIVER_707
16261627
static void
16271628
test_write_concern_legacy_ordered (void)
16281629
{
@@ -1635,6 +1636,7 @@ test_write_concern_legacy_unordered (void)
16351636
{
16361637
_test_write_concern (false, false);
16371638
}
1639+
#endif
16381640

16391641

16401642
static void
@@ -2250,12 +2252,12 @@ test_bulk_install (TestSuite *suite)
22502252
test_single_unordered_bulk);
22512253
TestSuite_Add (suite, "/BulkOperation/single_error_unordered_bulk",
22522254
test_single_error_unordered_bulk);
2253-
/* TODO: CDRIVER-707.
2255+
#ifdef TODO_CDRIVER_707
22542256
TestSuite_Add (suite, "/BulkOperation/write_concern/legacy/ordered",
22552257
test_write_concern_legacy_ordered);
22562258
TestSuite_Add (suite, "/BulkOperation/write_concern/legacy/unordered",
22572259
test_write_concern_legacy_unordered);
2258-
*/
2260+
#endif
22592261
TestSuite_Add (suite, "/BulkOperation/write_concern/write_command/ordered",
22602262
test_write_concern_write_command_ordered);
22612263
TestSuite_Add (suite, "/BulkOperation/write_concern/write_command/unordered",

tests/test-mongoc-client.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ test_mongoc_client_authenticate_failure (void *context)
210210
}
211211

212212

213+
#ifdef TODO_CDRIVER_689
213214
static void
214215
test_wire_version (void)
215216
{
@@ -257,6 +258,7 @@ test_wire_version (void)
257258
mongoc_client_destroy (client);
258259
mock_server_destroy (server);
259260
}
261+
#endif
260262

261263

262264
static void
@@ -699,6 +701,8 @@ test_client_install (TestSuite *suite)
699701
TestSuite_Add (suite, "/Client/server_status", test_server_status);
700702
TestSuite_Add (suite, "/Client/database_names", test_get_database_names);
701703

702-
/* TODO: CDRIVER-689 */
703-
/*TestSuite_Add (suite, "/Client/wire_version", test_wire_version);*/
704+
#ifdef TODO_CDRIVER_689
705+
TestSuite_Add (suite, "/Client/wire_version", test_wire_version);
706+
#endif
704707
}
708+

tests/test-mongoc-cursor.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ test_kill_cursors_pooled (void)
222222
}
223223

224224

225+
#ifdef TODO_CDRIVER_679
225226
static void
226227
_test_getmore_fail (bool has_primary,
227228
bool pooled)
@@ -328,6 +329,7 @@ test_getmore_fail_no_primary_single (void)
328329
{
329330
_test_getmore_fail (false, false);
330331
}
332+
#endif
331333

332334

333335
void
@@ -338,7 +340,7 @@ test_cursor_install (TestSuite *suite)
338340
TestSuite_Add (suite, "/Cursor/invalid_query", test_invalid_query);
339341
TestSuite_Add (suite, "/Cursor/kill/single", test_kill_cursors_single);
340342
TestSuite_Add (suite, "/Cursor/kill/pooled", test_kill_cursors_pooled);
341-
/* TODO: CDRIVER-679
343+
#ifdef TODO_CDRIVER_679
342344
TestSuite_Add (suite, "/Cursor/getmore_fail/with_primary/pooled",
343345
test_getmore_fail_with_primary_pooled);
344346
TestSuite_Add (suite, "/Cursor/getmore_fail/with_primary/single",
@@ -347,4 +349,5 @@ test_cursor_install (TestSuite *suite)
347349
test_getmore_fail_no_primary_pooled);
348350
TestSuite_Add (suite, "/Cursor/getmore_fail/no_primary/single",
349351
test_getmore_fail_no_primary_single);*/
352+
#endif
350353
}

tests/test-mongoc-stream-tls-error.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ test_mongoc_tls_hangup (void)
221221
* 5. confirms that it times out
222222
* 6. shuts down
223223
*/
224+
#ifdef TODO_CDRIVER_630
224225
static void *
225226
handshake_stall_client (void *ptr)
226227
{
@@ -316,6 +317,7 @@ test_mongoc_tls_handshake_stall (void)
316317
ASSERT (cr.result == SSL_TEST_SUCCESS);
317318
ASSERT (sr.result == SSL_TEST_SUCCESS);
318319
}
320+
#endif
319321

320322
void
321323
test_stream_tls_error_install (TestSuite *suite)
@@ -325,9 +327,8 @@ test_stream_tls_error_install (TestSuite *suite)
325327
TestSuite_Add (suite, "/TLS/hangup", test_mongoc_tls_hangup);
326328
#endif
327329

328-
/* TODO: CDRIVER-630 */
329-
/*
330+
#ifdef TODO_CDRIVER_630
330331
TestSuite_Add (suite, "/TLS/handshake_stall",
331332
test_mongoc_tls_handshake_stall);
332-
*/
333+
#endif
333334
}

0 commit comments

Comments
 (0)