xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [Xen-devel] [PATCH] tools/ocaml: Fix build error with Arch Linux
@ 2019-10-25 23:21 Petre Pircalabu
  2019-10-28 14:33 ` Anthony PERARD
  0 siblings, 1 reply; 4+ messages in thread
From: Petre Pircalabu @ 2019-10-25 23:21 UTC (permalink / raw)
  To: xen-devel
  Cc: Petre Pircalabu, Ian Jackson, Christian Lindig, Wei Liu, David Scott

gcc (GCC) 9.2.0 complains:

xentoollog_stubs.c: In function ‘stub_xtl_ocaml_vmessage’:
xentoollog_stubs.c:93:16: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
   93 |  value *func = caml_named_value(xtl->vmessage_cb) ;
      |                ^~~~~~~~~~~~~~~~

Signed-off-by: Petre Pircalabu <ppircalabu@bitdefender.com>
---
 tools/ocaml/libs/xentoollog/xentoollog_stubs.c |  4 ++--
 tools/ocaml/libs/xl/xenlight_stubs.c           | 20 ++++++++++----------
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/tools/ocaml/libs/xentoollog/xentoollog_stubs.c b/tools/ocaml/libs/xentoollog/xentoollog_stubs.c
index aadc3d1..1f73f26 100644
--- a/tools/ocaml/libs/xentoollog/xentoollog_stubs.c
+++ b/tools/ocaml/libs/xentoollog/xentoollog_stubs.c
@@ -90,7 +90,7 @@ static void stub_xtl_ocaml_vmessage(struct xentoollog_logger *logger,
 	CAMLparam0();
 	CAMLlocalN(args, 4);
 	struct caml_xtl *xtl = (struct caml_xtl*)logger;
-	value *func = caml_named_value(xtl->vmessage_cb) ;
+	const value *func = caml_named_value(xtl->vmessage_cb) ;
 	char *msg;
 
 	if (func == NULL)
@@ -120,7 +120,7 @@ static void stub_xtl_ocaml_progress(struct xentoollog_logger *logger,
 	CAMLparam0();
 	CAMLlocalN(args, 5);
 	struct caml_xtl *xtl = (struct caml_xtl*)logger;
-	value *func = caml_named_value(xtl->progress_cb) ;
+	const value *func = caml_named_value(xtl->progress_cb) ;
 
 	if (func == NULL)
 		caml_raise_sys_error(caml_copy_string("Unable to find callback"));
diff --git a/tools/ocaml/libs/xl/xenlight_stubs.c b/tools/ocaml/libs/xl/xenlight_stubs.c
index ff16b87..1181971 100644
--- a/tools/ocaml/libs/xl/xenlight_stubs.c
+++ b/tools/ocaml/libs/xl/xenlight_stubs.c
@@ -75,7 +75,7 @@ static void failwith_xl(int error, char *fname)
 {
 	CAMLparam0();
 	CAMLlocal1(arg);
-	static value *exc = NULL;
+	static const value *exc = NULL;
 
 	/* First time around, lookup by name */
 	if (!exc)
@@ -424,7 +424,7 @@ void async_callback(libxl_ctx *ctx, int rc, void *for_callback)
 	caml_leave_blocking_section();
 	CAMLparam0();
 	CAMLlocal2(error, tmp);
-	static value *func = NULL;
+	static const value *func = NULL;
 	value *p = (value *) for_callback;
 
 	if (func == NULL) {
@@ -1133,7 +1133,7 @@ value stub_libxl_xen_console_read_start(value ctx, value clear)
 
 static void raise_eof(void)
 {
-	static value *exc = NULL;
+	static const value *exc = NULL;
 
 	/* First time around, lookup by name */
 	if (!exc)
@@ -1274,7 +1274,7 @@ int fd_register(void *user, int fd, void **for_app_registration_out,
 	CAMLparam0();
 	CAMLlocalN(args, 4);
 	int ret = 0;
-	static value *func = NULL;
+	static const value *func = NULL;
 	value *p = (value *) user;
 	value *for_app;
 
@@ -1317,7 +1317,7 @@ int fd_modify(void *user, int fd, void **for_app_registration_update,
 	CAMLparam0();
 	CAMLlocalN(args, 4);
 	int ret = 0;
-	static value *func = NULL;
+	static const value *func = NULL;
 	value *p = (value *) user;
 	value *for_app = *for_app_registration_update;
 
@@ -1356,7 +1356,7 @@ void fd_deregister(void *user, int fd, void *for_app_registration)
 	caml_leave_blocking_section();
 	CAMLparam0();
 	CAMLlocalN(args, 3);
-	static value *func = NULL;
+	static const value *func = NULL;
 	value *p = (value *) user;
 	value *for_app = for_app_registration;
 
@@ -1398,7 +1398,7 @@ int timeout_register(void *user, void **for_app_registration_out,
 	CAMLlocal2(sec, usec);
 	CAMLlocalN(args, 4);
 	int ret = 0;
-	static value *func = NULL;
+	static const value *func = NULL;
 	value *p = (value *) user;
 	struct timeout_handles *handles;
 
@@ -1450,7 +1450,7 @@ int timeout_modify(void *user, void **for_app_registration_update,
 	CAMLlocal1(for_app_update);
 	CAMLlocalN(args, 2);
 	int ret = 0;
-	static value *func = NULL;
+	static const value *func = NULL;
 	value *p = (value *) user;
 	struct timeout_handles *handles = *for_app_registration_update;
 
@@ -1566,7 +1566,7 @@ void event_occurs(void *user, libxl_event *event)
 	CAMLparam0();
 	CAMLlocalN(args, 2);
 	struct user_with_ctx *c_user = (struct user_with_ctx *) user;
-	static value *func = NULL;
+	static const value *func = NULL;
 
 	if (func == NULL) {
 		/* First time around, lookup by name */
@@ -1589,7 +1589,7 @@ void disaster(void *user, libxl_event_type type,
 	CAMLparam0();
 	CAMLlocalN(args, 4);
 	struct user_with_ctx *c_user = (struct user_with_ctx *) user;
-	static value *func = NULL;
+	static const value *func = NULL;
 
 	if (func == NULL) {
 		/* First time around, lookup by name */
-- 
2.7.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Xen-devel] [PATCH] tools/ocaml: Fix build error with Arch Linux
  2019-10-25 23:21 [Xen-devel] [PATCH] tools/ocaml: Fix build error with Arch Linux Petre Pircalabu
@ 2019-10-28 14:33 ` Anthony PERARD
  2019-10-28 15:28   ` Jürgen Groß
  2019-10-28 16:35   ` Petre Ovidiu PIRCALABU
  0 siblings, 2 replies; 4+ messages in thread
From: Anthony PERARD @ 2019-10-28 14:33 UTC (permalink / raw)
  To: Petre Pircalabu
  Cc: Jürgen Groß,
	Wei Liu, Ian Jackson, Christian Lindig, David Scott, xen-devel

On Sat, Oct 26, 2019 at 02:21:10AM +0300, Petre Pircalabu wrote:
> gcc (GCC) 9.2.0 complains:
> 
> xentoollog_stubs.c: In function ‘stub_xtl_ocaml_vmessage’:
> xentoollog_stubs.c:93:16: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
>    93 |  value *func = caml_named_value(xtl->vmessage_cb) ;
>       |                ^~~~~~~~~~~~~~~~

Hi Petre,

Thanks for the patch, it looks fine. However it would be nice to add
some more context on why gcc complains. A quick search seems to lead to
https://github.com/ocaml/ocaml/commit/4f03a1467d29cf587df5a191830f1525506ee0e3
    "Make caml_named_value return a const value*"
which change the prototype of caml_named_value.

With the commit message changed:
Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>

CC Jürgen, I think it would be nice to have the build fix in the
release.

Cheers.


> Signed-off-by: Petre Pircalabu <ppircalabu@bitdefender.com>
> ---
>  tools/ocaml/libs/xentoollog/xentoollog_stubs.c |  4 ++--
>  tools/ocaml/libs/xl/xenlight_stubs.c           | 20 ++++++++++----------
>  2 files changed, 12 insertions(+), 12 deletions(-)
> 
> diff --git a/tools/ocaml/libs/xentoollog/xentoollog_stubs.c b/tools/ocaml/libs/xentoollog/xentoollog_stubs.c
> index aadc3d1..1f73f26 100644
> --- a/tools/ocaml/libs/xentoollog/xentoollog_stubs.c
> +++ b/tools/ocaml/libs/xentoollog/xentoollog_stubs.c
> @@ -90,7 +90,7 @@ static void stub_xtl_ocaml_vmessage(struct xentoollog_logger *logger,
>  	CAMLparam0();
>  	CAMLlocalN(args, 4);
>  	struct caml_xtl *xtl = (struct caml_xtl*)logger;
> -	value *func = caml_named_value(xtl->vmessage_cb) ;
> +	const value *func = caml_named_value(xtl->vmessage_cb) ;
>  	char *msg;
>  
>  	if (func == NULL)
> @@ -120,7 +120,7 @@ static void stub_xtl_ocaml_progress(struct xentoollog_logger *logger,
>  	CAMLparam0();
>  	CAMLlocalN(args, 5);
>  	struct caml_xtl *xtl = (struct caml_xtl*)logger;
> -	value *func = caml_named_value(xtl->progress_cb) ;
> +	const value *func = caml_named_value(xtl->progress_cb) ;
>  
>  	if (func == NULL)
>  		caml_raise_sys_error(caml_copy_string("Unable to find callback"));
> diff --git a/tools/ocaml/libs/xl/xenlight_stubs.c b/tools/ocaml/libs/xl/xenlight_stubs.c
> index ff16b87..1181971 100644
> --- a/tools/ocaml/libs/xl/xenlight_stubs.c
> +++ b/tools/ocaml/libs/xl/xenlight_stubs.c
> @@ -75,7 +75,7 @@ static void failwith_xl(int error, char *fname)
>  {
>  	CAMLparam0();
>  	CAMLlocal1(arg);
> -	static value *exc = NULL;
> +	static const value *exc = NULL;
>  
>  	/* First time around, lookup by name */
>  	if (!exc)
> @@ -424,7 +424,7 @@ void async_callback(libxl_ctx *ctx, int rc, void *for_callback)
>  	caml_leave_blocking_section();
>  	CAMLparam0();
>  	CAMLlocal2(error, tmp);
> -	static value *func = NULL;
> +	static const value *func = NULL;
>  	value *p = (value *) for_callback;
>  
>  	if (func == NULL) {
> @@ -1133,7 +1133,7 @@ value stub_libxl_xen_console_read_start(value ctx, value clear)
>  
>  static void raise_eof(void)
>  {
> -	static value *exc = NULL;
> +	static const value *exc = NULL;
>  
>  	/* First time around, lookup by name */
>  	if (!exc)
> @@ -1274,7 +1274,7 @@ int fd_register(void *user, int fd, void **for_app_registration_out,
>  	CAMLparam0();
>  	CAMLlocalN(args, 4);
>  	int ret = 0;
> -	static value *func = NULL;
> +	static const value *func = NULL;
>  	value *p = (value *) user;
>  	value *for_app;
>  
> @@ -1317,7 +1317,7 @@ int fd_modify(void *user, int fd, void **for_app_registration_update,
>  	CAMLparam0();
>  	CAMLlocalN(args, 4);
>  	int ret = 0;
> -	static value *func = NULL;
> +	static const value *func = NULL;
>  	value *p = (value *) user;
>  	value *for_app = *for_app_registration_update;
>  
> @@ -1356,7 +1356,7 @@ void fd_deregister(void *user, int fd, void *for_app_registration)
>  	caml_leave_blocking_section();
>  	CAMLparam0();
>  	CAMLlocalN(args, 3);
> -	static value *func = NULL;
> +	static const value *func = NULL;
>  	value *p = (value *) user;
>  	value *for_app = for_app_registration;
>  
> @@ -1398,7 +1398,7 @@ int timeout_register(void *user, void **for_app_registration_out,
>  	CAMLlocal2(sec, usec);
>  	CAMLlocalN(args, 4);
>  	int ret = 0;
> -	static value *func = NULL;
> +	static const value *func = NULL;
>  	value *p = (value *) user;
>  	struct timeout_handles *handles;
>  
> @@ -1450,7 +1450,7 @@ int timeout_modify(void *user, void **for_app_registration_update,
>  	CAMLlocal1(for_app_update);
>  	CAMLlocalN(args, 2);
>  	int ret = 0;
> -	static value *func = NULL;
> +	static const value *func = NULL;
>  	value *p = (value *) user;
>  	struct timeout_handles *handles = *for_app_registration_update;
>  
> @@ -1566,7 +1566,7 @@ void event_occurs(void *user, libxl_event *event)
>  	CAMLparam0();
>  	CAMLlocalN(args, 2);
>  	struct user_with_ctx *c_user = (struct user_with_ctx *) user;
> -	static value *func = NULL;
> +	static const value *func = NULL;
>  
>  	if (func == NULL) {
>  		/* First time around, lookup by name */
> @@ -1589,7 +1589,7 @@ void disaster(void *user, libxl_event_type type,
>  	CAMLparam0();
>  	CAMLlocalN(args, 4);
>  	struct user_with_ctx *c_user = (struct user_with_ctx *) user;
> -	static value *func = NULL;
> +	static const value *func = NULL;
>  
>  	if (func == NULL) {
>  		/* First time around, lookup by name */
> -- 
> 2.7.4
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xenproject.org
> https://lists.xenproject.org/mailman/listinfo/xen-devel

-- 
Anthony PERARD

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Xen-devel] [PATCH] tools/ocaml: Fix build error with Arch Linux
  2019-10-28 14:33 ` Anthony PERARD
@ 2019-10-28 15:28   ` Jürgen Groß
  2019-10-28 16:35   ` Petre Ovidiu PIRCALABU
  1 sibling, 0 replies; 4+ messages in thread
From: Jürgen Groß @ 2019-10-28 15:28 UTC (permalink / raw)
  To: Anthony PERARD, Petre Pircalabu
  Cc: xen-devel, Ian Jackson, Christian Lindig, Wei Liu, David Scott

On 28.10.19 15:33, Anthony PERARD wrote:
> On Sat, Oct 26, 2019 at 02:21:10AM +0300, Petre Pircalabu wrote:
>> gcc (GCC) 9.2.0 complains:
>>
>> xentoollog_stubs.c: In function ‘stub_xtl_ocaml_vmessage’:
>> xentoollog_stubs.c:93:16: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
>>     93 |  value *func = caml_named_value(xtl->vmessage_cb) ;
>>        |                ^~~~~~~~~~~~~~~~
> 
> Hi Petre,
> 
> Thanks for the patch, it looks fine. However it would be nice to add
> some more context on why gcc complains. A quick search seems to lead to
> https://github.com/ocaml/ocaml/commit/4f03a1467d29cf587df5a191830f1525506ee0e3
>      "Make caml_named_value return a const value*"
> which change the prototype of caml_named_value.
> 
> With the commit message changed:
> Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
> 
> CC Jürgen, I think it would be nice to have the build fix in the
> release.
> 
> Cheers.
> 
> 
>> Signed-off-by: Petre Pircalabu <ppircalabu@bitdefender.com>

Release-acked-by: Juergen Gross <jgross@suse.com>


Juergen


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Xen-devel] [PATCH] tools/ocaml: Fix build error with Arch Linux
  2019-10-28 14:33 ` Anthony PERARD
  2019-10-28 15:28   ` Jürgen Groß
@ 2019-10-28 16:35   ` Petre Ovidiu PIRCALABU
  1 sibling, 0 replies; 4+ messages in thread
From: Petre Ovidiu PIRCALABU @ 2019-10-28 16:35 UTC (permalink / raw)
  To: Anthony PERARD
  Cc: Jürgen Groß,
	Wei Liu, Ian Jackson, Christian Lindig, David Scott, xen-devel

On Mon, 2019-10-28 at 14:33 +0000, Anthony PERARD wrote:
> On Sat, Oct 26, 2019 at 02:21:10AM +0300, Petre Pircalabu wrote:
> > gcc (GCC) 9.2.0 complains:
> > 
> > xentoollog_stubs.c: In function ‘stub_xtl_ocaml_vmessage’:
> > xentoollog_stubs.c:93:16: error: initialization discards ‘const’
> > qualifier from pointer target type [-Werror=discarded-qualifiers]
> >    93 |  value *func = caml_named_value(xtl->vmessage_cb) ;
> >       |                ^~~~~~~~~~~~~~~~
> 
> Hi Petre,
> 
> Thanks for the patch, it looks fine. However it would be nice to add
> some more context on why gcc complains. A quick search seems to lead
> to
> 
https://github.com/ocaml/ocaml/commit/4f03a1467d29cf587df5a191830f1525506ee0e3
>     "Make caml_named_value return a const value*"
> which change the prototype of caml_named_value.
> 
> With the commit message changed:
> Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>
> 
> CC Jürgen, I think it would be nice to have the build fix in the
> release.
> 
> Cheers.
> 

Thank you very much for your input. I will modify the commit message
and send a v2 version of this patch.

Best regards,
Petre

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-10-28 16:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-25 23:21 [Xen-devel] [PATCH] tools/ocaml: Fix build error with Arch Linux Petre Pircalabu
2019-10-28 14:33 ` Anthony PERARD
2019-10-28 15:28   ` Jürgen Groß
2019-10-28 16:35   ` Petre Ovidiu PIRCALABU

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).