On Wednesday, June 22, 2011, Michael Meeks wrote:

>       But a single method:
> 
>       bool running_under_valgrind (void);
> or
>       bool running_under_memcheck (void);
> 
>       so we can switch our allocation semantics auto-magically.
> 
>       Julian - we have lots of complex stuff; how do we get the simple
> boolean we want out :-)

Oh, I think I missed answering the simple question here.  Thusly:

  #include "valgrind.h"

  bool running_under_valgrind (void)
  {
     return (RUNNING_ON_VALGRIND) ? true : false;
  }

Is that what you want, or did you mean something different?

You might want to cache the result of RUNNING_ON_VALGRIND
so that the common (production) case overhead is reduced to
a load and conditional branch, rather than the strange sequence
of stores and rotates generated by the macro. 

J
_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to