winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
February 2021
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
2 participants
915 discussions
Start a n
N
ew thread
Piotr Caban : msvcrt: Add x87 asin implementation.
by Alexandre Julliard
05 Feb '21
05 Feb '21
Module: wine Branch: master Commit: a6e3987e5b58cac29f003b20325373deadbd90af URL:
https://source.winehq.org/git/wine.git/?a=commit;h=a6e3987e5b58cac29f003b20…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Fri Feb 5 16:07:10 2021 +0100 msvcrt: Add x87 asin implementation. Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=50429
Signed-off-by: Piotr Caban <piotr(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/msvcrt/math.c | 85 +++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 62 insertions(+), 23 deletions(-) diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c index bebd3e2cef9..83e5d1e65da 100644 --- a/dlls/msvcrt/math.c +++ b/dlls/msvcrt/math.c @@ -94,6 +94,31 @@ static inline double CDECL ret_nan( BOOL update_sw ) return (x - x) / (x - x); } +#define SET_X87_CW(MASK) \ + "subl $4, %esp\n\t" \ + __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t") \ + "fnstcw (%esp)\n\t" \ + "movw (%esp), %ax\n\t" \ + "movw %ax, 2(%esp)\n\t" \ + "testw $" #MASK ", %ax\n\t" \ + "jz 1f\n\t" \ + "andw $~" #MASK ", %ax\n\t" \ + "movw %ax, 2(%esp)\n\t" \ + "fldcw 2(%esp)\n\t" \ + "1:\n\t" + +#define RESET_X87_CW \ + "movw (%esp), %ax\n\t" \ + "cmpw %ax, 2(%esp)\n\t" \ + "je 1f\n\t" \ + "fstpl 8(%esp)\n\t" \ + "fldcw (%esp)\n\t" \ + "fldl 8(%esp)\n\t" \ + "fwait\n\t" \ + "1:\n\t" \ + "addl $4, %esp\n\t" \ + __ASM_CFI(".cfi_adjust_cfa_offset -4\n\t") + /********************************************************************* * _matherr (CRTDLL.@) */ @@ -886,6 +911,23 @@ static double asin_R(double z) return p / q; } +#ifdef __i386__ +double CDECL x87_asin(double); +__ASM_GLOBAL_FUNC( x87_asin, + "fldl 4(%esp)\n\t" + SET_X87_CW(~0x37f) + "fld %st\n\t" + "fld1\n\t" + "fsubp\n\t" + "fld1\n\t" + "fadd %st(2)\n\t" + "fmulp\n\t" + "fsqrt\n\t" + "fpatan\n\t" + RESET_X87_CW + "ret" ) +#endif + double CDECL asin( double x ) { static const double pio2_hi = 1.57079632679489655800e+00, @@ -894,6 +936,9 @@ double CDECL asin( double x ) double z, r, s; unsigned int hx, ix; ULONGLONG llx; +#ifdef __i386__ + unsigned int x87_cw, sse2_cw; +#endif hx = *(ULONGLONG*)&x >> 32; ix = hx & 0x7fffffff; @@ -904,9 +949,24 @@ double CDECL asin( double x ) if (((ix - 0x3ff00000) | lx) == 0) /* asin(1) = +-pi/2 with inexact */ return x * pio2_hi + 7.5231638452626401e-37; - if (isnan(x)) return x; + if (isnan(x)) + { +#ifdef __i386__ + return math_error(_DOMAIN, "sqrt", x, 0, x); +#else + return x; +#endif + } return math_error(_DOMAIN, "asin", x, 0, 0 / (x - x)); } + +#ifdef __i386__ + __control87_2(0, 0, &x87_cw, &sse2_cw); + if (!sse2_enabled || (x87_cw & _MCW_EM) != _MCW_EM + || (sse2_cw & (_MCW_EM | _MCW_RC)) != _MCW_EM) + return x87_asin(x); +#endif + /* |x| < 0.5 */ if (ix < 0x3fe00000) { /* if 0x1p-1022 <= |x| < 0x1p-26, avoid raising underflow */ @@ -1231,31 +1291,10 @@ __ASM_GLOBAL_FUNC( sse2_sqrt, #endif #ifdef __i386__ -#define SET_X87_CW \ - "subl $4, %esp\n\t" \ - __ASM_CFI(".cfi_adjust_cfa_offset 4\n\t") \ - "fnstcw (%esp)\n\t" \ - "movw (%esp), %ax\n\t" \ - "testw $0xc00, %ax\n\t" \ - "jz 1f\n\t" \ - "andw $0xf3ff, %ax\n\t" \ - "movw %ax, 2(%esp)\n\t" \ - "fldcw 2(%esp)\n\t" \ - "1:\n\t" - -#define RESET_X87_CW \ - "movw (%esp), %ax\n\t" \ - "testw $0xc00, %ax\n\t" \ - "jz 1f\n\t" \ - "fldcw (%esp)\n\t" \ - "1:\n\t" \ - "addl $4, %esp\n\t" \ - __ASM_CFI(".cfi_adjust_cfa_offset -4\n\t") - double CDECL x87_sqrt(double); __ASM_GLOBAL_FUNC( x87_sqrt, "fldl 4(%esp)\n\t" - SET_X87_CW + SET_X87_CW(0xc00) "fsqrt\n\t" RESET_X87_CW "ret" )
1
0
0
0
Piotr Caban : msvcrt: Disable sse2 math functions in older versions of runtime.
by Alexandre Julliard
05 Feb '21
05 Feb '21
Module: wine Branch: master Commit: 4ae82fd0077dcc1ef3a6d07dd2f369c32e1d8ba0 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=4ae82fd0077dcc1ef3a6d07d…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Fri Feb 5 16:06:50 2021 +0100 msvcrt: Disable sse2 math functions in older versions of runtime. Signed-off-by: Piotr Caban <piotr(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/msvcrt/math.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c index d0cc87d2c8e..bebd3e2cef9 100644 --- a/dlls/msvcrt/math.c +++ b/dlls/msvcrt/math.c @@ -71,7 +71,12 @@ static const struct unix_funcs *unix_funcs; void msvcrt_init_math( void *module ) { - sse2_supported = sse2_enabled = IsProcessorFeaturePresent( PF_XMMI64_INSTRUCTIONS_AVAILABLE ); + sse2_supported = IsProcessorFeaturePresent( PF_XMMI64_INSTRUCTIONS_AVAILABLE ); +#if _MSVCR_VER <=71 + sse2_enabled = FALSE; +#else + sse2_enabled = sse2_supported; +#endif __wine_init_unix_lib( module, DLL_PROCESS_ATTACH, NULL, &unix_funcs ); }
1
0
0
0
Piotr Caban : msvcrt: Set mxcsr denormal flag in sqrtf if needed.
by Alexandre Julliard
05 Feb '21
05 Feb '21
Module: wine Branch: master Commit: 0cd71776f474a6d8df7dc1198c50a3c31bacb635 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=0cd71776f474a6d8df7dc119…
Author: Piotr Caban <piotr(a)codeweavers.com> Date: Fri Feb 5 16:06:47 2021 +0100 msvcrt: Set mxcsr denormal flag in sqrtf if needed. Signed-off-by: Piotr Caban <piotr(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/msvcrt/math.c | 85 ++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 53 insertions(+), 32 deletions(-) diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c index 0f41cbac468..d0cc87d2c8e 100644 --- a/dlls/msvcrt/math.c +++ b/dlls/msvcrt/math.c @@ -82,6 +82,13 @@ static inline float fp_barrierf(float x) return y; } +static inline double CDECL ret_nan( BOOL update_sw ) +{ + double x = 1.0; + if (!update_sw) return -NAN; + return (x - x) / (x - x); +} + /********************************************************************* * _matherr (CRTDLL.@) */ @@ -613,6 +620,28 @@ float CDECL sinhf( float x ) return ret; } +static BOOL sqrtf_validate( float *x ) +{ + short c = _fdclass(*x); + + if (c == FP_ZERO) return FALSE; + if (c == FP_NAN) return FALSE; + if (signbit(*x)) + { + *x = math_error(_DOMAIN, "sqrtf", *x, 0, ret_nan(TRUE)); + return FALSE; + } + if (c == FP_INFINITE) return FALSE; + return TRUE; +} + +#if defined(__x86_64__) || defined(__i386__) +float CDECL sse2_sqrtf(float); +__ASM_GLOBAL_FUNC( sse2_sqrtf, + "sqrtss %xmm0, %xmm0\n\t" + "ret" ) +#endif + /********************************************************************* * sqrtf (MSVCRT.@) * @@ -620,25 +649,23 @@ float CDECL sinhf( float x ) */ float CDECL sqrtf( float x ) { +#ifdef __x86_64__ + if (!sqrtf_validate(&x)) + return x; + + return sse2_sqrtf(x); +#else static const float tiny = 1.0e-30; float z; - int sign = 0x80000000; int ix,s,q,m,t,i; unsigned int r; ix = *(int*)&x; - /* take care of Inf and NaN */ - if ((ix & 0x7f800000) == 0x7f800000 && (ix == 0x7f800000 || ix & 0x7fffff)) + if (!sqrtf_validate(&x)) return x; - /* take care of zero */ - if (ix <= 0) { - if ((ix & ~sign) == 0) - return x; /* sqrt(+-0) = +-0 */ - return math_error(_DOMAIN, "sqrtf", x, 0, (x - x) / (x - x)); /* sqrt(-ve) = sNaN */ - } /* normalize x */ m = ix >> 23; if (m == 0) { /* subnormal x */ @@ -683,6 +710,7 @@ float CDECL sqrtf( float x ) r = ix + ((unsigned int)m << 23); z = *(float*)&r; return z; +#endif } /********************************************************************* @@ -1165,14 +1193,7 @@ double CDECL sinh( double x ) return ret; } -static inline double CDECL ret_nan( BOOL update_sw ) -{ - double x = 1.0; - if (!update_sw) return -NAN; - return (x - x) / (x - x); -} - -BOOL sqrt_validate( double *x, BOOL update_sw ) +static BOOL sqrt_validate( double *x, BOOL update_sw ) { short c = _dclass(*x); @@ -3511,6 +3532,21 @@ __int64 CDECL llrintf(float x) return unix_funcs->llrintf( x ); } +/********************************************************************* + * _fdclass (MSVCR120.@) + * + * Copied from musl: src/math/__fpclassifyf.c + */ +short CDECL _fdclass(float x) +{ + union { float f; UINT32 i; } u = { x }; + int e = u.i >> 23 & 0xff; + + if (!e) return u.i << 1 ? FP_SUBNORMAL : FP_ZERO; + if (e == 0xff) return u.i << 9 ? FP_NAN : FP_INFINITE; + return FP_NORMAL; +} + /********************************************************************* * _dclass (MSVCR120.@) * @@ -3592,21 +3628,6 @@ float CDECL truncf(float x) return unix_funcs->truncf(x); } -/********************************************************************* - * _fdclass (MSVCR120.@) - * - * Copied from musl: src/math/__fpclassifyf.c - */ -short CDECL _fdclass(float x) -{ - union { float f; UINT32 i; } u = { x }; - int e = u.i >> 23 & 0xff; - - if (!e) return u.i << 1 ? FP_SUBNORMAL : FP_ZERO; - if (e == 0xff) return u.i << 9 ? FP_NAN : FP_INFINITE; - return FP_NORMAL; -} - /********************************************************************* * _dtest (MSVCR120.@) */
1
0
0
0
Henri Verbeet : wined3d: Invalidate STATE_STENCIL_REF when switching between NULL and non-NULL depth/stencil views.
by Alexandre Julliard
05 Feb '21
05 Feb '21
Module: wine Branch: master Commit: 08dc5b92e02536a173b19da5fba6788f492410e0 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=08dc5b92e02536a173b19da5…
Author: Henri Verbeet <hverbeet(a)codeweavers.com> Date: Fri Feb 5 11:37:16 2021 +0100 wined3d: Invalidate STATE_STENCIL_REF when switching between NULL and non-NULL depth/stencil views. Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wined3d/cs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c index 1dfc881905b..0385b8f4693 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -1229,6 +1229,7 @@ static void wined3d_cs_exec_set_depth_stencil_view(struct wined3d_cs *cs, const { /* Swapping NULL / non NULL depth stencil affects the depth and tests */ device_invalidate_state(device, STATE_DEPTH_STENCIL); + device_invalidate_state(device, STATE_STENCIL_REF); device_invalidate_state(device, STATE_RASTERIZER); } else if (prev)
1
0
0
0
Rémi Bernon : widl: Fold aIDENTIFIER / aKNOWNTYPE rules together.
by Alexandre Julliard
05 Feb '21
05 Feb '21
Module: wine Branch: master Commit: 36597eda3df66a4b24b341e7ed85d92eecb3b688 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=36597eda3df66a4b24b341e7…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Fri Feb 5 10:11:04 2021 +0100 widl: Fold aIDENTIFIER / aKNOWNTYPE rules together. Splitting t_ident rule as typename / m_typename rules. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- tools/widl/parser.y | 55 +++++++++++++++++++++-------------------------------- 1 file changed, 22 insertions(+), 33 deletions(-) diff --git a/tools/widl/parser.y b/tools/widl/parser.y index 782ed39643c..2d527805c14 100644 --- a/tools/widl/parser.y +++ b/tools/widl/parser.y @@ -305,7 +305,8 @@ static typelib_t *current_typelib; %type <type> apicontract apicontract_def %type <num> contract_ver %type <num> pointer_type threading_type marshaling_behavior version -%type <str> libraryhdr callconv cppquote importlib import t_ident +%type <str> libraryhdr callconv cppquote importlib import +%type <str> typename m_typename %type <uuid> uuid_string %type <import> import_start %type <typelib> library_start librarydef @@ -459,8 +460,7 @@ importlib: tIMPORTLIB '(' aSTRING ')' semicolon_opt { $$ = $3; if(!parse_only) add_importlib($3, current_typelib); } ; -libraryhdr: tLIBRARY aIDENTIFIER { $$ = $2; } - | tLIBRARY aKNOWNTYPE { $$ = $2; } +libraryhdr: tLIBRARY typename { $$ = $2; } ; library_start: attributes libraryhdr '{' { $$ = make_library($2, check_library_attrs($2, $1)); if (!parse_only && do_typelib) current_typelib = $$; @@ -715,7 +715,7 @@ enum: enum_member '=' expr_int_const { $$ = reg_const($1); } ; -enumdef: tENUM t_ident '{' enums '}' { $$ = type_new_enum($2, current_namespace, TRUE, $4); } +enumdef: tENUM m_typename '{' enums '}' { $$ = type_new_enum($2, current_namespace, TRUE, $4); } ; m_exprs: m_expr { $$ = append_expr( NULL, $1 ); } @@ -847,14 +847,15 @@ m_ident: { $$ = NULL; } | ident ; -t_ident: { $$ = NULL; } - | aIDENTIFIER { $$ = $1; } - | aKNOWNTYPE { $$ = $1; } +m_typename: { $$ = NULL; } + | typename ; -ident: aIDENTIFIER { $$ = make_var($1); } -/* some "reserved words" used in attributes are also used as field names in some MS IDL files */ - | aKNOWNTYPE { $$ = make_var($<str>1); } +typename: aIDENTIFIER + | aKNOWNTYPE + ; + +ident: typename { $$ = make_var($1); } ; base_type: tBYTE { $$ = find_type_or_error($<str>1); } @@ -895,26 +896,21 @@ qualified_type: | aNAMESPACE '.' { init_lookup_namespace($1); } qualified_seq { $$ = $4; } ; -coclass: tCOCLASS aIDENTIFIER { $$ = type_coclass_declare($2); } - | tCOCLASS aKNOWNTYPE { $$ = type_coclass_declare($2); } +coclass: tCOCLASS typename { $$ = type_coclass_declare($2); } ; coclassdef: attributes coclass '{' class_interfaces '}' semicolon_opt { $$ = type_coclass_define($2, $1, $4); } ; -runtimeclass: - tRUNTIMECLASS aIDENTIFIER { $$ = type_runtimeclass_declare($2, current_namespace); } - | tRUNTIMECLASS aKNOWNTYPE { $$ = type_runtimeclass_declare($2, current_namespace); } +runtimeclass: tRUNTIMECLASS typename { $$ = type_runtimeclass_declare($2, current_namespace); } ; runtimeclass_def: attributes runtimeclass '{' class_interfaces '}' semicolon_opt { $$ = type_runtimeclass_define($2, $1, $4); } ; -apicontract: - tAPICONTRACT aIDENTIFIER { $$ = type_apicontract_declare($2, current_namespace); } - | tAPICONTRACT aKNOWNTYPE { $$ = type_apicontract_declare($2, current_namespace); } +apicontract: tAPICONTRACT typename { $$ = type_apicontract_declare($2, current_namespace); } ; apicontract_def: attributes apicontract '{' '}' semicolon_opt @@ -933,9 +929,7 @@ class_interface: m_attributes interfaceref ';' { $$ = make_ifref($2); $$->attrs = $1; } ; -dispinterface: - tDISPINTERFACE aIDENTIFIER { $$ = type_dispinterface_declare($2); } - | tDISPINTERFACE aKNOWNTYPE { $$ = type_dispinterface_declare($2); } +dispinterface: tDISPINTERFACE typename { $$ = type_dispinterface_declare($2); } ; dispattributes: attributes { $$ = append_attr($1, make_attr(ATTR_DISPINTERFACE)); } @@ -960,9 +954,7 @@ inherit: { $$ = NULL; } | ':' qualified_type { $$ = $2; } ; -interface: - tINTERFACE aIDENTIFIER { $$ = type_interface_declare($2, current_namespace); } - | tINTERFACE aKNOWNTYPE { $$ = type_interface_declare($2, current_namespace); } +interface: tINTERFACE typename { $$ = type_interface_declare($2, current_namespace); } ; interfacedef: attributes interface inherit @@ -978,14 +970,11 @@ interfacedef: attributes interface inherit ; interfaceref: - tINTERFACE aIDENTIFIER { $$ = get_type(TYPE_INTERFACE, $2, current_namespace, 0); } - | tINTERFACE aKNOWNTYPE { $$ = get_type(TYPE_INTERFACE, $2, current_namespace, 0); } - | tDISPINTERFACE aIDENTIFIER { $$ = get_type(TYPE_INTERFACE, $2, current_namespace, 0); } - | tDISPINTERFACE aKNOWNTYPE { $$ = get_type(TYPE_INTERFACE, $2, current_namespace, 0); } + tINTERFACE typename { $$ = get_type(TYPE_INTERFACE, $2, current_namespace, 0); } + | tDISPINTERFACE typename { $$ = get_type(TYPE_INTERFACE, $2, current_namespace, 0); } ; -module: tMODULE aIDENTIFIER { $$ = type_module_declare($2); } - | tMODULE aKNOWNTYPE { $$ = type_module_declare($2); } +module: tMODULE typename { $$ = type_module_declare($2); } ; moduledef: attributes module '{' int_statements '}' semicolon_opt @@ -1153,7 +1142,7 @@ pointer_type: | tPTR { $$ = FC_FP; } ; -structdef: tSTRUCT t_ident '{' fields '}' { $$ = type_new_struct($2, current_namespace, TRUE, $4); } +structdef: tSTRUCT m_typename '{' fields '}' { $$ = type_new_struct($2, current_namespace, TRUE, $4); } ; type: tVOID { $$ = type_new_void(); } @@ -1175,9 +1164,9 @@ typedef: m_attributes tTYPEDEF m_attributes decl_spec declarator_list } ; -uniondef: tUNION t_ident '{' ne_union_fields '}' +uniondef: tUNION m_typename '{' ne_union_fields '}' { $$ = type_new_nonencapsulated_union($2, TRUE, $4); } - | tUNION t_ident + | tUNION m_typename tSWITCH '(' s_field ')' m_ident '{' cases '}' { $$ = type_new_encapsulated_union($2, $5, $7, $9); } ;
1
0
0
0
Rémi Bernon : widl: Factor and cleanup module type declaration and definition.
by Alexandre Julliard
05 Feb '21
05 Feb '21
Module: wine Branch: master Commit: 6f1308cd6240776d8a3474e6d98f055599a1e07b URL:
https://source.winehq.org/git/wine.git/?a=commit;h=6f1308cd6240776d8a3474e6…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Fri Feb 5 10:11:03 2021 +0100 widl: Factor and cleanup module type declaration and definition. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- tools/widl/parser.y | 20 ++++++-------------- tools/widl/typetree.c | 27 +++++++++++++++------------ tools/widl/typetree.h | 5 +++-- 3 files changed, 24 insertions(+), 28 deletions(-) diff --git a/tools/widl/parser.y b/tools/widl/parser.y index 8c805e481f8..782ed39643c 100644 --- a/tools/widl/parser.y +++ b/tools/widl/parser.y @@ -95,7 +95,6 @@ static attr_list_t *check_struct_attrs(attr_list_t *attrs); static attr_list_t *check_union_attrs(attr_list_t *attrs); static attr_list_t *check_field_attrs(const char *name, attr_list_t *attrs); static attr_list_t *check_library_attrs(const char *name, attr_list_t *attrs); -static attr_list_t *check_module_attrs(const char *name, attr_list_t *attrs); const char *get_attr_display_name(enum attr_type type); static void add_explicit_handle_if_necessary(const type_t *iface, var_t *func); @@ -285,7 +284,7 @@ static typelib_t *current_typelib; %type <type> inherit interface interfacedef %type <type> interfaceref %type <type> dispinterface dispinterfacedef -%type <type> module modulehdr moduledef +%type <type> module moduledef %type <str> namespacedef %type <type> base_type int_std %type <type> enumdef structdef uniondef typedecl @@ -985,19 +984,12 @@ interfaceref: | tDISPINTERFACE aKNOWNTYPE { $$ = get_type(TYPE_INTERFACE, $2, current_namespace, 0); } ; -module: tMODULE aIDENTIFIER { $$ = type_new_module($2); } - | tMODULE aKNOWNTYPE { $$ = type_new_module($2); } +module: tMODULE aIDENTIFIER { $$ = type_module_declare($2); } + | tMODULE aKNOWNTYPE { $$ = type_module_declare($2); } ; -modulehdr: attributes module { $$ = $2; - $$->attrs = check_module_attrs($2->name, $1); - } - ; - -moduledef: modulehdr '{' int_statements '}' - semicolon_opt { $$ = $1; - type_module_define($$, $3); - } +moduledef: attributes module '{' int_statements '}' semicolon_opt + { $$ = type_module_define($2, $1, $4); } ; storage_cls_spec: @@ -2476,7 +2468,7 @@ attr_list_t *check_dispiface_attrs(const char *name, attr_list_t *attrs) return attrs; } -static attr_list_t *check_module_attrs(const char *name, attr_list_t *attrs) +attr_list_t *check_module_attrs(const char *name, attr_list_t *attrs) { const attr_t *attr; if (!attrs) return attrs; diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c index 004f7fc7b0d..b3f0725f00e 100644 --- a/tools/widl/typetree.c +++ b/tools/widl/typetree.c @@ -195,16 +195,6 @@ type_t *type_new_alias(const decl_spec_t *t, const char *name) return a; } -type_t *type_new_module(char *name) -{ - type_t *type = get_type(TYPE_MODULE, name, NULL, 0); - if (type->type_type != TYPE_MODULE || type->defined) - error_loc("%s: redefinition error; original definition was at %s:%d\n", - type->name, type->loc_info.input_name, type->loc_info.line_number); - type->name = name; - return type; -} - type_t *type_new_array(const char *name, const decl_spec_t *element, int declptr, unsigned int dim, expr_t *size_is, expr_t *length_is) { @@ -519,12 +509,25 @@ type_t *type_dispinterface_define_from_iface(type_t *dispiface, attr_list_t *att return dispiface; } -void type_module_define(type_t *module, statement_list_t *stmts) +type_t *type_module_declare(char *name) +{ + type_t *type = get_type(TYPE_MODULE, name, NULL, 0); + if (type_get_type_detect_alias(type) != TYPE_MODULE) + error_loc("module %s previously not declared a module at %s:%d\n", + type->name, type->loc_info.input_name, type->loc_info.line_number); + return type; +} + +type_t *type_module_define(type_t* module, attr_list_t *attrs, statement_list_t *stmts) { - if (module->details.module) error_loc("multiple definition error\n"); + if (module->defined) + error_loc("module %s already defined at %s:%d\n", + module->name, module->loc_info.input_name, module->loc_info.line_number); + module->attrs = check_module_attrs(module->name, attrs); module->details.module = xmalloc(sizeof(*module->details.module)); module->details.module->stmts = stmts; module->defined = TRUE; + return module; } type_t *type_coclass_declare(char *name) diff --git a/tools/widl/typetree.h b/tools/widl/typetree.h index 7c19da8e045..8e04537ab4d 100644 --- a/tools/widl/typetree.h +++ b/tools/widl/typetree.h @@ -33,12 +33,13 @@ attr_list_t *check_apicontract_attrs(const char *name, attr_list_t *attrs); attr_list_t *check_coclass_attrs(const char *name, attr_list_t *attrs); attr_list_t *check_dispiface_attrs(const char *name, attr_list_t *attrs); attr_list_t *check_interface_attrs(const char *name, attr_list_t *attrs); +attr_list_t *check_module_attrs(const char *name, attr_list_t *attrs); attr_list_t *check_runtimeclass_attrs(const char *name, attr_list_t *attrs); type_t *type_new_function(var_list_t *args); type_t *type_new_pointer(type_t *ref); type_t *type_new_alias(const decl_spec_t *t, const char *name); -type_t *type_new_module(char *name); +type_t *type_module_declare(char *name); type_t *type_new_array(const char *name, const decl_spec_t *element, int declptr, unsigned int dim, expr_t *size_is, expr_t *length_is); type_t *type_new_basic(enum type_basic_type basic_type); @@ -56,7 +57,7 @@ type_t *type_interface_define(type_t *iface, attr_list_t *attrs, type_t *inherit type_t *type_dispinterface_declare(char *name); type_t *type_dispinterface_define(type_t *iface, attr_list_t *attrs, var_list_t *props, var_list_t *methods); type_t *type_dispinterface_define_from_iface(type_t *dispiface, attr_list_t *attrs, type_t *iface); -void type_module_define(type_t *module, statement_list_t *stmts); +type_t *type_module_define(type_t* module, attr_list_t *attrs, statement_list_t *stmts); type_t *type_coclass_define(type_t *coclass, attr_list_t *attrs, ifref_list_t *ifaces); type_t *type_runtimeclass_define(type_t *runtimeclass, attr_list_t *attrs, ifref_list_t *ifaces); type_t *type_apicontract_declare(char *name, struct namespace *namespace);
1
0
0
0
Rémi Bernon : widl: Factor and cleanup apicontract type declaration and definition.
by Alexandre Julliard
05 Feb '21
05 Feb '21
Module: wine Branch: master Commit: 62c58eb8a055243563e2861147491df91cba5d8e URL:
https://source.winehq.org/git/wine.git/?a=commit;h=62c58eb8a055243563e28611…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Fri Feb 5 10:11:02 2021 +0100 widl: Factor and cleanup apicontract type declaration and definition. And remove unused check_def helper. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- tools/widl/parser.y | 35 +++++++++++++++-------------------- tools/widl/typetree.c | 19 +++++++++++++++++++ tools/widl/typetree.h | 3 +++ 3 files changed, 37 insertions(+), 20 deletions(-) diff --git a/tools/widl/parser.y b/tools/widl/parser.y index 349e4730d96..8c805e481f8 100644 --- a/tools/widl/parser.y +++ b/tools/widl/parser.y @@ -96,10 +96,8 @@ static attr_list_t *check_union_attrs(attr_list_t *attrs); static attr_list_t *check_field_attrs(const char *name, attr_list_t *attrs); static attr_list_t *check_library_attrs(const char *name, attr_list_t *attrs); static attr_list_t *check_module_attrs(const char *name, attr_list_t *attrs); -static attr_list_t *check_apicontract_attrs(const char *name, attr_list_t *attrs); const char *get_attr_display_name(enum attr_type type); static void add_explicit_handle_if_necessary(const type_t *iface, var_t *func); -static void check_def(const type_t *t); static void check_async_uuid(type_t *iface); @@ -305,7 +303,7 @@ static typelib_t *current_typelib; %type <declarator_list> declarator_list struct_declarator_list %type <type> coclass coclassdef %type <type> runtimeclass runtimeclass_def -%type <type> apicontract +%type <type> apicontract apicontract_def %type <num> contract_ver %type <num> pointer_type threading_type marshaling_behavior version %type <str> libraryhdr callconv cppquote importlib import t_ident @@ -364,8 +362,9 @@ gbl_statements: { $$ = NULL; } | gbl_statements coclassdef { $$ = append_statement($1, make_statement_type_decl($2)); reg_type($2, $2->name, current_namespace, 0); } - | gbl_statements apicontract ';' { $$ = append_statement($1, make_statement_type_decl($2)); - reg_type($2, $2->name, current_namespace, 0); } + | gbl_statements apicontract ';' { $$ = $1; reg_type($2, $2->name, current_namespace, 0); } + | gbl_statements apicontract_def { $$ = append_statement($1, make_statement_type_decl($2)); + reg_type($2, $2->name, current_namespace, 0); } | gbl_statements runtimeclass ';' { $$ = $1; reg_type($2, $2->name, current_namespace, 0); } | gbl_statements runtimeclass_def { $$ = append_statement($1, make_statement_type_decl($2)); reg_type($2, $2->name, current_namespace, 0); } @@ -384,8 +383,9 @@ imp_statements: { $$ = NULL; } | imp_statements coclassdef { $$ = append_statement($1, make_statement_type_decl($2)); reg_type($2, $2->name, current_namespace, 0); } - | imp_statements apicontract ';' { $$ = append_statement($1, make_statement_type_decl($2)); - reg_type($2, $2->name, current_namespace, 0); } + | imp_statements apicontract ';' { $$ = $1; reg_type($2, $2->name, current_namespace, 0); } + | imp_statements apicontract_def { $$ = append_statement($1, make_statement_type_decl($2)); + reg_type($2, $2->name, current_namespace, 0); } | imp_statements runtimeclass ';' { $$ = $1; reg_type($2, $2->name, current_namespace, 0); } | imp_statements runtimeclass_def { $$ = append_statement($1, make_statement_type_decl($2)); reg_type($2, $2->name, current_namespace, 0); } @@ -913,11 +913,13 @@ runtimeclass_def: attributes runtimeclass '{' class_interfaces '}' semicolon_opt { $$ = type_runtimeclass_define($2, $1, $4); } ; -apicontract: attributes tAPICONTRACT aIDENTIFIER '{' '}' - { $$ = get_type(TYPE_APICONTRACT, $3, current_namespace, 0); - check_def($$); - $$->attrs = check_apicontract_attrs($$->name, $1); - } +apicontract: + tAPICONTRACT aIDENTIFIER { $$ = type_apicontract_declare($2, current_namespace); } + | tAPICONTRACT aKNOWNTYPE { $$ = type_apicontract_declare($2, current_namespace); } + ; + +apicontract_def: attributes apicontract '{' '}' semicolon_opt + { $$ = type_apicontract_define($2, $1); } ; namespacedef: tNAMESPACE aIDENTIFIER { $$ = $2; } @@ -2511,7 +2513,7 @@ attr_list_t *check_runtimeclass_attrs(const char *name, attr_list_t *attrs) return attrs; } -static attr_list_t *check_apicontract_attrs(const char *name, attr_list_t *attrs) +attr_list_t *check_apicontract_attrs(const char *name, attr_list_t *attrs) { const attr_t *attr; if (!attrs) return attrs; @@ -3205,10 +3207,3 @@ void init_loc_info(loc_info_t *i) i->line_number = line_number; i->near_text = parser_text; } - -static void check_def(const type_t *t) -{ - if (t->defined) - error_loc("%s: redefinition error; original definition was at %s:%d\n", - t->name, t->loc_info.input_name, t->loc_info.line_number); -} diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c index 81eaba5556b..004f7fc7b0d 100644 --- a/tools/widl/typetree.c +++ b/tools/widl/typetree.c @@ -569,6 +569,25 @@ type_t *type_runtimeclass_define(type_t *runtimeclass, attr_list_t *attrs, ifref return runtimeclass; } +type_t *type_apicontract_declare(char *name, struct namespace *namespace) +{ + type_t *type = get_type(TYPE_APICONTRACT, name, namespace, 0); + if (type_get_type_detect_alias(type) != TYPE_APICONTRACT) + error_loc("apicontract %s previously not declared a apicontract at %s:%d\n", + type->name, type->loc_info.input_name, type->loc_info.line_number); + return type; +} + +type_t *type_apicontract_define(type_t *apicontract, attr_list_t *attrs) +{ + if (apicontract->defined) + error_loc("apicontract %s already defined at %s:%d\n", + apicontract->name, apicontract->loc_info.input_name, apicontract->loc_info.line_number); + apicontract->attrs = check_apicontract_attrs(apicontract->name, attrs); + apicontract->defined = TRUE; + return apicontract; +} + int type_is_equal(const type_t *type1, const type_t *type2) { if (type_get_type_detect_alias(type1) != type_get_type_detect_alias(type2)) diff --git a/tools/widl/typetree.h b/tools/widl/typetree.h index 280d2e722cf..7c19da8e045 100644 --- a/tools/widl/typetree.h +++ b/tools/widl/typetree.h @@ -29,6 +29,7 @@ enum name_type { NAME_C }; +attr_list_t *check_apicontract_attrs(const char *name, attr_list_t *attrs); attr_list_t *check_coclass_attrs(const char *name, attr_list_t *attrs); attr_list_t *check_dispiface_attrs(const char *name, attr_list_t *attrs); attr_list_t *check_interface_attrs(const char *name, attr_list_t *attrs); @@ -58,6 +59,8 @@ type_t *type_dispinterface_define_from_iface(type_t *dispiface, attr_list_t *att void type_module_define(type_t *module, statement_list_t *stmts); type_t *type_coclass_define(type_t *coclass, attr_list_t *attrs, ifref_list_t *ifaces); type_t *type_runtimeclass_define(type_t *runtimeclass, attr_list_t *attrs, ifref_list_t *ifaces); +type_t *type_apicontract_declare(char *name, struct namespace *namespace); +type_t *type_apicontract_define(type_t *apicontract, attr_list_t *attrs); int type_is_equal(const type_t *type1, const type_t *type2); const char *type_get_name(const type_t *type, enum name_type name_type); char *gen_name(void);
1
0
0
0
Rémi Bernon : widl: Factor and cleanup dispinterface type declaration and definition.
by Alexandre Julliard
05 Feb '21
05 Feb '21
Module: wine Branch: master Commit: ce148774363988b08f9648eacec941ec6c47e91a URL:
https://source.winehq.org/git/wine.git/?a=commit;h=ce148774363988b08f9648ea…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Fri Feb 5 10:11:01 2021 +0100 widl: Factor and cleanup dispinterface type declaration and definition. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- tools/widl/parser.y | 36 +++++++++++++----------------------- tools/widl/typetree.c | 23 +++++++++++++++++++++-- tools/widl/typetree.h | 6 ++++-- 3 files changed, 38 insertions(+), 27 deletions(-) diff --git a/tools/widl/parser.y b/tools/widl/parser.y index 44716deb5b6..349e4730d96 100644 --- a/tools/widl/parser.y +++ b/tools/widl/parser.y @@ -95,7 +95,6 @@ static attr_list_t *check_struct_attrs(attr_list_t *attrs); static attr_list_t *check_union_attrs(attr_list_t *attrs); static attr_list_t *check_field_attrs(const char *name, attr_list_t *attrs); static attr_list_t *check_library_attrs(const char *name, attr_list_t *attrs); -static attr_list_t *check_dispiface_attrs(const char *name, attr_list_t *attrs); static attr_list_t *check_module_attrs(const char *name, attr_list_t *attrs); static attr_list_t *check_apicontract_attrs(const char *name, attr_list_t *attrs); const char *get_attr_display_name(enum attr_type type); @@ -276,6 +275,7 @@ static typelib_t *current_typelib; %type <attr> attribute acf_attribute %type <attr_list> m_attributes attributes attrib_list %type <attr_list> acf_attributes acf_attribute_list +%type <attr_list> dispattributes %type <str_list> str_list %type <expr> m_expr expr expr_const expr_int_const array m_bitfield %type <expr_list> m_exprs /* exprs expr_list */ expr_list_int_const @@ -286,7 +286,7 @@ static typelib_t *current_typelib; %type <declspec> decl_spec decl_spec_no_type m_decl_spec_no_type %type <type> inherit interface interfacedef %type <type> interfaceref -%type <type> dispinterface dispinterfacehdr dispinterfacedef +%type <type> dispinterface dispinterfacedef %type <type> module modulehdr moduledef %type <str> namespacedef %type <type> base_type int_std @@ -932,17 +932,12 @@ class_interface: m_attributes interfaceref ';' { $$ = make_ifref($2); $$->attrs = $1; } ; -dispinterface: tDISPINTERFACE aIDENTIFIER { $$ = get_type(TYPE_INTERFACE, $2, current_namespace, 0); } - | tDISPINTERFACE aKNOWNTYPE { $$ = get_type(TYPE_INTERFACE, $2, current_namespace, 0); } +dispinterface: + tDISPINTERFACE aIDENTIFIER { $$ = type_dispinterface_declare($2); } + | tDISPINTERFACE aKNOWNTYPE { $$ = type_dispinterface_declare($2); } ; -dispinterfacehdr: attributes dispinterface { attr_t *attrs; - $$ = $2; - check_def($$); - attrs = make_attr(ATTR_DISPINTERFACE); - $$->attrs = append_attr( check_dispiface_attrs($2->name, $1), attrs ); - $$->defined = TRUE; - } +dispattributes: attributes { $$ = append_attr($1, make_attr(ATTR_DISPINTERFACE)); } ; dispint_props: tPROPERTIES ':' { $$ = NULL; } @@ -953,16 +948,11 @@ dispint_meths: tMETHODS ':' { $$ = NULL; } | dispint_meths funcdef ';' { $$ = append_var( $1, $2 ); } ; -dispinterfacedef: dispinterfacehdr '{' - dispint_props - dispint_meths - '}' { $$ = $1; - type_dispinterface_define($$, $3, $4); - } - | dispinterfacehdr - '{' interface ';' '}' { $$ = $1; - type_dispinterface_define_from_iface($$, $3); - } +dispinterfacedef: + dispattributes dispinterface '{' dispint_props dispint_meths '}' + { $$ = type_dispinterface_define($2, $1, $4, $5); } + | dispattributes dispinterface '{' interface ';' '}' + { $$ = type_dispinterface_define_from_iface($2, $1, $4); } ; inherit: { $$ = NULL; } @@ -2214,7 +2204,7 @@ struct allowed_attr allowed_attr[] = /* ATTR_DEFAULTVALUE */ { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "defaultvalue" }, /* ATTR_DEFAULTVTABLE */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, "defaultvtable" }, /* ATTR_DISABLECONSISTENCYCHECK */{ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "disable_consistency_check" }, - /* ATTR_DISPINTERFACE */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL }, + /* ATTR_DISPINTERFACE */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, NULL }, /* ATTR_DISPLAYBIND */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "displaybind" }, /* ATTR_DLLNAME */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, "dllname" }, /* ATTR_DUAL */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "dual" }, @@ -2471,7 +2461,7 @@ static attr_list_t *check_library_attrs(const char *name, attr_list_t *attrs) return attrs; } -static attr_list_t *check_dispiface_attrs(const char *name, attr_list_t *attrs) +attr_list_t *check_dispiface_attrs(const char *name, attr_list_t *attrs) { const attr_t *attr; if (!attrs) return attrs; diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c index 84be75fa3b7..81eaba5556b 100644 --- a/tools/widl/typetree.c +++ b/tools/widl/typetree.c @@ -472,8 +472,21 @@ type_t *type_interface_define(type_t *iface, attr_list_t *attrs, type_t *inherit return iface; } -void type_dispinterface_define(type_t *iface, var_list_t *props, var_list_t *methods) +type_t *type_dispinterface_declare(char *name) { + type_t *type = get_type(TYPE_INTERFACE, name, NULL, 0); + if (type_get_type_detect_alias(type) != TYPE_INTERFACE) + error_loc("dispinterface %s previously not declared a dispinterface at %s:%d\n", + type->name, type->loc_info.input_name, type->loc_info.line_number); + return type; +} + +type_t *type_dispinterface_define(type_t *iface, attr_list_t *attrs, var_list_t *props, var_list_t *methods) +{ + if (iface->defined) + error_loc("dispinterface %s already defined at %s:%d\n", + iface->name, iface->loc_info.input_name, iface->loc_info.line_number); + iface->attrs = check_dispiface_attrs(iface->name, attrs); iface->details.iface = xmalloc(sizeof(*iface->details.iface)); iface->details.iface->disp_props = props; iface->details.iface->disp_methods = methods; @@ -484,10 +497,15 @@ void type_dispinterface_define(type_t *iface, var_list_t *props, var_list_t *met iface->details.iface->async_iface = NULL; iface->defined = TRUE; compute_method_indexes(iface); + return iface; } -void type_dispinterface_define_from_iface(type_t *dispiface, type_t *iface) +type_t *type_dispinterface_define_from_iface(type_t *dispiface, attr_list_t *attrs, type_t *iface) { + if (dispiface->defined) + error_loc("dispinterface %s already defined at %s:%d\n", + dispiface->name, dispiface->loc_info.input_name, dispiface->loc_info.line_number); + dispiface->attrs = check_dispiface_attrs(dispiface->name, attrs); dispiface->details.iface = xmalloc(sizeof(*dispiface->details.iface)); dispiface->details.iface->disp_props = NULL; dispiface->details.iface->disp_methods = NULL; @@ -498,6 +516,7 @@ void type_dispinterface_define_from_iface(type_t *dispiface, type_t *iface) dispiface->details.iface->async_iface = NULL; dispiface->defined = TRUE; compute_method_indexes(dispiface); + return dispiface; } void type_module_define(type_t *module, statement_list_t *stmts) diff --git a/tools/widl/typetree.h b/tools/widl/typetree.h index 7b67f3b996a..280d2e722cf 100644 --- a/tools/widl/typetree.h +++ b/tools/widl/typetree.h @@ -30,6 +30,7 @@ enum name_type { }; attr_list_t *check_coclass_attrs(const char *name, attr_list_t *attrs); +attr_list_t *check_dispiface_attrs(const char *name, attr_list_t *attrs); attr_list_t *check_interface_attrs(const char *name, attr_list_t *attrs); attr_list_t *check_runtimeclass_attrs(const char *name, attr_list_t *attrs); @@ -51,8 +52,9 @@ type_t *type_new_bitfield(type_t *field_type, const expr_t *bits); type_t *type_runtimeclass_declare(char *name, struct namespace *namespace); type_t *type_interface_declare(char *name, struct namespace *namespace); type_t *type_interface_define(type_t *iface, attr_list_t *attrs, type_t *inherit, statement_list_t *stmts); -void type_dispinterface_define(type_t *iface, var_list_t *props, var_list_t *methods); -void type_dispinterface_define_from_iface(type_t *dispiface, type_t *iface); +type_t *type_dispinterface_declare(char *name); +type_t *type_dispinterface_define(type_t *iface, attr_list_t *attrs, var_list_t *props, var_list_t *methods); +type_t *type_dispinterface_define_from_iface(type_t *dispiface, attr_list_t *attrs, type_t *iface); void type_module_define(type_t *module, statement_list_t *stmts); type_t *type_coclass_define(type_t *coclass, attr_list_t *attrs, ifref_list_t *ifaces); type_t *type_runtimeclass_define(type_t *runtimeclass, attr_list_t *attrs, ifref_list_t *ifaces);
1
0
0
0
Rémi Bernon : widl: Factor and cleanup interface type declaration and definition.
by Alexandre Julliard
05 Feb '21
05 Feb '21
Module: wine Branch: master Commit: f8684cf953c5aae31e0b2858ab839e702b7cff20 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=f8684cf953c5aae31e0b2858…
Author: Rémi Bernon <rbernon(a)codeweavers.com> Date: Fri Feb 5 10:11:00 2021 +0100 widl: Factor and cleanup interface type declaration and definition. Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com> Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- tools/widl/parser.y | 34 ++++++++++------------------------ tools/widl/typetree.c | 19 ++++++++++++++++++- tools/widl/typetree.h | 4 +++- 3 files changed, 31 insertions(+), 26 deletions(-) diff --git a/tools/widl/parser.y b/tools/widl/parser.y index 1505e3e88a0..44716deb5b6 100644 --- a/tools/widl/parser.y +++ b/tools/widl/parser.y @@ -87,7 +87,6 @@ static void push_lookup_namespace(const char *name); static void check_arg_attrs(const var_t *arg); static void check_statements(const statement_list_t *stmts, int is_inside_library); static void check_all_user_types(const statement_list_t *stmts); -static attr_list_t *check_iface_attrs(const char *name, attr_list_t *attrs); static attr_list_t *check_function_attrs(const char *name, attr_list_t *attrs); static attr_list_t *check_typedef_attrs(attr_list_t *attrs); static attr_list_t *check_enum_attrs(attr_list_t *attrs); @@ -281,7 +280,6 @@ static typelib_t *current_typelib; %type <expr> m_expr expr expr_const expr_int_const array m_bitfield %type <expr_list> m_exprs /* exprs expr_list */ expr_list_int_const %type <expr> contract_req -%type <type> interfacehdr %type <stgclass> storage_cls_spec %type <type_qualifier> type_qualifier m_type_qual_list %type <function_specifier> function_specifier @@ -971,31 +969,20 @@ inherit: { $$ = NULL; } | ':' qualified_type { $$ = $2; } ; -interface: tINTERFACE aIDENTIFIER { $$ = get_type(TYPE_INTERFACE, $2, current_namespace, 0); } - | tINTERFACE aKNOWNTYPE { $$ = get_type(TYPE_INTERFACE, $2, current_namespace, 0); } +interface: + tINTERFACE aIDENTIFIER { $$ = type_interface_declare($2, current_namespace); } + | tINTERFACE aKNOWNTYPE { $$ = type_interface_declare($2, current_namespace); } ; -interfacehdr: attributes interface { $$ = $2; - check_def($2); - $2->attrs = check_iface_attrs($2->name, $1); - $2->defined = TRUE; - } - ; - -interfacedef: interfacehdr inherit - '{' int_statements '}' semicolon_opt { $$ = $1; - if($$ == $2) - error_loc("Interface can't inherit from itself\n"); - type_interface_define($$, $2, $4); +interfacedef: attributes interface inherit + '{' int_statements '}' semicolon_opt { $$ = type_interface_define($2, $1, $3, $5); check_async_uuid($$); } /* MIDL is able to import the definition of a base class from inside the * definition of a derived class, I'll try to support it with this rule */ - | interfacehdr ':' aIDENTIFIER + | attributes interface ':' aIDENTIFIER '{' import int_statements '}' - semicolon_opt { $$ = $1; - type_interface_define($$, find_type_or_error($3), $6); - } + semicolon_opt { $$ = type_interface_define($2, $1, find_type_or_error($4), $7); } | dispinterfacedef semicolon_opt { $$ = $1; } ; @@ -2340,7 +2327,7 @@ const char *get_attr_display_name(enum attr_type type) return allowed_attr[type].display_name; } -static attr_list_t *check_iface_attrs(const char *name, attr_list_t *attrs) +attr_list_t *check_interface_attrs(const char *name, attr_list_t *attrs) { const attr_t *attr; if (!attrs) return attrs; @@ -2978,8 +2965,7 @@ static void check_async_uuid(type_t *iface) if (!inherit) error_loc("async_uuid applied to an interface with incompatible parent\n"); - async_iface = get_type(TYPE_INTERFACE, strmake("Async%s", iface->name), iface->namespace, 0); - async_iface->attrs = map_attrs(iface->attrs, async_iface_attrs); + async_iface = type_interface_declare(strmake("Async%s", iface->name), iface->namespace); STATEMENTS_FOR_EACH_FUNC( stmt, type_iface_get_stmts(iface) ) { @@ -3010,7 +2996,7 @@ static void check_async_uuid(type_t *iface) stmts = append_statement(stmts, make_statement_declaration(finish_func)); } - type_interface_define(async_iface, inherit, stmts); + type_interface_define(async_iface, map_attrs(iface->attrs, async_iface_attrs), inherit, stmts); iface->details.iface->async_iface = async_iface->details.iface->async_iface = async_iface; } diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c index 825348ddef4..84be75fa3b7 100644 --- a/tools/widl/typetree.c +++ b/tools/widl/typetree.c @@ -442,8 +442,24 @@ static unsigned int compute_method_indexes(type_t *iface) return idx; } -void type_interface_define(type_t *iface, type_t *inherit, statement_list_t *stmts) +type_t *type_interface_declare(char *name, struct namespace *namespace) { + type_t *type = get_type(TYPE_INTERFACE, name, namespace, 0); + if (type_get_type_detect_alias(type) != TYPE_INTERFACE) + error_loc("interface %s previously not declared an interface at %s:%d\n", + type->name, type->loc_info.input_name, type->loc_info.line_number); + return type; +} + +type_t *type_interface_define(type_t *iface, attr_list_t *attrs, type_t *inherit, statement_list_t *stmts) +{ + if (iface->defined) + error_loc("interface %s already defined at %s:%d\n", + iface->name, iface->loc_info.input_name, iface->loc_info.line_number); + if (iface == inherit) + error_loc("interface %s can't inherit from itself\n", + iface->name); + iface->attrs = check_interface_attrs(iface->name, attrs); iface->details.iface = xmalloc(sizeof(*iface->details.iface)); iface->details.iface->disp_props = NULL; iface->details.iface->disp_methods = NULL; @@ -453,6 +469,7 @@ void type_interface_define(type_t *iface, type_t *inherit, statement_list_t *stm iface->details.iface->async_iface = NULL; iface->defined = TRUE; compute_method_indexes(iface); + return iface; } void type_dispinterface_define(type_t *iface, var_list_t *props, var_list_t *methods) diff --git a/tools/widl/typetree.h b/tools/widl/typetree.h index 8a8e1c529ac..7b67f3b996a 100644 --- a/tools/widl/typetree.h +++ b/tools/widl/typetree.h @@ -30,6 +30,7 @@ enum name_type { }; attr_list_t *check_coclass_attrs(const char *name, attr_list_t *attrs); +attr_list_t *check_interface_attrs(const char *name, attr_list_t *attrs); attr_list_t *check_runtimeclass_attrs(const char *name, attr_list_t *attrs); type_t *type_new_function(var_list_t *args); @@ -48,7 +49,8 @@ type_t *type_new_nonencapsulated_union(const char *name, int defined, var_list_t type_t *type_new_encapsulated_union(char *name, var_t *switch_field, var_t *union_field, var_list_t *cases); type_t *type_new_bitfield(type_t *field_type, const expr_t *bits); type_t *type_runtimeclass_declare(char *name, struct namespace *namespace); -void type_interface_define(type_t *iface, type_t *inherit, statement_list_t *stmts); +type_t *type_interface_declare(char *name, struct namespace *namespace); +type_t *type_interface_define(type_t *iface, attr_list_t *attrs, type_t *inherit, statement_list_t *stmts); void type_dispinterface_define(type_t *iface, var_list_t *props, var_list_t *methods); void type_dispinterface_define_from_iface(type_t *dispiface, type_t *iface); void type_module_define(type_t *module, statement_list_t *stmts);
1
0
0
0
Alexandre Julliard : ntdll/tests: Add more tests for object types.
by Alexandre Julliard
05 Feb '21
05 Feb '21
Module: wine Branch: master Commit: d4156d1da8b4afdafa8a2993eb3735593e2b49e2 URL:
https://source.winehq.org/git/wine.git/?a=commit;h=d4156d1da8b4afdafa8a2993…
Author: Alexandre Julliard <julliard(a)winehq.org> Date: Fri Feb 5 12:15:28 2021 +0100 ntdll/tests: Add more tests for object types. Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/ntdll/tests/om.c | 220 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 220 insertions(+) Diff:
https://source.winehq.org/git/wine.git/?a=commitdiff;h=d4156d1da8b4afdafa8a…
1
0
0
0
← Newer
1
...
68
69
70
71
72
73
74
...
92
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
Results per page:
10
25
50
100
200