<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Thu, Dec 13, 2018 at 11:34 AM Dylan Baker <<a href="mailto:dylan@pnwbakers.com">dylan@pnwbakers.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Quoting Rob Clark (2018-12-12 16:35:24)<br>
> On Wed, Dec 12, 2018 at 7:14 PM Dylan Baker <<a href="mailto:dylan@pnwbakers.com" target="_blank">dylan@pnwbakers.com</a>> wrote:<br>
> ><br>
> > Quoting Rob Clark (2018-12-12 15:52:47)<br>
> > > On Wed, Dec 12, 2018 at 6:25 PM Dylan Baker <<a href="mailto:dylan@pnwbakers.com" target="_blank">dylan@pnwbakers.com</a>> wrote:<br>
> > > ><br>
> > > > In the autotools discussion I've come to realize that we also need to talk about<br>
> > > > the -DDEBUG guard. It seems that there are two different uses, and thus two<br>
> > > > different asks about it:<br>
> > > ><br>
> > > > - Nine (and RadeonSI?) use -DDEBUG to hide generic debugging<br>
> > > > - NIR and Intel (at least) use -DDEBUG to hide really expensive checks that are<br>
> > > > useful, but necessarily tank performance.<br>
> > > ><br>
> > > > The first group would like -DDEBUG in debugoptimized builds, the second<br>
> > > > obviously doesn't.<br>
> > > ><br>
> > > > Is the right solution to move the first group being !NDEBUG, or would it be<br>
> > > > better to split DEBUG into two different defines such as DEBUG_MESSAGES and<br>
> > > > EXPENSIVE_VALIDATION (paint the bikeshed whatever color you like), with the<br>
> > > > first for both debug and debugoptimized and the second only in debug builds?<br>
> > ><br>
> > > I guess my use cases for !=release builds are:<br>
> > ><br>
> > > + I want all the expensive checking because I'm not in it to win the<br>
> > > deqp/piglit fps race<br>
> > > + I want debug syms for profiling and/or valgrind, but otherwise<br>
> > > want something close to a release build but with debug syms<br>
> > ><br>
> > ><br>
> > > That said, I can get behind replacing DEBUG with !NDEBUG or<br>
> > > EXPENSIVE_DEBUG or whatever permutation of that color folks prefer<br>
> > ><br>
> > ><br>
> > > BR,<br>
> > > -R<br>
> ><br>
> > I guess I should have covered that:<br>
> ><br>
> > autotools had effectively two build types "debug" and "not debug", "debug" set<br>
> > "-DDEBUG -g -O2", "not debug" set -DNDEBUG<br>
> ><br>
> > Meson has 4 build types, and a separate toggle for NDEBUG:<br>
> > debug: -O0 -DDEBUG (we add -DDEBUG)<br>
> > debugoptimzed: -O2 -g<br>
> > release: -O2<br>
> > plain: (nothing)<br>
> <br>
> I generally view meson as an upgrade in this respect, I guess mostly<br>
> because I have no use for '-DDEBUG -g -O2' (ie. the -O0 equiv is fine<br>
> by me).. maybe making meson debug config use -O2 would bridge the gap?<br>
> If so I have no problem with dropping -O0 and making debug config<br>
> also use -O2<br>
> <br>
> BR.<br>
> -R<br>
<br>
Unfortunately buildtypes are part of meson itself, you can't override them. It<br>
does this to ensure that each buildtype is equivalent when changing compiler,<br>
ie, MSVC doesn't have -O0 and -O2, but it does have equivalent commands options.<br>
<br>
Basically our choices (as I see them are):<br>
<br>
1. Status Quo<br>
2. Split DEBUG into two flags, one that is only in debug builds, one that is in<br>
both debug and debugoptimized builds<br></blockquote><div><br></div><div><div>Whatever we do, let's please not split DEBUG and NDEBUG. We've had no end of trouble with sorting out the fallout of them being different.</div></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
3. Stop defining DEBUG by default in any build type and tell people to add<br>
-Dc_args=-DDEBUG -Dcpp_args=-DDEBUG if they want DEBUG.<br></blockquote><div><br></div><div>Can we not please? Yes, I have a script that wraps things but -Dbuild-type=debug should do something reasonable and reasonable includes -DDEBUG.</div><div><br></div><div>--Jason<br></div></div></div>