mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2025-02-24 06:48:05 +01:00
Have autoconf check whether enums are signed.
Fixes bug 7727; fix on 0.2.4.10-alpha.
This commit is contained in:
parent
0e597471af
commit
41200b4770
4 changed files with 11 additions and 2 deletions
|
@ -2,3 +2,6 @@
|
||||||
- Use Ville Laurikari's implementation of AX_CHECK_SIGN() to determine
|
- Use Ville Laurikari's implementation of AX_CHECK_SIGN() to determine
|
||||||
the signs of types during autoconf. This is better than our old
|
the signs of types during autoconf. This is better than our old
|
||||||
approach, which didn't work when cross-compiling.
|
approach, which didn't work when cross-compiling.
|
||||||
|
- Detect the sign of enum values, rather than assuming that MSC is the
|
||||||
|
only compiler where enum types are all signed. Fix for bug 7727;
|
||||||
|
bugfix on 0.2.4.10-alpha.
|
||||||
|
|
|
@ -984,6 +984,12 @@ if test "$tor_cv_size_t_signed" = yes; then
|
||||||
AC_MSG_ERROR([You have a signed size_t; that's grossly nonconformant.])
|
AC_MSG_ERROR([You have a signed size_t; that's grossly nonconformant.])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
AX_CHECK_SIGN([enum always],
|
||||||
|
[ AC_DEFINE(ENUM_VALS_ARE_SIGNED, 1, [Define if enum is always signed]) ],
|
||||||
|
[ : ], [
|
||||||
|
enum always { AAA, BBB, CCC };
|
||||||
|
])
|
||||||
|
|
||||||
AC_CHECK_SIZEOF(socklen_t, , [AC_INCLUDES_DEFAULT()
|
AC_CHECK_SIZEOF(socklen_t, , [AC_INCLUDES_DEFAULT()
|
||||||
#ifdef HAVE_SYS_SOCKET_H
|
#ifdef HAVE_SYS_SOCKET_H
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
|
|
@ -136,8 +136,7 @@ extern INLINE double U64_TO_DBL(uint64_t x) {
|
||||||
#define DBL_TO_U64(x) ((uint64_t) (x))
|
#define DBL_TO_U64(x) ((uint64_t) (x))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#ifdef ENUM_VALS_ARE_SIGNED
|
||||||
/* XXXX024 we should instead have a more general check for "Is enum signed?"*/
|
|
||||||
#define ENUM_BF(t) unsigned
|
#define ENUM_BF(t) unsigned
|
||||||
#else
|
#else
|
||||||
/** Wrapper for having a bitfield of an enumerated type. Where possible, we
|
/** Wrapper for having a bitfield of an enumerated type. Where possible, we
|
||||||
|
|
|
@ -256,3 +256,4 @@
|
||||||
#define CURVE25519_ENABLED
|
#define CURVE25519_ENABLED
|
||||||
#define USE_CURVE25519_DONNA
|
#define USE_CURVE25519_DONNA
|
||||||
|
|
||||||
|
#define ENUM_VALS_ARE_SIGNED 1
|
||||||
|
|
Loading…
Add table
Reference in a new issue