As _strto[u]ll exists in msvcrt.dll and works well for either –m32|-m64
tcc.h can just test for _WIN32.

I also define those macros in the win32§include/stdlib.h

 

 

jullien@sims4:~/tinycc $ git diff

diff --git a/tcc.h b/tcc.h

index aa04404..1756831 100644

--- a/tcc.h

+++ b/tcc.h

@@ -65,7 +65,7 @@ extern long double strtold (const char *__nptr, char
**__endptr);

# ifndef __GNUC__

#  define strtold (long double)strtod

#  define strtof (float)strtod

-#  ifdef _WIN64

+#  ifdef _WIN32

#   define strtoll _strtoi64

#   define strtoull _strtoui64

#  else

diff --git a/win32/include/stdlib.h b/win32/include/stdlib.h

index 033c0fd..671772c 100644

--- a/win32/include/stdlib.h

+++ b/win32/include/stdlib.h

@@ -544,8 +544,18 @@ extern "C" {

 

   __CRT_INLINE long long __cdecl llabs(long long _j) { return (_j >= 0 ? _j
: -_j); }

 

+  /* stro[u]ll do not properly map in Windows; use macros as with VC++ does
*/

+#if !defined(strtoll)

+#define strtoll _strtoi64

+#endif

+#if !defined(strtoull)

+#define strtoull _strtoui64

+#endif

+

+/*

   long long  __cdecl strtoll(const char* __restrict__, char** __restrict,
int);

   unsigned long long  __cdecl strtoull(const char* __restrict__, char**
__restrict__, int);

+*/

 

   /* these are stubs for MS _i64 versions */

   long long  __cdecl atoll (const char *);

_______________________________________________
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to