Skip to content

Commit

Permalink
Consistently include "Platform.h" instead of including <windows.h>
Browse files Browse the repository at this point in the history
Platform.h includes lldb/Host/windows/windows.h, which overrides e.g.
NTDDI_VERSION and _WIN32_WINNT before including <windows.h>. If
we directly include <windows.h> somewhere first, and then later
include lldb/Host/windows/windows.h (via Platform.h) we end up
redefining NTDDI_VERSION.

Also include lldb/Host/windows/PosixApi.h (for consistency, as it
ends up included in some files but not in others) and add ifdefs
around some defines that are defined by lldb's PosixApi.h. (Adding
ifdefs instead of removing the definitions altogether, as older
versions of lldb might not have the same defines.)
  • Loading branch information
mstorsjo authored and tkrasnukha committed May 6, 2021
1 parent f05c9d2 commit 89945aa
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/MICmnStreamStdin.cpp
Expand Up @@ -7,8 +7,8 @@
//===----------------------------------------------------------------------===//

// Third Party Headers
#ifdef _MSC_VER
#include <windows.h>
#ifdef _WIN32
#include "Platform.h"
#endif
#include <string.h>

Expand Down
4 changes: 1 addition & 3 deletions src/MIDataTypes.h
Expand Up @@ -17,9 +17,7 @@
// Windows headers:
#ifdef _WIN32

// Suppress the min and max macro definitions in Windef.h.
#define NOMINMAX
#include <windows.h>
#include "Platform.h"

// Debugging:
#ifdef _DEBUG
Expand Down
2 changes: 1 addition & 1 deletion src/MIUtilDebug.cpp
Expand Up @@ -8,7 +8,7 @@

// Third party headers:
#ifdef _WIN32
#include <windows.h>
#include "Platform.h"
#endif

// In-house headers:
Expand Down
19 changes: 13 additions & 6 deletions src/Platform.h
Expand Up @@ -14,6 +14,7 @@
#include <signal.h>

#include "lldb/Host/HostGetOpt.h"
#include "lldb/Host/windows/PosixApi.h"
#include "lldb/Host/windows/windows.h"

struct winsize {
Expand All @@ -25,7 +26,9 @@ typedef unsigned int speed_t;
typedef unsigned int tcflag_t;

// fcntl.h // This is not used by MI
#ifndef O_NOCTTY
#define O_NOCTTY 0400
#endif

// ioctls.h
#define TIOCGWINSZ 0x5413
Expand All @@ -50,7 +53,9 @@ typedef long pid_t;
#endif

#define STDIN_FILENO 0
#ifndef PATH_MAX
#define PATH_MAX 32768
#endif
#define snprintf _snprintf

extern int ioctl(int d, int request, ...);
Expand All @@ -64,12 +69,14 @@ typedef void (*sighandler_t)(int);

// CODETAG_IOR_SIGNALS
// signal.h
#define SIGQUIT 3 // Terminal quit signal
#define SIGKILL 9 // Kill (cannot be caught or ignored)
#define SIGPIPE 13 // Write on a pipe with no one to read it
#define SIGCONT 18 // Continue executing, if stopped.
#define SIGTSTP 20 // Terminal stop signal
#define SIGSTOP 23 // Stop executing (cannot be caught or ignored)
#define SIGQUIT 3 // Terminal quit signal
#define SIGKILL 9 // Kill (cannot be caught or ignored)
#define SIGPIPE 13 // Write on a pipe with no one to read it
#define SIGCONT 18 // Continue executing, if stopped.
#define SIGTSTP 20 // Terminal stop signal
#ifndef SIGSTOP
#define SIGSTOP 23 // Stop executing (cannot be caught or ignored)
#endif
#define SIGWINCH 28 // (== SIGVTALRM)

#else
Expand Down

0 comments on commit 89945aa

Please sign in to comment.