mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 14:43:02 +00:00
Miscellaneous Visual C++ compilation fixes
modified include/crt/mingw32/intrin_x86.h modified include/crt/msc/intrin.h Fixed declarations of _InterlockedDecrement16 and _InterlockedIncrement16 Fixed declarations of __readcr0, __readcr2, __readcr3 and __readcr4 for x86 Implement __readdr and __writedr for x86 too Added missing semicolon modified include/crt/stdlib.h modified lib/3rdparty/mingw/crtexe.c Use Visual C++-compatible attribute placement modified lib/3rdparty/mingw/crtexe.c Get rid of useless assembly, replace with __writefsdword (it's still useless) modified lib/3rdparty/mingw/mingw.rbuild Disable Visual C++ warning C4733 ("Inline asm assigning to 'FS:0' : handler not registered as safe handler") for mingw_wmain modified lib/sdk/scrnsave/scrnsave.c Silence a warning modified ReactOS-generic.rbuild Disable Visual C++ warning C4711 ("function 'function' selected for inline expansion") globally modified tools/rbuild/backend/mingw/compilers/msc.mak Fix Visual C++ compiler rules to emit an uniquely named PDB for each object file svn path=/trunk/; revision=41442
This commit is contained in:
parent
f706410ede
commit
f6a788b116
8 changed files with 129 additions and 38 deletions
|
@ -127,4 +127,6 @@
|
||||||
</directory>
|
</directory>
|
||||||
|
|
||||||
<compilerflag compiler="cxx" compilerset="gcc">-Wno-non-virtual-dtor</compilerflag>
|
<compilerflag compiler="cxx" compilerset="gcc">-Wno-non-virtual-dtor</compilerflag>
|
||||||
|
|
||||||
|
<compilerflag compilerset="msc">/wd4711</compilerflag>
|
||||||
</group>
|
</group>
|
||||||
|
|
|
@ -479,12 +479,12 @@ __INTRIN_INLINE long _InterlockedIncrement(volatile long * const lpAddend)
|
||||||
return _InterlockedExchangeAdd(lpAddend, 1) + 1;
|
return _InterlockedExchangeAdd(lpAddend, 1) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
__INTRIN_INLINE long _InterlockedDecrement16(volatile short * const lpAddend)
|
__INTRIN_INLINE short _InterlockedDecrement16(volatile short * const lpAddend)
|
||||||
{
|
{
|
||||||
return _InterlockedExchangeAdd16(lpAddend, -1) - 1;
|
return _InterlockedExchangeAdd16(lpAddend, -1) - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
__INTRIN_INLINE long _InterlockedIncrement16(volatile short * const lpAddend)
|
__INTRIN_INLINE short _InterlockedIncrement16(volatile short * const lpAddend)
|
||||||
{
|
{
|
||||||
return _InterlockedExchangeAdd16(lpAddend, 1) + 1;
|
return _InterlockedExchangeAdd16(lpAddend, 1) + 1;
|
||||||
}
|
}
|
||||||
|
@ -1132,7 +1132,6 @@ __INTRIN_INLINE void __writecr8(const unsigned __int64 Data)
|
||||||
{
|
{
|
||||||
__asm__("mov %[Data], %%cr8" : : [Data] "q" (Data) : "memory");
|
__asm__("mov %[Data], %%cr8" : : [Data] "q" (Data) : "memory");
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
__INTRIN_INLINE unsigned __int64 __readcr0(void)
|
__INTRIN_INLINE unsigned __int64 __readcr0(void)
|
||||||
{
|
{
|
||||||
|
@ -1162,13 +1161,40 @@ __INTRIN_INLINE unsigned __int64 __readcr4(void)
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _M_AMD64
|
|
||||||
__INTRIN_INLINE unsigned __int64 __readcr8(void)
|
__INTRIN_INLINE unsigned __int64 __readcr8(void)
|
||||||
{
|
{
|
||||||
unsigned __int64 value;
|
unsigned __int64 value;
|
||||||
__asm__ __volatile__("movq %%cr8, %q[value]" : [value] "=q" (value));
|
__asm__ __volatile__("movq %%cr8, %q[value]" : [value] "=q" (value));
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
__INTRIN_INLINE unsigned long __readcr0(void)
|
||||||
|
{
|
||||||
|
unsigned long value;
|
||||||
|
__asm__ __volatile__("mov %%cr0, %[value]" : [value] "=q" (value));
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
__INTRIN_INLINE unsigned long __readcr2(void)
|
||||||
|
{
|
||||||
|
unsigned long value;
|
||||||
|
__asm__ __volatile__("mov %%cr2, %[value]" : [value] "=q" (value));
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
__INTRIN_INLINE unsigned long __readcr3(void)
|
||||||
|
{
|
||||||
|
unsigned long value;
|
||||||
|
__asm__ __volatile__("mov %%cr3, %[value]" : [value] "=q" (value));
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
__INTRIN_INLINE unsigned long __readcr4(void)
|
||||||
|
{
|
||||||
|
unsigned long value;
|
||||||
|
__asm__ __volatile__("mov %%cr4, %[value]" : [value] "=q" (value));
|
||||||
|
return value;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _M_AMD64
|
#ifdef _M_AMD64
|
||||||
|
@ -1235,6 +1261,70 @@ __INTRIN_INLINE void __writedr(unsigned reg, unsigned __int64 value)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
__INTRIN_INLINE unsigned int __readdr(unsigned int reg)
|
||||||
|
{
|
||||||
|
unsigned int value;
|
||||||
|
switch (reg)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
__asm__ __volatile__("movq %%dr0, %q[value]" : [value] "=q" (value));
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
__asm__ __volatile__("movq %%dr1, %q[value]" : [value] "=q" (value));
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
__asm__ __volatile__("movq %%dr2, %q[value]" : [value] "=q" (value));
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
__asm__ __volatile__("movq %%dr3, %q[value]" : [value] "=q" (value));
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
__asm__ __volatile__("movq %%dr4, %q[value]" : [value] "=q" (value));
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
__asm__ __volatile__("movq %%dr5, %q[value]" : [value] "=q" (value));
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
__asm__ __volatile__("movq %%dr6, %q[value]" : [value] "=q" (value));
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
__asm__ __volatile__("movq %%dr7, %q[value]" : [value] "=q" (value));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
__INTRIN_INLINE void __writedr(unsigned reg, unsigned int value)
|
||||||
|
{
|
||||||
|
switch (reg)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
__asm__("movq %q[value], %%dr0" : : [value] "q" (value) : "memory");
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
__asm__("movq %q[value], %%dr1" : : [value] "q" (value) : "memory");
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
__asm__("movq %q[value], %%dr2" : : [value] "q" (value) : "memory");
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
__asm__("movq %q[value], %%dr3" : : [value] "q" (value) : "memory");
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
__asm__("movq %q[value], %%dr4" : : [value] "q" (value) : "memory");
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
__asm__("movq %q[value], %%dr5" : : [value] "q" (value) : "memory");
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
__asm__("movq %q[value], %%dr6" : : [value] "q" (value) : "memory");
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
__asm__("movq %q[value], %%dr7" : : [value] "q" (value) : "memory");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
__INTRIN_INLINE void __invlpg(void * const Address)
|
__INTRIN_INLINE void __invlpg(void * const Address)
|
||||||
|
|
|
@ -35,8 +35,8 @@ long _InterlockedXor(volatile long * const value, const long mask);
|
||||||
long _InterlockedAddLargeStatistic(volatile __int64 * const Addend, const long Value);
|
long _InterlockedAddLargeStatistic(volatile __int64 * const Addend, const long Value);
|
||||||
long _InterlockedDecrement(volatile long * const lpAddend);
|
long _InterlockedDecrement(volatile long * const lpAddend);
|
||||||
long _InterlockedIncrement(volatile long * const lpAddend);
|
long _InterlockedIncrement(volatile long * const lpAddend);
|
||||||
long _InterlockedDecrement16(volatile short * const lpAddend);
|
short _InterlockedDecrement16(volatile short * const lpAddend);
|
||||||
long _InterlockedIncrement16(volatile short * const lpAddend);
|
short _InterlockedIncrement16(volatile short * const lpAddend);
|
||||||
unsigned char _interlockedbittestandreset(volatile long * a, const long b);
|
unsigned char _interlockedbittestandreset(volatile long * a, const long b);
|
||||||
unsigned char _interlockedbittestandset(volatile long * a, const long b);
|
unsigned char _interlockedbittestandset(volatile long * a, const long b);
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ void __incfsword(const unsigned long Offset);
|
||||||
void __incfsdword(const unsigned long Offset);
|
void __incfsdword(const unsigned long Offset);
|
||||||
void __addfsbyte(const unsigned long Offset, const unsigned char Data);
|
void __addfsbyte(const unsigned long Offset, const unsigned char Data);
|
||||||
void __addfsword(const unsigned long Offset, const unsigned short Data);
|
void __addfsword(const unsigned long Offset, const unsigned short Data);
|
||||||
void __addfsdword(const unsigned long Offset, const unsigned int Data)
|
void __addfsdword(const unsigned long Offset, const unsigned int Data);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -153,19 +153,21 @@ void __writecr4(const unsigned __int64 Data);
|
||||||
|
|
||||||
#ifdef _M_AMD64
|
#ifdef _M_AMD64
|
||||||
void __writecr8(const unsigned __int64 Data);
|
void __writecr8(const unsigned __int64 Data);
|
||||||
#endif
|
|
||||||
|
|
||||||
unsigned __int64 __readcr0(void);
|
unsigned __int64 __readcr0(void);
|
||||||
unsigned __int64 __readcr2(void);
|
unsigned __int64 __readcr2(void);
|
||||||
unsigned __int64 __readcr3(void);
|
unsigned __int64 __readcr3(void);
|
||||||
unsigned __int64 __readcr4(void);
|
unsigned __int64 __readcr4(void);
|
||||||
|
|
||||||
#ifdef _M_AMD64
|
|
||||||
unsigned __int64 __readcr8(void);
|
unsigned __int64 __readcr8(void);
|
||||||
#endif
|
|
||||||
|
|
||||||
unsigned __int64 __readdr(unsigned int reg);
|
unsigned __int64 __readdr(unsigned int reg);
|
||||||
void __writedr(unsigned reg, unsigned __int64 value);
|
void __writedr(unsigned reg, unsigned __int64 value);
|
||||||
|
#else
|
||||||
|
unsigned long __readcr0(void);
|
||||||
|
unsigned long __readcr2(void);
|
||||||
|
unsigned long __readcr3(void);
|
||||||
|
unsigned long __readcr4(void);
|
||||||
|
unsigned int __readdr(unsigned int reg);
|
||||||
|
void __writedr(unsigned reg, unsigned int value);
|
||||||
|
#endif
|
||||||
|
|
||||||
void __invlpg(void * const Address);
|
void __invlpg(void * const Address);
|
||||||
|
|
||||||
|
|
|
@ -304,7 +304,7 @@ extern "C" {
|
||||||
_CRTIMP __declspec(noreturn) void __cdecl _exit(int _Code);
|
_CRTIMP __declspec(noreturn) void __cdecl _exit(int _Code);
|
||||||
#if !defined __NO_ISOCEXT /* extern stub in static libmingwex.a */
|
#if !defined __NO_ISOCEXT /* extern stub in static libmingwex.a */
|
||||||
/* C99 function name */
|
/* C99 function name */
|
||||||
void __cdecl __declspec(noreturn) _Exit(int); /* Declare to get noreturn attribute. */
|
__declspec(noreturn) void __cdecl _Exit(int); /* Declare to get noreturn attribute. */
|
||||||
__CRT_INLINE void __cdecl _Exit(int status)
|
__CRT_INLINE void __cdecl _Exit(int status)
|
||||||
{ _exit(status); }
|
{ _exit(status); }
|
||||||
#endif
|
#endif
|
||||||
|
@ -312,7 +312,7 @@ extern "C" {
|
||||||
#pragma push_macro("abort")
|
#pragma push_macro("abort")
|
||||||
#undef abort
|
#undef abort
|
||||||
#endif
|
#endif
|
||||||
void __cdecl __declspec(noreturn) abort(void);
|
__declspec(noreturn) void __cdecl abort(void);
|
||||||
#if __MINGW_GNUC_PREREQ(4,4)
|
#if __MINGW_GNUC_PREREQ(4,4)
|
||||||
#pragma pop_macro("abort")
|
#pragma pop_macro("abort")
|
||||||
#endif
|
#endif
|
||||||
|
|
19
reactos/lib/3rdparty/mingw/crtexe.c
vendored
19
reactos/lib/3rdparty/mingw/crtexe.c
vendored
|
@ -20,6 +20,7 @@
|
||||||
#include <tchar.h>
|
#include <tchar.h>
|
||||||
#include <sect_attribs.h>
|
#include <sect_attribs.h>
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
|
#include <intrin.h>
|
||||||
|
|
||||||
#ifndef __winitenv
|
#ifndef __winitenv
|
||||||
extern wchar_t ***_imp____winitenv;
|
extern wchar_t ***_imp____winitenv;
|
||||||
|
@ -86,7 +87,7 @@ static int has_cctor = 0;
|
||||||
static _startupinfo startinfo;
|
static _startupinfo startinfo;
|
||||||
|
|
||||||
extern void _pei386_runtime_relocator (void);
|
extern void _pei386_runtime_relocator (void);
|
||||||
static CALLBACK long _gnu_exception_handler (EXCEPTION_POINTERS * exception_data);
|
static long CALLBACK _gnu_exception_handler (EXCEPTION_POINTERS * exception_data);
|
||||||
static LONG __mingw_vex(EXCEPTION_POINTERS * exception_data);
|
static LONG __mingw_vex(EXCEPTION_POINTERS * exception_data);
|
||||||
#ifdef WPRFLAG
|
#ifdef WPRFLAG
|
||||||
static void duplicate_ppstrings (int ac, wchar_t ***av);
|
static void duplicate_ppstrings (int ac, wchar_t ***av);
|
||||||
|
@ -212,17 +213,9 @@ __tmainCRTStartup (void)
|
||||||
|
|
||||||
_pei386_runtime_relocator ();
|
_pei386_runtime_relocator ();
|
||||||
|
|
||||||
#ifdef _WIN64
|
#if defined(__i386__) || defined(_M_IX86)
|
||||||
__asm__ __volatile__ (
|
__writefsdword(0, 0xffffffff);
|
||||||
"xorq %rax,%rax\n\t"
|
#endif
|
||||||
"decq %rax\n\t"
|
|
||||||
"movq %rax,%gs:0" "\n");
|
|
||||||
#else
|
|
||||||
__asm__ __volatile__ (
|
|
||||||
"xorl %eax,%eax\n\t"
|
|
||||||
"decl %eax\n\t"
|
|
||||||
"movl %eax,%fs:0" "\n");
|
|
||||||
#endif
|
|
||||||
AddVectoredExceptionHandler (0, (PVECTORED_EXCEPTION_HANDLER)__mingw_vex);
|
AddVectoredExceptionHandler (0, (PVECTORED_EXCEPTION_HANDLER)__mingw_vex);
|
||||||
SetUnhandledExceptionFilter (_gnu_exception_handler);
|
SetUnhandledExceptionFilter (_gnu_exception_handler);
|
||||||
|
|
||||||
|
@ -330,7 +323,7 @@ check_managed_app (void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static CALLBACK long
|
static long CALLBACK
|
||||||
_gnu_exception_handler (EXCEPTION_POINTERS * exception_data)
|
_gnu_exception_handler (EXCEPTION_POINTERS * exception_data)
|
||||||
{
|
{
|
||||||
void (*old_handler) (int);
|
void (*old_handler) (int);
|
||||||
|
|
1
reactos/lib/3rdparty/mingw/mingw.rbuild
vendored
1
reactos/lib/3rdparty/mingw/mingw.rbuild
vendored
|
@ -39,6 +39,7 @@
|
||||||
<define name="_CRTBLD" />
|
<define name="_CRTBLD" />
|
||||||
<define name="WPRFLAG" />
|
<define name="WPRFLAG" />
|
||||||
<include base="ReactOS">include/reactos/mingw-w64</include>
|
<include base="ReactOS">include/reactos/mingw-w64</include>
|
||||||
|
<compilerflag compilerset="msc">/wd4733</compilerflag>
|
||||||
<file>crt0_w.c</file>
|
<file>crt0_w.c</file>
|
||||||
<file>crtexe.c</file>
|
<file>crtexe.c</file>
|
||||||
<file>dllargv.c</file>
|
<file>dllargv.c</file>
|
||||||
|
|
|
@ -204,6 +204,9 @@ int APIENTRY _tWinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPTSTR CmdLine, int
|
||||||
{
|
{
|
||||||
LPTSTR p;
|
LPTSTR p;
|
||||||
|
|
||||||
|
UNREFERENCED_PARAMETER(nCmdShow);
|
||||||
|
UNREFERENCED_PARAMETER(hPrevInst);
|
||||||
|
|
||||||
hMainInstance = hInst;
|
hMainInstance = hInst;
|
||||||
|
|
||||||
// Parse the arguments
|
// Parse the arguments
|
||||||
|
|
|
@ -47,13 +47,13 @@ ${call RBUILD_DEPENDS,$(1),$(2),,${call RBUILD_cflags,$(1),$(4)},$(5).d}
|
||||||
|
|
||||||
$(5): $(2) $(5).d $(3) $$(RBUILD_HELPER_TARGET) | ${call RBUILD_dir,$(5)}
|
$(5): $(2) $(5).d $(3) $$(RBUILD_HELPER_TARGET) | ${call RBUILD_dir,$(5)}
|
||||||
$$(ECHO_CC)
|
$$(ECHO_CC)
|
||||||
$${cl} /TC /Fo$$@ ${call RBUILD_cflags,$(1),$(4)} /c $$<
|
$${cl} /TC /Fo$$@ /Fd$(basename $$@).pdb ${call RBUILD_cflags,$(1),$(4)} /c $$<
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
$(5): $(2) $(3) $$(RBUILD_HELPER_TARGET) | ${call RBUILD_dir,$(5)}
|
$(5): $(2) $(3) $$(RBUILD_HELPER_TARGET) | ${call RBUILD_dir,$(5)}
|
||||||
$$(ECHO_CC)
|
$$(ECHO_CC)
|
||||||
$${cl} /TC /Fo$$@ ${call RBUILD_cflags,$(1),$(4)} /c $$<
|
$${cl} /TC /Fo$$@ /Fd$(basename $$@).pdb ${call RBUILD_cflags,$(1),$(4)} /c $$<
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -71,13 +71,13 @@ ${call RBUILD_CXX_DEPENDS,$(1),$(2),,${call RBUILD_cflags,$(1),$(4)},$(5).d}
|
||||||
|
|
||||||
$(5): $(2) $(5).d $(3) $$(RBUILD_HELPER_TARGET) | ${call RBUILD_dir,$(5)}
|
$(5): $(2) $(5).d $(3) $$(RBUILD_HELPER_TARGET) | ${call RBUILD_dir,$(5)}
|
||||||
$$(ECHO_CC)
|
$$(ECHO_CC)
|
||||||
$${cl} /TP /Fo$$@ ${call RBUILD_cxxflags,$(1),$(4)} /c $$<
|
$${cl} /TP /Fo$$@ /Fd$(basename $$@).pdb ${call RBUILD_cxxflags,$(1),$(4)} /c $$<
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
$(5): $(2) $(3) $$(RBUILD_HELPER_TARGET) | ${call RBUILD_dir,$(5)}
|
$(5): $(2) $(3) $$(RBUILD_HELPER_TARGET) | ${call RBUILD_dir,$(5)}
|
||||||
$$(ECHO_CC)
|
$$(ECHO_CC)
|
||||||
$${cl} /TP /Fo$$@ ${call RBUILD_cxxflags,$(1),$(4)} /c $$<
|
$${cl} /TP /Fo$$@ /Fd$(basename $$@).pdb ${call RBUILD_cxxflags,$(1),$(4)} /c $$<
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue