From 0c72efe8f11b16e086eb2cffa5f337702be9077e Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Thu, 14 May 2015 20:20:59 +0000 Subject: [PATCH] [CRT] Make sure to get no errors, when implementing functions that exist as intrinsics. svn path=/trunk/; revision=67721 --- reactos/lib/sdk/crt/float/isnan.c | 4 ++++ reactos/lib/sdk/crt/math/cos.c | 5 +++++ reactos/lib/sdk/crt/math/cosf.c | 9 +++++++-- reactos/lib/sdk/crt/math/logf.c | 9 +++++++-- reactos/lib/sdk/crt/math/powf.c | 5 +++++ reactos/lib/sdk/crt/math/sin.c | 5 +++++ reactos/lib/sdk/crt/math/sinf.c | 9 +++++++-- reactos/lib/sdk/crt/mem/memchr.c | 4 ++++ reactos/lib/sdk/crt/mem/memcpy.c | 4 ++++ reactos/lib/sdk/crt/mem/memset.c | 4 ++++ reactos/lib/sdk/crt/string/tcscat.h | 4 ++++ reactos/lib/sdk/crt/string/tcscmp.h | 4 ++++ reactos/lib/sdk/crt/string/tcscpy.h | 4 ++++ reactos/lib/sdk/crt/string/tcslen.h | 4 ++++ reactos/lib/sdk/crt/string/tcsncmp.h | 4 ++++ reactos/lib/sdk/crt/string/tcsncpy.h | 4 ++++ 16 files changed, 76 insertions(+), 6 deletions(-) diff --git a/reactos/lib/sdk/crt/float/isnan.c b/reactos/lib/sdk/crt/float/isnan.c index bc2dfd3320a..476aa3ba905 100644 --- a/reactos/lib/sdk/crt/float/isnan.c +++ b/reactos/lib/sdk/crt/float/isnan.c @@ -19,6 +19,10 @@ #include +#if defined(_MSC_VER) && defined(_M_ARM) +#pragma function(_isnan) +#endif /* _MSC_VER */ + /* * @implemented */ diff --git a/reactos/lib/sdk/crt/math/cos.c b/reactos/lib/sdk/crt/math/cos.c index 6fcae769449..f12722a92c5 100644 --- a/reactos/lib/sdk/crt/math/cos.c +++ b/reactos/lib/sdk/crt/math/cos.c @@ -6,6 +6,11 @@ * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) */ +#ifdef _MSC_VER +#pragma warning(suppress:4164) /* intrinsic not declared */ +#pragma function(cos) +#endif /* _MSC_VER */ + #define PRECISION 9 #define M_PI 3.141592653589793238462643 diff --git a/reactos/lib/sdk/crt/math/cosf.c b/reactos/lib/sdk/crt/math/cosf.c index 0605582efd4..d00e6ef3aae 100644 --- a/reactos/lib/sdk/crt/math/cosf.c +++ b/reactos/lib/sdk/crt/math/cosf.c @@ -7,7 +7,12 @@ #include #undef cosf -float cosf(float _X) +#if defined(_MSC_VER) && (defined(_M_ARM) || defined(_M_AMD64)) +#pragma warning(suppress:4164) /* intrinsic not declared */ +#pragma function(cosf) +#endif /* _MSC_VER */ + +float cosf(float x) { - return ((float)cos((double)_X)); + return ((float)cos((double)x)); } diff --git a/reactos/lib/sdk/crt/math/logf.c b/reactos/lib/sdk/crt/math/logf.c index 417250f46a8..c87e9c06bd0 100644 --- a/reactos/lib/sdk/crt/math/logf.c +++ b/reactos/lib/sdk/crt/math/logf.c @@ -7,7 +7,12 @@ #include #undef logf -float logf(float _X) +#if defined(_MSC_VER) && (defined(_M_ARM) || defined(_M_AMD64)) +#pragma warning(suppress:4164) /* intrinsic not declared */ +#pragma function(logf) +#endif /* _MSC_VER */ + +float logf(float x) { - return ((float)log((double)_X)); + return ((float)log((double)x)); } diff --git a/reactos/lib/sdk/crt/math/powf.c b/reactos/lib/sdk/crt/math/powf.c index e9cc35ad642..53a16e0a9b3 100644 --- a/reactos/lib/sdk/crt/math/powf.c +++ b/reactos/lib/sdk/crt/math/powf.c @@ -4,6 +4,11 @@ * No warranty is given; refer to the file DISCLAIMER.PD within this package. */ +#if defined(_MSC_VER) && (defined(_M_ARM) || defined(_M_AMD64)) +#pragma warning(suppress:4164) /* intrinsic not declared */ +#pragma function(powf) +#endif /* _MSC_VER */ + double __cdecl pow(double x, double y); float powf(float x, float y) diff --git a/reactos/lib/sdk/crt/math/sin.c b/reactos/lib/sdk/crt/math/sin.c index 013f91e83aa..630ed648ad3 100644 --- a/reactos/lib/sdk/crt/math/sin.c +++ b/reactos/lib/sdk/crt/math/sin.c @@ -6,6 +6,11 @@ * PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org) */ +#ifdef _MSC_VER +#pragma warning(suppress:4164) /* intrinsic not declared */ +#pragma function(sin) +#endif /* _MSC_VER */ + #define PRECISION 9 #define M_PI 3.141592653589793238462643 diff --git a/reactos/lib/sdk/crt/math/sinf.c b/reactos/lib/sdk/crt/math/sinf.c index 92ffc9900d4..2183fc7940e 100644 --- a/reactos/lib/sdk/crt/math/sinf.c +++ b/reactos/lib/sdk/crt/math/sinf.c @@ -7,7 +7,12 @@ #include #undef sinf -float sinf(float _X) +#if defined(_MSC_VER) && (defined(_M_ARM) || defined(_M_AMD64)) +#pragma warning(suppress:4164) /* intrinsic not declared */ +#pragma function(sinf) +#endif /* _MSC_VER */ + +float sinf(float x) { - return ((float) sin ((double) _X)); + return ((float)sin((double)x)); } diff --git a/reactos/lib/sdk/crt/mem/memchr.c b/reactos/lib/sdk/crt/mem/memchr.c index 47be47effc9..58409e2d96c 100644 --- a/reactos/lib/sdk/crt/mem/memchr.c +++ b/reactos/lib/sdk/crt/mem/memchr.c @@ -1,6 +1,10 @@ #include +#if defined(_MSC_VER) && defined(_M_ARM) +#pragma function(memchr) +#endif /* _MSC_VER */ + void* memchr(const void *s, int c, size_t n) { if (n) diff --git a/reactos/lib/sdk/crt/mem/memcpy.c b/reactos/lib/sdk/crt/mem/memcpy.c index 65876118b57..06ac2d652e1 100644 --- a/reactos/lib/sdk/crt/mem/memcpy.c +++ b/reactos/lib/sdk/crt/mem/memcpy.c @@ -1,5 +1,9 @@ #include +#ifdef _MSC_VER +#pragma function(memcpy) +#endif /* _MSC_VER */ + /* NOTE: This code is a duplicate of memmove implementation! */ void* memcpy(void* dest, const void* src, size_t count) { diff --git a/reactos/lib/sdk/crt/mem/memset.c b/reactos/lib/sdk/crt/mem/memset.c index 60ad45a9296..b55af71cba0 100644 --- a/reactos/lib/sdk/crt/mem/memset.c +++ b/reactos/lib/sdk/crt/mem/memset.c @@ -1,6 +1,10 @@ #include +#ifdef _MSC_VER +#pragma function(memset) +#endif /* _MSC_VER */ + void* memset(void* src, int val, size_t count) { char *char_src = (char *)src; diff --git a/reactos/lib/sdk/crt/string/tcscat.h b/reactos/lib/sdk/crt/string/tcscat.h index 1c45439c484..5df3e351bb8 100644 --- a/reactos/lib/sdk/crt/string/tcscat.h +++ b/reactos/lib/sdk/crt/string/tcscat.h @@ -1,6 +1,10 @@ #include +#ifdef _MSC_VER +#pragma function(_tcscat) +#endif /* _MSC_VER */ + _TCHAR * _tcscat(_TCHAR * s, const _TCHAR * append) { _TCHAR * save = s; diff --git a/reactos/lib/sdk/crt/string/tcscmp.h b/reactos/lib/sdk/crt/string/tcscmp.h index e7c5b281b3c..22eec372583 100644 --- a/reactos/lib/sdk/crt/string/tcscmp.h +++ b/reactos/lib/sdk/crt/string/tcscmp.h @@ -1,6 +1,10 @@ #include +#if defined(_MSC_VER) +#pragma function(_tcscmp) +#endif /* _MSC_VER */ + int _tcscmp(const _TCHAR* s1, const _TCHAR* s2) { while(*s1 == *s2) diff --git a/reactos/lib/sdk/crt/string/tcscpy.h b/reactos/lib/sdk/crt/string/tcscpy.h index 716e06e5041..f2fde0ea701 100644 --- a/reactos/lib/sdk/crt/string/tcscpy.h +++ b/reactos/lib/sdk/crt/string/tcscpy.h @@ -1,6 +1,10 @@ #include +#ifdef _MSC_VER +#pragma function(_tcscpy) +#endif /* _MSC_VER */ + _TCHAR * _tcscpy(_TCHAR * to, const _TCHAR * from) { _TCHAR *save = to; diff --git a/reactos/lib/sdk/crt/string/tcslen.h b/reactos/lib/sdk/crt/string/tcslen.h index ab2cc75419a..e8de5b2b179 100644 --- a/reactos/lib/sdk/crt/string/tcslen.h +++ b/reactos/lib/sdk/crt/string/tcslen.h @@ -2,6 +2,10 @@ #include #include +#ifdef _MSC_VER +#pragma function(_tcslen) +#endif /* _MSC_VER */ + size_t _tcslen(const _TCHAR * str) { const _TCHAR * s; diff --git a/reactos/lib/sdk/crt/string/tcsncmp.h b/reactos/lib/sdk/crt/string/tcsncmp.h index ae6c8d19563..68c7f6355aa 100644 --- a/reactos/lib/sdk/crt/string/tcsncmp.h +++ b/reactos/lib/sdk/crt/string/tcsncmp.h @@ -2,6 +2,10 @@ #include #include +#if defined(_MSC_VER) && defined(_M_ARM) +#pragma function(_tcsncmp) +#endif /* _MSC_VER */ + int _tcsncmp(const _TCHAR * s1, const _TCHAR * s2, size_t n) { if(n == 0) return 0; diff --git a/reactos/lib/sdk/crt/string/tcsncpy.h b/reactos/lib/sdk/crt/string/tcsncpy.h index dbab841a111..ea4caf68dbd 100644 --- a/reactos/lib/sdk/crt/string/tcsncpy.h +++ b/reactos/lib/sdk/crt/string/tcsncpy.h @@ -2,6 +2,10 @@ #include #include +#if defined(_MSC_VER) && defined(_M_ARM) +#pragma function(_tcsncpy) +#endif /* _MSC_VER */ + _TCHAR * _tcsncpy(_TCHAR * dst, const _TCHAR * src, size_t n) { if(n != 0)