Skip to content

Commit 6555bd3

Browse files
committed
Musl support.
1 parent 979d8ce commit 6555bd3

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

Makefile

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
1-
# Disable built-in rules and variables
2-
MAKEFLAGS += --no-builtin-rules
3-
MAKEFLAGS += --no-builtin-variables
4-
51
# flags
62
CC_WARN := -Wall -Wextra -Werror=implicit-function-declaration -Wformat -Werror=format-security
3+
4+
ifeq ($(CC),musl-gcc)
5+
# musl is ISO 10646 compliant but doesn't define __STDC_ISO_10646__
6+
CC_EXTRA := -D__STDC_ISO_10646__=201706L
7+
else
8+
# sanitisers only work for non-musl builds
79
CC_SAN := -fsanitize=address -fsanitize=leak -fsanitize=undefined -fsanitize-address-use-after-scope
10+
endif
811

9-
test: CFLAGS := -ggdb -std=c11 -pipe $(CC_WARN) -fno-omit-frame-pointer $(CC_SAN)
10-
flto-test: CFLAGS := -s -O2 -pipe -std=c11 $(CC_WARN) -flto -march=native -mtune=native
11-
tools: CFLAGS := -s -O2 -pipe -std=c11 $(CC_WARN)
12+
test: CFLAGS := -ggdb -std=c11 -pipe $(CC_WARN) $(CC_EXTRA) -fno-omit-frame-pointer $(CC_SAN)
13+
flto-test: CFLAGS := -s -O2 -pipe -std=c11 $(CC_WARN) $(CC_EXTRA) -flto -march=native -mtune=native
14+
tools: CFLAGS := -s -O2 -pipe -std=c11 $(CC_WARN) $(CC_EXTRA)
1215

1316
# str library source files
1417
SRC := str.c str.h str_test.c
1518

16-
# compiler
17-
CC := gcc
18-
# CC := clang
19-
2019
# all
2120
.PHONY: all
2221
all: tools test flto-test

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,5 +434,6 @@ to see an example of its output.
434434
435435
## Project Status
436436
The library requires at least a C11 compiler. So far has been tested on Linux Mint versions
437-
from 19.3 to 22.0, with `gcc` versions from 9.5.0 to 13.2.0, and `clang` versions up to 18.1.3;
438-
it is also reported to work on ALT Linux 9.1 for Elbrus, with `lcc` version 1.25.09.
437+
from 19.3 to 22.0, with `gcc` versions from 9.5.0 to 13.2.0 (with either `libc` or `musl`),
438+
and `clang` versions up to 18.1.3; it is also reported to work on ALT Linux 9.1 for Elbrus, with
439+
`lcc` version 1.25.09.

tools/gen_char_class.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4040

4141
// platform checks
4242
#ifndef __STDC_ISO_10646__
43-
#error "this platform does not support UNICODE (\"__STDC_ISO_10646__\" is not defined)"
43+
#error "this platform does not support UNICODE (__STDC_ISO_10646__ is not defined)"
4444
#endif
4545

4646
#if __SIZEOF_WCHAR_T__ < 4 || __SIZEOF_WINT_T__ < 4

0 commit comments

Comments
 (0)