All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] tools: fix clang build
@ 2018-07-23 10:26 Wei Liu
  2018-07-23 10:26 ` [PATCH v2 1/2] tools/gdbsx: fix build with clang 3.8 Wei Liu
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Wei Liu @ 2018-07-23 10:26 UTC (permalink / raw)
  To: Xen-devel; +Cc: Wei Liu, Ian Jackson

Wei Liu (2):
  tools/gdbsx: fix build with clang 3.8
  ocaml: remove undefined behaviour in systemd_stubs.c

 tools/debugger/gdbsx/Rules.mk         |  2 ++
 tools/ocaml/xenstored/systemd_stubs.c | 10 ++--------
 2 files changed, 4 insertions(+), 8 deletions(-)

-- 
2.11.0


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

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

* [PATCH v2 1/2] tools/gdbsx: fix build with clang 3.8
  2018-07-23 10:26 [PATCH v2 0/2] tools: fix clang build Wei Liu
@ 2018-07-23 10:26 ` Wei Liu
  2018-07-23 10:26 ` [PATCH v2 2/2] ocaml: remove undefined behaviour in systemd_stubs.c Wei Liu
  2018-07-23 10:32 ` [PATCH v2 0/2] tools: fix clang build Andrew Cooper
  2 siblings, 0 replies; 5+ messages in thread
From: Wei Liu @ 2018-07-23 10:26 UTC (permalink / raw)
  To: Xen-devel; +Cc: Elena Ufimtseva, Wei Liu, Ian Jackson

Currently building gdbsx with clang 3.8 gives the following errors:

xg_main.c:783:17: error: 'aligned' attribute ignored when parsing type [-Werror,-Wignored-attributes]
    iop->uva = (uint64_aligned_t)((unsigned long)tobuf);
                ^~~~~~~~~~~~~~~~
/builds/liuw/xen/tools/debugger/gdbsx/xg/../../../../tools/include/xen/arch-x86/xen-x86_32.h:105:50: note: expanded from macro 'uint64_aligned_t'
                                                 ^~~~~~~~~~
xg_main.c:816:17: error: 'aligned' attribute ignored when parsing type [-Werror,-Wignored-attributes]
    iop->uva = (uint64_aligned_t)((unsigned long)frombuf);
                ^~~~~~~~~~~~~~~~
/builds/liuw/xen/tools/debugger/gdbsx/xg/../../../../tools/include/xen/arch-x86/xen-x86_32.h:105:50: note: expanded from macro 'uint64_aligned_t'

According to https://bugs.llvm.org/show_bug.cgi?id=11071, this issue has
been fixed in clang. But we're not going to get that in 3.8.

Explicitly disable that warning to fix the build.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
Cc:  Elena Ufimtseva <elena.ufimtseva@oracle.com>

See also:
https://patches.linaro.org/patch/27062/
https://gitlab.com/liuw/xen/-/jobs/83610026
---
 tools/debugger/gdbsx/Rules.mk | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/debugger/gdbsx/Rules.mk b/tools/debugger/gdbsx/Rules.mk
index 6e38f2df99..920f1c87fb 100644
--- a/tools/debugger/gdbsx/Rules.mk
+++ b/tools/debugger/gdbsx/Rules.mk
@@ -2,3 +2,5 @@ include $(XEN_ROOT)/tools/Rules.mk
 
 CFLAGS   += -Werror -Wmissing-prototypes 
 # (gcc 4.3x and later)   -Wconversion -Wno-sign-conversion
+
+CFLAGS-$(clang) += -Wno-ignored-attributes
-- 
2.11.0


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

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

* [PATCH v2 2/2] ocaml: remove undefined behaviour in systemd_stubs.c
  2018-07-23 10:26 [PATCH v2 0/2] tools: fix clang build Wei Liu
  2018-07-23 10:26 ` [PATCH v2 1/2] tools/gdbsx: fix build with clang 3.8 Wei Liu
@ 2018-07-23 10:26 ` Wei Liu
  2018-07-23 10:28   ` Christian Lindig
  2018-07-23 10:32 ` [PATCH v2 0/2] tools: fix clang build Andrew Cooper
  2 siblings, 1 reply; 5+ messages in thread
From: Wei Liu @ 2018-07-23 10:26 UTC (permalink / raw)
  To: Xen-devel; +Cc: Wei Liu, Ian Jackson, Christian Lindig, David Scott

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 <wei.liu2@citrix.com>
---
Cc: Christian Lindig <christian.lindig@citrix.com>
Cc: David Scott <dave@recoil.org>

See: https://gitlab.com/liuw/xen/-/jobs/83628833
---
 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
-- 
2.11.0


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

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

* Re: [PATCH v2 2/2] ocaml: remove undefined behaviour in systemd_stubs.c
  2018-07-23 10:26 ` [PATCH v2 2/2] ocaml: remove undefined behaviour in systemd_stubs.c Wei Liu
@ 2018-07-23 10:28   ` Christian Lindig
  0 siblings, 0 replies; 5+ messages in thread
From: Christian Lindig @ 2018-07-23 10:28 UTC (permalink / raw)
  To: Wei Liu; +Cc: Xen-devel, David Scott, Ian Jackson



> On 23 Jul 2018, at 11:26, Wei Liu <wei.liu2@citrix.com> wrote:
> 
> 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 <wei.liu2@citrix.com>
> ---
> Cc: Christian Lindig <christian.lindig@citrix.com>
> Cc: David Scott <dave@recoil.org>
> 
> See: https://gitlab.com/liuw/xen/-/jobs/83628833
> ---
> 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
> -- 
> 2.11.0
> 

Acked-by: Christian Lindig <christian.lindig@citrix.com>


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

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

* Re: [PATCH v2 0/2] tools: fix clang build
  2018-07-23 10:26 [PATCH v2 0/2] tools: fix clang build Wei Liu
  2018-07-23 10:26 ` [PATCH v2 1/2] tools/gdbsx: fix build with clang 3.8 Wei Liu
  2018-07-23 10:26 ` [PATCH v2 2/2] ocaml: remove undefined behaviour in systemd_stubs.c Wei Liu
@ 2018-07-23 10:32 ` Andrew Cooper
  2 siblings, 0 replies; 5+ messages in thread
From: Andrew Cooper @ 2018-07-23 10:32 UTC (permalink / raw)
  To: Wei Liu, Xen-devel; +Cc: Ian Jackson

On 23/07/18 11:26, Wei Liu wrote:
> Wei Liu (2):
>   tools/gdbsx: fix build with clang 3.8
>   ocaml: remove undefined behaviour in systemd_stubs.c

Both Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>

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

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

end of thread, other threads:[~2018-07-23 10:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-23 10:26 [PATCH v2 0/2] tools: fix clang build Wei Liu
2018-07-23 10:26 ` [PATCH v2 1/2] tools/gdbsx: fix build with clang 3.8 Wei Liu
2018-07-23 10:26 ` [PATCH v2 2/2] ocaml: remove undefined behaviour in systemd_stubs.c Wei Liu
2018-07-23 10:28   ` Christian Lindig
2018-07-23 10:32 ` [PATCH v2 0/2] tools: fix clang build Andrew Cooper

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.