Skip to content

Commit 5b22e0f

Browse files
committed
Set feature test macro for tests in one spot
1 parent e2c8463 commit 5b22e0f

19 files changed

+7
-71
lines changed

t/bad_databases_t.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
// This test currently does not work on Windows as nftw is
22
// not available.
3-
#ifndef _POSIX_C_SOURCE
4-
#define _POSIX_C_SOURCE 200809L
5-
#endif
63
#define _XOPEN_SOURCE 500
74
#include <ftw.h>
85

t/bad_pointers_t.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
#ifndef _POSIX_C_SOURCE
2-
#define _POSIX_C_SOURCE 200809L
3-
#endif
4-
51
#include "maxminddb_test_helper.h"
62

73
void run_tests(int mode, const char *mode_desc) {

t/basic_lookup_t.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
#ifndef _POSIX_C_SOURCE
2-
#define _POSIX_C_SOURCE 200809L
3-
#endif
4-
51
#include "maxminddb_test_helper.h"
62

73
static void test_big_lookup(void);

t/data-pool-t.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
#ifndef _POSIX_C_SOURCE
2-
#define _POSIX_C_SOURCE 200809L
3-
#endif
4-
51
#include "libtap/tap.h"
62
#include "maxminddb_test_helper.h"
73
#include <assert.h>

t/data_entry_list_t.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
#ifndef _POSIX_C_SOURCE
2-
#define _POSIX_C_SOURCE 200809L
3-
#endif
4-
51
#include "maxminddb_test_helper.h"
62

73
MMDB_entry_data_list_s *

t/data_types_t.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
#ifndef _POSIX_C_SOURCE
2-
#define _POSIX_C_SOURCE 200809L
3-
#endif
4-
51
#include "maxminddb_test_helper.h"
62

73
void test_all_data_types(MMDB_lookup_result_s *result,

t/dump_t.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
#ifndef _POSIX_C_SOURCE
2-
#define _POSIX_C_SOURCE 200809L
3-
#endif
41
#define _XOPEN_SOURCE 700
52

63
#include "maxminddb_test_helper.h"

t/get_value_pointer_bug_t.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
#ifndef _POSIX_C_SOURCE
2-
#define _POSIX_C_SOURCE 200809L
3-
#endif
4-
51
#include "maxminddb_test_helper.h"
62

73
/* This test exercises a bug found in MMDB_get_value for certain types of

t/get_value_t.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
#ifndef _POSIX_C_SOURCE
2-
#define _POSIX_C_SOURCE 200809L
3-
#endif
4-
51
#include "maxminddb_test_helper.h"
62

73
void test_array_0_result(int status,

t/ipv4_start_cache_t.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
#ifndef _POSIX_C_SOURCE
2-
#define _POSIX_C_SOURCE 200809L
3-
#endif
4-
51
#include "maxminddb_test_helper.h"
62

73
void test_one_ip(MMDB_s *mmdb,

t/ipv6_lookup_in_ipv4_t.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
#ifndef _POSIX_C_SOURCE
2-
#define _POSIX_C_SOURCE 200809L
3-
#endif
4-
51
#include "maxminddb_test_helper.h"
62

73
void run_tests(int mode, const char *mode_desc) {

t/maxminddb_test_helper.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1+
#include "maxminddb_test_helper.h"
2+
13
#if HAVE_CONFIG_H
24
#include <config.h>
35
#endif
46

5-
#define _POSIX_C_SOURCE 200112L
67
#include <assert.h>
78
#include <stdarg.h>
89
#include <sys/types.h>
910

1011
#include "maxminddb.h"
11-
#include "maxminddb_test_helper.h"
1212

1313
#ifdef _WIN32
1414
#include <io.h>

t/maxminddb_test_helper.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
/* Some test files may require something newer */
2-
#if !defined(_GNU_SOURCE) && !defined(_POSIX_C_SOURCE)
3-
#define _POSIX_C_SOURCE 200112L
1+
// The spec says this should be set prior to including any headers, but since
2+
// this is test code, it should be fine to set it here. Setting it here avoids
3+
// setting it in every test program.
4+
#ifndef _POSIX_C_SOURCE
5+
#define _POSIX_C_SOURCE 200809L
46
#endif
57

68
#if HAVE_CONFIG_H

t/metadata_pointers_t.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
#ifndef _POSIX_C_SOURCE
2-
#define _POSIX_C_SOURCE 200809L
3-
#endif
4-
51
#include "maxminddb_test_helper.h"
62

73
void run_tests(int mode, const char *mode_desc) {

t/metadata_t.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
#ifndef _POSIX_C_SOURCE
2-
#define _POSIX_C_SOURCE 200809L
3-
#endif
4-
51
#include "maxminddb_test_helper.h"
62

73
void test_metadata(MMDB_s *mmdb, const char *mode_desc) {

t/no_map_get_value_t.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
#ifndef _POSIX_C_SOURCE
2-
#define _POSIX_C_SOURCE 200809L
3-
#endif
4-
51
#include "maxminddb_test_helper.h"
62

73
void run_tests(int mode, const char *mode_desc) {

t/read_node_t.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
#ifndef _POSIX_C_SOURCE
2-
#define _POSIX_C_SOURCE 200809L
3-
#endif
4-
51
#include "maxminddb_test_helper.h"
62

73
void test_entry_data(MMDB_s *mmdb,

t/threads_t.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
#ifndef _POSIX_C_SOURCE
2-
#define _POSIX_C_SOURCE 200809L
3-
#endif
4-
51
#include "maxminddb_test_helper.h"
62
#include <pthread.h>
73

t/version_t.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
#ifndef _POSIX_C_SOURCE
2-
#define _POSIX_C_SOURCE 200809L
3-
#endif
4-
51
#include "maxminddb_test_helper.h"
62

73
int main(void) {

0 commit comments

Comments
 (0)