From b15ce02b2a461279ad0e4d9e07f82aba6cd4e30f Mon Sep 17 00:00:00 2001 From: Pavel Brychta Date: Thu, 24 Mar 2022 12:46:55 +0100 Subject: [PATCH] Makro TRACEPLUS, verze 0.0.5 --- library.json | 2 +- src/trace.h | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/library.json b/library.json index b5609f4..56ca27b 100644 --- a/library.json +++ b/library.json @@ -12,7 +12,7 @@ "type": "git", "url": "https://git.xpablo.cz/pablo2048/Trace.git" }, - "version": "0.0.4", + "version": "0.0.5", "license": "MIT", "frameworks": "arduino", "platforms": ["espressif8266","espressif32"], diff --git a/src/trace.h b/src/trace.h index f63ba62..b614909 100644 --- a/src/trace.h +++ b/src/trace.h @@ -2,7 +2,7 @@ * @file trace.h * @author Pavel Brychta, http://www.xpablo.cz * - * Copyright (c) 2016-19 Pavel Brychta. All rights reserved. + * Copyright (c) 2016-22 Pavel Brychta. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -125,6 +125,7 @@ void trace_forceupdate(void); #define STRINGIFY(x) #x #define TOSTRING(x) STRINGIFY(x) +#define TRACEPLUS(when, severity, ...) if (when != 0) TRACE(severity, __VA_ARGS__) #define TRACE(severity, ...) trace_print(severity, __VA_ARGS__) #define TRACEFUNC(severity, ...) trace_printfunc(severity, __func__, __FILE__, TOSTRING(__LINE__), __VA_ARGS__) #define TRACEDUMP(severity, prefix, address, size) trace_dump(severity, prefix, address, size) @@ -134,6 +135,7 @@ void trace_forceupdate(void); #define TRACE_FORCEUPDATE(a) trace_forceupdate() #else // DONT_USE_TRACE +#define TRACEPLUS(...) ((void)0) #define TRACE(...) ((void)0) // from assert.h "NOP" - http://stackoverflow.com/questions/9187628/c-empty-function-macros #define TRACEFUNC(...) ((void)0) #define TRACEDUMP(...) ((void)0)