From 9c2530f1740b976dd2f625209e417983ea1aa71d Mon Sep 17 00:00:00 2001 From: Joseph Mirabel <jmirabel@laas.fr> Date: Fri, 28 Sep 2018 09:42:23 +0200 Subject: [PATCH] Add __null_stream function to avoid compilation error --- include/dynamic-graph/debug.h | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/include/dynamic-graph/debug.h b/include/dynamic-graph/debug.h index 742f8a3..216a35a 100644 --- a/include/dynamic-graph/debug.h +++ b/include/dynamic-graph/debug.h @@ -188,13 +188,13 @@ inline bool dgTDEBUG_ENABLE (const int & level) if (1) \ ; \ else \ - std::ostream(NULL) + ::dynamicgraph::__null_stream() # define dgDEBUGMUTE (level) \ if (1) \ ; \ else \ - std::ostream(NULL) + ::dynamicgraph::__null_stream() # define dgERROR \ dgERRORFLOW.outputbuffer << dgPREERROR @@ -219,12 +219,23 @@ inline void dgERRORF (const char*, ...) return; } +namespace dynamicgraph +{ +inline std::ostream& __null_stream () +{ + // This function should never be called. With -O3, + // it should not appear in the generated binary. + static std::ostream os (NULL); return os; +} +} + + // TEMPLATE # define dgTDEBUG(level) \ if (1) \ ; \ else \ - std::ostream(NULL) + ::dynamicgraph::__null_stream() inline void dgTDEBUGF (const int, const char*, ...) { -- GitLab