Extended prettyasserts.py to support prefixed memcmp/strcmp
The move to lfs_memcmp/lfs_strcmp highlighted an interesting hole in
prettyasserts.py: the lack of support for custom memcmp/strcmp symbols.
Rather than just adding more flags for an increasing number of symbols,
I've added -p/--prefix and -P/--prefix-insensitive to generate relevant
symbols based on a prefix. In littlefs's case, we use -Plfs_, which
matches both lfs_memcmp and LFS_ASSERT (and LFS_MEMCMP and lfs_assert
but ignore those):
$ ./scripts/prettyasserts.py -Plfs_ lfs.t.c -o lfs.t.a.c
Don't worry, you can still provide explicit symbols, but only via
long-form flags. This gets a bit noisy:
$ ./scripts/prettyasserts.py \
--assert=LFS_ASSERT \
--unreachable=LFS_UNREACHABLE \
--memcmp=lfs_memcmp \
--strcmp=lfs_strcmp \
lfs.t.c -o lfs.t.a.c
This commit also finally gives the prettyasserts.py's symbols actual
word boundaries, instead of the big error-prone hack of sorting by size.
This commit is contained in:
@@ -523,10 +523,10 @@ $(BUILDDIR)/%.s: %.c
|
||||
$(CC) -S $(CFLAGS) $< -o $@
|
||||
|
||||
$(BUILDDIR)/%.a.c: %.c
|
||||
$(PRETTYASSERTS) -a LFS_ASSERT -u LFS_UNREACHABLE $< -o $@
|
||||
$(PRETTYASSERTS) -Plfs_ $< -o $@
|
||||
|
||||
$(BUILDDIR)/%.a.c: $(BUILDDIR)/%.c
|
||||
$(PRETTYASSERTS) -a LFS_ASSERT -u LFS_UNREACHABLE $< -o $@
|
||||
$(PRETTYASSERTS) -Plfs_ $< -o $@
|
||||
|
||||
$(BUILDDIR)/%.t.c: %.toml
|
||||
./scripts/test.py -c $< $(TESTCFLAGS) -o $@
|
||||
|
||||
Reference in New Issue
Block a user