mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-19 18:00:33 +01:00
Merge remote-tracking branch 'public/require_some_c99'
This commit is contained in:
commit
5190ec0bc4
10
changes/require-c99
Normal file
10
changes/require-c99
Normal file
@ -0,0 +1,10 @@
|
||||
o New compiler requirements:
|
||||
- Tor 0.2.6.x requires that your compiler support more of the C99
|
||||
language standard than before. The 'configure' script now detects
|
||||
whether your compiler supports C99 mid-block declarations and
|
||||
designated initializers. If it does not, Tor will not compile.
|
||||
|
||||
We may revisit this requirement if it turns out that a significant
|
||||
number of people need to build Tor with compilers that don't
|
||||
bother implementing a 15-year-old standard. Closes ticket 13233.
|
||||
|
25
configure.ac
25
configure.ac
@ -194,6 +194,7 @@ AM_CONDITIONAL(USE_FW_HELPER, test x$natpmp = xtrue || test x$upnp = xtrue)
|
||||
AM_CONDITIONAL(NAT_PMP, test x$natpmp = xtrue)
|
||||
AM_CONDITIONAL(MINIUPNPC, test x$upnp = xtrue)
|
||||
AM_PROG_CC_C_O
|
||||
AC_PROG_CC_C99
|
||||
|
||||
AC_ARG_VAR(PYTHON)
|
||||
AC_CHECK_PROGS(PYTHON, [python python2 python2.7 python3 python3.3])
|
||||
@ -224,6 +225,28 @@ AC_C_FLEXIBLE_ARRAY_MEMBER
|
||||
fi
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK([for working C99 mid-block declaration syntax],
|
||||
tor_cv_c_c99_decl,
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([], [int x; x = 3; int y; y = 4 + x;])],
|
||||
[tor_cv_c_c99_decl=yes],
|
||||
[tor_cv_c_c99_decl=no] )])
|
||||
if test "$tor_cv_c_c99_decl" != "yes"; then
|
||||
AC_MSG_ERROR([Your compiler doesn't support c99 mid-block declarations. This is required as of Tor 0.2.6.x])
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([for working C99 designated initializers],
|
||||
tor_cv_c_c99_designated_init,
|
||||
[AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([struct s { int a; int b; };],
|
||||
[[ struct s ss = { .b = 5, .a = 6 }; ]])],
|
||||
[tor_cv_c_c99_designated_init=yes],
|
||||
[tor_cv_c_c99_designated_init=no] )])
|
||||
|
||||
if test "$tor_cv_c_c99_designated_init" != "yes"; then
|
||||
AC_MSG_ERROR([Your compiler doesn't support c99 designated initializers. This is required as of Tor 0.2.6.x])
|
||||
fi
|
||||
|
||||
AC_PATH_PROG([SHA1SUM], [sha1sum], none)
|
||||
AC_PATH_PROG([OPENSSL], [openssl], none)
|
||||
|
||||
@ -1511,7 +1534,7 @@ if test x$enable_gcc_warnings = xyes || test x$enable_gcc_warnings_advisory = xy
|
||||
|
||||
if test x$have_gcc4 = xyes ; then
|
||||
# These warnings break gcc 3.3.5 and work on gcc 4.0.2
|
||||
CFLAGS="$CFLAGS -Winit-self -Wmissing-field-initializers -Wdeclaration-after-statement -Wold-style-definition"
|
||||
CFLAGS="$CFLAGS -Winit-self -Wmissing-field-initializers -Wold-style-definition"
|
||||
fi
|
||||
|
||||
if test x$have_gcc42 = xyes ; then
|
||||
|
@ -323,10 +323,9 @@ tor_addr_is_internal_(const tor_addr_t *addr, int for_listening,
|
||||
{
|
||||
uint32_t iph4 = 0;
|
||||
uint32_t iph6[4];
|
||||
sa_family_t v_family;
|
||||
|
||||
tor_assert(addr);
|
||||
v_family = tor_addr_family(addr);
|
||||
sa_family_t v_family = tor_addr_family(addr);
|
||||
|
||||
if (v_family == AF_INET) {
|
||||
iph4 = tor_addr_to_ipv4h(addr);
|
||||
@ -472,7 +471,6 @@ tor_addr_parse_PTR_name(tor_addr_t *result, const char *address,
|
||||
|
||||
if (!strcasecmpend(address, ".ip6.arpa")) {
|
||||
const char *cp;
|
||||
int i;
|
||||
int n0, n1;
|
||||
struct in6_addr in6;
|
||||
|
||||
@ -480,7 +478,7 @@ tor_addr_parse_PTR_name(tor_addr_t *result, const char *address,
|
||||
return -1;
|
||||
|
||||
cp = address;
|
||||
for (i = 0; i < 16; ++i) {
|
||||
for (int i = 0; i < 16; ++i) {
|
||||
n0 = hex_decode_digit(*cp++); /* The low-order nybble appears first. */
|
||||
if (*cp++ != '.') return -1; /* Then a dot. */
|
||||
n1 = hex_decode_digit(*cp++); /* The high-order nybble appears first. */
|
||||
@ -605,7 +603,7 @@ tor_addr_parse_mask_ports(const char *s,
|
||||
int any_flag=0, v4map=0;
|
||||
sa_family_t family;
|
||||
struct in6_addr in6_tmp;
|
||||
struct in_addr in_tmp;
|
||||
struct in_addr in_tmp = { .s_addr = 0 };
|
||||
|
||||
tor_assert(s);
|
||||
tor_assert(addr_out);
|
||||
@ -666,7 +664,7 @@ tor_addr_parse_mask_ports(const char *s,
|
||||
tor_addr_from_ipv4h(addr_out, 0);
|
||||
any_flag = 1;
|
||||
} else if (!strcmp(address, "*6") && (flags & TAPMP_EXTENDED_STAR)) {
|
||||
static char nil_bytes[16] = { 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0 };
|
||||
static char nil_bytes[16] = { [0]=0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0 };
|
||||
family = AF_INET6;
|
||||
tor_addr_from_ipv6_bytes(addr_out, nil_bytes);
|
||||
any_flag = 1;
|
||||
|
Loading…
Reference in New Issue
Block a user