common: compile libtestpoint as C++
authorSimon Marchi <simon.marchi@efficios.com>
Fri, 3 Sep 2021 21:31:29 +0000 (17:31 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 18 Nov 2021 00:00:12 +0000 (19:00 -0500)
Change-Id: I2dae562c4632ea3ecfa1365f573baa6d6ba232bf
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/common/testpoint/Makefile.am
src/common/testpoint/testpoint.c [deleted file]
src/common/testpoint/testpoint.cpp [new file with mode: 0644]

index ef8a2e9cd81d91c77173420d8608c5dea65ccdb1..7fd8ed76e6cf498fb6bcd2e91222edea8b4be4b6 100644 (file)
@@ -2,5 +2,7 @@
 
 noinst_LTLIBRARIES = libtestpoint.la
 
-libtestpoint_la_SOURCES = testpoint.h testpoint.c
+libtestpoint_la_SOURCES = \
+       testpoint.cpp \
+       testpoint.h
 libtestpoint_la_LIBADD = $(DL_LIBS)
diff --git a/src/common/testpoint/testpoint.c b/src/common/testpoint/testpoint.c
deleted file mode 100644 (file)
index c702458..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2012 Christian Babeux <christian.babeux@efficios.com>
- *
- * SPDX-License-Identifier: GPL-2.0-only
- *
- */
-
-#ifndef NTESTPOINT
-
-#define _LGPL_SOURCE
-#include <dlfcn.h>  /* for dlsym   */
-#include <stdlib.h> /* for getenv  */
-#include <string.h> /* for strncmp */
-
-#include "testpoint.h"
-
-/* Environment variable used to enable the testpoints facilities. */
-static const char *lttng_testpoint_env_var = "LTTNG_TESTPOINT_ENABLE";
-
-/* Testpoint toggle flag */
-int lttng_testpoint_activated;
-
-/*
- * Toggle the support for testpoints on the application startup.
- */
-static void __attribute__((constructor)) lttng_testpoint_check(void)
-{
-       char *testpoint_env_val = NULL;
-
-       testpoint_env_val = getenv(lttng_testpoint_env_var);
-       if (testpoint_env_val != NULL
-                       && (strncmp(testpoint_env_val, "1", 1) == 0)) {
-               lttng_testpoint_activated = 1;
-       }
-}
-
-/*
- * Lookup a symbol by name.
- *
- * Return the address where the symbol is loaded or NULL if the symbol was not
- * found.
- */
-void *lttng_testpoint_lookup(const char *name)
-{
-       if (!name) {
-               return NULL;
-       }
-
-       return dlsym(RTLD_DEFAULT, name);
-}
-
-#endif /* NTESTPOINT */
diff --git a/src/common/testpoint/testpoint.cpp b/src/common/testpoint/testpoint.cpp
new file mode 100644 (file)
index 0000000..c702458
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2012 Christian Babeux <christian.babeux@efficios.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0-only
+ *
+ */
+
+#ifndef NTESTPOINT
+
+#define _LGPL_SOURCE
+#include <dlfcn.h>  /* for dlsym   */
+#include <stdlib.h> /* for getenv  */
+#include <string.h> /* for strncmp */
+
+#include "testpoint.h"
+
+/* Environment variable used to enable the testpoints facilities. */
+static const char *lttng_testpoint_env_var = "LTTNG_TESTPOINT_ENABLE";
+
+/* Testpoint toggle flag */
+int lttng_testpoint_activated;
+
+/*
+ * Toggle the support for testpoints on the application startup.
+ */
+static void __attribute__((constructor)) lttng_testpoint_check(void)
+{
+       char *testpoint_env_val = NULL;
+
+       testpoint_env_val = getenv(lttng_testpoint_env_var);
+       if (testpoint_env_val != NULL
+                       && (strncmp(testpoint_env_val, "1", 1) == 0)) {
+               lttng_testpoint_activated = 1;
+       }
+}
+
+/*
+ * Lookup a symbol by name.
+ *
+ * Return the address where the symbol is loaded or NULL if the symbol was not
+ * found.
+ */
+void *lttng_testpoint_lookup(const char *name)
+{
+       if (!name) {
+               return NULL;
+       }
+
+       return dlsym(RTLD_DEFAULT, name);
+}
+
+#endif /* NTESTPOINT */
This page took 0.026813 seconds and 4 git commands to generate.