]> code.delx.au - gnu-emacs/blobdiff - nt/preprep.c
Merge from origin/emacs-25
[gnu-emacs] / nt / preprep.c
index 9824cda0b581c3223f61d3378e550a9af0f8cb8a..491a93ba3b039220ff40fdd3496bcd07350afdc3 100644 (file)
@@ -1,12 +1,12 @@
 /* Pre-process emacs.exe for profiling by MSVC.
-   Copyright (C) 1999, 2001-201 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2001-2016 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
 GNU Emacs is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
+the Free Software Foundation, either version 3 of the License, or (at
+your option) any later version.
 
 GNU Emacs is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -25,7 +25,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 #include <stdio.h>
 #include <fcntl.h>
 #include <time.h>
-#ifdef __GNUC__
+#if defined(__GNUC__) && !defined(MINGW_W64)
 #define _ANONYMOUS_UNION
 #define _ANONYMOUS_STRUCT
 #endif
@@ -34,11 +34,10 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 /* Include relevant definitions from IMAGEHLP.H, which can be found
    in \\win32sdk\mstools\samples\image\include\imagehlp.h. */
 
-PIMAGE_NT_HEADERS
-(__stdcall * pfnCheckSumMappedFile) (LPVOID BaseAddress,
-                                    DWORD_PTR FileLength,
-                                    PDWORD_PTR HeaderSum,
-                                    PDWORD_PTR CheckSum);
+PIMAGE_NT_HEADERS (__stdcall * pfnCheckSumMappedFile) (LPVOID BaseAddress,
+                                                      DWORD_PTR FileLength,
+                                                      PDWORD_PTR HeaderSum,
+                                                      PDWORD_PTR CheckSum);
 
 #undef min
 #undef max
@@ -279,16 +278,16 @@ relocate_offset (DWORD_PTR offset,
 }
 
 #define OFFSET_TO_RVA(offset, section) \
-         (section->VirtualAddress + ((DWORD_PTR)(offset) - section->PointerToRawData))
+  ((section)->VirtualAddress + ((DWORD_PTR)(offset) - (section)->PointerToRawData))
 
 #define RVA_TO_OFFSET(rva, section) \
-         (section->PointerToRawData + ((DWORD_PTR)(rva) - section->VirtualAddress))
+  ((section)->PointerToRawData + ((DWORD_PTR)(rva) - (section)->VirtualAddress))
 
 #define RVA_TO_SECTION_OFFSET(rva, section) \
-         ((DWORD_PTR)(rva) - section->VirtualAddress)
+  ((DWORD_PTR)(rva) - (section)->VirtualAddress)
 
 #define RVA_TO_PTR(var,section,filedata) \
-         ((void *)(RVA_TO_OFFSET(var,section) + (filedata)->file_base))
+  ((void *)((unsigned char *)(RVA_TO_OFFSET(var,section) + (filedata)->file_base)))
 
 /* Convert address in executing image to RVA.  */
 #define PTR_TO_RVA(ptr) ((DWORD_PTR)(ptr) - (DWORD_PTR) GetModuleHandle (NULL))