Skip to content

Commit 2ae714a

Browse files
committed
Fixed Issue #24 (assert statements)
The C assert.h header was erroneously included within a namespace in the NanoLog library, causing compilation errors for outside users. This commit fixes the issue by moving the include statement.
1 parent 1e7794f commit 2ae714a

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

runtime/Common.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,7 @@
1313
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1414
*/
1515

16-
// Unfortunately, unit tests based on gtest can't access private members
17-
// of classes. If the following uppercase versions of "private" and
18-
// "protected" are used instead, it works around the problem: when
19-
// compiling unit test files (anything that includes TestUtil.h)
20-
// everything becomes public.
16+
#include <cassert>
2117

2218
#ifndef COMMON_H
2319
#define COMMON_H
@@ -27,6 +23,12 @@
2723

2824
namespace NanoLogInternal {
2925

26+
// Unfortunately, unit tests based on gtest can't access private members
27+
// of classes. If the following uppercase versions of "private" and
28+
// "protected" are used instead, it works around the problem: when
29+
// compiling unit test files (anything that includes TestUtil.h)
30+
// everything becomes public.
31+
3032
#ifdef EXPOSE_PRIVATES
3133
#define PRIVATE public
3234
#define PROTECTED public
@@ -44,7 +46,6 @@ namespace NanoLogInternal {
4446
TypeName& operator=(const TypeName&) = delete;
4547
#endif
4648

47-
#include <cassert>
4849
/**
4950
* Cast one size of int down to another one.
5051
* Asserts that no precision is lost at runtime.

runtime/Log.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include <ctime>
1717
#include <vector>
1818

19-
#include <assert.h>
19+
#include <cassert>
2020
#include <stdio.h>
2121

2222
#include "Config.h"

runtime/PackerTest.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1414
*/
1515

16-
#include <assert.h>
16+
#include <cassert>
1717
#include <cstdlib>
18-
#include <stdio.h>
18+
#include <cstdio>
1919
#include <fstream>
2020

2121
#include "TestUtil.h"

runtime/Util.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#include <time.h>
2020
#include <stdint.h>
2121
#include <sched.h>
22-
#include <assert.h>
22+
#include <cassert>
2323
#include <sys/syscall.h>
2424
#include <unistd.h>
2525
#include <sys/ioctl.h>

0 commit comments

Comments
 (0)