[libcamera-devel] [PATCH] meson: Define _FORTIFY_SOURCE for non-debug builds
Niklas Söderlund
niklas.soderlund at ragnatech.se
Mon Aug 26 23:45:33 CEST 2019
Hi Laurent,
Thanks for your work.
On 2019-08-19 16:02:45 +0300, Laurent Pinchart wrote:
> _FORTIFY_SOURCE add useful checks during compilation. Enable it by
> default, except for debug builds as it requires at least a -O1
> optimisation level.
I think this is a good idea, it's a shame we can't have it enabled for
debug builds. My normal workflow of "meson build; ninja -C build"
produces debug builds so if this catch a problem it will be at release
time.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>
> ---
> meson.build | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/meson.build b/meson.build
> index 13d0605f903c..53263d68791d 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -35,6 +35,12 @@ common_arguments = [
> '-include', 'config.h',
> ]
>
> +if get_option('buildtype') != 'debug'
> + common_arguments += [
> + '-D_FORTIFY_SOURCE=1',
> + ]
> +endif
> +
> c_arguments = common_arguments
> cpp_arguments = common_arguments
>
> --
> Regards,
>
> Laurent Pinchart
>
> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel at lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
--
Regards,
Niklas Söderlund
More information about the libcamera-devel
mailing list