diff mbox

xen, tools: console.h shouldn't require string.h by default

Message ID 20171006114829.1718-1-wei.liu2@citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Wei Liu Oct. 6, 2017, 11:48 a.m. UTC
Unilaterally making string.h a prerequisite for console.h is going to
break build for a lot of consumers of console.h.

Define a macro for the new flex ring. Consumers which want to use it
should define the macro.

Partially revert af8d9356417cb617b635c5ace782388ebfe86e3a.

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
Cc: Julien Grall <julien.grall@arm.com>
Cc: Bhupinder Thakur <bhupinder.thakur@linaro.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: George Dunlap <George.Dunlap@eu.citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: Tim Deegan <tim@xen.org>
Cc: Wei Liu <wei.liu2@citrix.com>
---
 tools/console/daemon/io.c       | 2 +-
 xen/arch/arm/vpl011.c           | 2 ++
 xen/include/Makefile            | 1 -
 xen/include/public/io/console.h | 6 +++---
 4 files changed, 6 insertions(+), 5 deletions(-)

Comments

Jan Beulich Oct. 6, 2017, 12:39 p.m. UTC | #1
>>> On 06.10.17 at 13:48, <wei.liu2@citrix.com> wrote:
> @@ -40,7 +38,9 @@ struct xencons_interface {
>      XENCONS_RING_IDX out_cons, out_prod;
>  };
>  
> -#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
> +#if defined(__GNUC__) && !defined(__STRICT_ANSI__) && \
> +    defined(XEN_WANT_FLEX_CONSOLE_RING)
> +#include "ring.h"
>  DEFINE_XEN_FLEX_RING(xencons);
>  #endif

Wouldn't it be reasonable to drop the GNU and ANSI checks?
Someone not using a suitable compiler simply shouldn't define
the macro.

Jan
Wei Liu Oct. 6, 2017, 2:40 p.m. UTC | #2
On Fri, Oct 06, 2017 at 06:39:22AM -0600, Jan Beulich wrote:
> >>> On 06.10.17 at 13:48, <wei.liu2@citrix.com> wrote:
> > @@ -40,7 +38,9 @@ struct xencons_interface {
> >      XENCONS_RING_IDX out_cons, out_prod;
> >  };
> >  
> > -#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
> > +#if defined(__GNUC__) && !defined(__STRICT_ANSI__) && \
> > +    defined(XEN_WANT_FLEX_CONSOLE_RING)
> > +#include "ring.h"
> >  DEFINE_XEN_FLEX_RING(xencons);
> >  #endif
> 
> Wouldn't it be reasonable to drop the GNU and ANSI checks?
> Someone not using a suitable compiler simply shouldn't define
> the macro.

That would be fine by me.
diff mbox

Patch

diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c
index afe162e9c2..e22009aa39 100644
--- a/tools/console/daemon/io.c
+++ b/tools/console/daemon/io.c
@@ -21,7 +21,6 @@ 
 
 #include "utils.h"
 #include "io.h"
-#include <string.h>
 #include <xenevtchn.h>
 #include <xengnttab.h>
 #include <xenstore.h>
@@ -30,6 +29,7 @@ 
 
 #include <stdlib.h>
 #include <errno.h>
+#include <string.h>
 #include <poll.h>
 #include <fcntl.h>
 #include <unistd.h>
diff --git a/xen/arch/arm/vpl011.c b/xen/arch/arm/vpl011.c
index 56d9cbe09e..f7ddccb42a 100644
--- a/xen/arch/arm/vpl011.c
+++ b/xen/arch/arm/vpl011.c
@@ -16,6 +16,8 @@ 
  * this program; If not, see <http://www.gnu.org/licenses/>.
  */
 
+#define XEN_WANT_FLEX_CONSOLE_RING 1
+
 #include <xen/errno.h>
 #include <xen/event.h>
 #include <xen/guest_access.h>
diff --git a/xen/include/Makefile b/xen/include/Makefile
index c90fdeee75..1299b1962f 100644
--- a/xen/include/Makefile
+++ b/xen/include/Makefile
@@ -98,7 +98,6 @@  PUBLIC_C99_HEADERS := public/io/9pfs.h public/io/pvcalls.h
 PUBLIC_ANSI_HEADERS := $(filter-out public/%ctl.h public/xsm/% public/%hvm/save.h $(PUBLIC_C99_HEADERS), $(PUBLIC_HEADERS))
 
 public/io/9pfs.h-prereq := string
-public/io/console.h-prereq := string
 public/io/pvcalls.h-prereq := string
 
 headers.chk: $(PUBLIC_ANSI_HEADERS) Makefile
diff --git a/xen/include/public/io/console.h b/xen/include/public/io/console.h
index 0f0711fbdb..cdbdcd273b 100644
--- a/xen/include/public/io/console.h
+++ b/xen/include/public/io/console.h
@@ -27,8 +27,6 @@ 
 #ifndef __XEN_PUBLIC_IO_CONSOLE_H__
 #define __XEN_PUBLIC_IO_CONSOLE_H__
 
-#include "ring.h"
-
 typedef uint32_t XENCONS_RING_IDX;
 
 #define MASK_XENCONS_IDX(idx, ring) ((idx) & (sizeof(ring)-1))
@@ -40,7 +38,9 @@  struct xencons_interface {
     XENCONS_RING_IDX out_cons, out_prod;
 };
 
-#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
+#if defined(__GNUC__) && !defined(__STRICT_ANSI__) && \
+    defined(XEN_WANT_FLEX_CONSOLE_RING)
+#include "ring.h"
 DEFINE_XEN_FLEX_RING(xencons);
 #endif