On Sunday 29 December 2024 17:47:58 Martin Storsjö wrote: > On Sun, 29 Dec 2024, Pali Rohár wrote: > > > On Sunday 29 December 2024 17:35:03 Martin Storsjö wrote: > > > On Sat, 14 Dec 2024, Pali Rohár wrote: > > > > > > > This allows to define in lib-common/*.def.in files symbols with I386 > > > > stdcall @<num> suffixes and therefore have one common def file for all > > > > platforms. > > > > --- > > > > mingw-w64-crt/Makefile.am | 6 +++--- > > > > 1 file changed, 3 insertions(+), 3 deletions(-) > > > > > > > > diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am > > > > index 27c18eebd774..2bbc26adb364 100644 > > > > --- a/mingw-w64-crt/Makefile.am > > > > +++ b/mingw-w64-crt/Makefile.am > > > > @@ -4263,13 +4263,13 @@ lib32/%.def: lib-common/%.def.in > > > > $(MKDIR_P) $(@D) && $(CPP) -x c $< -Wp,-w -undef -P > > > > -I$(top_srcdir)/def-include -DDEF_I386 > $@ > > > > > > > > lib64/%.def: lib-common/%.def.in > > > > - $(MKDIR_P) $(@D) && $(CPP) -x c $< -Wp,-w -undef -P > > > > -I$(top_srcdir)/def-include -DDEF_X64 > $@ > > > > + $(MKDIR_P) $(@D) && $(CPP) -x c $< -Wp,-w -undef -P > > > > -I$(top_srcdir)/def-include -DDEF_X64 | sed -E 's/^([^ ]+)@[0-9]+( > > > > |$$)/\1\2/' > $@ > > > > > > What's the purpose of the second group, ( |$$), here - why can't we just > > > leave it out and skip the \2 bit in the replacement? > > > > In case the @ character is in the middle of the symbol name (e.g. > > fastcall mangling or msvc c++ mangling) then it must not be dropped as > > it is not stdcall suffix. > > > > Basically symbol name starts at the beginning of line (there can be > > leading spaces) and after it is either end of line or space separator. > > > > So the point of "( |$$)" is to match separator. > > Ah, right. > > I think it would be good to include examples of the various def file lines > that we have taken into account, in the commit message, as a clear > example/reminder to the reader about all these cases (i.e. also mention the > @ordinal case). > > // Martin
Note that double $$ is just escape sequence for make, in reality it is single $. One mistake, leading spaces for that regex is not allowed. Some test cases: Test@4 Test1@4 ; comment Test2@4 == Test22 Test3@4 @8 Test@4@8 Test@5test@8 @Test6@8 Result is: Test Test1 ; comment Test2 == Test22 Test3 @8 Test@4 Test@5test @Test6 _______________________________________________ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public