On 2024/09/18 4:06, Timofei Zhakov wrote:
> On Tue, Sep 17, 2024 at 7:55 PM Timofei Zhakov <t...@chemodax.net> wrote:
>>
>> Hi,
>>
>> On Tue, Sep 17, 2024 at 6:45 AM Jun Omae <jun6...@gmail.com> wrote:
>>>
>>> On 2024/09/16 21:41, rin...@apache.org wrote:
>>>> Author: rinrab
>>>> Date: Mon Sep 16 12:41:13 2024
>>>> New Revision: 1920717
>>>>
>>>> URL: http://svn.apache.org/viewvc?rev=1920717&view=rev
>>>> Log:
>>>> Merge the `cmake` branch to trunk.
>>>
>>> I'm trying to build all programs, tools, tests, swig-* bindings and apache
>>> modules with cmake on Windows. However, building swig-pl stopped with the
>>> following errors:
>>>
>>> [[[
>>>     22>Link:
>>>             Creating library 
>>> C:/usr/src/subversion/trunk-py312/out/Release/libperl_core.lib and object 
>>> C:/usr/src/subversion/trunk-py312/out/Release/libperl_core.exp
>>>     22>corePERL_wrap.obj : error LNK2019: unresolved external symbol 
>>> svn_swig_pl_thunk_ssl_server_trust_prompt referenced in function 
>>> _wrap_svn_auth_get_ssl_server_trust_prompt_provider 
>>> [C:\usr\src\subversion\trunk-py312\out\perl_core.vcxproj]
>>>     22>corePERL_wrap.obj : error LNK2019: unresolved external symbol 
>>> svn_swig_pl_thunk_ssl_client_cert_prompt referenced in function 
>>> _wrap_svn_auth_get_ssl_client_cert_prompt_provider 
>>> [C:\usr\src\subversion\trunk-py312\out\perl_core.vcxproj]
>>>     22>corePERL_wrap.obj : error LNK2019: unresolved external symbol 
>>> svn_swig_pl_thunk_ssl_client_cert_pw_prompt referenced in function 
>>> _wrap_svn_auth_get_ssl_client_cert_pw_prompt_provider 
>>> [C:\usr\src\subversion\trunk-py312\out\perl_core.vcxproj]
>>> ]]]
>>
>> Wait... Oh, I've reproduced it.
>>
>>> It is caused by that libsvn_swig_perl.def is not same between vcnet and 
>>> cmake.
>>> The .def files directly are generated from CMakeLists.txt instead of
>>> build/generator/extractor.py, but the pattern for the exported symbols is
>>> changed. It is the root cause. The pattern should be same.
>>>
>>> In CMakeLists.txt:
>>> [[[
>>>     set(func_regex "^([A-Za-z0-9_][A-Za-z0-9_* ]+[ 
>>> *])?(svn[A-Za-z0-9_]+)\\(")
>>> ]]]
>>>
>>> In build/generator/extractor.py:
>>> [[[
>>> _funcs = re.compile(r'^(?:(?:(?:\w+|\*) 
>>> )+\*?)?((?:svn|apr)_[a-z_0-9]+)\s*\(', re.M)
>>> ]]]
>>>
>>> The REGEX feature in cmake is poor but we could revise like the following
>>> changes, otherwise we should use extractor.py:
>>
>> Yeah, it is incomplete, so I rewrote this regex from a blank when
>> implementing the extractor in CMake, and forgot to check for Perl
>> bindings.
>>
>>> [[[
>>> Index: CMakeLists.txt
>>> ===================================================================
>>> --- CMakeLists.txt      (revision 1920717)
>>> +++ CMakeLists.txt      (working copy)
>>> @@ -412,15 +412,16 @@
>>>      set(def_file_path ${CMAKE_BINARY_DIR}/${target_name}.def)
>>>
>>>      # see build/generator/extractor.py
>>> -    set(func_regex "^([A-Za-z0-9_][A-Za-z0-9_* ]+[ 
>>> *])?(svn[A-Za-z0-9_]+)\\(")
>>> +    set(func_regex "(^|\n)((([A-Za-z0-9_]+|[*]) 
>>> )+[*]?)?((svn|apr)_[a-z_0-9]+)[ \t\r\n]*\\(")
>>>
>>>      set(defs)
>>>      foreach(file ${ARGN})
>>> -      file(STRINGS ${file} funcs REGEX "${func_regex}")
>>> +      file(READ ${file} contents)
>>> +      string(REGEX MATCHALL "${func_regex}" funcs ${contents})
>>>
>>>        foreach(func_string ${funcs})
>>> -        string(REGEX REPLACE "${func_regex}.*$" "\\2" func_name 
>>> ${func_string})
>>> -
>>> +        string(REGEX MATCH "[A-Za-z0-9_]+[ \t\r\n]*\\($" func_name 
>>> ${func_string})
>>> +        string(REGEX REPLACE "[ \t\r\n]*\\($" "" func_name ${func_name})
>>>          list(APPEND defs "${func_name}")
>>>        endforeach()
>>>
>>> ]]]
>>>
>>> Thoughts?
>>
>> This patch seems to be working and it resolves the issue. I think it's
>> okay to commit it. Would you like to do it, or should I commit it?

Thanks for the reviewing! Committed in r1920764.

> I have an additional resolution to the problem:
> 
> I think those three functions are the last, where the opening brackets
> are placed on a new line, separate from the function name. How about
> reformatting them to match the style used in other functions?
> Additionally, their implementations have the opening brackets on the
> same line as the function name.
> 
> I’ve attached a patch as svn-fix-declaration-wrapping.patch.txt.

Reformatting is okay to me. Also, the following functions have the same issue:

[[[
$ grep -Pzo -r --include='*.h' '\b(svn|apr)_[A-Za-z0-9_]+\s*\n(?=\s*\()' 
subversion
subversion/include/svn_auth.h:svn_auth_get_gpg_agent_simple_provider
subversion/libsvn_subr/auth.h:svn_auth__get_gpg_agent_simple_provider
subversion/bindings/swig/perl/libsvn_swig_perl/swigutil_pl.h:svn_swig_pl_thunk_ssl_server_trust_prompt
subversion/bindings/swig/perl/libsvn_swig_perl/swigutil_pl.h:svn_swig_pl_thunk_ssl_client_cert_prompt
subversion/bindings/swig/perl/libsvn_swig_perl/swigutil_pl.h:svn_swig_pl_thunk_ssl_client_cert_pw_prompt
subversion/bindings/swig/ruby/libsvn_swig_ruby/swigutil_rb.h:svn_swig_rb_conflict_resolver_func
]]]

-- 
Jun Omae <jun6...@gmail.com> (大前 潤)

Reply via email to