libwpp: Use __int64 instead of long long.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2019-03-13 16:47:26 +01:00
parent 9068ad0f09
commit 595386250a
3 changed files with 28 additions and 59 deletions

View File

@ -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,11 +899,7 @@ static int make_number(int radix, YYSTYPE *val, const char *str, int len)
is_u++;
}
if(is_ll)
{
/* Assume as in the declaration of wrc_ull_t and wrc_sll_t */
#ifdef HAVE_LONG_LONG
if (is_u)
if(is_u && is_ll)
{
errno = 0;
val->ull = strtoull(str, NULL, radix);
@ -911,7 +907,7 @@ static int make_number(int radix, YYSTYPE *val, const char *str, int len)
ppy_error("integer constant %s is too large\n", str);
return tULONGLONG;
}
else
else if(!is_u && is_ll)
{
errno = 0;
val->sll = strtoll(str, NULL, radix);
@ -919,10 +915,6 @@ static int make_number(int radix, YYSTYPE *val, const char *str, int len)
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
}
else if(is_u && is_l)
{
errno = 0;

View File

@ -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;
}

View File

@ -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;