Commit c13a81f7 authored by Kris Katterjohn's avatar Kris Katterjohn Committed by Nick Mathewson
Browse files

Fix (and make consistent) the use of OpenBSD preprocessor macro tests

Prior to this commit, the testsuite was failing on OpenBSD.  After
this commit the testsuite runs fine on OpenBSD.

It was previously decided to test for the OpenBSD macro (rather than
__OpenBSD__, etc.) because OpenBSD forks seem to have the former
macro defined.  sys/param.h must be included for the OpenBSD macro
definition; however, many files tested for the OpenBSD macro without
having this header included.

This commit includes sys/param.h in the files where the OpenBSD macro
is used (and sys/param.h is not already included), and it also
changes some instances of the __OpenBSD__ macro to OpenBSD.

See commit 27df23ab which changed
everything to use OpenBSD instead of __OpenBSD__ or OPENBSD.  See
also tickets #6982 and #20980

 (the latter ticket is where it was
decided to use the OpenBSD macro).
Signed-off-by: default avatarKris Katterjohn <katterjohn@gmail.com>
parent 44edfa7a
...@@ -131,6 +131,9 @@ ...@@ -131,6 +131,9 @@
#ifdef HAVE_SYS_STAT_H #ifdef HAVE_SYS_STAT_H
#include <sys/stat.h> #include <sys/stat.h>
#endif #endif
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif #endif
......
...@@ -139,6 +139,9 @@ ...@@ -139,6 +139,9 @@
#ifdef HAVE_SYS_IOCTL_H #ifdef HAVE_SYS_IOCTL_H
#include <sys/ioctl.h> #include <sys/ioctl.h>
#endif #endif
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#if defined(HAVE_NET_IF_H) && defined(HAVE_NET_PFVAR_H) #if defined(HAVE_NET_IF_H) && defined(HAVE_NET_PFVAR_H)
#include <net/if.h> #include <net/if.h>
......
...@@ -29,6 +29,10 @@ ...@@ -29,6 +29,10 @@
Jean-Philippe Aumasson (https://131002.net/siphash/siphash24.c) Jean-Philippe Aumasson (https://131002.net/siphash/siphash24.c)
*/ */
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
/* This code is extracted from csiphash.h */ /* This code is extracted from csiphash.h */
#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && \ #if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && \
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
#define OS_OSX #define OS_OSX
#elif defined(macintosh) || defined(Macintosh) #elif defined(macintosh) || defined(Macintosh)
#define OS_MAC #define OS_MAC
#elif defined(__OpenBSD__) #elif defined(OpenBSD)
#define OS_OPENBSD #define OS_OPENBSD
#endif #endif
#endif #endif
......
...@@ -14,6 +14,10 @@ ...@@ -14,6 +14,10 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && \ #if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && \
__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
# define IS_LITTLE_ENDIAN 1 # define IS_LITTLE_ENDIAN 1
...@@ -31,7 +35,7 @@ ...@@ -31,7 +35,7 @@
# define IS_LITTLE_ENDIAN # define IS_LITTLE_ENDIAN
# endif # endif
#else #else
# if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) # if defined(__FreeBSD__) || defined(__NetBSD__) || defined(OpenBSD)
# include <sys/endian.h> # include <sys/endian.h>
# else # else
# include <endian.h> # include <endian.h>
......
...@@ -32,6 +32,9 @@ ...@@ -32,6 +32,9 @@
#ifdef HAVE_SIGNAL_H #ifdef HAVE_SIGNAL_H
#include <signal.h> #include <signal.h>
#endif #endif
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#include <errno.h> #include <errno.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
......
...@@ -28,6 +28,9 @@ ...@@ -28,6 +28,9 @@
#ifdef HAVE_SYS_SOCKET_H #ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h> #include <sys/socket.h>
#endif #endif
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#ifdef _WIN32 #ifdef _WIN32
#include <winsock2.h> #include <winsock2.h>
...@@ -60,7 +63,7 @@ struct in6_addr ...@@ -60,7 +63,7 @@ struct in6_addr
/** @{ */ /** @{ */
/** Many BSD variants seem not to define these. */ /** Many BSD variants seem not to define these. */
#if defined(__APPLE__) || defined(__darwin__) || \ #if defined(__APPLE__) || defined(__darwin__) || \
defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) defined(__FreeBSD__) || defined(__NetBSD__) || defined(OpenBSD)
#ifndef s6_addr16 #ifndef s6_addr16
#define s6_addr16 __u6_addr.__u6_addr16 #define s6_addr16 __u6_addr.__u6_addr16
#endif #endif
......
...@@ -12,6 +12,10 @@ ...@@ -12,6 +12,10 @@
#include <sys/types.h> #include <sys/types.h>
#include <stdlib.h> #include <stdlib.h>
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
static unsigned fill_a_buffer_memset(void) __attribute__((noinline)); static unsigned fill_a_buffer_memset(void) __attribute__((noinline));
static unsigned fill_a_buffer_memwipe(void) __attribute__((noinline)); static unsigned fill_a_buffer_memwipe(void) __attribute__((noinline));
static unsigned fill_a_buffer_nothing(void) __attribute__((noinline)); static unsigned fill_a_buffer_nothing(void) __attribute__((noinline));
......
...@@ -23,6 +23,10 @@ ...@@ -23,6 +23,10 @@
#include "test/test_helpers.h" #include "test/test_helpers.h"
#include "lib/net/resolve.h" #include "lib/net/resolve.h"
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#define NS_MODULE test_options #define NS_MODULE test_options
typedef struct { typedef struct {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment