Module: wine Branch: master Commit: 595386250ab6e54e9dbadd8e209852ff61babbf1 URL: https://source.winehq.org/git/wine.git/?a=commit;h=595386250ab6e54e9dbadd8e2...
Author: Alexandre Julliard julliard@winehq.org Date: Wed Mar 13 16:47:26 2019 +0100
libwpp: Use __int64 instead of long long.
Signed-off-by: Alexandre Julliard julliard@winehq.org
---
libs/wpp/ppl.l | 40 ++++++++++++++++------------------------ libs/wpp/ppy.y | 20 ++++++++++---------- libs/wpp/wpp_private.h | 27 ++------------------------- 3 files changed, 28 insertions(+), 59 deletions(-)
diff --git a/libs/wpp/ppl.l b/libs/wpp/ppl.l index 1a04860..0a3768b 100644 --- a/libs/wpp/ppl.l +++ b/libs/wpp/ppl.l @@ -171,11 +171,11 @@ ul [uUlL]|[uUlL][lL]|[lL][uU]|[lL][lL][uU]|[uU][lL][lL]|[lL][uU][lL] #include <limits.h>
#ifndef LLONG_MAX -# define LLONG_MAX ((long long)0x7fffffff << 32 | 0xffffffff) +# define LLONG_MAX ((__int64)0x7fffffff << 32 | 0xffffffff) # define LLONG_MIN (-LLONG_MAX - 1) #endif #ifndef ULLONG_MAX -# define ULLONG_MAX ((long long)0xffffffff << 32 | 0xffffffff) +# define ULLONG_MAX ((__int64)0xffffffff << 32 | 0xffffffff) #endif
#ifndef HAVE_UNISTD_H @@ -899,29 +899,21 @@ static int make_number(int radix, YYSTYPE *val, const char *str, int len) is_u++; }
- if(is_ll) + if(is_u && is_ll) { -/* Assume as in the declaration of wrc_ull_t and wrc_sll_t */ -#ifdef HAVE_LONG_LONG - if (is_u) - { - errno = 0; - val->ull = strtoull(str, NULL, radix); - if (val->ull == ULLONG_MAX && errno == ERANGE) - ppy_error("integer constant %s is too large\n", str); - return tULONGLONG; - } - else - { - errno = 0; - val->sll = strtoll(str, NULL, radix); - if ((val->sll == LLONG_MIN || val->sll == LLONG_MAX) && errno == ERANGE) - ppy_error("integer constant %s is too large\n", str); - return tSLONGLONG; - } -#else - pp_internal_error(__FILE__, __LINE__, "long long constants not supported on this platform"); -#endif + errno = 0; + val->ull = strtoull(str, NULL, radix); + if (val->ull == ULLONG_MAX && errno == ERANGE) + ppy_error("integer constant %s is too large\n", str); + return tULONGLONG; + } + else if(!is_u && is_ll) + { + errno = 0; + val->sll = strtoll(str, NULL, radix); + if ((val->sll == LLONG_MIN || val->sll == LLONG_MAX) && errno == ERANGE) + ppy_error("integer constant %s is too large\n", str); + return tSLONGLONG; } else if(is_u && is_l) { diff --git a/libs/wpp/ppy.y b/libs/wpp/ppy.y index dbbe972..eb4f15a 100644 --- a/libs/wpp/ppy.y +++ b/libs/wpp/ppy.y @@ -81,9 +81,9 @@ if(cv_signed(v1) && cv_signed(v2)) \ r.val.sll = v1.val.sll OP v2.val.sll; \ else if(cv_signed(v1) && !cv_signed(v2)) \ - r.val.sll = v1.val.sll OP (wrc_sll_t) v2.val.ull; \ + r.val.sll = v1.val.sll OP (__int64) v2.val.ull; \ else if(!cv_signed(v1) && cv_signed(v2)) \ - r.val.sll = (wrc_sll_t) v1.val.ull OP v2.val.sll; \ + r.val.sll = (__int64) v1.val.ull OP v2.val.sll; \ else \ r.val.ull = v1.val.ull OP v2.val.ull;
@@ -128,8 +128,8 @@ static int nmacro_args; unsigned int uint; long slong; unsigned long ulong; - wrc_sll_t sll; - wrc_ull_t ull; + __int64 sll; + unsigned __int64 ull; int *iptr; char *cptr; cval_t cval; @@ -539,12 +539,12 @@ static int boolean(cval_t *v) { switch(v->type) { - case cv_sint: return v->val.si != (int)0; - case cv_uint: return v->val.ui != (unsigned int)0; - case cv_slong: return v->val.sl != (long)0; - case cv_ulong: return v->val.ul != (unsigned long)0; - case cv_sll: return v->val.sll != (wrc_sll_t)0; - case cv_ull: return v->val.ull != (wrc_ull_t)0; + case cv_sint: return v->val.si != 0; + case cv_uint: return v->val.ui != 0; + case cv_slong: return v->val.sl != 0; + case cv_ulong: return v->val.ul != 0; + case cv_sll: return v->val.sll != 0; + case cv_ull: return v->val.ull != 0; } return 0; } diff --git a/libs/wpp/wpp_private.h b/libs/wpp/wpp_private.h index caa52b9..093f221 100644 --- a/libs/wpp/wpp_private.h +++ b/libs/wpp/wpp_private.h @@ -20,10 +20,6 @@ #ifndef __WINE_WPP_PRIVATE_H #define __WINE_WPP_PRIVATE_H
-#ifndef __WINE_CONFIG_H -# error You must include config.h to use this header -#endif - #include <stdio.h> #include <string.h>
@@ -136,25 +132,6 @@ typedef struct int seen_junk; /* Set when junk is seen */ } include_state_t;
- -/* - * If the configure says we have long long then we can use it. Presumably - * if we have long long then we have strtoull and strtoll too. If that is - * not the case we will need to add to the configure tests. - * If we do not have long long , then we revert to a simple 'long' for now. - * This should prevent most unexpected things with other compilers than - * gcc and egcs for now. - * In the future it should be possible to use another way, like a - * structure, so that we can emulate the MS compiler. - */ -#ifdef HAVE_LONG_LONG -typedef long long wrc_sll_t; -typedef unsigned long long wrc_ull_t; -#else -typedef long wrc_sll_t; -typedef unsigned long wrc_ull_t; -#endif - #define SIZE_CHAR 1 #define SIZE_SHORT 2 #define SIZE_INT 3 @@ -191,8 +168,8 @@ typedef struct cval { unsigned int ui; long sl; unsigned long ul; - wrc_sll_t sll; - wrc_ull_t ull; + __int64 sll; + unsigned __int64 ull; } val; } cval_t;