Skip to content

Commit 1ed3356

Browse files
committed
py/py.mk: Make berkeley-db C-defs apply only to relevant source files.
Otherwise they can interfere (eg redefinition of "abort") with other source files in a given uPy port.
1 parent 513dfcf commit 1ed3356

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Diff for: py/py.mk

+4-2
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ endif
7474

7575
ifeq ($(MICROPY_PY_BTREE),1)
7676
BTREE_DIR = lib/berkeley-db-1.xx
77-
CFLAGS_MOD += -D__DBINTERFACE_PRIVATE=1 -Dmpool_error=printf -Dabort=abort_ -Dvirt_fd_t=mp_obj_t "-DVIRT_FD_T_HEADER=<py/obj.h>"
77+
BTREE_DEFS = -D__DBINTERFACE_PRIVATE=1 -Dmpool_error=printf -Dabort=abort_ -Dvirt_fd_t=mp_obj_t "-DVIRT_FD_T_HEADER=<py/obj.h>"
7878
INC += -I../$(BTREE_DIR)/PORT/include
7979
SRC_MOD += extmod/modbtree.c
8080
SRC_MOD += $(addprefix $(BTREE_DIR)/,\
@@ -95,7 +95,9 @@ mpool/mpool.c \
9595
)
9696
CFLAGS_MOD += -DMICROPY_PY_BTREE=1
9797
# we need to suppress certain warnings to get berkeley-db to compile cleanly
98-
$(BUILD)/$(BTREE_DIR)/%.o: CFLAGS += -Wno-old-style-definition -Wno-sign-compare -Wno-unused-parameter
98+
# and we have separate BTREE_DEFS so the definitions don't interfere with other source code
99+
$(BUILD)/$(BTREE_DIR)/%.o: CFLAGS += -Wno-old-style-definition -Wno-sign-compare -Wno-unused-parameter $(BTREE_DEFS)
100+
$(BUILD)/extmod/modbtree.o: CFLAGS += $(BTREE_DEFS)
99101
endif
100102

101103
# py object files

0 commit comments

Comments
 (0)