Files
RetroArch/samples/core_options/Makefile
LibretroAdmin 631c443892 core options, runahead: one allocation for value hashes, flat input list
Option value hashes live in one pool per manager, indexed by value,
and every value and label append is checked, so a failed append ends
the parse without writing outside a list. The legacy parser reads the
description and values in place from the variable string.

Runahead's input logging keeps the tuples the dense cache has no slot
for in one flat array; each tuple's ids are sized on first write.

samples/core_options drives the manager with each append failing in
turn; samples/runahead covers the input list, including each realloc
failing in turn.
2026-10-15 22:55:31 +02:00

68 lines
1.9 KiB
Makefile

include ../sample_objdir.mk
TARGET := core_options_test
CORE_DIR = ../..
LIBRETRO_COMM_DIR = $(CORE_DIR)/libretro-common
INCDIRS := -I$(LIBRETRO_COMM_DIR)/include -I$(CORE_DIR) -I$(CORE_DIR)/deps
CC ?= gcc
# core_option_manager.c as shipped, on the real config_file,
# string_list and nested_list. string_list_append is wrapped so the
# test can fail any one call.
SOURCES_C := \
core_options_test.c \
$(CORE_DIR)/core_option_manager.c \
$(LIBRETRO_COMM_DIR)/lists/string_list.c \
$(LIBRETRO_COMM_DIR)/lists/nested_list.c \
$(LIBRETRO_COMM_DIR)/file/config_file.c \
$(LIBRETRO_COMM_DIR)/file/config_file_io.c \
$(LIBRETRO_COMM_DIR)/file/file_path.c \
$(LIBRETRO_COMM_DIR)/file/file_path_io.c \
$(LIBRETRO_COMM_DIR)/streams/file_stream.c \
$(LIBRETRO_COMM_DIR)/vfs/vfs_implementation.c \
$(LIBRETRO_COMM_DIR)/string/stdstring.c \
$(LIBRETRO_COMM_DIR)/string/rstrtod.c \
$(LIBRETRO_COMM_DIR)/compat/compat_strl.c \
$(LIBRETRO_COMM_DIR)/compat/compat_strldup.c \
$(LIBRETRO_COMM_DIR)/compat/compat_posix_string.c \
$(LIBRETRO_COMM_DIR)/compat/fopen_utf8.c \
$(LIBRETRO_COMM_DIR)/encodings/encoding_utf.c \
$(LIBRETRO_COMM_DIR)/time/rtime.c
CFLAGS += -std=gnu99 -O1 -g1 -Wall -Werror=implicit-function-declaration \
$(INCDIRS) -DRARCH_INTERNAL -DHAVE_CONFIGFILE -D_GNU_SOURCE
LDFLAGS += -Wl,--wrap=string_list_append
ifneq ($(SAN),)
SANITIZER := $(SAN)
endif
ifneq ($(SANITIZER),)
CFLAGS := -fsanitize=$(SANITIZER) -fno-omit-frame-pointer $(CFLAGS)
LDFLAGS := -fsanitize=$(SANITIZER) $(LDFLAGS)
endif
OBJS := $(call sample_objs,$(SOURCES_C:.c=.o))
all: $(TARGET)
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
$(SAMPLE_OBJDIR)/%.o: $$(call sample_src,$$*).c
@mkdir -p $(@D)
$(CC) $(CFLAGS) -c -o $@ $<
$(TARGET): $(OBJS)
$(CC) -o $@ $(OBJS) $(LDFLAGS) -lm
check: $(TARGET)
./$(TARGET)
clean:
rm -rf $(SAMPLE_OBJDIR)
rm -f $(OBJS) $(TARGET) $(TARGET).exe core_options_test.cfg
.PHONY: all check clean