Skip to content

Commit

Permalink
Move MACRO_TO_STR() to common/debug.h.
Browse files Browse the repository at this point in the history
This macro is handy for constructing static message strings so move it where the core code can see it.
  • Loading branch information
dwsteele committed Jan 27, 2019
1 parent 4027123 commit 82c2d61
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
4 changes: 4 additions & 0 deletions doc/xml/release.xml
Expand Up @@ -137,6 +137,10 @@
<p>Rename <code>common/io/handle</code> module to <code>common/io/handleWrite</code>.</p>
</release-item>

<release-item>
<p>Move <code>MACRO_TO_STR()</code> to <file>common/debug.h</file>.</p>
</release-item>

<release-item>
<p>Add <code>const VariantList *</code> debug type.</p>
</release-item>
Expand Down
8 changes: 8 additions & 0 deletions src/common/debug.h
Expand Up @@ -25,6 +25,14 @@ Extern variables that are needed for unit testing
static
#endif

/***********************************************************************************************************************************
Convert a macro to a string
***********************************************************************************************************************************/
#define MACRO_TO_STR_INNER(macro) \
#macro
#define MACRO_TO_STR(macro) \
MACRO_TO_STR_INNER(macro)

/***********************************************************************************************************************************
Base function debugging macros
Expand Down
9 changes: 1 addition & 8 deletions test/src/common/harnessTest.h
Expand Up @@ -6,6 +6,7 @@ C Test Harness

#include <inttypes.h>

#include "common/debug.h"
#include "common/error.h"

/***********************************************************************************************************************************
Expand Down Expand Up @@ -33,14 +34,6 @@ void testExpectPathSet(const char *testExpectPath);
const char *testRepoPath(void);
void testRepoPathSet(const char *testRepoPath);

/***********************************************************************************************************************************
Convert a macro to a string -- handy for testing debug macros
***********************************************************************************************************************************/
#define MACRO_TO_STR_INNER(macro) \
#macro
#define MACRO_TO_STR(macro) \
MACRO_TO_STR_INNER(macro)

/***********************************************************************************************************************************
Maximum size of a formatted result in the TEST_RESULT macro. Strings don't count as they are output directly, so this only applies
to the formatting of bools, ints, floats, etc. This should be plenty of room for any of those types.
Expand Down

0 comments on commit 82c2d61

Please sign in to comment.