[Libosinfo] [PATCH] Drop redundant 'const' keyword from object parameters
Christophe Fergeau
cfergeau at redhat.com
Thu Nov 16 09:16:22 UTC 2017
Hey,
On Sun, Nov 12, 2017 at 05:04:19PM +0100, Zeeshan Ali wrote:
> Use of 'const' parameter on object parameters is redundant, inconsistent
> (both internally and against other GObject libraries) and currently breaks
> the low-level Rust binding generator:
>
> https://github.com/gtk-rs/glib/pull/249
Could the Rust binding generator be fixed to cope with that instead?
It's definitely not used consistently, but removing a 'const' from
external API is going to cause breakage in C++ code:
extern "C" {
#include <osinfo/osinfo_datamap.h>
#include <osinfo/osinfo_entity.h>
#include <osinfo/osinfo_install_config.h>
#include <osinfo/osinfo_install_config_paramlist.h>
#include <osinfo/osinfo_install_script.h>
}
int main(void)
{
const OsinfoInstallScript *script;
osinfo_install_script_get_config_param(script, "");
return 0;
}
$ LC_ALL=C g++ $(pkg-config --cflags --libs libosinfo-1.0) ./osinfo.cpp
./osinfo.cpp: In function 'int main()':
./osinfo.cpp:12:58: error: invalid conversion from 'const OsinfoInstallScript* {aka const _OsinfoInstallScript*}' to 'OsinfoInstallScript* {aka _OsinfoInstallScript*}' [-fpermissive]
osinfo_install_script_get_config_param(script, "");
In file included from ./osinfo.cpp:6:0:
/usr/include/libosinfo-1.0/osinfo/osinfo_install_script.h:246:27: note: initializing argument 1 of 'OsinfoInstallConfigParam* osinfo_install_script_get_config_param(OsinfoInstallScript*, const gchar*)'
OsinfoInstallConfigParam *osinfo_install_script_get_config_param(OsinfoInstallScript *script, const gchar *name);
Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libosinfo/attachments/20171116/b2133e2a/attachment.sig>
More information about the Libosinfo
mailing list