Adding DECLARE_CRITICAL_SECTION()

Jacek Caban jacek at codeweavers.com
Mon May 6 07:29:54 CDT 2019


On 5/4/19 11:16 PM, Michael Stefaniuc wrote:
> On 5/1/19 12:59 PM, Jacek Caban wrote:
>> On 4/30/19 9:58 PM, Michael Stefaniuc wrote:
>>> On 4/29/19 9:56 PM, Jacek Caban wrote:
>>>> FWIW, it would be nice if declaring a critical section would be easier
>>>> and less error prone. Maybe WINE_STATIC_CRITICAL_SECTION() macro?
>>> There's a reason I wrote the coccinelle script in the first place ;)
>>>
>>> Anyway, I have attached an example patch. Once I have a working
>>> coccinelle script to do the transformation I can send it in.
>>>
>>> DECLARE_CRITICAL_SECTION() is IMHO a better name, can be prefixed with
>>> WINE_ if so desired.
>>
>> Looks good to me.
> OK, my coccinelle script is ready and it finds 144 occurrences so far.
>   125 files changed, 144 insertions(+), 1157 deletions(-)
>
> There are 10 more uses of CRITICAL_SECTION_DEBUG, mostly for
> CRITICAL_SECTION that are defined as extern in a header.
> And of course the stuff from ntdll which uses RTL_CRITICAL_SECTION.
>
>
> Now where do I add the DECLARE_CRITICAL_SECTION() or
> WINE_DECLARE_CRITICAL_SECTION()?


I'm not sure, maybe winnt.h where related structs are declared? 
Duplicating in DLLs (at least for the first iteration) would be another 
possibility.


> I tried to make it global and add it to winbase.h (protected by
> __WINESRC__) but wrc bombs out:
>
> wine64/tools/wrc/wrc -o comctl32.res -m32 --nostdinc -I.
> -I/home/michi/work/wine/dlls/comctl32 \
>    -I../../include -I/home/michi/work/wine/include -D__WINESRC__
> -D_COMCTL32_ --po-dir=../../po \
>    /home/michi/work/wine/dlls/comctl32/comctl32.rc
> /home/michi/work/wine/include/winbase.h:65:227: Error: syntax error
> make: *** [Makefile:1185: comctl32.res] Error 1


#ifndef RC_INVOKED should help.


Thanks,

Jacek




More information about the wine-devel mailing list