Skip to content

Commit 958e597

Browse files
committed
1. Cache miss/hit
2. Improve for Linux with _GNU_SOURCE.
1 parent a6c8f23 commit 958e597

8 files changed

Lines changed: 263 additions & 258 deletions

File tree

File renamed without changes.

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ if(DEFINED UNIX_LINUX)
2020
if(DEFINED MACOSX)
2121
target_compile_definitions(simplelog PUBLIC __MACH__=1)
2222
endif()
23+
if(DEFINED _GNU_SOURCE)
24+
target_compile_definitions(simplelog PUBLIC _GNU_SOURCE=1)
25+
endif()
26+
if(DEFINED __LINUX__)
27+
target_compile_definitions(simplelog PUBLIC __LINUX__=1)
28+
endif()
2329
set_target_properties(simplelog PROPERTIES
2430
VERSION 1.0.8
2531
SOVERSION 1

INSTALL.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
- Come to root folder, **mkdir build && cd build**.
55
- For windows-32: **cmake .. -G "Visual Studio 17 2022" -A win32**.
66
- For windows-64: **cmake .. -G "Visual Studio 17 2022"**.
7-
- For Linux: **cmake .. -DUNIX_LINUX=1**.
7+
- For Linux: **cmake .. -DUNIX_LINUX=1**. If don't support _GNU_SOURCE.
8+
- For Linux: **cmake .. -DUNIX_LINUX=1 -D__LINUX__=1 -D_GNU_SOURCE=1**. If support _GNU_SOURCE.
89
- For MAC-OSX/Apple: **cmake .. -DUNIX_LINUX=1 -DMACOSX=1**.
910

1011

LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2024 Thuan Nguyen Thai <nguyenthaithuanalg@gmail.com> (Nguyễn Thái Thuận)
3+
Copyright (c) 2024-2026 Thuan Nguyen Thai <nguyenthaithuanalg@gmail.com> (Nguyễn Thái Thuận)
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

include/simplelog.h

Lines changed: 143 additions & 140 deletions
Large diffs are not rendered by default.

src/linux/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
target=libsimplelog.so
22
debugFlag=-g -fPIC -Wall -shared
3-
releaseFlag=-fPIC -Wall -shared
3+
releaseFlag=-fPIC -Wall -shared -s
44
LIBS+=-lpthread
55
src=../simplelog.c
66
INC=-I../ -I../../include
77
PREFIX_SRC=../../tests
88
#CFLAGS=-ansi
9-
CFLAGS=-std=gnu89 -D UNIX_LINUX -Werror=format
9+
CFLAGS=-std=c89 -D UNIX_LINUX -Werror=format -D _GNU_SOURCE -D __LINUX__
1010
#CPPFLAGS=-std=c++98
1111
#CPPFLAGS=-std=c++98 -D UNIX_LINUX -D __UNIX_LINUX_CPP11_AND_NEWERS
12-
CPPFLAGS=-D UNIX_LINUX -D __UNIX_LINUX_CPP11_AND_NEWERS__ -Wno-register -Werror=format
12+
CPPFLAGS=-D UNIX_LINUX -D __UNIX_LINUX_CPP11_AND_NEWERS__ -Wno-register -Werror=format -D _GNU_SOURCE -D __LINUX__
1313

1414
debug:
1515
gcc ${debugFlag} -o ${target} ${src} ${LIBS} ${CFLAGS} ${INC}

0 commit comments

Comments
 (0)