Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@ cc_binary(
":lib/src/jvmMain/cpp/jni.h",
":lib/src/jvmMain/cpp/jni_md.h",
],
copts = [
"-DHAVE_TO_STRING",
],
includes = [
"lib/src/jvmMain/cpp",
"lib/src/jvmMain/proto",
Expand Down
44 changes: 0 additions & 44 deletions lib/src/jvmMain/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,48 +17,6 @@ find_package(JNI)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")

#
# C++ standard library features
#

include(CheckCXXSourceCompiles)

# ::gets
check_cxx_source_compiles(
"
#include <cstdio>
using ::gets;
int main() {}
"
HAVE_GETS)
if(HAVE_GETS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DHAVE_GETS=1")
endif()

# std::make_unique
check_cxx_source_compiles(
"
#include <memory>
using std::make_unique;
int main() {}
"
HAVE_MAKE_UNIQUE)
if(HAVE_MAKE_UNIQUE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DHAVE_MAKE_UNIQUE=1")
endif()

# std::to_string
check_cxx_source_compiles(
"
#include <string>
using std::to_string;
int main() {}
"
HAVE_TO_STRING)
if(HAVE_TO_STRING)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DHAVE_TO_STRING=1")
endif()

#
# Build
#
Expand Down Expand Up @@ -101,7 +59,6 @@ add_library(
ToxCrypto/ToxCrypto.cpp
ToxCrypto/ToxCrypto.h
Tox4j.cpp
cpp14compat.h
tox4j/ToxInstances.h
tox4j/Tox4j.h
tox/av.cpp
Expand All @@ -121,7 +78,6 @@ add_library(
util/exceptions.cpp
util/exceptions.h
util/instance_manager.h
util/pp_attributes.h
util/pp_cat.h
util/to_bytes.cpp
util/to_bytes.h
Expand Down
4 changes: 3 additions & 1 deletion lib/src/jvmMain/cpp/ToxAv/lifecycle.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#include <memory>

#include "ToxAv.h"
#include "../ToxCore/ToxCore.h"

Expand Down Expand Up @@ -122,7 +124,7 @@ TOX_METHOD (jint, New,
tox4j_assert (toxav != nullptr);

// Create the master events object and set up our callbacks.
auto events = tox::callbacks<ToxAV> (make_unique<Events> ())
auto events = tox::callbacks<ToxAV> (std::make_unique<Events> ())
#define CALLBACK(NAME) .set<tox::callback_##NAME, tox4j_##NAME##_cb> ()
#include "tox/generated/av.h"
#undef CALLBACK
Expand Down
4 changes: 3 additions & 1 deletion lib/src/jvmMain/cpp/ToxCore/lifecycle.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#include <memory>

#include "ToxCore.h"

using namespace core;
Expand Down Expand Up @@ -269,7 +271,7 @@ TOX_METHOD (jint, New,
tox4j_assert (tox != nullptr);

// Create the master events object and set up our callbacks.
auto events = tox::callbacks<Tox> (make_unique<Events> ())
auto events = tox::callbacks<Tox> (std::make_unique<Events> ())
#define CALLBACK(NAME) .set<tox::callback_##NAME, tox4j_##NAME##_cb> ()
#include "tox/generated/core.h"
#undef CALLBACK
Expand Down
34 changes: 0 additions & 34 deletions lib/src/jvmMain/cpp/cpp14compat.h

This file was deleted.

9 changes: 0 additions & 9 deletions lib/src/jvmMain/cpp/tox4j/Tox4j.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#pragma once

#include "cpp14compat.h"

#include "ToxInstances.h"
#include "util/jni/ArrayFromJava.h"
#include "util/jni/ArrayToJava.h"
Expand All @@ -11,13 +9,6 @@
#include "util/to_bytes.h"


#if defined(__GNUC__)
#define NORETURN __attribute__((__noreturn__))
#else
#define NORETURN
#endif


#define JAVA_METHOD_NAME(NAME) \
PP_CAT(Java_im_tox_tox4j_impl_jni_, PP_CAT(CLASS, PP_CAT(Jni_, NAME)))

Expand Down
2 changes: 1 addition & 1 deletion lib/src/jvmMain/cpp/util/exceptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <sstream>


PP_NORETURN void
[[noreturn]] void
tox4j_fatal_error (JNIEnv *env, char const *message)
{
env->FatalError (message);
Expand Down
4 changes: 1 addition & 3 deletions lib/src/jvmMain/cpp/util/exceptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,14 @@

#include <string>

#include "util/pp_attributes.h"


void throw_tox_killed_exception (JNIEnv *env, jint instance_number, char const *message);
void throw_illegal_state_exception (JNIEnv *env, jint instance_number, char const *message);
void throw_illegal_state_exception (JNIEnv *env, jint instance_number, std::string const &message);
void throw_tox_exception (JNIEnv *env, char const *module, char const *prefix, char const *method, char const *code);


PP_NORETURN void tox4j_fatal_error (JNIEnv *env, char const *message);
[[noreturn]] void tox4j_fatal_error (JNIEnv *env, char const *message);

#define tox4j_fatal(message) tox4j_fatal_error (env, message)

Expand Down
14 changes: 0 additions & 14 deletions lib/src/jvmMain/cpp/util/pp_attributes.h

This file was deleted.

3 changes: 1 addition & 2 deletions lib/src/jvmMain/cpp/util/wrap_void.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#pragma once

#include <type_traits>
#include <utility>

#include "cpp14compat.h"

/**
* Helper template to capture the return value of a function call so that
* functions returning void can be treated the same way as non-void ones.
Expand Down