perl5-dbi / DBD-MariaDB

Perl MariaDB driver
Other
32 stars 17 forks source link

DBD-MariaDB-1.22: Build warnings #169

Closed twata1 closed 2 years ago

twata1 commented 2 years ago

Hello,

Running Strawberry Perl 5.30.2 64 bit, I noticed the following message.

C:\home\sunlight2>cpan PALI/DBD-MariaDB-1.22.tar.gz

(snip)

Warning: duplicate function definition 'do' detected in MariaDB.xs, line 104
Warning: duplicate function definition 'rows' detected in MariaDB.xs, line 229
Warning: duplicate function definition 'last_insert_id' detected in MariaDB.xs, line 248

(snip)

Thank you,

choroba commented 2 years ago

What version of DBI do you have?

twata1 commented 2 years ago
C:\home\sunlight2>module-version DBI

The version of DBI in C:/Strawberry/perl/vendor/lib is 1.643

C:\home\sunlight2>

More Info: http://www.cpantesters.org/cpan/report/45699f69-6bff-1014-bc86-634176a13fd6

pali commented 2 years ago

Warning: duplicate function definition 'do' detected in MariaDB.xs, line 104

If you have DBI version 1.643 then following code for do definition is skipped: https://github.com/perl5-dbi/DBD-MariaDB/blob/ef11de2bf8b68b901037db8c0db0bc5c518330f9/MariaDB.xs#L101-L121


Warning: duplicate function definition 'last_insert_id' detected in MariaDB.xs, line 248

Same applies for last_insert_id definition, which is skipped too: https://github.com/perl5-dbi/DBD-MariaDB/blob/ef11de2bf8b68b901037db8c0db0bc5c518330f9/MariaDB.xs#L245-L263

Seems that this is just false-positive warning generated by xsubpp compiler. Probably compiler generates these warnings at early stage prior code is fully parsed. Maybe you could open ticket for xsubpp compiler about this issue.

Important is that code is compiled correctly without duplicate functions.


Warning: duplicate function definition 'rows' detected in MariaDB.xs, line 229

This warning is quite tricky, but again it is false-positive warning.

During compilation of MariaDB.xs soure code DBI prepends its Driver.xst source code which contains helper functions, including this rows:

https://github.com/perl5-dbi/dbi/blob/ea91ab4ea7ea75e82c94acb0d283951ebadf29d2/Driver.xst#L508-L517

But as you can see, this helper function is compiler only when dbd_st_rows is defined -- which is not case for DBD::MariaDB. DBD::MariaDB does not use that helper function, instead it uses own implementation:

https://github.com/perl5-dbi/DBD-MariaDB/blob/ef11de2bf8b68b901037db8c0db0bc5c518330f9/MariaDB.xs#L228-L243

So there should not be any issue. They are just false-positive warnings which I do not know how to turn off.

twata1 commented 2 years ago

Thank you for your detailed reply. I will open ticket for ExtUtils-ParseXS-3.44 which uses xsubpp.

Thank you,

pali commented 2 years ago

Moved to https://github.com/Perl/perl5/issues/19661