Squashed 'external/toxcore/c-toxcore/' changes from e29e185c03..f1df709b87

f1df709b87 feat: add ngc events
1b6c907235 refactor: Make event dispatch ordered by receive time.
b7f9367f6f test: Upgrade cppcheck, fix some warnings.
766e62bc89 chore: Use `pkg_search_module` directly in cmake.
00ff078f91 cleanup: Use target_link_libraries directly in cmake.
c58928cc89 chore: Add `IMPORTED_TARGET` to pkg-config packages.
895a6af122 cleanup: Remove NaCl support.
41dfb1c1c0 fix: unpack enum function names in event impl generator
447666d1a1 chore: Disable targets for cross-compilation.
572924e924 chore: Build a docker image with coverage info in it.
415cb78f5e cleanup: Some portability/warning fixes for Windows builds.
425216d9ec fix: Correct a use-after-free and fix some memory leaks.
4b1cfa3e08 refactor: Change all enum-like `#define` sequences into enums.
d3c2704fa9 chore: Fix make_single_file to support core-only.
0ce46b644e refactor: Change the `TCP_PACKET_*` defines into an enum.
22cd38ad50 adopt event impl generation tool to #2392
f31ea1088a add the event impl generation tool
4e603bb613 refactor: Use `enum-from-int` rule from tokstyle.
19d8f180d6 chore: Update github actions `uses`.
6a895be0c7 test: Make esp32 build actually try to instantiate tox.
65d09c9bfb cleanup: Remove test net support.
REVERT: e29e185c03 feat: add ngc events

git-subtree-dir: external/toxcore/c-toxcore
git-subtree-split: f1df709b8792da4c0e946d826b11df77d565064d
This commit is contained in:
2023-12-27 12:37:22 +01:00
parent 83e200df43
commit b2ae9530a4
173 changed files with 9191 additions and 5633 deletions

View File

@ -15,11 +15,14 @@ sh_test(
"-Wno-callback-names",
"-Wno-enum-names",
"+RTS",
"-N3",
"-N4",
"-RTS",
],
data = CIMPLE_FILES,
tags = ["haskell"],
tags = [
"haskell",
"no-cross",
],
)
sh_test(
@ -32,7 +35,11 @@ sh_test(
"-Iexternal/libvpx",
"-Iexternal/opus/include",
"-Ihs-tokstyle/include",
] + ["$(locations %s)" % f for f in CIMPLE_FILES],
] + ["$(locations %s)" % f for f in CIMPLE_FILES] + [
"+RTS",
"-N4",
"-RTS",
],
data = CIMPLE_FILES + [
"//c-toxcore/third_party:headers",
"//hs-tokstyle:headers",
@ -40,7 +47,10 @@ sh_test(
"@libvpx//:headers",
"@opus//:headers",
],
tags = ["haskell"],
tags = [
"haskell",
"no-cross",
],
toolchains = ["@rules_cc//cc:current_cc_toolchain"],
)
@ -50,7 +60,10 @@ sh_test(
srcs = ["//hs-cimple/tools:cimplefmt"],
args = ["--reparse"] + ["$(locations %s)" % f for f in CIMPLE_FILES],
data = CIMPLE_FILES,
tags = ["haskell"],
tags = [
"haskell",
"no-cross",
],
)
cc_library(

View File

@ -3,7 +3,15 @@ set(misc_tools_SOURCES
misc_tools.c
misc_tools.h)
add_library(misc_tools STATIC ${misc_tools_SOURCES})
target_link_modules(misc_tools toxcore)
if(TARGET toxcore_static)
target_link_libraries(misc_tools PRIVATE toxcore_static)
else()
target_link_libraries(misc_tools PRIVATE toxcore_shared)
endif()
target_link_libraries(misc_tools PRIVATE ${LIBSODIUM_LIBRARIES})
target_link_directories(misc_tools PUBLIC ${LIBSODIUM_LIBRARY_DIRS})
target_include_directories(misc_tools SYSTEM PRIVATE ${LIBSODIUM_INCLUDE_DIRS})
target_compile_options(misc_tools PRIVATE ${LIBSODIUM_CFLAGS_OTHER})
################################################################################
#
@ -11,7 +19,12 @@ target_link_modules(misc_tools toxcore)
#
################################################################################
if (BUILD_MISC_TESTS)
if(BUILD_MISC_TESTS)
add_executable(Messenger_test Messenger_test.c)
target_link_modules(Messenger_test toxcore misc_tools)
target_link_libraries(Messenger_test PRIVATE misc_tools)
if(TARGET toxcore_static)
target_link_libraries(Messenger_test PRIVATE toxcore_static)
else()
target_link_libraries(Messenger_test PRIVATE toxcore_shared)
endif()
endif()

View File

@ -19,16 +19,12 @@ noinst_PROGRAMS += Messenger_test
Messenger_test_SOURCES = \
../testing/Messenger_test.c
Messenger_test_CFLAGS = $(LIBSODIUM_CFLAGS) \
$(NACL_CFLAGS)
Messenger_test_CFLAGS = $(LIBSODIUM_CFLAGS)
Messenger_test_LDADD = $(LIBSODIUM_LDFLAGS) \
$(NACL_LDFLAGS) \
libmisc_tools.la \
libtoxcore.la \
$(LIBSODIUM_LIBS) \
$(NACL_OBJECTS) \
$(NACL_LIBS) \
$(WINSOCK2_LIBS)
endif

View File

@ -12,7 +12,7 @@
* If it receives a message from a friend it replies back.
*
*
* This is how I compile it: gcc -O2 -Wall -D VANILLA_NACL -o test ../core/Lossless_UDP.c ../core/network.c ../core/net_crypto.c ../core/Messenger.c ../core/DHT.c ../nacl/build/${HOSTNAME%.*}/lib/amd64/{cpucycles.o,libnacl.a,randombytes.o} Messenger_test.c
* This is how I compile it: gcc -O2 -Wall -o test ../core/Lossless_UDP.c ../core/network.c ../core/net_crypto.c ../core/Messenger.c ../core/DHT.c Messenger_test.c -lsodium
*
*
* Command line arguments are the ip, port and public_key of a node (for bootstrapping).

View File

@ -13,14 +13,14 @@ endif()
# Fuzzes the toxsave API
add_executable(toxsave_fuzzer toxsave_harness.cc)
target_link_libraries(toxsave_fuzzer toxcore_static fuzz_support ${LIBFUZZER_LINKER_FLAGS})
target_link_libraries(toxsave_fuzzer PRIVATE toxcore_static fuzz_support ${LIBFUZZER_LINKER_FLAGS})
# Fuzzes the bootstrap process
add_executable(bootstrap_fuzzer bootstrap_harness.cc)
target_link_libraries(bootstrap_fuzzer toxcore_static fuzz_support ${LIBFUZZER_LINKER_FLAGS})
target_link_libraries(bootstrap_fuzzer PRIVATE toxcore_static fuzz_support ${LIBFUZZER_LINKER_FLAGS})
add_executable(DHT_fuzz_test ../../toxcore/DHT_fuzz_test.cc)
target_link_libraries(DHT_fuzz_test toxcore_static fuzz_support ${LIBFUZZER_LINKER_FLAGS})
target_link_libraries(DHT_fuzz_test PRIVATE toxcore_static fuzz_support ${LIBFUZZER_LINKER_FLAGS})
add_executable(tox_events_fuzz_test ../../toxcore/tox_events_fuzz_test.cc)
target_link_libraries(tox_events_fuzz_test toxcore_static fuzz_support ${LIBFUZZER_LINKER_FLAGS})
target_link_libraries(tox_events_fuzz_test PRIVATE toxcore_static fuzz_support ${LIBFUZZER_LINKER_FLAGS})

View File

@ -20,9 +20,7 @@
#include <stdlib.h>
#include <string.h>
#ifndef VANILLA_NACL
#include <sodium.h>
#endif
#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
#include <windows.h>
@ -141,7 +139,6 @@ int cmdline_parsefor_ipv46(int argc, char **argv, bool *ipv6enabled)
}
#ifndef VANILLA_NACL
static const char *test_rng_name(void)
{
return "test_rng";
@ -198,11 +195,3 @@ int use_test_rng(uint32_t seed)
return randombytes_set_implementation(&test_rng);
}
#else
int use_test_rng(uint32_t seed)
{
assert(!"libsodium required for use_test_rng");
}
#endif