Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 03 Apr 2018 08:26:14 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-ports-bugs@FreeBSD.org
Subject:   [Bug 227244] databases/mariadb102-server: Fix build with clang 6
Message-ID:  <bug-227244-13@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D227244

            Bug ID: 227244
           Summary: databases/mariadb102-server: Fix build with clang 6
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: Individual Port(s)
          Assignee: brnrd@freebsd.org
          Reporter: dim@FreeBSD.org
             Flags: maintainer-feedback?(brnrd@freebsd.org)
          Assignee: brnrd@freebsd.org

Created attachment 192159
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D192159&action=
=3Dedit
Return 0 instead of NULL to fix build with clang 6 and higher

When building with clang 6, which defaults to -std=3Dgnu++14 for C++ mode,
databases/mariadb102-server fails to build, with the following errors:

[ 48%] Building CXX object storage/connect/CMakeFiles/connect.dir/tabjson.c=
pp.o
cd
/wrkdirs/usr/ports/databases/mariadb102-server/work/mariadb-10.2.14/storage=
/connect
&& /usr/bin/c++  -DFORCE_INIT_OF_VARS -DGZ_SUPPORT -DHAVE_CONFIG_H
-DHUGE_SUPPORT -DLIBXML2_SUPPORT -DLINUX -DMARIADB -DMYSQL_DYNAMIC_PLUGIN
-DNOCRYPT -DODBC_SUPPORT -DUBUNTU -DUNIX -DVCT_SUPPORT -DXMAP -DZIP_SUPPORT
-Dconnect_EXPORTS
-I/wrkdirs/usr/ports/databases/mariadb102-server/work/mariadb-10.2.14/inclu=
de
-I/wrkdirs/usr/ports/databases/mariadb102-server/work/mariadb-10.2.14/sql
-I/wrkdirs/usr/ports/databases/mariadb102-server/work/mariadb-10.2.14/pcre
-I/usr/local/include -I/usr/local/include/libxml2 -O2 -pipe -march=3Dhaswell
-fstack-protector -isystem /usr/local/include -fno-strict-aliasing  -isystem
/usr/local/include -Wl,-z,relro,-z,now -fstack-protector
--param=3Dssp-buffer-size=3D4 -DWITH_INNODB_DISALLOW_WRITES -fno-rtti -Wall
-Wmissing-declarations -Wno-unused-function -Wno-unused-variable
-Wno-unused-value -Wno-parentheses -Wno-strict-aliasing
-Wno-implicit-fallthrough -fpermissive -fexceptions -fPIC  -O2 -pipe
-march=3Dhaswell -fstack-protector -isystem /usr/local/include
-fno-strict-aliasing  -isystem /usr/local/include -D_FORTIFY_SOURCE=3D2
-DDBUG_OFF -fPIC -o CMakeFiles/connect.dir/tabjson.cpp.o -c
/wrkdirs/usr/ports/databases/mariadb102-server/work/mariadb-10.2.14/storage=
/connect/tabjson.cpp
c++: warning: -Wl,-z,relro,-z,now: 'linker' input unused
[-Wunused-command-line-argument]
/wrkdirs/usr/ports/databases/mariadb102-server/work/mariadb-10.2.14/storage=
/connect/tabjson.cpp:198:10:
error: cannot initialize return object of type 'int' with an rvalue of type
'nullptr_t'
                return NULL;
                       ^~~~
/usr/include/sys/_null.h:35:14: note: expanded from macro 'NULL'
#define NULL    nullptr
                ^~~~~~~
/wrkdirs/usr/ports/databases/mariadb102-server/work/mariadb-10.2.14/storage=
/connect/tabjson.cpp:246:11:
error: cannot initialize return object of type 'int' with an rvalue of type
'nullptr_t'
                        return NULL;
                               ^~~~
/usr/include/sys/_null.h:35:14: note: expanded from macro 'NULL'
#define NULL    nullptr
                ^~~~~~~
/wrkdirs/usr/ports/databases/mariadb102-server/work/mariadb-10.2.14/storage=
/connect/tabjson.cpp:253:12:
error: cannot initialize return object of type 'int' with an rvalue of type
'nullptr_t'
                                return NULL;
                                       ^~~~
/usr/include/sys/_null.h:35:14: note: expanded from macro 'NULL'
#define NULL    nullptr
                ^~~~~~~
/wrkdirs/usr/ports/databases/mariadb102-server/work/mariadb-10.2.14/storage=
/connect/tabjson.cpp:272:12:
error: cannot initialize return object of type 'int' with an rvalue of type
'nullptr_t'
                                return NULL;
                                       ^~~~
/usr/include/sys/_null.h:35:14: note: expanded from macro 'NULL'
#define NULL    nullptr
                ^~~~~~~
/wrkdirs/usr/ports/databases/mariadb102-server/work/mariadb-10.2.14/storage=
/connect/tabjson.cpp:279:12:
error: cannot initialize return object of type 'int' with an rvalue of type
'nullptr_t'
                                return NULL;
                                       ^~~~
/usr/include/sys/_null.h:35:14: note: expanded from macro 'NULL'
#define NULL    nullptr
                ^~~~~~~
/wrkdirs/usr/ports/databases/mariadb102-server/work/mariadb-10.2.14/storage=
/connect/tabjson.cpp:288:12:
error: cannot initialize return object of type 'int' with an rvalue of type
'nullptr_t'
                                return NULL;
                                       ^~~~
/usr/include/sys/_null.h:35:14: note: expanded from macro 'NULL'
#define NULL    nullptr
                ^~~~~~~
/wrkdirs/usr/ports/databases/mariadb102-server/work/mariadb-10.2.14/storage=
/connect/tabjson.cpp:307:11:
error: cannot initialize return object of type 'int' with an rvalue of type
'nullptr_t'
                        return NULL;
                               ^~~~
/usr/include/sys/_null.h:35:14: note: expanded from macro 'NULL'
#define NULL    nullptr
                ^~~~~~~
7 errors generated.

In this case, NULL is not suitable as a return value for a function returni=
ng
int.  (Before C++11, NULL was usually defined as plain zero, which is why t=
his
bad code used to compile.)

Fix it by returning integer zero instead, like in most other places in the =
same
function.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-227244-13>