Don't redefine nulltpr on FreeBSD
Needs ReviewPublic

Authored by tcberner on Nov 2 2018, 12:36 PM.

Details

Reviewers
cgilles
Group Reviewers
FreeBSD
Digikam
Summary

FreeBSDs /usr/include/sys/_null.h defines

[...]
#if __cplusplus >= 201103L
#define NULL    nullptr
[...]

This leads to compilation errors:

core/libs/dimg/loaders/pgfloader.cpp:295:27: error: use of undeclared identifier 'NULL'
                        NULL,
                        ^
/usr/include/sys/_null.h:37:14: note: expanded from macro 'NULL'
#define NULL    nullptr
                ^
core/libs/pgfutils/libpgf/PGFplatform.h:488:20: note: expanded from macro 'nullptr'
#define nullptr                         NULL
                                        ^
core/libs/dimg/loaders/pgfloader.cpp:455:26: error: use of undeclared identifier 'NULL'
                        NULL,
                        ^
/usr/include/sys/_null.h:37:14: note: expanded from macro 'NULL'
#define NULL    nullptr
                ^
core/libs/pgfutils/libpgf/PGFplatform.h:488:20: note: expanded from macro 'nullptr'
#define nullptr                         NULL
                                        ^
2 errors generated.
ninja: build stopped: subcommand failed.

Diff Detail

Repository
R482 digiKam
Branch
master
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 4476
Build 4494: arc lint + arc unit
tcberner requested review of this revision.Nov 2 2018, 12:36 PM
tcberner created this revision.

Fine to patch git/master too with this entry.

Note : as 3rdparty libpgf source code is modified, please report this change too in libpgf project here :

https://sourceforge.net/p/libpgf/_list/tickets

Thanks in advance

Gilles Caulier

rakuco added a subscriber: rakuco.Feb 24 2019, 6:37 PM

I don't think this should be a FreeBSD-specific check; even on other systems where the build is not currently broken we shouldn't be redefining nullptr anyway. I've sent a patch upstream with a more general approach: https://sourceforge.net/p/libpgf/patches/12/

I've sent a patch upstream with a more general approach: https://sourceforge.net/p/libpgf/patches/12/

The patch was merged today.