gnunet_container_lib.h incompatible with C++ in GNUnet 0.19.0

marty1885 <[email protected]> Thu, 08 Dec 2022 16:38:26 +0000
Newsgroups gmane.network.gnunet.bugs
Message-ID <Vp6UUU_sQ9qauFHTOIIApz4rckDZxQr1wR3KKzNIkmHXLLJpd3hieU6xsNO3FClDQV2umcGOT_vaRaCPfhZ4O83zaYNsBCxDJYEOuXEy3OM=@protonmail.com>
Hi,

Nice for releasing GNUnet 0.19.0. I've upgraded and find my C++ programs fa=
ils to compile against the new headers. After some debugging the root cause=
 is a (I assume) failed attempt at completing removing `extern "C"` guards =
in `gnunet_container_lib.h`. Seems the top half of the guard is removed but=
 the bottom half isn't. Leading to an error when including any headers that=
 uses that file from C++. For example the following simple program fails to=
 compile.

I have scanned through the GNUnet website and not sure how to contribute my=
 fix. The "development tutorial" page (https://docs.gnunet.org/tutorial/tut=
orial.html) is broken on the website. The website also mentioned needing to=
 sign copyright assignment? What exactly should I do?

#include <gnunet/gnunet_core_service.h>

int main()
{
    reutrn 0;
}

Compiling with g++ leads to the following error:

=E2=9D=AF g++ simple.cpp
In file included from simple.cpp:1:
/usr/include/gnunet/gnunet_core_service.h:440:1: error: expected declaratio=
n before =E2=80=98}=E2=80=99 token
  440 | }
      | ^

And following patch fixes it.

--- /usr/include/gnunet/gnunet_container_lib.h.old      2022-12-09 00:29:44=
.746504181 +0800
+++ /usr/include/gnunet/gnunet_container_lib.h  2022-12-09 00:29:58.5540553=
21 +0800
@@ -2328,15 +2328,6 @@
 GNUNET_CONTAINER_heap_update_cost (struct GNUNET_CONTAINER_HeapNode *node,
                                    GNUNET_CONTAINER_HeapCostType new_cost)=
;
=20
-
-#if 0 /* keep Emacsens' auto-indent happy */
-{
-#endif
-#ifdef __cplusplus
-}
-#endif
-
-
 /* ifndef GNUNET_CONTAINER_LIB_H */
 #endif
=20
Best,
Martin