Fix Integer Rounding issue and duplicate definition of __deref in sal.h (dotnet/corec...
authorSinan Kaya <41809318+franksinankaya@users.noreply.github.com>
Mon, 18 Feb 2019 05:12:28 +0000 (00:12 -0500)
committerJan Kotas <jkotas@microsoft.com>
Mon, 18 Feb 2019 05:12:28 +0000 (21:12 -0800)
* Fix large integer truncation

pal/pal.h:4988:43:
warning: large integer implicitly truncated to unsigned type
[-Woverflow]
     static const SIZE_T NoTargetFrameSp = SIZE_MAX;
                                                ^~~~~~~~

* Fix compilation error with GCC

/usr/include/c++/7.3.0/debug/functions.h:452:15: error: expected unqualified-id before ')' token
       __deref();
               ^
/usr/include/c++/7.3.0/debug/functions.h:455:34: error: expected primary-expression before '<' token
       typename = decltype(__deref<_It>() < __deref<_It>())>
                                  ^
/usr/include/c++/7.3.0/debug/functions.h:455:38: error: expected primary-expression before '>' token
       typename = decltype(__deref<_It>() < __deref<_It>())>
                                      ^
/usr/include/c++/7.3.0/debug/functions.h:455:40: error: expected primary-expression before ')' token
       typename = decltype(__deref<_It>() < __deref<_It>())>
                                        ^

Commit migrated from https://github.com/dotnet/coreclr/commit/f522e39d4a1da2a4b4859c5db5c741193d098984

src/coreclr/src/pal/inc/pal.h
src/coreclr/src/pal/inc/rt/sal.h

index 20befc9..0422a88 100644 (file)
@@ -4979,7 +4979,7 @@ PAL_FreeExceptionRecords(
 struct PAL_SEHException
 {
 private:
-    static const SIZE_T NoTargetFrameSp = SIZE_MAX;
+    static const SIZE_T NoTargetFrameSp = (SIZE_T)SIZE_MAX;
 
     void Move(PAL_SEHException& ex)
     {
index e5622a8..9a8c2a4 100644 (file)
@@ -2604,6 +2604,7 @@ extern "C" {
 #ifndef PAL_STDCPP_COMPAT
     #define __null
     #define __notnull
+    #define __deref
 #endif // !PAL_STDCPP_COMPAT
     #define __maybenull
     #define __readonly
@@ -2618,7 +2619,6 @@ extern "C" {
     #define __writableTo(size)
     #define __elem_writableTo(size)
     #define __byte_writableTo(size)
-    #define __deref
     #define __pre
     #define __post
     #define __precond(expr)