diff mbox

[NEXT,PATCHv2] linux-generic: fix forward declarations for queue and buf

Message ID 1441309674-24299-1-git-send-email-maxim.uvarov@linaro.org
State New
Headers show

Commit Message

Maxim Uvarov Sept. 3, 2015, 7:47 p.m. UTC
Fix:
In file included from odp_classification.c:15:
In file included from ./include/odp_packet_io_internal.h:23:
In file included from ./include/odp_classification_datamodel.h:27:
./include/odp_queue_internal.h:92:3: error: redefinition of typedef 'queue_entry_t' is a C11 feature [-Werror,-Wtypedef-redefinition]
} queue_entry_t;
  ^
./include/odp_buffer_internal.h:107:29: note: previous definition is here
typedef union queue_entry_u queue_entry_t;

Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
---
 That patch fixes the same issue as Bills patch. Just post it to mailing list if that
 solution looks better.


 v2: put buf typedef to buf header.


 platform/linux-generic/include/odp/plat/buffer_types.h |  2 ++
 platform/linux-generic/include/odp/plat/queue_types.h  |  2 ++
 platform/linux-generic/include/odp_buffer_internal.h   | 10 +++-------
 platform/linux-generic/include/odp_queue_internal.h    |  4 ++--
 4 files changed, 9 insertions(+), 9 deletions(-)
diff mbox

Patch

diff --git a/platform/linux-generic/include/odp/plat/buffer_types.h b/platform/linux-generic/include/odp/plat/buffer_types.h
index 3203020..0e8fdd9 100644
--- a/platform/linux-generic/include/odp/plat/buffer_types.h
+++ b/platform/linux-generic/include/odp/plat/buffer_types.h
@@ -29,6 +29,8 @@  typedef ODP_HANDLE_T(odp_buffer_t);
 /** ODP buffer segment */
 typedef ODP_HANDLE_T(odp_buffer_seg_t);
 
+typedef struct odp_buffer_hdr_t odp_buffer_hdr_t;
+
 /** Invalid segment */
 #define ODP_SEGMENT_INVALID ((odp_buffer_seg_t)ODP_BUFFER_INVALID)
 
diff --git a/platform/linux-generic/include/odp/plat/queue_types.h b/platform/linux-generic/include/odp/plat/queue_types.h
index a7df155..eb2d680 100644
--- a/platform/linux-generic/include/odp/plat/queue_types.h
+++ b/platform/linux-generic/include/odp/plat/queue_types.h
@@ -36,6 +36,8 @@  typedef ODP_HANDLE_T(odp_queue_group_t);
 
 typedef int odp_queue_type_t;
 
+typedef union queue_entry_u queue_entry_t;
+
 #define ODP_QUEUE_TYPE_SCHED  0
 #define ODP_QUEUE_TYPE_POLL   1
 #define ODP_QUEUE_TYPE_PKTIN  2
diff --git a/platform/linux-generic/include/odp_buffer_internal.h b/platform/linux-generic/include/odp_buffer_internal.h
index 6badeba..001654e 100644
--- a/platform/linux-generic/include/odp_buffer_internal.h
+++ b/platform/linux-generic/include/odp_buffer_internal.h
@@ -18,6 +18,7 @@ 
 extern "C" {
 #endif
 
+#include <odp/plat/queue_types.h>
 #include <odp/std_types.h>
 #include <odp/atomic.h>
 #include <odp/pool.h>
@@ -101,13 +102,8 @@  typedef union odp_buffer_bits_t {
 	};
 } odp_buffer_bits_t;
 
-/* forward declaration */
-struct odp_buffer_hdr_t;
-union queue_entry_u;
-typedef union queue_entry_u queue_entry_t;
-
 /* Common buffer header */
-typedef struct odp_buffer_hdr_t {
+struct odp_buffer_hdr_t {
 	struct odp_buffer_hdr_t *next;       /* next buf in a list--keep 1st */
 	union {                              /* Multi-use secondary link */
 		struct odp_buffer_hdr_t *prev;
@@ -144,7 +140,7 @@  typedef struct odp_buffer_hdr_t {
 		queue_entry_t   *target_qe;  /* ordered queue target */
 		uint64_t         sync;       /* for ordered synchronization */
 	};
-} odp_buffer_hdr_t;
+};
 
 /** @internal Compile time assert that the
  * allocator field can handle any allocator id*/
diff --git a/platform/linux-generic/include/odp_queue_internal.h b/platform/linux-generic/include/odp_queue_internal.h
index 0f30965..69f7645 100644
--- a/platform/linux-generic/include/odp_queue_internal.h
+++ b/platform/linux-generic/include/odp_queue_internal.h
@@ -86,10 +86,10 @@  struct queue_entry_s {
 	odp_atomic_u64_t  sync_out;
 };
 
-typedef union queue_entry_u {
+union queue_entry_u {
 	struct queue_entry_s s;
 	uint8_t pad[ODP_CACHE_LINE_SIZE_ROUNDUP(sizeof(struct queue_entry_s))];
-} queue_entry_t;
+};
 
 
 queue_entry_t *get_qentry(uint32_t queue_id);