forked from irungentoo/toxcore
-
Notifications
You must be signed in to change notification settings - Fork 292
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Use strong typedef instead of struct for
Socket
.
Sparse checks it. This is neater than using a struct, which has some slightly weird syntax at times. This also reduces the risk of someone adding another struct member.
- Loading branch information
Showing
13 changed files
with
262 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
!/Makefile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
SOURCES := $(wildcard tox*/*.c tox*/*/*.c) \ | ||
third_party/cmp/cmp.c | ||
OBJECTS := $(SOURCES:.c=.o) | ||
|
||
CFLAGS := $(shell pkg-config --cflags libsodium opus vpx) | ||
CPPFLAGS := -DSPARSE -DTCP_SERVER_USE_EPOLL=1 -DMIN_LOGGER_LEVEL=LOGGER_LEVEL_TRACE | ||
|
||
SPARSE_FLAGS := \ | ||
-Wsparse-error \ | ||
-Wpedantic \ | ||
-Waddress \ | ||
-Waddress-space \ | ||
-Wbitwise \ | ||
-Wbitwise-pointer \ | ||
-Wcast-from-as \ | ||
-Wcast-to-as \ | ||
-Wcast-truncate \ | ||
-Wconstant-suffix \ | ||
-Wconstexpr-not-const \ | ||
-Wcontext \ | ||
-Wdecl \ | ||
-Wdefault-bitfield-sign \ | ||
-Wdesignated-init \ | ||
-Wdo-while \ | ||
-Wenum-mismatch \ | ||
-Wexternal-function-has-definition \ | ||
-Wflexible-array-array \ | ||
-Wflexible-array-nested \ | ||
-Wflexible-array-union \ | ||
-Wimplicit-int \ | ||
-Winit-cstring \ | ||
-Wint-to-pointer-cast \ | ||
-Wmemcpy-max-count \ | ||
-Wnon-pointer-null \ | ||
-Wnewline-eof \ | ||
-Wold-initializer \ | ||
-Wold-style-definition \ | ||
-Wone-bit-signed-bitfield \ | ||
-Woverride-init \ | ||
-Woverride-init-all \ | ||
-Wparen-string \ | ||
-Wpast-deep-designator \ | ||
-Wpedantic \ | ||
-Wpointer-to-int-cast \ | ||
-Wptr-subtraction-blows \ | ||
-Wreturn-void \ | ||
-Wshadow \ | ||
-Wshift-count-negative \ | ||
-Wshift-count-overflow \ | ||
-Wsizeof-bool \ | ||
-Wstrict-prototypes \ | ||
-Wpointer-arith \ | ||
-Wsparse-error \ | ||
-Wtautological-compare \ | ||
-Wtransparent-union \ | ||
-Wtypesign \ | ||
-Wundef \ | ||
-Wuninitialized \ | ||
-Wunion-cast \ | ||
-Wvla | ||
|
||
SMATCH_FLAGS := $(foreach i,$(shell smatch --show-checks | grep -o 'check_.*'),--enable=$i) | ||
|
||
analyse: $(OBJECTS) | ||
|
||
%.o: %.c | ||
@echo "Processing $<" | ||
@sparse $(CFLAGS) $(CPPFLAGS) $(SPARSE_FLAGS) $< | ||
# @smatch $(CFLAGS) $(CPPFLAGS) $(SMATCH_FLAGS) $< | ||
# @sparse-llvm $(CFLAGS) $(CPPFLAGS) $< > /dev/null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
CFLAGS=-O3 -g -Wno-discarded-qualifiers -Wno-format-truncation -Wno-stringop-truncation -Wno-uninitialized -Wno-unused -Wno-unused-result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/sh | ||
|
||
set -eux | ||
BUILD=sparse | ||
other/docker/sources/build | ||
docker build -t "toxchat/c-toxcore:$BUILD" -f "other/docker/$BUILD/$BUILD.Dockerfile" . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
FROM toxchat/c-toxcore:sources AS sources | ||
FROM ubuntu:22.04 | ||
|
||
RUN apt-get update && \ | ||
DEBIAN_FRONTEND="noninteractive" apt-get install -y --no-install-recommends \ | ||
ca-certificates \ | ||
creduce \ | ||
g++ \ | ||
gcc \ | ||
git \ | ||
libc-dev \ | ||
libopus-dev \ | ||
libsodium-dev \ | ||
libsqlite3-dev \ | ||
libssl-dev \ | ||
libvpx-dev \ | ||
llvm-dev \ | ||
make \ | ||
pkg-config \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
WORKDIR /work/smatch | ||
RUN git clone --depth=1 https://repo.or.cz/smatch.git /work/smatch | ||
COPY other/docker/sparse/local.mk /work/smatch/local.mk | ||
RUN make install -j4 PREFIX=/usr/local | ||
|
||
WORKDIR /work/c-toxcore | ||
COPY --from=sources /src/ /work/c-toxcore | ||
#COPY other/make_single_file /work/c-toxcore/other/ | ||
#RUN other/make_single_file auto_tests/tox_new_test.c > crash.c | ||
#RUN sparsec $(pkg-config --cflags --libs libsodium opus vpx) crash.c | ||
|
||
COPY other/docker/sparse/Makefile /work/c-toxcore/ | ||
RUN make -j4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.