From ac6f8f6de98ab5fe672a47a37441b729150fe629 Mon Sep 17 00:00:00 2001 From: mrfoxygmfr Date: Thu, 22 May 2025 19:48:43 +0300 Subject: fix(build): now builds with clang --- Makefile | 5 +++-- lib/common.c | 2 +- worker.c | 6 +++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index e2ef40e..26c8a00 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,9 @@ ifeq ($(LLVM),1) CC = clang + LD = ld.lld else CC = gcc + LD = ld endif CFLAGS = \ @@ -15,7 +17,6 @@ LDFLAGS = -pthread -lrt ifeq ($(DEBUG),1) CFLAGS += -g -fsanitize=address,leak,undefined - #,memory else CFLAGS += -flto LDFLAGS += -flto @@ -68,5 +69,5 @@ build/%: %.c build/lib.o build/lib.o: $(patsubst %.c,build/%.o,$(shell find lib -type f -name '*.c' -print)) @mkdir -p $(@D) - @ld -r $^ -o $@ + @$(LD) -r $^ -o $@ diff --git a/lib/common.c b/lib/common.c index 6a54108..8167493 100644 --- a/lib/common.c +++ b/lib/common.c @@ -2,7 +2,7 @@ #include void timer_handler(int signum) { - signum = signum; + signum = signum * 2; printf("Stopping due to timeout\n"); exit(EXIT_FAILURE); diff --git a/worker.c b/worker.c index 08be9bd..c7c560a 100644 --- a/worker.c +++ b/worker.c @@ -20,7 +20,7 @@ long double func_der(long double x) { return 6 * x * x * x * x * x - 75 * x * x long double func_value_x(long double x) { return x; } long double func_der_x(long double x) { - x = x; + x = x * 2; return 1; } @@ -74,7 +74,7 @@ long double calculate_integral(func_t f, long double a, long double b, long doub void worker_func(const char* task, size_t task_size, char** resp, size_t* resp_size) { long double* args = (long double*) task; - task_size = task_size; + task_size = task_size * 2; long double res = calculate_integral(func, args[0], args[1], args[2]); printf("task %Lf %Lf -> %Lf\n", args[0], args[1], res); @@ -85,7 +85,7 @@ void worker_func(const char* task, size_t task_size, char** resp, size_t* resp_s } int32_t main() { - worker_init("127.0.0.1", "33554", 2, worker_func); + worker_init("127.0.0.1", "33554", 1, worker_func); configure_timeout(10); worker_exec(); } -- cgit mrf-deployment