On 11/05/2012 01:48 PM, Kinkie wrote:
> IIRC that's exactly the problem: __FILE__ is always Debug.h there
If that were true, our existing HERE macro would not work either.
http://stackoverflow.com/questions/5047597/file-in-h-what-does-it-resolve-to
HTH,
Alex.
> On Nov 5, 2012 8:35 PM, "Alex Rousskov"
> <rousskov_at_measurement-factory.com
> <mailto:rousskov_at_measurement-factory.com>> wrote:
>
> On 11/05/2012 08:47 AM, Kinkie wrote:
> > On Mon, Nov 5, 2012 at 4:19 PM, Alex Rousskov wrote:
> >> Long-term, we should consider making HERE in debugs() at level 2 or
> >> higher an automatic/default behavior. This will require some
> work, but I
> >> think it is possible, and I think it can even accommodate existing
> >> debugs() statements (with or without HERE) _without_ changing them.
>
>
> > It's hairy at best, if it can even be done, as it depends on cpp
> > predefined macro magic (__LINE__, __FILE__ etc).
>
> We already use that magic unconditionally so I do not see us growing
> more hairs. It think it will actually be rather simple, something along
> these lines:
>
> > #define debugs(SECTION, LEVEL, CONTENT) \
> > do { \
> > if ((Debug::level = (LEVEL)) <= Debug::Levels[SECTION]) { \
> > - Debug::getDebugOut() << CONTENT; \
> > + Debug::getDebugOut(__FILE__, __LINE__,
> __FUNCTION__) << CONTENT; \
> > Debug::finishDebug(); \
> > } \
> > } while (/*CONSTCOND*/ 0)
>
>
> with an addition to #defining HERE to log nothing and fixing cases where
> HERE is used with debug level 1 or lower (those cases should use MYNAME
> instead of HERE AFAICT).
>
> The updated Debug::getDebugOut() method will log current code location
> if and only if Debug::level exceeds 1.
>
>
> HTH,
>
> Alex.
>
Received on Mon Nov 05 2012 - 22:00:08 MST
This archive was generated by hypermail 2.2.0 : Tue Nov 06 2012 - 12:00:04 MST