Skip to content

Commit 8ef1f35

Browse files
author
David Zero
committed
Revert "Revert "Portability fixes""
This reverts commit 59e2a84, and defines _DARWIN_C_SOURCE in toxcore/network.c
1 parent 08cd613 commit 8ef1f35

27 files changed

+93
-24
lines changed

.gitignore

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ install_manifest.txt
2121
tags
2222
Makefile.in
2323
CMakeLists.txt.user
24+
DartConfiguration.tcl
25+
CTestTestfile.cmake
26+
*.pc
2427

2528
# Testing
2629
testing/data
@@ -40,6 +43,9 @@ testing/data
4043
*.app
4144
*.la
4245

46+
# Libraries
47+
*.so
48+
4349
# Misc (?)
4450
m4/*
4551
configure
@@ -51,8 +57,6 @@ config.log
5157
config.status
5258
stamp-h1
5359
autom4te.cache
54-
libtoxcore.pc
55-
libtoxav.pc
5660
libtool
5761
.deps
5862
.libs

CMakeLists.txt

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,22 +56,21 @@ macro(add_flag flag)
5656
add_cflag(${flag})
5757
add_cxxflag(${flag})
5858
endmacro()
59+
60+
# Set standard version for compiler.
61+
add_cflag("-std=c99")
62+
add_cxxflag("-std=c++11")
63+
64+
# Error on non-ISO C.
65+
add_cflag("-pedantic-errors")
5966

6067
option(WARNINGS "Enable additional compiler warnings" ON)
6168
if(WARNINGS)
62-
# Set standard version for compiler.
63-
add_cflag("-std=gnu99")
64-
add_cxxflag("-std=c++98")
65-
6669
# Add all warning flags we can.
6770
add_flag("-Wall")
6871
add_flag("-Wextra")
6972
add_flag("-Weverything")
7073

71-
# -pedantic only for C, because in C++ we want to allow the GNU/C99 extension
72-
# of having a comma at the end of an enumerator list.
73-
add_cflag("-pedantic")
74-
7574
# Disable specific warning flags for both C and C++.
7675
add_flag("-Wno-cast-align")
7776
add_flag("-Wno-conversion")

auto_tests/TCP_test.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#define _XOPEN_SOURCE 600
2+
13
#ifdef HAVE_CONFIG_H
24
#include "config.h"
35
#endif

auto_tests/conference_test.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
/* Auto Tests: Conferences.
22
*/
33

4+
#define _XOPEN_SOURCE 600
5+
46
#ifdef HAVE_CONFIG_H
57
#include "config.h"
68
#endif
@@ -175,7 +177,7 @@ START_TEST(test_many_group)
175177
* Either way in this case it's fine */
176178
if (peer_count != NUM_GROUP_TOX) {
177179
++test_run;
178-
printf("\tError starting up the first group (peer_count %"PRIu32" != %d, test_run = %d)\n", peer_count, NUM_GROUP_TOX,
180+
printf("\tError starting up the first group (peer_count %" PRIu32 " != %d, test_run = %d)\n", peer_count, NUM_GROUP_TOX,
179181
test_run);
180182

181183
for (j = 0; j < NUM_GROUP_TOX; ++j) {
@@ -194,7 +196,7 @@ START_TEST(test_many_group)
194196
* important again.
195197
*/
196198
ck_assert_msg(peer_count == NUM_GROUP_TOX, "\n\tBad number of group peers (pre check)."
197-
"\n\t\t\tExpected: %u but tox_instance(%u) only has: %"PRIu32"\n\n",
199+
"\n\t\t\tExpected: %u but tox_instance(%u) only has: %" PRIu32 "\n\n",
198200
NUM_GROUP_TOX, i, peer_count);
199201

200202
uint8_t title[2048];
@@ -241,7 +243,7 @@ START_TEST(test_many_group)
241243
for (i = 0; i < (k - 1); ++i) {
242244
uint32_t peer_count = tox_conference_peer_count(toxes[i], 0, NULL);
243245
ck_assert_msg(peer_count == (k - 1), "\n\tBad number of group peers (post check)."
244-
"\n\t\t\tExpected: %u but tox_instance(%u) only has: %"PRIu32"\n\n",
246+
"\n\t\t\tExpected: %u but tox_instance(%u) only has: %" PRIu32 "\n\n",
245247
(k - 1), i, peer_count);
246248
}
247249
}

auto_tests/dht_test.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#define _XOPEN_SOURCE 600
2+
13
#ifdef HAVE_CONFIG_H
24
#include "config.h"
35
#endif

auto_tests/network_test.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ START_TEST(test_ip_equal)
114114
ip2.ip6.uint32[2] = htonl(0xFFFF);
115115
ip2.ip6.uint32[3] = htonl(0x7F000001);
116116

117-
ck_assert_msg(IN6_IS_ADDR_V4MAPPED(&ip2.ip6.in6_addr) != 0,
118-
"IN6_IS_ADDR_V4MAPPED(::ffff:127.0.0.1): expected != 0, got 0.");
117+
ck_assert_msg(IPV6_IPV4_IN_V6(ip2.ip6) != 0,
118+
"IPV6_IPV4_IN_V6(::ffff:127.0.0.1): expected != 0, got 0.");
119119

120120
res = ip_equal(&ip1, &ip2);
121121
ck_assert_msg(res != 0, "ip_equal( {AF_INET, 127.0.0.1}, {AF_INET6, ::ffff:127.0.0.1} ): expected result != 0, got 0.");

auto_tests/onion_test.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#define _XOPEN_SOURCE 600
2+
13
#ifdef HAVE_CONFIG_H
24
#include "config.h"
35
#endif

auto_tests/save_friend_test.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
/* Auto Tests: Save and load friends.
22
*/
33

4+
#define _XOPEN_SOURCE 600
5+
46
#include "helpers.h"
7+
#include "../toxcore/tox.h"
58

69
#include <assert.h>
710
#include <stdio.h>

auto_tests/tox_many_tcp_test.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
/* Auto Tests: Many TCP.
22
*/
33

4+
#define _XOPEN_SOURCE 600
5+
46
#ifdef HAVE_CONFIG_H
57
#include "config.h"
68
#endif

auto_tests/tox_many_test.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
/* Auto Tests: Many clients.
22
*/
33

4+
#define _XOPEN_SOURCE 600
5+
46
#ifdef HAVE_CONFIG_H
57
#include "config.h"
68
#endif

0 commit comments

Comments
 (0)