[xen master] ocaml: remove undefined behaviour in systemd_stubs.c

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[xen master] ocaml: remove undefined behaviour in systemd_stubs.c

patchbot
commit 6e2a53afa15422ee290663dbb798c085ef7068ed
Author:     Wei Liu <[hidden email]>
AuthorDate: Mon Jul 23 11:26:49 2018 +0100
Commit:     Wei Liu <[hidden email]>
CommitDate: Tue Jul 24 09:16:16 2018 +0100

    ocaml: remove undefined behaviour in systemd_stubs.c
   
    Clang complains:
   
    systemd_stubs.c:51:8: error: shifting a negative signed value is undefined [-Werror,-Wshift-negative-value]
            ret = Val_int(-1U);
                  ^~~~~~~~~~~~
   
    Since sd_notify_fd has a signature of unit -> unit, we simply change
    the return value to Val_unit.
   
    Signed-off-by: Wei Liu <[hidden email]>
    Acked-by: Christian Lindig <[hidden email]>
    Acked-by: Andrew Cooper <[hidden email]>
---
 tools/ocaml/xenstored/systemd_stubs.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/tools/ocaml/xenstored/systemd_stubs.c b/tools/ocaml/xenstored/systemd_stubs.c
index 490156c06a..31a1a5d384 100644
--- a/tools/ocaml/xenstored/systemd_stubs.c
+++ b/tools/ocaml/xenstored/systemd_stubs.c
@@ -32,13 +32,10 @@
 CAMLprim value ocaml_sd_notify_ready(value ignore)
 {
  CAMLparam1(ignore);
- CAMLlocal1(ret);
-
- ret = Val_int(0);
 
  sd_notify(1, "READY=1");
 
- CAMLreturn(ret);
+ CAMLreturn(Val_unit);
 }
 
 #else
@@ -46,10 +43,7 @@ CAMLprim value ocaml_sd_notify_ready(value ignore)
 CAMLprim value ocaml_sd_notify_ready(value ignore)
 {
  CAMLparam1(ignore);
- CAMLlocal1(ret);
-
- ret = Val_int(-1U);
 
- CAMLreturn(ret);
+ CAMLreturn(Val_unit);
 }
 #endif
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
[hidden email]
https://lists.xenproject.org/xen-changelog