Remove random includes of windows.h

Instead, include a stanza in port_platform.h that:
- gets windows.h included
- defines things that we needs to define
- tries to respect applications configurations by leaving things as
untouched as possible
pull/2303/head
Craig Tiller 10 years ago
parent b367153115
commit ae65f1a212
  1. 2
      include/grpc/support/atm_win32.h
  2. 2
      include/grpc/support/log_win32.h
  3. 32
      include/grpc/support/port_platform.h
  4. 2
      include/grpc/support/sync_win32.h
  5. 1
      src/core/iomgr/iocp_windows.h
  6. 1
      src/core/iomgr/pollset_windows.h
  7. 2
      src/core/iomgr/sockaddr_win32.h
  8. 3
      src/core/iomgr/socket_windows.h
  9. 1
      src/core/support/cpu_windows.c
  10. 1
      src/core/support/string_win32.c
  11. 2
      src/core/support/string_win32.h
  12. 3
      src/core/support/sync_win32.c
  13. 1
      src/core/support/thd_win32.c
  14. 1
      src/core/support/time_win32.c

@ -37,8 +37,6 @@
/* Win32 variant of atm_platform.h */
#include <grpc/support/port_platform.h>
#include <windows.h>
typedef gpr_intptr gpr_atm;
#define gpr_atm_full_barrier MemoryBarrier

@ -34,8 +34,6 @@
#ifndef GRPC_SUPPORT_LOG_WIN32_H
#define GRPC_SUPPORT_LOG_WIN32_H
#include <windows.h>
#ifdef __cplusplus
extern "C" {
#endif

@ -34,6 +34,38 @@
#ifndef GRPC_SUPPORT_PORT_PLATFORM_H
#define GRPC_SUPPORT_PORT_PLATFORM_H
/* Get windows.h included everywhere (we need it) */
#if defined(_WIN64) || defined(WIN64) || defined(_WIN32) || defined(WIN32)
#ifndef WIN32_LEAN_AND_MEAN
#define GRPC_WIN32_LEAN_AND_MEAN_WAS_NOT_DEFINED
#define WIN32_LEAN_AND_MEAN
#endif /* WIN32_LEAN_AND_MEAN */
#ifndef NOMINMAX
#define GRPC_NOMINMX_WAS_NOT_DEFINED
#define NOMINMAX
#endif /* NOMINMAX */
#if defined(_WIN32_WINNT)
#if _WIN32_WINNT < 0x0600
#undef _WIN32_WINNT
#define _WIN32_WINNT 0x0600
#endif /* _WIN32_WINNT < 0x0600 */
#endif /* defined(_WIN32_WINNT) */
#include <windows.h>
#ifdef GRPC_WIN32_LEAN_AND_MEAN_WAS_NOT_DEFINED
#undef GRPC_WIN32_LEAN_AND_MEAN_WAS_NOT_DEFINED
#undef WIN32_LEAN_AND_MEAN
#endif /* GRPC_WIN32_LEAN_AND_MEAN_WAS_NOT_DEFINED */
#ifdef GRPC_NOMINMAX_WAS_NOT_DEFINED
#undef GRPC_NOMINMAX_WAS_NOT_DEFINED
#undef NOMINMAX
#endif /* GRPC_WIN32_LEAN_AND_MEAN_WAS_NOT_DEFINED */
#endif /* defined(_WIN64) || defined(WIN64) || defined(_WIN32) || defined(WIN32) */
/* Override this file with one for your platform if you need to redefine
things. */

@ -36,8 +36,6 @@
#include <grpc/support/sync_generic.h>
#include <windows.h>
typedef struct {
CRITICAL_SECTION cs; /* Not an SRWLock until Vista is unsupported */
int locked;

@ -34,7 +34,6 @@
#ifndef GRPC_INTERNAL_CORE_IOMGR_IOCP_WINDOWS_H
#define GRPC_INTERNAL_CORE_IOMGR_IOCP_WINDOWS_H
#include <windows.h>
#include <grpc/support/sync.h>
#include "src/core/iomgr/socket_windows.h"

@ -34,7 +34,6 @@
#ifndef GRPC_INTERNAL_CORE_IOMGR_POLLSET_WINDOWS_H
#define GRPC_INTERNAL_CORE_IOMGR_POLLSET_WINDOWS_H
#include <windows.h>
#include <grpc/support/sync.h>
#include "src/core/iomgr/socket_windows.h"

@ -34,8 +34,8 @@
#ifndef GRPC_INTERNAL_CORE_IOMGR_SOCKADDR_WIN32_H
#define GRPC_INTERNAL_CORE_IOMGR_SOCKADDR_WIN32_H
#include <ws2tcpip.h>
#include <winsock2.h>
#include <ws2tcpip.h>
#include <mswsock.h>
#ifdef __MINGW32__

@ -34,7 +34,8 @@
#ifndef GRPC_INTERNAL_CORE_IOMGR_SOCKET_WINDOWS_H
#define GRPC_INTERNAL_CORE_IOMGR_SOCKET_WINDOWS_H
#include <windows.h>
#include <grpc/support/port_platform.h>
#include <WinSock2.h>
#include <grpc/support/sync.h>
#include <grpc/support/atm.h>

@ -34,7 +34,6 @@
#include <grpc/support/port_platform.h>
#ifdef GPR_WIN32
#include <windows.h>
#include <grpc/support/log.h>
unsigned gpr_cpu_num_cores(void) {

@ -37,7 +37,6 @@
#ifdef GPR_WIN32
#include <windows.h>
#include <stdio.h>
#include <stdarg.h>
#include <string.h>

@ -38,8 +38,6 @@
#ifdef GPR_WIN32
#include <windows.h>
/* These allocate new strings using gpr_malloc to convert from and to utf-8. */
LPTSTR gpr_char_to_tchar(LPCSTR input);
LPSTR gpr_tchar_to_char(LPCTSTR input);

@ -37,9 +37,6 @@
#ifdef GPR_WIN32
#undef _WIN32_WINNT
#define _WIN32_WINNT 0x0600
#include <windows.h>
#include <grpc/support/log.h>
#include <grpc/support/sync.h>
#include <grpc/support/time.h>

@ -37,7 +37,6 @@
#ifdef GPR_WIN32
#include <windows.h>
#include <string.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>

@ -39,7 +39,6 @@
#include <grpc/support/time.h>
#include <sys/timeb.h>
#include <windows.h>
gpr_timespec gpr_now(void) {
gpr_timespec now_tv;

Loading…
Cancel
Save