Bug 1849068 - Change how the missing pieces are setup for mingw. r=bobowen

Mingw trunk recently gained the missing pieces we were #define'ing.
Unfortunately, the way we were doing that is not compatible with them
being there now, so we change it so that it works with both the current
version of mingw we use, and trunk by:
- using a typedef for HREPORT instead of a #define, which is the same
  declaration as in trunk
- because PWER_SUBMIT_RESULT is a typedef with the underlying
  WER_SUBMIT_RESULT type defined inline, we can't typedef it.
  Fortunately, there's only one thing using PWER_SUBMIT_RESULT in the
  old version of werapi.h in mingw (WerReportSubmit), so we #define
  it to change its definition instead.
- WER_MAX_PREFERRED_MODULES_BUFFER is a #define without parens in
  the new header, which would conflict, but #define'ing to the same
  value as in the new header, without the parens makes it work.

Differential Revision: https://phabricator.services.mozilla.com/D186412
This commit is contained in:
Mike Hommey 2023-08-17 19:26:07 +00:00
parent 943e3c05a7
commit 0b2cb8d923

View File

@ -14,11 +14,15 @@
# include <windows.h>
# if defined(__MINGW32__) || defined(__MINGW64__)
// Add missing constants and types for mingw builds
# define HREPORT HANDLE
# define PWER_SUBMIT_RESULT WER_SUBMIT_RESULT*
# define WER_MAX_PREFERRED_MODULES_BUFFER (256)
typedef HANDLE HREPORT;
# define WerReportSubmit(a, b, c, d) \
WerReportSubmit(a, b, c, WER_SUBMIT_RESULT* pSubmitResult)
# define WER_MAX_PREFERRED_MODULES_BUFFER 256
# endif // defined(__MINGW32__) || defined(__MINGW64__)
# include <werapi.h> // For WerRegisterRuntimeExceptionModule()
# if defined(__MINGW32__) || defined(__MINGW64__)
# undef WerReportSubmit
# endif // defined(__MINGW32__) || defined(__MINGW64__)
# include <stdlib.h>
# include "mozilla/mozalloc_oom.h"