[Mesa-dev] [PATCH 1/3] meson: Define NDEBUG for non-debug-builds

Dylan Baker dylan at pnwbakers.com
Tue Jul 17 16:37:15 UTC 2018


Quoting Michel Dänzer (2018-07-17 07:29:49)
> On 2018-07-17 03:07 PM, Rob Clark wrote:
> > On Tue, Jul 17, 2018 at 9:01 AM, Rob Clark <robdclark at gmail.com> wrote:
> >> On Mon, Apr 16, 2018 at 5:19 PM, Dylan Baker <dylan at pnwbakers.com> wrote:
> >>> Quoting Jan Alexander Steffens (heftig) (2018-04-14 10:23:20)
> >>>> This is for parity with autotools. We were suddenly getting assertion
> >>>> failures after switching to meson, see [1].
> >>>>
> >>>> [1]: https://bugs.archlinux.org/task/58218
> >>>>
> >>>> Signed-off-by: Jan Alexander Steffens (heftig) <jan.steffens at gmail.com>
> >>>> ---
> >>>>  meson.build | 2 ++
> >>>>  1 file changed, 2 insertions(+)
> >>>>
> >>>> diff --git a/meson.build b/meson.build
> >>>> index a4dfa62255..931e0389e6 100644
> >>>> --- a/meson.build
> >>>> +++ b/meson.build
> >>>> @@ -705,6 +705,8 @@ endif
> >>>>  # Define DEBUG for debug builds only (debugoptimized is not included on this one)
> >>>>  if get_option('buildtype') == 'debug'
> >>>>    pre_args += '-DDEBUG'
> >>>> +else
> >>>> +  pre_args += '-DNDEBUG'
> >>>>  endif
> >>>>
> >>>>  if get_option('shader-cache')
> >>>> --
> >>>> 2.16.2
> >>>
> >>> NAK.
> >>>
> >>> meson has -Db_ndebug for controlling NDEBUG, which is done separately from
> >>> optimization levels, this is in our documentation as well as the meson
> >>> documentation. For builds without asserts, set b_ndebug=true.
> >>>
> >>
> >> Is it possible to make b_ndebug default to true for release builds?
> >> That would be far less surprising..
> >>
> > 
> > just for context, debug_assert() (which can be used for expensive
> > checks), nir_validate_shader() (quite expensive), etc are all
> > controlled by NDEBUG.. so b_ndebug defaulting to false for release
> > builds basically looks like a big performance regression compared to
> > autotools builds.
> 
> FWIW, sounds like those things should really only be enabled when DEBUG
> is defined.

This seems like the right answer to me, its the reason that mesa has DEBUG to
begin with.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: signature
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180717/583fffdb/attachment.sig>


More information about the mesa-dev mailing list