diff mbox

[ndctl] ndctl: reorder header include for ARRAY_SIZE() definition

Message ID 20150420194852.16504.65097.stgit@dwillia2-desk3.amr.corp.intel.com
State Superseded
Headers show

Commit Message

Dan Williams April 20, 2015, 7:48 p.m. UTC
On a system without /usr/include/linux/ndctl.h (provided by the kernel "make
INSTALL_HDR_PATH=/usr headers_install").  The ndctl build falls back to using
the local copy of ndctl.h, triggering these warnings.

 CC       lib/test-dpa-alloc.o
In file included from lib/test-dpa-alloc.c:33:0:
./ndctl.h: In function ‘nfit_bus_cmd_name’:
./ndctl.h:122:2: warning: implicit declaration of function ‘ARRAY_SIZE’ [-Wimplicit-function-declaration]
  if (cmd < ARRAY_SIZE(names) && names[cmd])

Arrange for ARRAY_SIZE() to be picked up from
<ccan/array_size/array_size.h> as a fallback.

Reported-by: Robert Elliott <Elliott@hp.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 lib/test-dpa-alloc.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/lib/test-dpa-alloc.c b/lib/test-dpa-alloc.c
index 5b7db7c2f542..f94838ac0b9b 100644
--- a/lib/test-dpa-alloc.c
+++ b/lib/test-dpa-alloc.c
@@ -27,13 +27,14 @@ 
 #include <uuid/uuid.h>
 
 #include <ndctl/libndctl.h>
+#include <test-dpa-alloc.h>
+#include <ccan/array_size/array_size.h>
+
 #ifdef HAVE_NDCTL_H
 #include <linux/ndctl.h>
 #else
 #include <ndctl.h>
 #endif
-#include <test-dpa-alloc.h>
-#include <ccan/array_size/array_size.h>
 
 static const char *NFIT_TEST_MODULE = "nfit_test";
 static const char *NFIT_PROVIDER0 = "nfit_test.0";