gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnunet] branch master updated: build: Fix various constructor-related r


From: gnunet
Subject: [gnunet] branch master updated: build: Fix various constructor-related regressions
Date: Mon, 09 Sep 2024 14:06:37 +0200

This is an automated email from the git hooks/post-receive script.

martin-schanzenbach pushed a commit to branch master
in repository gnunet.

The following commit(s) were added to refs/heads/master by this push:
     new ec99272f1 build: Fix various constructor-related regressions
ec99272f1 is described below

commit ec99272f13147b2b82117d3e53c3120e2d708a67
Author: Martin Schanzenbach <schanzen@gnunet.org>
AuthorDate: Mon Sep 9 14:06:18 2024 +0200

    build: Fix various constructor-related regressions
---
 src/cli/nat-auto/gnunet-nat-server.c               |  2 +-
 src/include/gnunet_program_lib.h                   |  2 +-
 src/lib/curl/Makefile.am                           |  2 +-
 src/lib/curl/curl.c                                | 15 +++++---
 src/lib/curl/curl_internal.h                       | 40 ++++++++++++++++++++++
 src/lib/curl/curl_reschedule.c                     |  6 +---
 src/lib/gnsrecord/gnsrecord.c                      |  6 ++--
 src/lib/util/common_logging.c                      | 13 ++++---
 src/lib/util/crypto_elligator.c                    |  6 ++--
 src/lib/util/crypto_random.c                       | 10 ++++--
 src/lib/util/time.c                                |  6 ++--
 src/service/reclaim/reclaim_credential.c           |  6 ++--
 src/service/revocation/gnunet-service-revocation.c |  2 +-
 src/service/util/gnunet-service-resolver.c         |  2 +-
 14 files changed, 88 insertions(+), 30 deletions(-)

diff --git a/src/cli/nat-auto/gnunet-nat-server.c 
b/src/cli/nat-auto/gnunet-nat-server.c
index ab2e8b829..baa610e8f 100644
--- a/src/cli/nat-auto/gnunet-nat-server.c
+++ b/src/cli/nat-auto/gnunet-nat-server.c
@@ -388,7 +388,7 @@ GNUNET_SERVICE_MAIN
 /**
  * MINIMIZE heap size (way below 128k) since this process doesn't need much.
  */
-static void __attribute__ ((constructor))
+void __attribute__ ((constructor))
 GNUNET_ARM_memory_init ()
 {
   mallopt (M_TRIM_THRESHOLD, 4 * 1024);
diff --git a/src/include/gnunet_program_lib.h b/src/include/gnunet_program_lib.h
index 54dcbaac7..9b8479e67 100644
--- a/src/include/gnunet_program_lib.h
+++ b/src/include/gnunet_program_lib.h
@@ -160,7 +160,7 @@ GNUNET_PROGRAM_monolith_main (int argc,
         }
 #else
 #define GNUNET_DAEMON_MAIN(daemon_name, daemon_help, init_cb)  \
-        static int __attribute__ ((constructor)) \
+        int __attribute__ ((constructor)) \
         init (void) \
         { \
           return GNUNET_DAEMON_register (daemon_name, \
diff --git a/src/lib/curl/Makefile.am b/src/lib/curl/Makefile.am
index 78eae4b97..8c0f31f2b 100644
--- a/src/lib/curl/Makefile.am
+++ b/src/lib/curl/Makefile.am
@@ -14,7 +14,7 @@ libgnunetcurl_la_LDFLAGS = \
   -version-info 0:0:0 \
   -no-undefined
 libgnunetcurl_la_SOURCES = \
-  curl.c \
+  curl.c curl_internal.h \
   curl_reschedule.c
 libgnunetcurl_la_LIBADD = \
   $(top_builddir)/src/lib/util/libgnunetutil.la \
diff --git a/src/lib/curl/curl.c b/src/lib/curl/curl.c
index 80ff1f179..8a87f4091 100644
--- a/src/lib/curl/curl.c
+++ b/src/lib/curl/curl.c
@@ -27,6 +27,7 @@
 #include <jansson.h>
 #include <microhttpd.h>
 #include "gnunet_curl_lib.h"
+#include "curl_internal.h"
 
 #if ENABLE_BENCHMARK
 #include "../util/benchmark.h"
@@ -682,7 +683,7 @@ GNUNET_CURL_download_get_result_ (struct 
GNUNET_CURL_DownloadBuffer *db,
        (but keep response code) */
     if (0 != db->buf_size)
     {
-      char *url;
+      const char *url;
 
       if (CURLE_OK !=
           curl_easy_getinfo (eh,
@@ -698,7 +699,7 @@ GNUNET_CURL_download_get_result_ (struct 
GNUNET_CURL_DownloadBuffer *db,
   }
   if (0 == *response_code)
   {
-    char *url;
+    const char *url;
 
     if (CURLE_OK !=
         curl_easy_getinfo (eh,
@@ -800,7 +801,7 @@ GNUNET_CURL_perform2 (struct GNUNET_CURL_Context *ctx,
       rc (response);
     }
     {
-      char *url = NULL;
+      const char *url = NULL;
 
       if (CURLE_UNKNOWN_OPTION ==
           curl_easy_getinfo (job->easy_handle,
@@ -878,11 +879,13 @@ GNUNET_CURL_fini (struct GNUNET_CURL_Context *ctx)
   GNUNET_free (ctx);
 }
 
+void
+GNUNET_CURL_constructor__ (void);
 
 /**
  * Initial global setup logic, specifically runs the Curl setup.
  */
-__attribute__ ((constructor)) void
+void __attribute__ ((constructor)) 
 GNUNET_CURL_constructor__ (void)
 {
   CURLcode ret;
@@ -896,11 +899,13 @@ GNUNET_CURL_constructor__ (void)
   }
 }
 
+void
+GNUNET_CURL_destructor__ (void);
 
 /**
  * Cleans up after us, specifically runs the Curl cleanup.
  */
-__attribute__ ((destructor)) void
+void __attribute__ ((destructor))
 GNUNET_CURL_destructor__ (void)
 {
   if (curl_fail)
diff --git a/src/lib/curl/curl_internal.h b/src/lib/curl/curl_internal.h
new file mode 100644
index 000000000..a72960636
--- /dev/null
+++ b/src/lib/curl/curl_internal.h
@@ -0,0 +1,40 @@
+/*
+   This file is part of GNUnet
+   Copyright (C) 2024 GNUnet e.V.
+
+   GNUnet is free software: you can redistribute it and/or modify it
+   under the terms of the GNU Affero General Public License as published
+   by the Free Software Foundation, either version 3 of the License,
+   or (at your option) any later version.
+
+   GNUnet is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Affero General Public License for more details.
+
+   You should have received a copy of the GNU Affero General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+     SPDX-License-Identifier: AGPL3.0-or-later
+ */
+
+#ifndef GNUNETCURL_H
+#define GNUNETCURL_H
+
+/**
+ * @file curl/curl.h
+ * @brief API for downloading JSON via CURL
+ * @author Sree Harsha Totakura <sreeharsha@totakura.in>
+ * @author Christian Grothoff
+ */
+#include "platform.h"
+#include <jansson.h>
+#include <microhttpd.h>
+#include "gnunet_curl_lib.h"
+
+void *
+GNUNET_CURL_download_get_result_ (struct GNUNET_CURL_DownloadBuffer *db,
+                                  CURL *eh,
+                                  long *response_code);
+
+#endif
diff --git a/src/lib/curl/curl_reschedule.c b/src/lib/curl/curl_reschedule.c
index 0c19bd171..3e19391ab 100644
--- a/src/lib/curl/curl_reschedule.c
+++ b/src/lib/curl/curl_reschedule.c
@@ -26,11 +26,7 @@
 #include <jansson.h>
 #include "gnunet_curl_lib.h"
 #include "gnunet_util_lib.h"
-
-extern void *
-GNUNET_CURL_download_get_result_ (struct GNUNET_CURL_DownloadBuffer *db,
-                                  CURL *eh,
-                                  long *response_code);
+#include "curl_internal.h"
 
 /**
  * Closure for #GNUNET_CURL_gnunet_scheduler_reschedule().
diff --git a/src/lib/gnsrecord/gnsrecord.c b/src/lib/gnsrecord/gnsrecord.c
index bd048171e..c94b2298a 100644
--- a/src/lib/gnsrecord/gnsrecord.c
+++ b/src/lib/gnsrecord/gnsrecord.c
@@ -107,12 +107,14 @@ init ()
                                      NULL);
 }
 
+void
+GNSRECORD_fini (void);
 
 /**
  * Dual function to #init().
  */
-static void __attribute__ ((destructor))
-GNSRECORD_fini ()
+void __attribute__ ((destructor))
+GNSRECORD_fini (void)
 {
   struct Plugin *plugin;
   const struct GNUNET_OS_ProjectData *pd = GNUNET_OS_project_data_get ();
diff --git a/src/lib/util/common_logging.c b/src/lib/util/common_logging.c
index e08b6b6fe..fb3db70db 100644
--- a/src/lib/util/common_logging.c
+++ b/src/lib/util/common_logging.c
@@ -1564,22 +1564,27 @@ GNUNET_print_bytes (const void *buf, size_t buf_len, 
int fold, int in_be)
   printf ("\n");
 }
 
+void
+GNUNET_util_cl_init (void);
 
 /**
  * Initializer
  */
-static void __attribute__ ((constructor))
-GNUNET_util_cl_init ()
+void __attribute__ ((constructor))
+GNUNET_util_cl_init (void)
 {
   GNUNET_stderr = stderr;
 }
 
 
+void
+GNUNET_util_cl_fini (void);
+
 /**
  * Destructor
  */
-static void __attribute__ ((destructor))
-GNUNET_util_cl_fini ()
+void __attribute__ ((destructor))
+GNUNET_util_cl_fini (void)
 {
 
 }
diff --git a/src/lib/util/crypto_elligator.c b/src/lib/util/crypto_elligator.c
index 87a41260a..0e9a6ab8b 100644
--- a/src/lib/util/crypto_elligator.c
+++ b/src/lib/util/crypto_elligator.c
@@ -218,12 +218,14 @@ encode_bytes (uint8_t *bytes, mp_limb_t *number)
   }
 }
 
+void
+GNUNET_CRYPTO_ecdhe_elligator_initialize (void);
 
 /**
  * Initialize elligator scratch space.
 */
-static void __attribute__ ((constructor))
-GNUNET_CRYPTO_ecdhe_elligator_initialize ()
+void __attribute__ ((constructor))
+GNUNET_CRYPTO_ecdhe_elligator_initialize (void)
 {
   static bool initialized = false;
 
diff --git a/src/lib/util/crypto_random.c b/src/lib/util/crypto_random.c
index 064722906..b7d177c22 100644
--- a/src/lib/util/crypto_random.c
+++ b/src/lib/util/crypto_random.c
@@ -356,11 +356,13 @@ w_check (const void *p)
   return 0; /* not secure memory */
 }
 
+void
+GNUNET_CRYPTO_random_init (void);
 
 /**
  * Initialize libgcrypt.
  */
-static void __attribute__ ((constructor))
+void __attribute__ ((constructor))
 GNUNET_CRYPTO_random_init ()
 {
   gcry_error_t rc;
@@ -395,12 +397,14 @@ GNUNET_CRYPTO_random_init ()
     ^ GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, UINT32_MAX));
 }
 
+void
+GNUNET_CRYPTO_random_fini (void);
 
 /**
  * Nicely shut down libgcrypt.
  */
-static void __attribute__ ((destructor))
-GNUNET_CRYPTO_random_fini ()
+void __attribute__ ((destructor))
+GNUNET_CRYPTO_random_fini (void)
 {
   gcry_set_progress_handler (NULL, NULL);
 #ifdef GCRYCTL_CLOSE_RANDOM_DEVICE
diff --git a/src/lib/util/time.c b/src/lib/util/time.c
index 63e0ac0c0..aec4ded4f 100644
--- a/src/lib/util/time.c
+++ b/src/lib/util/time.c
@@ -979,12 +979,14 @@ GNUNET_TIME_absolute_get_monotonic (
   return now;
 }
 
+void
+GNUNET_util_time_fini (void);
 
 /**
  * Destructor
  */
-static void __attribute__ ((destructor))
-GNUNET_util_time_fini ()
+void __attribute__ ((destructor))
+GNUNET_util_time_fini (void)
 {
   (void) GNUNET_TIME_absolute_get_monotonic (NULL);
 }
diff --git a/src/service/reclaim/reclaim_credential.c 
b/src/service/reclaim/reclaim_credential.c
index 082638866..1c28f9e68 100644
--- a/src/service/reclaim/reclaim_credential.c
+++ b/src/service/reclaim/reclaim_credential.c
@@ -102,12 +102,14 @@ init ()
                                      NULL);
 }
 
+void
+RECLAIM_CREDENTIAL_fini (void);
 
 /**
  * Dual function to #init().
  */
-static void __attribute__ ((destructor))
-RECLAIM_CREDENTIAL_fini ()
+void __attribute__ ((destructor))
+RECLAIM_CREDENTIAL_fini (void)
 {
   struct Plugin *plugin;
   const struct GNUNET_OS_ProjectData *pd = GNUNET_OS_project_data_get ();
diff --git a/src/service/revocation/gnunet-service-revocation.c 
b/src/service/revocation/gnunet-service-revocation.c
index eb4a0477c..1edf30fe9 100644
--- a/src/service/revocation/gnunet-service-revocation.c
+++ b/src/service/revocation/gnunet-service-revocation.c
@@ -1047,7 +1047,7 @@ GNUNET_SERVICE_MAIN
 /**
  * MINIMIZE heap size (way below 128k) since this process doesn't need much.
  */
-static void __attribute__ ((constructor))
+void __attribute__ ((constructor))
 GNUNET_REVOCATION_memory_init ()
 {
   mallopt (M_TRIM_THRESHOLD, 4 * 1024);
diff --git a/src/service/util/gnunet-service-resolver.c 
b/src/service/util/gnunet-service-resolver.c
index 6ff751cef..e70be8f04 100644
--- a/src/service/util/gnunet-service-resolver.c
+++ b/src/service/util/gnunet-service-resolver.c
@@ -1368,7 +1368,7 @@ GNUNET_SERVICE_MAIN (
 /**
  * MINIMIZE heap size (way below 128k) since this process doesn't need much.
  */
-static void __attribute__ ((constructor))
+void __attribute__ ((constructor))
 GNUNET_RESOLVER_memory_init ()
 {
   mallopt (M_TRIM_THRESHOLD, 4 * 1024);

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]