Date: prev next · Thread: first prev next last
2017 Archives by date, by thread · List index


hey,

On Mon, Apr 24, 2017 at 1:04 AM, Chris Sherlock <chris.sherlock79@gmail.com>
wrote:

Hi all,

I'm getting some build failures on Jenkins. It seems there is a
compilation failure because there are a number of files that use
std::unique_ptr but done include <memory>.

I think it may have come from here:

https://gerrit.libreoffice.org/#/c/36190/

The only thing is: Jenkins did a full build without any errors, so I'm
scratching my head what has happened here...

I guess I'm interested: do we need to include <memory> when using
unique_ptr, and if so how did Jenkins manage to fully compile this code on
all platforms?

Chris



I suppose that the question is related to
https://gerrit.libreoffice.org/#/c/36838/

The patch that you referenced is correct and the code compiles because
header files are recursively included. So if any of the header files in the
include chain contains an "#include <memory> std::unique_ptr will be
available in that translation unit.

Now coming back to your patch, you changed the include chain for a number
of files by no longer including a header file that will bring in the
"memory" file. Therefore you need to fix the places that start to complain
now manually and add the #include <memory> into these files.

Regarding the question whether to include "memory" everytime you use
std::unique_ptr is a bit of a style question. There are people who advocate
to always include all necessary headers and to never rely on what the
included headers already include but at least in my opinion that often
leads to many include statements at the beginning of a file. IMHO the more
important part is to remove include lines that are not necessary any more.

Regards,
Markus

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.