Remove unnecessary '#ifdef __cplusplus' in *.cc files.

These files are already using C++ constructs, e.g. 'namespace', so
they're guaranteed to be compiled with a C++ compiler, not a C compiler.
It's only in the header files that '#ifdef __cplusplus' is needed.

PiperOrigin-RevId: 346804459
Change-Id: Ia49dc8e8f162a00f2dfbb77cf2fba84606f9dc1b
This commit is contained in:
Fergus Henderson 2020-12-10 09:47:41 -08:00 committed by TensorFlower Gardener
parent f30e7d3a7e
commit 655c0bc600
13 changed files with 6 additions and 58 deletions
tensorflow/lite
c
delegates
flex/java/src/main/native
gpu/java/src/main/native
hexagon/java/src/main/native
nnapi/java/src/main/native
utils/dummy_delegate
java/src
tools/benchmark
android/jni
experimental

View File

@ -27,10 +27,6 @@ limitations under the License.
#include "tensorflow/lite/model.h"
#include "tensorflow/lite/version.h"
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
namespace {
class CallbackErrorReporter : public tflite::ErrorReporter {
public:
@ -85,6 +81,8 @@ class CallbackOpResolver : public ::tflite::OpResolver {
} // namespace
extern "C" {
// LINT.IfChange
const char* TfLiteVersion() { return TFLITE_VERSION_STRING; }
@ -233,9 +231,7 @@ TfLiteStatus TfLiteTensorCopyToBuffer(const TfLiteTensor* tensor,
// LINT.ThenChange(//tensorflow/lite/experimental/examples/unity/TensorFlowLitePlugin/Assets/TensorFlowLite/SDK/Scripts/Interpreter.cs)
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus
namespace tflite {
namespace internal {

View File

@ -24,9 +24,7 @@ limitations under the License.
#include "tensorflow/lite/c/c_api_internal.h"
#include "tensorflow/lite/interpreter.h"
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
TfLiteStatus TfLiteInterpreterResetVariableTensors(
TfLiteInterpreter* interpreter) {
@ -82,6 +80,4 @@ void TfLiteInterpreterOptionsSetEnableDelegateFallback(
options->enable_delegate_fallback = enable;
}
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus

View File

@ -19,9 +19,7 @@ limitations under the License.
#include "tensorflow/lite/delegates/utils/simple_delegate.h"
#include "tensorflow/lite/testing/init_tensorflow.h"
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
JNIEXPORT void JNICALL
Java_org_tensorflow_lite_flex_FlexDelegate_nativeInitTensorFlow(JNIEnv* env,
@ -42,6 +40,4 @@ Java_org_tensorflow_lite_flex_FlexDelegate_nativeDeleteDelegate(
reinterpret_cast<struct TfLiteDelegate*>(delegate));
}
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus

View File

@ -23,9 +23,7 @@ limitations under the License.
#include "tensorflow/lite/experimental/acceleration/compatibility/android_info.h"
#include "tensorflow/lite/experimental/acceleration/compatibility/gpu_compatibility.h"
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
JNIEXPORT jlong JNICALL Java_org_tensorflow_lite_gpu_GpuDelegate_createDelegate(
JNIEnv* env, jclass clazz, jboolean precision_loss_allowed,
@ -113,6 +111,4 @@ Java_org_tensorflow_lite_gpu_CompatibilityList_deleteCompatibilityList(
delete compatibility_list;
}
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus

View File

@ -18,9 +18,7 @@ limitations under the License.
#include "tensorflow/lite/delegates/hexagon/hexagon_delegate.h"
#ifdef __cplusplus
extern "C" {
#endif
JNIEXPORT jlong JNICALL
Java_org_tensorflow_lite_HexagonDelegate_createDelegate(
@ -51,6 +49,4 @@ Java_org_tensorflow_lite_HexagonDelegate_setAdspLibraryPath(
: JNI_FALSE;
}
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus

View File

@ -17,12 +17,10 @@ limitations under the License.
#include "tensorflow/lite/delegates/nnapi/nnapi_delegate.h"
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
using namespace tflite;
extern "C" {
JNIEXPORT jlong JNICALL
Java_org_tensorflow_lite_nnapi_NnApiDelegate_createDelegate(
JNIEnv* env, jclass clazz, jint preference, jstring accelerator_name,
@ -87,6 +85,4 @@ Java_org_tensorflow_lite_nnapi_NnApiDelegate_deleteDelegate(JNIEnv* env,
delete reinterpret_cast<StatefulNnApiDelegate*>(delegate);
}
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus

View File

@ -84,9 +84,7 @@ TfLiteDelegate* CreateDummyDelegateFromOptions(char** options_keys,
} // namespace tools
} // namespace tflite
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
// Defines two symbols that need to be exported to use the TFLite external
// delegate. See tensorflow/lite/delegates/external for details.
@ -101,6 +99,4 @@ TFL_CAPI_EXPORT void tflite_plugin_destroy_delegate(TfLiteDelegate* delegate) {
TfLiteDummyDelegateDelete(delegate);
}
#ifdef __cplusplus
}
#endif // __cplusplus
} // extern "C"

View File

@ -157,9 +157,7 @@ bool VerifyModel(const void* buf, size_t len) {
} // namespace
#ifdef __cplusplus
extern "C" {
#endif
JNIEXPORT jobjectArray JNICALL
Java_org_tensorflow_lite_NativeInterpreterWrapper_getInputNames(JNIEnv* env,
@ -646,6 +644,4 @@ JNIEXPORT void JNICALL Java_org_tensorflow_lite_NativeInterpreterWrapper_delete(
}
}
#ifdef __cplusplus
} // extern "C"
#endif

View File

@ -392,9 +392,7 @@ void WriteScalarString(JNIEnv* env, jobject src, TfLiteTensor* tensor) {
} // namespace
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
JNIEXPORT jlong JNICALL Java_org_tensorflow_lite_Tensor_create(
JNIEnv* env, jclass clazz, jlong interpreter_handle, jint tensor_index) {
@ -615,6 +613,4 @@ JNIEXPORT jint JNICALL Java_org_tensorflow_lite_Tensor_quantizationZeroPoint(
return static_cast<jint>(tensor ? tensor->params.zero_point : 0);
}
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus

View File

@ -20,9 +20,7 @@ limitations under the License.
#include "tensorflow/lite/c/common.h"
#include "tensorflow/lite/kernels/kernel_util.h"
#ifdef __cplusplus
extern "C" {
#endif
JNIEXPORT jlong JNICALL
Java_org_tensorflow_lite_InterpreterTest_getNativeHandleForDelegate(
@ -97,6 +95,4 @@ Java_org_tensorflow_lite_InterpreterTest_getNativeHandleForInvalidDelegate(
return reinterpret_cast<jlong>(&delegate);
}
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus

View File

@ -62,9 +62,7 @@ void Run(int argc, char** argv) {
} // namespace benchmark
} // namespace tflite
#ifdef __cplusplus
extern "C" {
#endif
JNIEXPORT void JNICALL
Java_org_tensorflow_lite_benchmark_BenchmarkModel_nativeRun(JNIEnv* env,
@ -90,6 +88,4 @@ Java_org_tensorflow_lite_benchmark_BenchmarkModel_nativeRun(JNIEnv* env,
env->ReleaseStringUTFChars(args_obj, args_chars);
}
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus

View File

@ -18,9 +18,7 @@ limitations under the License.
#include "tensorflow/core/util/stats_calculator.h"
#include "tensorflow/lite/tools/benchmark/benchmark_tflite_model.h"
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
// -----------------------------------------------------------------------------
// C APIs corresponding to tflite::benchmark::BenchmarkResults type.
@ -179,6 +177,4 @@ void TfLiteBenchmarkTfLiteModelAddListener(
return benchmark_model->benchmark_model->AddListener(listener->adapter.get());
}
#ifdef __cplusplus
}
#endif // __cplusplus
} // extern "C"

View File

@ -247,9 +247,7 @@ void RunScenario(const string& library_dir, int scenario, int report_fd) {
} // namespace benchmark
} // namespace tflite
#ifdef __cplusplus
extern "C" {
#endif
JNIEXPORT void JNICALL
Java_org_tensorflow_lite_benchmark_firebase_BenchmarkModel_nativeRun(
@ -263,6 +261,4 @@ Java_org_tensorflow_lite_benchmark_firebase_BenchmarkModel_nativeRun(
env->ReleaseStringUTFChars(library_dir, lib_dir);
}
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus