Re: gnunet_container_lib.h incompatible with C++ in GNUnet 0.19.0

Martin Schanzenbach <[email protected]> Fri, 9 Dec 2022 10:50:08 +0900
Newsgroups gmane.network.gnunet.bugs
Message-ID <20221209015008.z7nfua5xabfkby3r@werkbank>
--r2t5o26bdz6hzrza
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hi Martin,

On 08.12.22 16:38, marty1885 wrote:
> Hi,
>=20
> Nice for releasing GNUnet 0.19.0. I've upgraded and find my C++ programs =
fails to compile against the new headers. After some debugging the root cau=
se is a (I assume) failed attempt at completing removing `extern "C"` guard=
s in `gnunet_container_lib.h`. Seems the top half of the guard is removed b=
ut the bottom half isn't. Leading to an error when including any headers th=
at uses that file from C++. For example the following simple program fails =
to compile.
>=20
> I have scanned through the GNUnet website and not sure how to contribute =
my fix. The "development tutorial" page (https://docs.gnunet.org/tutorial/t=
utorial.html) is broken on the website. The website also mentioned needing =
to sign copyright assignment? What exactly should I do?
>=20

The correct link is https://docs.gnunet.org/developers/tutorial.html. I
will fix that.
Regarding the copyright assignment: Yes, in order to get git privileges
in order to contribute significant functionality and code you need to
sign the CA PDF: https://www.gnunet.org/en/copyright.html
And then send the original to GNUnet e.V. (you can get the address by
emailing [email protected]).

For minor contributions such as your fix below you can simply post it to
[email protected] .
I already fixed the issue the issue now so that is for future patches.

> #include <gnunet/gnunet_core_service.h>
>=20
> int main()
> {
>     reutrn 0;
> }
>=20
> Compiling with g++ leads to the following error:
>=20
> =E2=9D=AF g++ simple.cpp
> In file included from simple.cpp:1:
> /usr/include/gnunet/gnunet_core_service.h:440:1: error: expected declarat=
ion before =E2=80=98}=E2=80=99 token
>   440 | }
>       | ^
>=20
> And following patch fixes it.
>=20
> --- /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.55405=
5321 +0800
> @@ -2328,15 +2328,6 @@
>  GNUNET_CONTAINER_heap_update_cost (struct GNUNET_CONTAINER_HeapNode *nod=
e,
>                                     GNUNET_CONTAINER_HeapCostType new_cos=
t);
> =20
> -
> -#if 0 /* keep Emacsens' auto-indent happy */
> -{
> -#endif
> -#ifdef __cplusplus
> -}
> -#endif
> -
> -
>  /* ifndef GNUNET_CONTAINER_LIB_H */
>  #endif
> =20

You are right that fixes it. But it was never my intention to remove the
guard anyway. I added it back. Thanks for spotting this! Will release .1
soon (TM).

BR
Martin

> Best,
> Martin
>=20

--r2t5o26bdz6hzrza
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEPREGPBD5jRS9JNFHCwmY74b1m2oFAmOSlFAACgkQCwmY74b1
m2pF8Q//YHH+37FFx/KiLBQOK7emsXgq37VY7ldO6iuMykiPICEHyFMIV5Ejzdvq
zi+CneYGcoOQL2KpkJE5cGsCkSLjvkmuGK5CqSF3kV5xfxFILgMvTy394Xfpvenn
iUr5252nhuR3GPw/+tYHFxdq479K6t4gqrIhyND4h3ZDm3aexv7Kdk6C8r9Al+6c
o0r1m1DWktvOXLdqyVb65pNp8RbSGmgRzGPrZ8xv6AEQmx9G2V8RIf8Ti2KvlI5i
BUib/XhuXHTanJuOZVEYVPz17wNCqw4Qg4aa8PkivO5b8LdbcqNhxWusI9lwPpC+
vlvtADg3/9LBX1J7czWYs5SvLrKD/AKEFqLoTY6g/37ayd+Ssg8p8ZEnmcNVqRDm
k/nI0qPGz03MGt50V285mPsxJGyagjOVeohPSDhnCSqxyhaNYv93dbTASa9oeIW3
D3WA/mk8gh/c9kfZ1AsR/Z1R7ahLjfQi6VKSoMUREGiJm5Nb92i2LREOhlGIZ5rs
h5rETwXpQkz+hPufOUytk1kHNLaKlktjHOnTBr8d3Bhz1vKJh3Ld3bBBzEQYMMMu
fD2OHBs3V6J05rqZucAe8SEFK5N1OAum1xEa9RFmA73VUB6MsBTe3x5vJ/xSzWP/
POLKE6mwsf+mjUgUsQdoiEJfYzERVeViFVNC81lJoi3OuV9gLWA=
=9xc8
-----END PGP SIGNATURE-----

--r2t5o26bdz6hzrza--