lib/classifier.c is also included by the tests/test-classifier.c. Make
sure the classifier vlog module is declared only once.  This should solve a 
problem building OVS with --enable-shared.

lib/coverage.h and lib/stream.h included lib/vlog.h, but vlog
interface should only be made available when a vlog module is also
declared.

Signed-off-by: Jarno Rajahalme <[email protected]>
---
 lib/classifier.c        |    6 ++++++
 lib/coverage.h          |    1 -
 lib/stream.h            |    3 ++-
 tests/test-classifier.c |   13 ++++++++-----
 4 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/lib/classifier.c b/lib/classifier.c
index 8dc89d9..0333a45 100644
--- a/lib/classifier.c
+++ b/lib/classifier.c
@@ -31,7 +31,13 @@
 #include "util.h"
 #include "vlog.h"
 
+/* This file is also included by test-classifier.c to gain access to the
+ * internal data structures.  Declare the vlog module only if we are not
+ * include by test-classifier.c. */
+#ifndef TEST_CLASSIFIER
+
 VLOG_DEFINE_THIS_MODULE(classifier);
+#endif
 
 struct trie_ctx;
 
diff --git a/lib/coverage.h b/lib/coverage.h
index af0bdfe..832c433 100644
--- a/lib/coverage.h
+++ b/lib/coverage.h
@@ -28,7 +28,6 @@
  * a useful debugging tool. */
 
 #include "ovs-thread.h"
-#include "vlog.h"
 #include "compiler.h"
 
 /* Makes coverage_run run every 5000 ms (5 seconds).
diff --git a/lib/stream.h b/lib/stream.h
index 3780ff9..3087f45 100644
--- a/lib/stream.h
+++ b/lib/stream.h
@@ -22,11 +22,12 @@
 #include <stdint.h>
 #include <sys/types.h>
 #include "openvswitch/types.h"
-#include "vlog.h"
 #include "socket-util.h"
+#include "util.h"
 
 struct pstream;
 struct stream;
+struct vlog_module;
 
 void stream_usage(const char *name, bool active, bool passive, bool bootstrap);
 
diff --git a/tests/test-classifier.c b/tests/test-classifier.c
index 1726171..d9e332b 100644
--- a/tests/test-classifier.c
+++ b/tests/test-classifier.c
@@ -26,6 +26,8 @@
  */
 
 #include <config.h>
+#undef NDEBUG
+#include <assert.h>
 #include <errno.h>
 #include <limits.h>
 #include "byte-order.h"
@@ -36,16 +38,17 @@
 #include "random.h"
 #include "unaligned.h"
 #include "ovstest.h"
-#undef NDEBUG
-#include <assert.h>
+#include "vlog.h"
+
+VLOG_DEFINE_THIS_MODULE(test_classifier);
 
 /* We need access to classifier internal definitions to be able to fully
- * test them.  The alternative would be to expose them all in the classifier
- * API. */
+ * test them. */
+#define TEST_CLASSIFIER 1
 #include "classifier.c"
 
 /* Fields in a rule. */
-#define CLS_FIELDS                                                  \
+#define CLS_FIELDS                        \
     /*        struct flow    all-caps */  \
     /*        member name    name     */  \
     /*        -----------    -------- */  \
-- 
1.7.10.4

_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev

Reply via email to