From patchwork Mon Oct 28 16:38:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Petre Ovidiu PIRCALABU X-Patchwork-Id: 11216069 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 39539112C for ; Mon, 28 Oct 2019 16:40:23 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1C0C820717 for ; Mon, 28 Oct 2019 16:40:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1C0C820717 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=bitdefender.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iP82c-0007yo-Vg; Mon, 28 Oct 2019 16:38:50 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iP82b-0007yg-Pn for xen-devel@lists.xenproject.org; Mon, 28 Oct 2019 16:38:49 +0000 X-Inumbo-ID: 6a5b723c-f9a1-11e9-94fb-12813bfff9fa Received: from mx01.bbu.dsd.mx.bitdefender.com (unknown [91.199.104.161]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 6a5b723c-f9a1-11e9-94fb-12813bfff9fa; Mon, 28 Oct 2019 16:38:48 +0000 (UTC) Received: from smtp.bitdefender.com (smtp02.buh.bitdefender.net [10.17.80.76]) by mx01.bbu.dsd.mx.bitdefender.com (Postfix) with ESMTPS id 821373074839; Mon, 28 Oct 2019 18:38:47 +0200 (EET) Received: from bitdefender.com (unknown [195.189.155.70]) by smtp.bitdefender.com (Postfix) with ESMTPSA id E5008303EF07; Mon, 28 Oct 2019 18:38:46 +0200 (EET) From: Petre Pircalabu To: xen-devel@lists.xenproject.org Date: Mon, 28 Oct 2019 18:38:42 +0200 Message-Id: X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v2] tools/ocaml: Fix build error with Arch Linux X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Petre Pircalabu , Ian Jackson , Christian Lindig , Wei Liu , David Scott Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" 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) ; | ^~~~~~~~~~~~~~~~ This patch constifies the pointer returned by caml_named_value in order to the accommodate newer versions of OCaml. In OCaml >= 4.09 the return value pointer of caml_named_value is declared const. https://github.com/ocaml/ocaml/commit/4f03a1467d29cf587df5a191830f1525506ee0e3 Signed-off-by: Petre Pircalabu Reviewed-by: Anthony PERARD Release-acked-by: Juergen Gross Acked-by: Wei Liu --- 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 */