Skip to content

Commit

Permalink
Trying to compile new code
Browse files Browse the repository at this point in the history
  • Loading branch information
hurufu committed Apr 16, 2024
1 parent 62d9e44 commit fb9b828
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 18 deletions.
15 changes: 10 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,21 @@ CFLAGS_gcc := -fanalyzer -fanalyzer-checker=taint -fsanitize=bounds -fsanitize-u
CFLAGS_gcc += -Wformat -Werror=format-security -grecord-gcc-switches
CFLAGS_gcc += -fstack-protector-all
CFLAGS_gcc += -fstack-clash-protection
CFLAGS ?= -std=gnu11 -O$(OPTLEVEL) -ggdb3 -Wall -Wextra -mtune=native -march=native -flto $(CFLAGS_$(CC))
CFLAGS ?= -std=gnu11 -O$(OPTLEVEL) -ggdb3 -Wall -Wextra -flto $(CFLAGS_$(CC))
CFLAGS += $(call if_coverage,--coverage)
#CFLAGS += -fstrict-flex-arrays
# TODO: Remove those warnings only for generated files
CFLAGS += -Wno-implicit-fallthrough -Wno-unused-const-variable -Wno-sign-compare -Wno-unused-variable -Wno-unused-parameter
TARGET_ARCH := -mtune=native -march=native

LDFLAGS ?= -flto
LDFLAGS += $(call if_coverage,--coverage)

# Project configuration ########################################################
RL_FILES := $(wildcard *.rl)
RL_FILES := wireprotocol.rl frontend.rl
RL_C := $(RL_FILES:.rl=.c)
RL_O := $(RL_FILES:.rl=.o)
CFILES := $(RL_C) frob.c log.c utils.c serialization.c
CFILES := $(RL_C) main.c log.c utils.c serialization.c
OFILES := $(CFILES:.c=.o)
UT_T := $(wildcard *.in)
UT_C := $(UT_T:.in=.c) utils.c serialization.c log.c
Expand All @@ -45,8 +46,10 @@ ALL_PLIST := $(ALL_C:.c=.plist)
all: frob ut
index: tags cscope.out
test: test-unit test-functional test-random
clean:
clean: clean-multitasking
$(if $(strip $F),$(RM) -- $F)
clean-multitasking:
$(MAKE) -C multitasking clean
coverage: test | $(CFILES) $(UT_C)
gcov -o . $|
clang-analyze: $(ALL_PLIST)
Expand Down Expand Up @@ -97,11 +100,13 @@ acknak: acknak.o log.o utils.o evloop.o
objcopy --only-keep-debug $@ $@.debug
strip --strip-unneeded $@
objcopy --add-gnu-debuglink=$@.debug $@
frob: $(OFILES)
frob: $(OFILES) multitasking/libcomulti.a
$(LINK.o) -o $@ $^ $(LDLIBS)
objcopy --only-keep-debug $@ $@.debug
strip --strip-unneeded $@
objcopy --add-gnu-debuglink=$@.debug $@
multitasking/libcomulti.a:
$(MAKE) -j1 -C multitasking libcomulti.a
%.c: %.rl
ragel -G2 -L $<
%.s: %.c
Expand Down
14 changes: 7 additions & 7 deletions co/frontend.c.rl → frontend.rl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "comultitask.h"
#include "multitasking/sus.h"
#include "frob.h"
#include "../log.h"
#include "../utils.h"
#include "log.h"
#include "utils.h"
#include <stdbool.h>
#include <sys/timerfd.h>
#include <unistd.h>
Expand All @@ -11,7 +11,7 @@ static int cs;
%%{
machine frontend;
alphtype char;
include frob_common "../common.rl";
include frob_common "common.rl";

# Foreign:
OK = stx;
Expand Down Expand Up @@ -70,7 +70,7 @@ void fsm_frontend_init() {
%% write init;
}

int fsm_frontend_foreign(struct args_frontend_foreign* const a) {
int fsm_frontend_foreign(struct fsm_frontend_foreign_args* const a) {
(void)a;
ssize_t bytes;
const char* p;
Expand All @@ -84,7 +84,7 @@ int fsm_frontend_foreign(struct args_frontend_foreign* const a) {
return -1;
}

int fsm_frontend_internal(struct args_frontend_internal* const a) {
int fsm_frontend_internal(struct fsm_frontend_internal_args* const a) {
(void)a;
/*
ssize_t bytes;
Expand All @@ -97,7 +97,7 @@ int fsm_frontend_internal(struct args_frontend_internal* const a) {
return -1;
}

int fsm_frontend_timer(struct args_frontend_timer* const a) {
int fsm_frontend_timer(struct fsm_frontend_timer_args* const a) {
(void)a;
/*
const int fd = timerfd_create(CLOCK_MONOTONIC, TFD_NONBLOCK | TFD_CLOEXEC);
Expand Down
2 changes: 1 addition & 1 deletion main.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "log.h"
#include "utils.h"
#include "comultitask.h"
#include "multitasking/sus.h"
#include "frob.h"

int main() {
Expand Down
2 changes: 1 addition & 1 deletion multitasking/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
CPPFLAGS ?=
CFLAGS ?=
TARGET_ARCH ?=
SOURCES := $(wildcard *.c coro/coro.c)
SOURCES := coro/coro.c contextring.c eventloop.c suspendables.c
OBJECTS := $(SOURCES:.c=.o)
DEPENDENCIES = $(if $(filter clean wipe,$(MAKECMDGOALS)),,$(SOURCES:.c=.d) ut.d)
LOADLIBES :=
Expand Down
8 changes: 4 additions & 4 deletions co/wireprotocol.c.rl → wireprotocol.rl
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#include "comultitask.h"
#include "multitasking/sus.h"
#include "frob.h"
#include "../utils.h"
#include "../log.h"
#include "utils.h"
#include "log.h"
#include <unistd.h>
#include <fcntl.h>

%%{
machine wireformat;
alphtype unsigned char;
include frob_common "../common.rl";
include frob_common "common.rl";

action LRC_Init {
lrc = 0;
Expand Down

0 comments on commit fb9b828

Please sign in to comment.