From 9c71d3f2ff6d9076b599420aaa6cf2934c66cfbe Mon Sep 17 00:00:00 2001
From: Alessandro Rubini <rubini@gnudd.com>
Date: Thu, 6 Nov 2014 18:49:54 +0100
Subject: [PATCH] ppsi.h: forcibly include autoconf.h, and define ARRAY_SIZE

In the next commits we'll need CONFIG_ symbols and ARRAY_SIZE

Unfortunately, we can't use "-include include/generated/autoconf.h"
in CFLAGS, because pp_printf is built with our CFLAGS from its own
directory. And I'd better not include the full pathname as our make
is verbose

Signed-off-by: Alessandro Rubini <rubini@gnudd.com>
---
 include/ppsi/ppsi.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/ppsi/ppsi.h b/include/ppsi/ppsi.h
index b6b3f97a..cae5bf10 100644
--- a/include/ppsi/ppsi.h
+++ b/include/ppsi/ppsi.h
@@ -7,6 +7,7 @@
 
 #ifndef __PPSI_PPSI_H__
 #define __PPSI_PPSI_H__
+#include <generated/autoconf.h>
 
 #include <stdint.h>
 #include <stdarg.h>
@@ -20,6 +21,10 @@
 
 #include <arch/arch.h> /* ntohs and so on -- and wr-api.h for wr archs */
 
+/* At this point in time, we need ARRAY_SIZE to conditionally build vlan code */
+#undef ARRAY_SIZE
+#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+
 /* We can't include pp-printf.h when building freestading, so have it here */
 extern int pp_printf(const char *fmt, ...)
 	__attribute__((format(printf, 1, 2)));
-- 
GitLab