EnterpriseDB / mysql_fdw

PostgreSQL foreign data wrapper for MySQL
Other
523 stars 161 forks source link

Build warnings on Fedora 32 #204

Closed devrimgunduz closed 3 years ago

devrimgunduz commented 3 years ago

Hi,

I'm seeing these warnings on Fedora 32 (gcc 10.2.1 and mariadb-devel 10.4.13). Can you please take a look?

Thanks! Devrim

/usr/lib64/ccache/clang -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -O2  -I/usr/include/mysql -I/usr/include/mysql/mysql -D _MYSQL_LIBNAME=\"libmysqlclient.so\" -I. -I./ -I/usr/pgsql-12/include/server -I/usr/pgsql-12/include/internal  -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include -flto=thin -emit-llvm -c -o mysql_query.bc mysql_query.c
In file included from mysql_query.c:23:
/usr/include/mysql/mysql_com.h:3:2: warning: #warning This file should not be included by clients, include only <mysql.h> [-Wcpp]
    3 | #warning This file should not be included by clients, include only <mysql.h>
      |  ^~~~~~~
mysql_query.c: In function 'mysql_bind_sql_var':
mysql_query.c:183:24: warning: assignment to 'my_bool *' {aka 'char *'} from incompatible pointer type '_Bool *' [-Wincompatible-pointer-types]
  183 |  binds[attnum].is_null = isnull;
      |                        ^
mysql_query.c: In function 'mysql_bind_result':
mysql_query.c:394:17: warning: assignment to 'my_bool *' {aka 'char *'} from incompatible pointer type '_Bool *' [-Wincompatible-pointer-types]
  394 |  mbind->is_null = &column->is_null;
      |                 ^
mysql_query.c:396:15: warning: assignment to 'my_bool *' {aka 'char *'} from incompatible pointer type '_Bool *' [-Wincompatible-pointer-types]
  396 |  mbind->error = &column->error;
      |               ^
/usr/lib64/ccache/clang -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -O2  -I/usr/include/mysql -I/usr/include/mysql/mysql -D _MYSQL_LIBNAME=\"libmysqlclient.so\" -I. -I./ -I/usr/pgsql-12/include/server -I/usr/pgsql-12/include/internal  -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include -flto=thin -emit-llvm -c -o mysql_fdw.bc mysql_fdw.c
In file included from mysql_query.c:23:
/usr/include/mysql/mysql_com.h:3:2: warning: This file should not be included by clients, include only <mysql.h> [-W#warnings]
#warning This file should not be included by clients, include only <mysql.h>
 ^
mysql_query.c:183:24: warning: incompatible pointer types assigning to 'my_bool *' (aka 'char *') from 'bool *' [-Wincompatible-pointer-types]
        binds[attnum].is_null = isnull;
                              ^ ~~~~~~
mysql_query.c:394:17: warning: incompatible pointer types assigning to 'my_bool *' (aka 'char *') from 'bool *' [-Wincompatible-pointer-types]
        mbind->is_null = &column->is_null;
                       ^ ~~~~~~~~~~~~~~~~
mysql_query.c:396:15: warning: incompatible pointer types assigning to 'my_bool *' (aka 'char *') from 'bool *' [-Wincompatible-pointer-types]
        mbind->error = &column->error;
                     ^ ~~~~~~~~~~~~~~
4 warnings generated.
surajkharage19 commented 3 years ago

Thanks @devrimgunduz for reporting this. Can you please confirm if the attached patch resolves those warnings and regression is fine after that at your end?

compilation_fix.txt

devrimgunduz commented 3 years ago

Hi,

I'm seeing one less warning only:

/usr/lib64/ccache/clang -Wno-ignored-attributes -fno-strict-aliasing -fwrapv -O2  -I/usr/include/mysql -I/usr/include/mysql/mysql -D _MYSQL_LIBNAME=\"libmysqlclient.so\" -I. -I./ -I/usr/pgsql-12/include/server -I/usr/pgsql-12/include/internal  -D_GNU_SOURCE -I/usr/include/libxml2  -I/usr/include -flto=thin -emit-llvm -c -o mysql_fdw.bc mysql_fdw.c
mysql_query.c: In function 'mysql_bind_sql_var':
mysql_query.c:185:24: warning: assignment to 'my_bool *' {aka 'char *'} from incompatible pointer type '_Bool *' [-Wincompatible-pointer-types]
  185 |  binds[attnum].is_null = isnull;
      |                        ^
mysql_query.c: In function 'mysql_bind_result':
mysql_query.c:401:17: warning: assignment to 'my_bool *' {aka 'char *'} from incompatible pointer type '_Bool *' [-Wincompatible-pointer-types]
  401 |  mbind->is_null = &column->is_null;
      |                 ^
mysql_query.c:402:15: warning: assignment to 'my_bool *' {aka 'char *'} from incompatible pointer type '_Bool *' [-Wincompatible-pointer-types]
  402 |  mbind->error = &column->error;
      |               ^
gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -Wno-stringop-truncation -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC -shared -o mysql_fdw.so connection.o option.o deparse.o mysql_query.o mysql_fdw.o -L/usr/pgsql-12/lib   -L/usr/lib64  -L/usr/lib64 -Wl,--as-needed -Wl,-rpath,'/usr/pgsql-12/lib',--enable-new-dtags  
mysql_query.c:185:24: warning: incompatible pointer types assigning to 'my_bool *' (aka 'char *') from 'bool *' [-Wincompatible-pointer-types]
        binds[attnum].is_null = isnull;
                              ^ ~~~~~~
mysql_query.c:401:17: warning: incompatible pointer types assigning to 'my_bool *' (aka 'char *') from 'bool *' [-Wincompatible-pointer-types]
        mbind->is_null = &column->is_null;
                       ^ ~~~~~~~~~~~~~~~~
mysql_query.c:402:15: warning: incompatible pointer types assigning to 'my_bool *' (aka 'char *') from 'bool *' [-Wincompatible-pointer-types]
        mbind->error = &column->error;
                     ^ ~~~~~~~~~~~~~~
3 warnings generated.
surajkharage19 commented 3 years ago

The VERSION ID is different for mysql and mariadb servers, that is why an earlier patch was not working for mariadb.

I have now fixed for MariaDB versions as well, can you please verify the same with the attached patch? I have tested at my end with MariaDB 10.5 on CentOS 7 and did not observe the above mentioned warnings, also regression is fine.

mariadb-compilation_v2.txt

devrimgunduz commented 3 years ago

Hi @surajkharage19 ,

Thanks a lot! It worked.

Regards, Devrim