When including an -internal.h header outside the main tree, do so early

Some of our unit tests and sample code need functions and structures
defined in an -internal.h header.  But that can freak out OpenSolaris,
where stdio.h wants to define _FILE_OFFSET_BITS unless it's already
defined, and then evconfig-internal.h defines it.  Regular users
should never ever use our -internal.h headers, so the solution is
to make sure that if we're going to use them ourselves, we do so
before system headers.
This commit is contained in:
Nick Mathewson 2012-01-24 16:08:00 -05:00
parent b9f7e5fd19
commit 95e2455cdb
16 changed files with 24 additions and 24 deletions

View File

@ -6,6 +6,9 @@
*/ */
/* Compatibility for possible missing IPv6 declarations */
#include "../util-internal.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -44,9 +47,6 @@
# endif # endif
#endif #endif
/* Compatibility for possible missing IPv6 declarations */
#include "../util-internal.h"
#ifdef _WIN32 #ifdef _WIN32
#define stat _stat #define stat _stat
#define fstat _fstat #define fstat _fstat

View File

@ -25,6 +25,9 @@
* *
*/ */
/* for EVUTIL_ERR_CONNECT_RETRIABLE macro */
#include "util-internal.h"
#include <sys/types.h> #include <sys/types.h>
#ifdef _WIN32 #ifdef _WIN32
#include <winsock2.h> #include <winsock2.h>
@ -44,9 +47,6 @@
#include "event2/buffer.h" #include "event2/buffer.h"
#include "event2/util.h" #include "event2/util.h"
/* for EVUTIL_ERR_CONNECT_RETRIABLE macro */
#include "util-internal.h"
const char *resource = NULL; const char *resource = NULL;
struct event_base *base = NULL; struct event_base *base = NULL;

View File

@ -24,6 +24,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include "util-internal.h"
#ifdef _WIN32 #ifdef _WIN32
#include <winsock2.h> #include <winsock2.h>
@ -63,7 +64,6 @@
#include "event2/util.h" #include "event2/util.h"
#include "event-internal.h" #include "event-internal.h"
#include "evthread-internal.h" #include "evthread-internal.h"
#include "util-internal.h"
#include "log-internal.h" #include "log-internal.h"
#include "regress.h" #include "regress.h"

View File

@ -24,6 +24,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include "util-internal.h"
#ifdef _WIN32 #ifdef _WIN32
#include <winsock2.h> #include <winsock2.h>
@ -58,7 +59,6 @@
#include "evbuffer-internal.h" #include "evbuffer-internal.h"
#include "log-internal.h" #include "log-internal.h"
#include "util-internal.h"
#include "regress.h" #include "regress.h"

View File

@ -24,6 +24,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include "util-internal.h"
/* The old tests here need assertions to work. */ /* The old tests here need assertions to work. */
#undef NDEBUG #undef NDEBUG

View File

@ -24,6 +24,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include "../util-internal.h"
#ifdef _WIN32 #ifdef _WIN32
#include <winsock2.h> #include <winsock2.h>
@ -71,8 +72,6 @@
#include "regress.h" #include "regress.h"
#include "regress_testutils.h" #include "regress_testutils.h"
#include "../util-internal.h"
static int dns_ok = 0; static int dns_ok = 0;
static int dns_got_cancel = 0; static int dns_got_cancel = 0;
static int dns_err = 0; static int dns_err = 0;

View File

@ -24,6 +24,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include "util-internal.h"
#ifdef _WIN32 #ifdef _WIN32
#include <winsock2.h> #include <winsock2.h>
@ -59,7 +60,6 @@
#include "event2/bufferevent.h" #include "event2/bufferevent.h"
#include "event2/util.h" #include "event2/util.h"
#include "log-internal.h" #include "log-internal.h"
#include "util-internal.h"
#include "http-internal.h" #include "http-internal.h"
#include "regress.h" #include "regress.h"
#include "regress_testutils.h" #include "regress_testutils.h"

View File

@ -23,6 +23,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include "util-internal.h"
#ifdef _WIN32 #ifdef _WIN32
#include <winsock2.h> #include <winsock2.h>
@ -49,7 +50,6 @@
#include "regress.h" #include "regress.h"
#include "tinytest.h" #include "tinytest.h"
#include "tinytest_macros.h" #include "tinytest_macros.h"
#include "util-internal.h"
static void static void
acceptcb(struct evconnlistener *listener, evutil_socket_t fd, acceptcb(struct evconnlistener *listener, evutil_socket_t fd,

View File

@ -24,6 +24,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include "util-internal.h"
#ifdef _WIN32 #ifdef _WIN32
#include <winsock2.h> #include <winsock2.h>

View File

@ -23,13 +23,13 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include "../minheap-internal.h"
#include <stdlib.h> #include <stdlib.h>
#include "event2/event_struct.h" #include "event2/event_struct.h"
#include "tinytest.h" #include "tinytest.h"
#include "tinytest_macros.h" #include "tinytest_macros.h"
#include "../minheap-internal.h"
static void static void
set_random_timeout(struct event *ev) set_random_timeout(struct event *ev)

View File

@ -23,6 +23,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include "../util-internal.h"
#ifdef _WIN32 #ifdef _WIN32
#include <winsock2.h> #include <winsock2.h>
@ -68,8 +69,6 @@
#include "regress.h" #include "regress.h"
#include "regress_testutils.h" #include "regress_testutils.h"
#include "../util-internal.h"
/* globals */ /* globals */
static struct evdns_server_port *dns_port; static struct evdns_server_port *dns_port;
evutil_socket_t dns_sock = -1; evutil_socket_t dns_sock = -1;

View File

@ -23,6 +23,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include "util-internal.h"
/* The old tests here need assertions to work. */ /* The old tests here need assertions to work. */
#undef NDEBUG #undef NDEBUG
@ -53,14 +54,13 @@
#include "sys/queue.h" #include "sys/queue.h"
#include "event2/util.h"
#include "event2/event.h" #include "event2/event.h"
#include "event2/event_struct.h" #include "event2/event_struct.h"
#include "event2/thread.h" #include "event2/thread.h"
#include "event2/util.h"
#include "evthread-internal.h" #include "evthread-internal.h"
#include "event-internal.h" #include "event-internal.h"
#include "defer-internal.h" #include "defer-internal.h"
#include "util-internal.h"
#include "regress.h" #include "regress.h"
#include "tinytest_macros.h" #include "tinytest_macros.h"

View File

@ -23,6 +23,8 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include "../util-internal.h"
#ifdef _WIN32 #ifdef _WIN32
#include <winsock2.h> #include <winsock2.h>
#include <windows.h> #include <windows.h>
@ -53,7 +55,6 @@
#include "event2/event.h" #include "event2/event.h"
#include "event2/util.h" #include "event2/util.h"
#include "../ipv6-internal.h" #include "../ipv6-internal.h"
#include "../util-internal.h"
#include "../log-internal.h" #include "../log-internal.h"
#include "../strlcpy-internal.h" #include "../strlcpy-internal.h"
#include "../mm-internal.h" #include "../mm-internal.h"

View File

@ -23,6 +23,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include "../util-internal.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -49,7 +50,6 @@
#include "event2/listener.h" #include "event2/listener.h"
#include "event2/thread.h" #include "event2/thread.h"
#include "../util-internal.h"
static int cfg_verbose = 0; static int cfg_verbose = 0;
static int cfg_help = 0; static int cfg_help = 0;

View File

@ -22,16 +22,15 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifdef TINYTEST_LOCAL
#include "tinytest_local.h"
#endif
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <assert.h> #include <assert.h>
#ifdef TINYTEST_LOCAL
#include "tinytest_local.h"
#endif
#ifdef _WIN32 #ifdef _WIN32
#include <windows.h> #include <windows.h>
#else #else

View File

@ -1,10 +1,10 @@
#include "util-internal.h"
#ifdef _WIN32 #ifdef _WIN32
#include <winsock2.h> #include <winsock2.h>
#endif #endif
#include "event2/util.h" #include "event2/util.h"
#include "util-internal.h"
#ifdef snprintf #ifdef snprintf
#undef snprintf #undef snprintf