diff mbox

linux-generic: strongtypes: use named structs for C++

Message ID 1426889810-29236-1-git-send-email-ola.liljedahl@linaro.org
State Accepted
Commit a6d797b6aa82bcc1557cd418c6e38455d2562976
Headers show

Commit Message

Ola Liljedahl March 20, 2015, 10:16 p.m. UTC
Typedefs to anonymous structs creates problems for C++ programs:
GCC:
warning: ‘odp_crypto_op_params’ has a field ‘odp_crypto_op_params::pkt’
whose type uses the anonymous namespace
error: anonymous type with no linkage used to declare function
‘<anonymous struct>* ppp_packet::get_queue() const’ with linkage
CLANG:
extern odp_pool_t tmo_pool;
warning: variable 'tmo_pool' has internal linkage but is not defined
When linking:
undefined reference to `tmo_pool'

The solution is to add a (unique) name to all structs used by the strong
typing typedefs.

Signed-off-by: Ola Liljedahl <ola.liljedahl@linaro.org>
---
(This document/code contribution attached is provided under the terms of
agreement LES-LTM-21309)

 platform/linux-generic/include/odp/plat/buffer_types.h         | 4 ++--
 platform/linux-generic/include/odp/plat/classification_types.h | 8 ++++----
 platform/linux-generic/include/odp/plat/crypto_types.h         | 2 +-
 platform/linux-generic/include/odp/plat/event_types.h          | 2 +-
 platform/linux-generic/include/odp/plat/packet_io_types.h      | 2 +-
 platform/linux-generic/include/odp/plat/packet_types.h         | 4 ++--
 platform/linux-generic/include/odp/plat/pool_types.h           | 2 +-
 platform/linux-generic/include/odp/plat/queue_types.h          | 4 ++--
 platform/linux-generic/include/odp/plat/shared_memory_types.h  | 2 +-
 platform/linux-generic/include/odp/plat/strong_types.h         | 6 +++++-
 10 files changed, 20 insertions(+), 16 deletions(-)

Comments

Bill Fischofer March 20, 2015, 11:18 p.m. UTC | #1
This patch seems to generate a raft of doxygen warnings:

rm -rf doc/output
SRCDIR='.' PROJECT='OpenDataPlane' DOCDIR='doc/output' VERSION='1.0.1'
WITH_PLATFORM='linux-generic' PERL_PATH='/usr/bin/perl' HAVE_DOT='NO'
GENERATE_MAN='NO' GENERATE_RTF='NO' GENERATE_XML='NO'
GENERATE_HTMLHELP='NO' GENERATE_CHI='NO' GENERATE_HTML='YES'
GENERATE_LATEX='YES' /usr/bin/doxygen ./doc/doxygen.cfg
/home/bill/linaro/check-odp/build/odp-apply/include/odp/api/buffer.h:29:
warning: documented symbol `odp_buffer_t' was not declared or defined.
/home/bill/linaro/check-odp/build/odp-apply/include/odp/api/buffer.h:39:
warning: documented symbol `odp_buffer_seg_t' was not declared or defined.
/home/bill/linaro/check-odp/build/odp-apply/include/odp/api/classification.h:29:
warning: documented symbol `odp_cos_t' was not declared or defined.
/home/bill/linaro/check-odp/build/odp-apply/include/odp/api/classification.h:34:
warning: documented symbol `odp_flowsig_t' was not declared or defined.
/home/bill/linaro/check-odp/build/odp-apply/include/odp/api/classification.h:186:
warning: documented symbol `odp_pmr_t' was not declared or defined.
/home/bill/linaro/check-odp/build/odp-apply/include/odp/api/classification.h:349:
warning: documented symbol `odp_pmr_set_t' was not declared or defined.
/home/bill/linaro/check-odp/build/odp-apply/include/odp/api/crypto.h:37:
warning: documented symbol `odp_crypto_compl_t' was not declared or defined.
/home/bill/linaro/check-odp/build/odp-apply/include/odp/api/event.h:29:
warning: documented symbol `odp_event_t' was not declared or defined.
/home/bill/linaro/check-odp/build/odp-apply/include/odp/api/packet.h:27:
warning: documented symbol `odp_packet_t' was not declared or defined.
/home/bill/linaro/check-odp/build/odp-apply/include/odp/api/packet.h:42:
warning: documented symbol `odp_packet_seg_t' was not declared or defined.
/home/bill/linaro/check-odp/build/odp-apply/include/odp/api/packet_io.h:27:
warning: documented symbol `odp_pktio_t' was not declared or defined.
/home/bill/linaro/check-odp/build/odp-apply/include/odp/api/pool.h:31:
warning: documented symbol `odp_pool_t' was not declared or defined.
/home/bill/linaro/check-odp/build/odp-apply/include/odp/api/queue.h:28:
warning: documented symbol `odp_queue_t' was not declared or defined.
/home/bill/linaro/check-odp/build/odp-apply/include/odp/api/queue.h:33:
warning: documented symbol `odp_queue_group_t' was not declared or defined.
/home/bill/linaro/check-odp/build/odp-apply/include/odp/api/shared_memory.h:28:
warning: documented symbol `odp_shm_t' was not declared or defined.
/home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/classification_types.h:26:
warning: Member ODP_HANDLE_T(odp_cos_t) (function) of group
odp_classification is not documented.
/home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/classification_types.h:27:
warning: Member ODP_HANDLE_T(odp_flowsig_t) (function) of group
odp_classification is not documented.
/home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/classification_types.h:34:
warning: Member ODP_HANDLE_T(odp_pmr_t) (function) of group
odp_classification is not documented.
/home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/classification_types.h:37:
warning: Member ODP_HANDLE_T(odp_pmr_set_t) (function) of group
odp_classification is not documented.
/home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/crypto_types.h:28:
warning: Member ODP_HANDLE_T(odp_crypto_compl_t) (function) of group
odp_crypto is not documented.
/home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/event_types.h:29:
warning: Member ODP_HANDLE_T(odp_event_t) (function) of group odp_event is
not documented.
/home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/packet_io_types.h:29:
warning: Member ODP_HANDLE_T(odp_pktio_t) (function) of group odp_packet_io
is not documented.
/home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/packet_types.h:29:
warning: Member ODP_HANDLE_T(odp_packet_t) (function) of group odp_packet
is not documented.
/home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/packet_types.h:35:
warning: Member ODP_HANDLE_T(odp_packet_seg_t) (function) of group
odp_packet is not documented.
/home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/pool_types.h:28:
warning: Member ODP_HANDLE_T(odp_pool_t) (function) of group odp_buffer is
not documented.
/home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/queue_types.h:28:
warning: Member ODP_HANDLE_T(odp_queue_t) (function) of group odp_queue is
not documented.
/home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/queue_types.h:30:
warning: Member ODP_HANDLE_T(odp_queue_group_t) (function) of group
odp_queue is not documented.
/home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/shared_memory_types.h:29:
warning: Member ODP_HANDLE_T(odp_shm_t) (function) of group
odp_shared_memory is not documented.
/home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/pool_types.h:28:
warning: Member ODP_HANDLE_T(odp_pool_t) (function) of group odp_buffer is
not documented.
/home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/classification_types.h:26:
warning: Member ODP_HANDLE_T(odp_cos_t) (function) of group
odp_classification is not documented.
/home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/classification_types.h:27:
warning: Member ODP_HANDLE_T(odp_flowsig_t) (function) of group
odp_classification is not documented.
/home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/classification_types.h:34:
warning: Member ODP_HANDLE_T(odp_pmr_t) (function) of group
odp_classification is not documented.
/home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/classification_types.h:37:
warning: Member ODP_HANDLE_T(odp_pmr_set_t) (function) of group
odp_classification is not documented.
/home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/crypto_types.h:28:
warning: Member ODP_HANDLE_T(odp_crypto_compl_t) (function) of group
odp_crypto is not documented.
/home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/event_types.h:29:
warning: Member ODP_HANDLE_T(odp_event_t) (function) of group odp_event is
not documented.
/home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/packet_types.h:29:
warning: Member ODP_HANDLE_T(odp_packet_t) (function) of group odp_packet
is not documented.
/home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/packet_types.h:35:
warning: Member ODP_HANDLE_T(odp_packet_seg_t) (function) of group
odp_packet is not documented.
/home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/packet_io_types.h:29:
warning: Member ODP_HANDLE_T(odp_pktio_t) (function) of group odp_packet_io
is not documented.
/home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/queue_types.h:28:
warning: Member ODP_HANDLE_T(odp_queue_t) (function) of group odp_queue is
not documented.
/home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/queue_types.h:30:
warning: Member ODP_HANDLE_T(odp_queue_group_t) (function) of group
odp_queue is not documented.
/home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/shared_memory_types.h:29:
warning: Member ODP_HANDLE_T(odp_shm_t) (function) of group
odp_shared_memory is not documented.



On Fri, Mar 20, 2015 at 5:16 PM, Ola Liljedahl <ola.liljedahl@linaro.org>
wrote:

> Typedefs to anonymous structs creates problems for C++ programs:
> GCC:
> warning: ‘odp_crypto_op_params’ has a field ‘odp_crypto_op_params::pkt’
> whose type uses the anonymous namespace
> error: anonymous type with no linkage used to declare function
> ‘<anonymous struct>* ppp_packet::get_queue() const’ with linkage
> CLANG:
> extern odp_pool_t tmo_pool;
> warning: variable 'tmo_pool' has internal linkage but is not defined
> When linking:
> undefined reference to `tmo_pool'
>
> The solution is to add a (unique) name to all structs used by the strong
> typing typedefs.
>
> Signed-off-by: Ola Liljedahl <ola.liljedahl@linaro.org>
> ---
> (This document/code contribution attached is provided under the terms of
> agreement LES-LTM-21309)
>
>  platform/linux-generic/include/odp/plat/buffer_types.h         | 4 ++--
>  platform/linux-generic/include/odp/plat/classification_types.h | 8
> ++++----
>  platform/linux-generic/include/odp/plat/crypto_types.h         | 2 +-
>  platform/linux-generic/include/odp/plat/event_types.h          | 2 +-
>  platform/linux-generic/include/odp/plat/packet_io_types.h      | 2 +-
>  platform/linux-generic/include/odp/plat/packet_types.h         | 4 ++--
>  platform/linux-generic/include/odp/plat/pool_types.h           | 2 +-
>  platform/linux-generic/include/odp/plat/queue_types.h          | 4 ++--
>  platform/linux-generic/include/odp/plat/shared_memory_types.h  | 2 +-
>  platform/linux-generic/include/odp/plat/strong_types.h         | 6 +++++-
>  10 files changed, 20 insertions(+), 16 deletions(-)
>
> diff --git a/platform/linux-generic/include/odp/plat/buffer_types.h
> b/platform/linux-generic/include/odp/plat/buffer_types.h
> index 3e7070e..0c017ae 100644
> --- a/platform/linux-generic/include/odp/plat/buffer_types.h
> +++ b/platform/linux-generic/include/odp/plat/buffer_types.h
> @@ -26,13 +26,13 @@ extern "C" {
>   */
>
>  /** ODP buffer */
> -typedef odp_handle_t odp_buffer_t;
> +typedef ODP_HANDLE_T(odp_buffer_t);
>
>  /** Invalid buffer */
>  #define ODP_BUFFER_INVALID _odp_cast_scalar(odp_buffer_t, 0xffffffff)
>
>  /** ODP buffer segment */
> -typedef odp_handle_t odp_buffer_seg_t;
> +typedef ODP_HANDLE_T(odp_buffer_seg_t);
>
>  /** Invalid segment */
>  #define ODP_SEGMENT_INVALID ((odp_buffer_seg_t)ODP_BUFFER_INVALID)
> diff --git
> a/platform/linux-generic/include/odp/plat/classification_types.h
> b/platform/linux-generic/include/odp/plat/classification_types.h
> index 042d8c8..767da7d 100644
> --- a/platform/linux-generic/include/odp/plat/classification_types.h
> +++ b/platform/linux-generic/include/odp/plat/classification_types.h
> @@ -23,18 +23,18 @@ extern "C" {
>   *  @{
>   */
>
> -typedef odp_handle_t odp_cos_t;
> -typedef odp_handle_t odp_flowsig_t;
> +typedef ODP_HANDLE_T(odp_cos_t);
> +typedef ODP_HANDLE_T(odp_flowsig_t);
>
>  #define ODP_COS_INVALID  _odp_cast_scalar(odp_cos_t, ~0)
>  #define ODP_COS_NAME_LEN 32
>
>  typedef uint16_t odp_cos_flow_set_t;
>
> -typedef odp_handle_t odp_pmr_t;
> +typedef ODP_HANDLE_T(odp_pmr_t);
>  #define ODP_PMR_INVAL _odp_cast_scalar(odp_pmr_t, ~0)
>
> -typedef odp_handle_t odp_pmr_set_t;
> +typedef ODP_HANDLE_T(odp_pmr_set_t);
>  #define ODP_PMR_SET_INVAL _odp_cast_scalar(odp_pmr_set_t, ~0)
>
>  /** Get printable format of odp_cos_t */
> diff --git a/platform/linux-generic/include/odp/plat/crypto_types.h
> b/platform/linux-generic/include/odp/plat/crypto_types.h
> index 1b10a5d..a91d88e 100644
> --- a/platform/linux-generic/include/odp/plat/crypto_types.h
> +++ b/platform/linux-generic/include/odp/plat/crypto_types.h
> @@ -25,7 +25,7 @@ extern "C" {
>  #define ODP_CRYPTO_SESSION_INVALID (0xffffffffffffffffULL)
>
>  typedef uint64_t odp_crypto_session_t;
> -typedef odp_handle_t odp_crypto_compl_t;
> +typedef ODP_HANDLE_T(odp_crypto_compl_t);
>
>  enum odp_crypto_op_mode {
>         ODP_CRYPTO_SYNC,
> diff --git a/platform/linux-generic/include/odp/plat/event_types.h
> b/platform/linux-generic/include/odp/plat/event_types.h
> index 24be22f..d91937d 100644
> --- a/platform/linux-generic/include/odp/plat/event_types.h
> +++ b/platform/linux-generic/include/odp/plat/event_types.h
> @@ -26,7 +26,7 @@ extern "C" {
>   *  @{
>   */
>
> -typedef odp_handle_t odp_event_t;
> +typedef ODP_HANDLE_T(odp_event_t);
>
>  #define ODP_EVENT_INVALID _odp_cast_scalar(odp_event_t, 0xffffffff)
>
> diff --git a/platform/linux-generic/include/odp/plat/packet_io_types.h
> b/platform/linux-generic/include/odp/plat/packet_io_types.h
> index 60592e3..3cc64c6 100644
> --- a/platform/linux-generic/include/odp/plat/packet_io_types.h
> +++ b/platform/linux-generic/include/odp/plat/packet_io_types.h
> @@ -26,7 +26,7 @@ extern "C" {
>   *  @{
>   */
>
> -typedef odp_handle_t odp_pktio_t;
> +typedef ODP_HANDLE_T(odp_pktio_t);
>
>  #define ODP_PKTIO_INVALID _odp_cast_scalar(odp_pktio_t, 0)
>
> diff --git a/platform/linux-generic/include/odp/plat/packet_types.h
> b/platform/linux-generic/include/odp/plat/packet_types.h
> index 57e9662..45cb801 100644
> --- a/platform/linux-generic/include/odp/plat/packet_types.h
> +++ b/platform/linux-generic/include/odp/plat/packet_types.h
> @@ -26,13 +26,13 @@ extern "C" {
>   *  @{
>   */
>
> -typedef odp_handle_t odp_packet_t;
> +typedef ODP_HANDLE_T(odp_packet_t);
>
>  #define ODP_PACKET_INVALID _odp_cast_scalar(odp_packet_t, 0xffffffff)
>
>  #define ODP_PACKET_OFFSET_INVALID (0x0fffffff)
>
> -typedef odp_handle_t odp_packet_seg_t;
> +typedef ODP_HANDLE_T(odp_packet_seg_t);
>
>  #define ODP_PACKET_SEG_INVALID _odp_cast_scalar(odp_packet_seg_t,
> 0xffffffff)
>
> diff --git a/platform/linux-generic/include/odp/plat/pool_types.h
> b/platform/linux-generic/include/odp/plat/pool_types.h
> index 71c7783..568556f 100644
> --- a/platform/linux-generic/include/odp/plat/pool_types.h
> +++ b/platform/linux-generic/include/odp/plat/pool_types.h
> @@ -25,7 +25,7 @@ extern "C" {
>   *  @{
>   */
>
> -typedef odp_handle_t odp_pool_t;
> +typedef ODP_HANDLE_T(odp_pool_t);
>
>  #define ODP_POOL_INVALID _odp_cast_scalar(odp_pool_t, 0xffffffff)
>
> diff --git a/platform/linux-generic/include/odp/plat/queue_types.h
> b/platform/linux-generic/include/odp/plat/queue_types.h
> index 04a0be9..1cecc90 100644
> --- a/platform/linux-generic/include/odp/plat/queue_types.h
> +++ b/platform/linux-generic/include/odp/plat/queue_types.h
> @@ -25,9 +25,9 @@ extern "C" {
>   *  @{
>   */
>
> -typedef odp_handle_t odp_queue_t;
> +typedef ODP_HANDLE_T(odp_queue_t);
>
> -typedef odp_handle_t odp_queue_group_t;
> +typedef ODP_HANDLE_T(odp_queue_group_t);
>
>  #define ODP_QUEUE_INVALID  _odp_cast_scalar(odp_queue_t, 0)
>
> diff --git a/platform/linux-generic/include/odp/plat/shared_memory_types.h
> b/platform/linux-generic/include/odp/plat/shared_memory_types.h
> index d2e92cf..4be7356 100644
> --- a/platform/linux-generic/include/odp/plat/shared_memory_types.h
> +++ b/platform/linux-generic/include/odp/plat/shared_memory_types.h
> @@ -26,7 +26,7 @@ extern "C" {
>   *  @{
>   */
>
> -typedef odp_handle_t odp_shm_t;
> +typedef ODP_HANDLE_T(odp_shm_t);
>
>  #define ODP_SHM_INVALID _odp_cast_scalar(odp_shm_t, 0)
>  #define ODP_SHM_NULL ODP_SHM_INVALID
> diff --git a/platform/linux-generic/include/odp/plat/strong_types.h
> b/platform/linux-generic/include/odp/plat/strong_types.h
> index cd15853..39bdea3 100644
> --- a/platform/linux-generic/include/odp/plat/strong_types.h
> +++ b/platform/linux-generic/include/odp/plat/strong_types.h
> @@ -16,7 +16,11 @@
>  #define STRONG_TYPES_H_
>
>  /** Use strong typing for ODP types */
> -#define odp_handle_t struct { uint8_t unused_dummy_var; } *
> +#ifdef __cplusplus
> +#define ODP_HANDLE_T(type) struct _##type { uint8_t unused_dummy_var; }
> *type
> +#else
> +#define ODP_HANDLE_T(type) struct { } *type
> +#endif
>
>  /** Internal macro to get value of an ODP handle */
>  #define _odp_typeval(handle) ((uint32_t)(uintptr_t)(handle))
> --
> 1.9.1
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
>
Ola Liljedahl March 23, 2015, 10:25 a.m. UTC | #2
On 21 March 2015 at 00:18, Bill Fischofer <bill.fischofer@linaro.org> wrote:

> This patch seems to generate a raft of doxygen warnings:
>
I didn't test that...

Doxygen doesn't use the preprocessor? And my patch requires the
preprocessor for generating the typedefs. I did not want to have to use
#ifdef __cplusplus in every header file, thus the macro.
Could have done it like this, for every type...
#ifdef __cplusplus
typedef struct _odp_packet_t { uint8_t unused_dummy_var; } *odp_packet_t;
//Or perhaps use the new macro here? Which #if path is used by doxygen?
Should we swap the C and C++ cases?
#else
typedef odp_handle_t odp_packet_t;
#endif

What's the minimal changes we need to keep doxygen happy?



> rm -rf doc/output
> SRCDIR='.' PROJECT='OpenDataPlane' DOCDIR='doc/output' VERSION='1.0.1'
> WITH_PLATFORM='linux-generic' PERL_PATH='/usr/bin/perl' HAVE_DOT='NO'
> GENERATE_MAN='NO' GENERATE_RTF='NO' GENERATE_XML='NO'
> GENERATE_HTMLHELP='NO' GENERATE_CHI='NO' GENERATE_HTML='YES'
> GENERATE_LATEX='YES' /usr/bin/doxygen ./doc/doxygen.cfg
> /home/bill/linaro/check-odp/build/odp-apply/include/odp/api/buffer.h:29:
> warning: documented symbol `odp_buffer_t' was not declared or defined.
> /home/bill/linaro/check-odp/build/odp-apply/include/odp/api/buffer.h:39:
> warning: documented symbol `odp_buffer_seg_t' was not declared or defined.
> /home/bill/linaro/check-odp/build/odp-apply/include/odp/api/classification.h:29:
> warning: documented symbol `odp_cos_t' was not declared or defined.
> /home/bill/linaro/check-odp/build/odp-apply/include/odp/api/classification.h:34:
> warning: documented symbol `odp_flowsig_t' was not declared or defined.
> /home/bill/linaro/check-odp/build/odp-apply/include/odp/api/classification.h:186:
> warning: documented symbol `odp_pmr_t' was not declared or defined.
> /home/bill/linaro/check-odp/build/odp-apply/include/odp/api/classification.h:349:
> warning: documented symbol `odp_pmr_set_t' was not declared or defined.
> /home/bill/linaro/check-odp/build/odp-apply/include/odp/api/crypto.h:37:
> warning: documented symbol `odp_crypto_compl_t' was not declared or defined.
> /home/bill/linaro/check-odp/build/odp-apply/include/odp/api/event.h:29:
> warning: documented symbol `odp_event_t' was not declared or defined.
> /home/bill/linaro/check-odp/build/odp-apply/include/odp/api/packet.h:27:
> warning: documented symbol `odp_packet_t' was not declared or defined.
> /home/bill/linaro/check-odp/build/odp-apply/include/odp/api/packet.h:42:
> warning: documented symbol `odp_packet_seg_t' was not declared or defined.
> /home/bill/linaro/check-odp/build/odp-apply/include/odp/api/packet_io.h:27:
> warning: documented symbol `odp_pktio_t' was not declared or defined.
> /home/bill/linaro/check-odp/build/odp-apply/include/odp/api/pool.h:31:
> warning: documented symbol `odp_pool_t' was not declared or defined.
> /home/bill/linaro/check-odp/build/odp-apply/include/odp/api/queue.h:28:
> warning: documented symbol `odp_queue_t' was not declared or defined.
> /home/bill/linaro/check-odp/build/odp-apply/include/odp/api/queue.h:33:
> warning: documented symbol `odp_queue_group_t' was not declared or defined.
> /home/bill/linaro/check-odp/build/odp-apply/include/odp/api/shared_memory.h:28:
> warning: documented symbol `odp_shm_t' was not declared or defined.
> /home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/classification_types.h:26:
> warning: Member ODP_HANDLE_T(odp_cos_t) (function) of group
> odp_classification is not documented.
> /home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/classification_types.h:27:
> warning: Member ODP_HANDLE_T(odp_flowsig_t) (function) of group
> odp_classification is not documented.
> /home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/classification_types.h:34:
> warning: Member ODP_HANDLE_T(odp_pmr_t) (function) of group
> odp_classification is not documented.
> /home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/classification_types.h:37:
> warning: Member ODP_HANDLE_T(odp_pmr_set_t) (function) of group
> odp_classification is not documented.
> /home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/crypto_types.h:28:
> warning: Member ODP_HANDLE_T(odp_crypto_compl_t) (function) of group
> odp_crypto is not documented.
> /home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/event_types.h:29:
> warning: Member ODP_HANDLE_T(odp_event_t) (function) of group odp_event is
> not documented.
> /home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/packet_io_types.h:29:
> warning: Member ODP_HANDLE_T(odp_pktio_t) (function) of group odp_packet_io
> is not documented.
> /home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/packet_types.h:29:
> warning: Member ODP_HANDLE_T(odp_packet_t) (function) of group odp_packet
> is not documented.
> /home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/packet_types.h:35:
> warning: Member ODP_HANDLE_T(odp_packet_seg_t) (function) of group
> odp_packet is not documented.
> /home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/pool_types.h:28:
> warning: Member ODP_HANDLE_T(odp_pool_t) (function) of group odp_buffer is
> not documented.
> /home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/queue_types.h:28:
> warning: Member ODP_HANDLE_T(odp_queue_t) (function) of group odp_queue is
> not documented.
> /home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/queue_types.h:30:
> warning: Member ODP_HANDLE_T(odp_queue_group_t) (function) of group
> odp_queue is not documented.
> /home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/shared_memory_types.h:29:
> warning: Member ODP_HANDLE_T(odp_shm_t) (function) of group
> odp_shared_memory is not documented.
> /home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/pool_types.h:28:
> warning: Member ODP_HANDLE_T(odp_pool_t) (function) of group odp_buffer is
> not documented.
> /home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/classification_types.h:26:
> warning: Member ODP_HANDLE_T(odp_cos_t) (function) of group
> odp_classification is not documented.
> /home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/classification_types.h:27:
> warning: Member ODP_HANDLE_T(odp_flowsig_t) (function) of group
> odp_classification is not documented.
> /home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/classification_types.h:34:
> warning: Member ODP_HANDLE_T(odp_pmr_t) (function) of group
> odp_classification is not documented.
> /home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/classification_types.h:37:
> warning: Member ODP_HANDLE_T(odp_pmr_set_t) (function) of group
> odp_classification is not documented.
> /home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/crypto_types.h:28:
> warning: Member ODP_HANDLE_T(odp_crypto_compl_t) (function) of group
> odp_crypto is not documented.
> /home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/event_types.h:29:
> warning: Member ODP_HANDLE_T(odp_event_t) (function) of group odp_event is
> not documented.
> /home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/packet_types.h:29:
> warning: Member ODP_HANDLE_T(odp_packet_t) (function) of group odp_packet
> is not documented.
> /home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/packet_types.h:35:
> warning: Member ODP_HANDLE_T(odp_packet_seg_t) (function) of group
> odp_packet is not documented.
> /home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/packet_io_types.h:29:
> warning: Member ODP_HANDLE_T(odp_pktio_t) (function) of group odp_packet_io
> is not documented.
> /home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/queue_types.h:28:
> warning: Member ODP_HANDLE_T(odp_queue_t) (function) of group odp_queue is
> not documented.
> /home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/queue_types.h:30:
> warning: Member ODP_HANDLE_T(odp_queue_group_t) (function) of group
> odp_queue is not documented.
> /home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/shared_memory_types.h:29:
> warning: Member ODP_HANDLE_T(odp_shm_t) (function) of group
> odp_shared_memory is not documented.
>
>
>
> On Fri, Mar 20, 2015 at 5:16 PM, Ola Liljedahl <ola.liljedahl@linaro.org>
> wrote:
>
>> Typedefs to anonymous structs creates problems for C++ programs:
>> GCC:
>> warning: ‘odp_crypto_op_params’ has a field ‘odp_crypto_op_params::pkt’
>> whose type uses the anonymous namespace
>> error: anonymous type with no linkage used to declare function
>> ‘<anonymous struct>* ppp_packet::get_queue() const’ with linkage
>> CLANG:
>> extern odp_pool_t tmo_pool;
>> warning: variable 'tmo_pool' has internal linkage but is not defined
>> When linking:
>> undefined reference to `tmo_pool'
>>
>> The solution is to add a (unique) name to all structs used by the strong
>> typing typedefs.
>>
>> Signed-off-by: Ola Liljedahl <ola.liljedahl@linaro.org>
>> ---
>> (This document/code contribution attached is provided under the terms of
>> agreement LES-LTM-21309)
>>
>>  platform/linux-generic/include/odp/plat/buffer_types.h         | 4 ++--
>>  platform/linux-generic/include/odp/plat/classification_types.h | 8
>> ++++----
>>  platform/linux-generic/include/odp/plat/crypto_types.h         | 2 +-
>>  platform/linux-generic/include/odp/plat/event_types.h          | 2 +-
>>  platform/linux-generic/include/odp/plat/packet_io_types.h      | 2 +-
>>  platform/linux-generic/include/odp/plat/packet_types.h         | 4 ++--
>>  platform/linux-generic/include/odp/plat/pool_types.h           | 2 +-
>>  platform/linux-generic/include/odp/plat/queue_types.h          | 4 ++--
>>  platform/linux-generic/include/odp/plat/shared_memory_types.h  | 2 +-
>>  platform/linux-generic/include/odp/plat/strong_types.h         | 6 +++++-
>>  10 files changed, 20 insertions(+), 16 deletions(-)
>>
>> diff --git a/platform/linux-generic/include/odp/plat/buffer_types.h
>> b/platform/linux-generic/include/odp/plat/buffer_types.h
>> index 3e7070e..0c017ae 100644
>> --- a/platform/linux-generic/include/odp/plat/buffer_types.h
>> +++ b/platform/linux-generic/include/odp/plat/buffer_types.h
>> @@ -26,13 +26,13 @@ extern "C" {
>>   */
>>
>>  /** ODP buffer */
>> -typedef odp_handle_t odp_buffer_t;
>> +typedef ODP_HANDLE_T(odp_buffer_t);
>>
>>  /** Invalid buffer */
>>  #define ODP_BUFFER_INVALID _odp_cast_scalar(odp_buffer_t, 0xffffffff)
>>
>>  /** ODP buffer segment */
>> -typedef odp_handle_t odp_buffer_seg_t;
>> +typedef ODP_HANDLE_T(odp_buffer_seg_t);
>>
>>  /** Invalid segment */
>>  #define ODP_SEGMENT_INVALID ((odp_buffer_seg_t)ODP_BUFFER_INVALID)
>> diff --git
>> a/platform/linux-generic/include/odp/plat/classification_types.h
>> b/platform/linux-generic/include/odp/plat/classification_types.h
>> index 042d8c8..767da7d 100644
>> --- a/platform/linux-generic/include/odp/plat/classification_types.h
>> +++ b/platform/linux-generic/include/odp/plat/classification_types.h
>> @@ -23,18 +23,18 @@ extern "C" {
>>   *  @{
>>   */
>>
>> -typedef odp_handle_t odp_cos_t;
>> -typedef odp_handle_t odp_flowsig_t;
>> +typedef ODP_HANDLE_T(odp_cos_t);
>> +typedef ODP_HANDLE_T(odp_flowsig_t);
>>
>>  #define ODP_COS_INVALID  _odp_cast_scalar(odp_cos_t, ~0)
>>  #define ODP_COS_NAME_LEN 32
>>
>>  typedef uint16_t odp_cos_flow_set_t;
>>
>> -typedef odp_handle_t odp_pmr_t;
>> +typedef ODP_HANDLE_T(odp_pmr_t);
>>  #define ODP_PMR_INVAL _odp_cast_scalar(odp_pmr_t, ~0)
>>
>> -typedef odp_handle_t odp_pmr_set_t;
>> +typedef ODP_HANDLE_T(odp_pmr_set_t);
>>  #define ODP_PMR_SET_INVAL _odp_cast_scalar(odp_pmr_set_t, ~0)
>>
>>  /** Get printable format of odp_cos_t */
>> diff --git a/platform/linux-generic/include/odp/plat/crypto_types.h
>> b/platform/linux-generic/include/odp/plat/crypto_types.h
>> index 1b10a5d..a91d88e 100644
>> --- a/platform/linux-generic/include/odp/plat/crypto_types.h
>> +++ b/platform/linux-generic/include/odp/plat/crypto_types.h
>> @@ -25,7 +25,7 @@ extern "C" {
>>  #define ODP_CRYPTO_SESSION_INVALID (0xffffffffffffffffULL)
>>
>>  typedef uint64_t odp_crypto_session_t;
>> -typedef odp_handle_t odp_crypto_compl_t;
>> +typedef ODP_HANDLE_T(odp_crypto_compl_t);
>>
>>  enum odp_crypto_op_mode {
>>         ODP_CRYPTO_SYNC,
>> diff --git a/platform/linux-generic/include/odp/plat/event_types.h
>> b/platform/linux-generic/include/odp/plat/event_types.h
>> index 24be22f..d91937d 100644
>> --- a/platform/linux-generic/include/odp/plat/event_types.h
>> +++ b/platform/linux-generic/include/odp/plat/event_types.h
>> @@ -26,7 +26,7 @@ extern "C" {
>>   *  @{
>>   */
>>
>> -typedef odp_handle_t odp_event_t;
>> +typedef ODP_HANDLE_T(odp_event_t);
>>
>>  #define ODP_EVENT_INVALID _odp_cast_scalar(odp_event_t, 0xffffffff)
>>
>> diff --git a/platform/linux-generic/include/odp/plat/packet_io_types.h
>> b/platform/linux-generic/include/odp/plat/packet_io_types.h
>> index 60592e3..3cc64c6 100644
>> --- a/platform/linux-generic/include/odp/plat/packet_io_types.h
>> +++ b/platform/linux-generic/include/odp/plat/packet_io_types.h
>> @@ -26,7 +26,7 @@ extern "C" {
>>   *  @{
>>   */
>>
>> -typedef odp_handle_t odp_pktio_t;
>> +typedef ODP_HANDLE_T(odp_pktio_t);
>>
>>  #define ODP_PKTIO_INVALID _odp_cast_scalar(odp_pktio_t, 0)
>>
>> diff --git a/platform/linux-generic/include/odp/plat/packet_types.h
>> b/platform/linux-generic/include/odp/plat/packet_types.h
>> index 57e9662..45cb801 100644
>> --- a/platform/linux-generic/include/odp/plat/packet_types.h
>> +++ b/platform/linux-generic/include/odp/plat/packet_types.h
>> @@ -26,13 +26,13 @@ extern "C" {
>>   *  @{
>>   */
>>
>> -typedef odp_handle_t odp_packet_t;
>> +typedef ODP_HANDLE_T(odp_packet_t);
>>
>>  #define ODP_PACKET_INVALID _odp_cast_scalar(odp_packet_t, 0xffffffff)
>>
>>  #define ODP_PACKET_OFFSET_INVALID (0x0fffffff)
>>
>> -typedef odp_handle_t odp_packet_seg_t;
>> +typedef ODP_HANDLE_T(odp_packet_seg_t);
>>
>>  #define ODP_PACKET_SEG_INVALID _odp_cast_scalar(odp_packet_seg_t,
>> 0xffffffff)
>>
>> diff --git a/platform/linux-generic/include/odp/plat/pool_types.h
>> b/platform/linux-generic/include/odp/plat/pool_types.h
>> index 71c7783..568556f 100644
>> --- a/platform/linux-generic/include/odp/plat/pool_types.h
>> +++ b/platform/linux-generic/include/odp/plat/pool_types.h
>> @@ -25,7 +25,7 @@ extern "C" {
>>   *  @{
>>   */
>>
>> -typedef odp_handle_t odp_pool_t;
>> +typedef ODP_HANDLE_T(odp_pool_t);
>>
>>  #define ODP_POOL_INVALID _odp_cast_scalar(odp_pool_t, 0xffffffff)
>>
>> diff --git a/platform/linux-generic/include/odp/plat/queue_types.h
>> b/platform/linux-generic/include/odp/plat/queue_types.h
>> index 04a0be9..1cecc90 100644
>> --- a/platform/linux-generic/include/odp/plat/queue_types.h
>> +++ b/platform/linux-generic/include/odp/plat/queue_types.h
>> @@ -25,9 +25,9 @@ extern "C" {
>>   *  @{
>>   */
>>
>> -typedef odp_handle_t odp_queue_t;
>> +typedef ODP_HANDLE_T(odp_queue_t);
>>
>> -typedef odp_handle_t odp_queue_group_t;
>> +typedef ODP_HANDLE_T(odp_queue_group_t);
>>
>>  #define ODP_QUEUE_INVALID  _odp_cast_scalar(odp_queue_t, 0)
>>
>> diff --git
>> a/platform/linux-generic/include/odp/plat/shared_memory_types.h
>> b/platform/linux-generic/include/odp/plat/shared_memory_types.h
>> index d2e92cf..4be7356 100644
>> --- a/platform/linux-generic/include/odp/plat/shared_memory_types.h
>> +++ b/platform/linux-generic/include/odp/plat/shared_memory_types.h
>> @@ -26,7 +26,7 @@ extern "C" {
>>   *  @{
>>   */
>>
>> -typedef odp_handle_t odp_shm_t;
>> +typedef ODP_HANDLE_T(odp_shm_t);
>>
>>  #define ODP_SHM_INVALID _odp_cast_scalar(odp_shm_t, 0)
>>  #define ODP_SHM_NULL ODP_SHM_INVALID
>> diff --git a/platform/linux-generic/include/odp/plat/strong_types.h
>> b/platform/linux-generic/include/odp/plat/strong_types.h
>> index cd15853..39bdea3 100644
>> --- a/platform/linux-generic/include/odp/plat/strong_types.h
>> +++ b/platform/linux-generic/include/odp/plat/strong_types.h
>> @@ -16,7 +16,11 @@
>>  #define STRONG_TYPES_H_
>>
>>  /** Use strong typing for ODP types */
>> -#define odp_handle_t struct { uint8_t unused_dummy_var; } *
>> +#ifdef __cplusplus
>> +#define ODP_HANDLE_T(type) struct _##type { uint8_t unused_dummy_var; }
>> *type
>> +#else
>> +#define ODP_HANDLE_T(type) struct { } *type
>> +#endif
>>
>>  /** Internal macro to get value of an ODP handle */
>>  #define _odp_typeval(handle) ((uint32_t)(uintptr_t)(handle))
>> --
>> 1.9.1
>>
>>
>> _______________________________________________
>> lng-odp mailing list
>> lng-odp@lists.linaro.org
>> http://lists.linaro.org/mailman/listinfo/lng-odp
>>
>
>
Maxim Uvarov March 23, 2015, 10:42 a.m. UTC | #3
On 03/23/15 13:25, Ola Liljedahl wrote:
> On 21 March 2015 at 00:18, Bill Fischofer <bill.fischofer@linaro.org 
> <mailto:bill.fischofer@linaro.org>> wrote:
>
>     This patch seems to generate a raft of doxygen warnings:
>
> I didn't test that...
> Doxygen doesn't use the preprocessor? And my patch requires the 
> preprocessor for generating the typedefs. I did not want to have to 
> use #ifdef __cplusplus in every header file, thus the macro.
> Could have done it like this, for every type...
> #ifdef __cplusplus
> typedef struct _odp_packet_t { uint8_t unused_dummy_var; } *odp_packet_t;
> //Or perhaps use the new macro here? Which #if path is used by 
> doxygen? Should we swap the C and C++ cases?
> #else
> typedef odp_handle_t odp_packet_t;
> #endif
>
> What's the minimal changes we need to keep doxygen happy?
>
>

I think you patch is correct but you need add define to PREDEFINED in 
doxygen config:
http://www.stack.nl/~dimitri/doxygen/manual/preprocessing.html

Maxim.

>
>     rm -rf doc/output
>     SRCDIR='.' PROJECT='OpenDataPlane' DOCDIR='doc/output'
>     VERSION='1.0.1' WITH_PLATFORM='linux-generic'
>     PERL_PATH='/usr/bin/perl' HAVE_DOT='NO' GENERATE_MAN='NO'
>     GENERATE_RTF='NO' GENERATE_XML='NO' GENERATE_HTMLHELP='NO'
>     GENERATE_CHI='NO' GENERATE_HTML='YES' GENERATE_LATEX='YES'
>     /usr/bin/doxygen ./doc/doxygen.cfg
>     /home/bill/linaro/check-odp/build/odp-apply/include/odp/api/buffer.h:29:
>     warning: documented symbol `odp_buffer_t' was not declared or defined.
>     /home/bill/linaro/check-odp/build/odp-apply/include/odp/api/buffer.h:39:
>     warning: documented symbol `odp_buffer_seg_t' was not declared or
>     defined.
>     /home/bill/linaro/check-odp/build/odp-apply/include/odp/api/classification.h:29:
>     warning: documented symbol `odp_cos_t' was not declared or defined.
>     /home/bill/linaro/check-odp/build/odp-apply/include/odp/api/classification.h:34:
>     warning: documented symbol `odp_flowsig_t' was not declared or
>     defined.
>     /home/bill/linaro/check-odp/build/odp-apply/include/odp/api/classification.h:186:
>     warning: documented symbol `odp_pmr_t' was not declared or defined.
>     /home/bill/linaro/check-odp/build/odp-apply/include/odp/api/classification.h:349:
>     warning: documented symbol `odp_pmr_set_t' was not declared or
>     defined.
>     /home/bill/linaro/check-odp/build/odp-apply/include/odp/api/crypto.h:37:
>     warning: documented symbol `odp_crypto_compl_t' was not declared
>     or defined.
>     /home/bill/linaro/check-odp/build/odp-apply/include/odp/api/event.h:29:
>     warning: documented symbol `odp_event_t' was not declared or defined.
>     /home/bill/linaro/check-odp/build/odp-apply/include/odp/api/packet.h:27:
>     warning: documented symbol `odp_packet_t' was not declared or defined.
>     /home/bill/linaro/check-odp/build/odp-apply/include/odp/api/packet.h:42:
>     warning: documented symbol `odp_packet_seg_t' was not declared or
>     defined.
>     /home/bill/linaro/check-odp/build/odp-apply/include/odp/api/packet_io.h:27:
>     warning: documented symbol `odp_pktio_t' was not declared or defined.
>     /home/bill/linaro/check-odp/build/odp-apply/include/odp/api/pool.h:31:
>     warning: documented symbol `odp_pool_t' was not declared or defined.
>     /home/bill/linaro/check-odp/build/odp-apply/include/odp/api/queue.h:28:
>     warning: documented symbol `odp_queue_t' was not declared or defined.
>     /home/bill/linaro/check-odp/build/odp-apply/include/odp/api/queue.h:33:
>     warning: documented symbol `odp_queue_group_t' was not declared or
>     defined.
>     /home/bill/linaro/check-odp/build/odp-apply/include/odp/api/shared_memory.h:28:
>     warning: documented symbol `odp_shm_t' was not declared or defined.
>     /home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/classification_types.h:26:
>     warning: Member ODP_HANDLE_T(odp_cos_t) (function) of group
>     odp_classification is not documented.
>     /home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/classification_types.h:27:
>     warning: Member ODP_HANDLE_T(odp_flowsig_t) (function) of group
>     odp_classification is not documented.
>     /home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/classification_types.h:34:
>     warning: Member ODP_HANDLE_T(odp_pmr_t) (function) of group
>     odp_classification is not documented.
>     /home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/classification_types.h:37:
>     warning: Member ODP_HANDLE_T(odp_pmr_set_t) (function) of group
>     odp_classification is not documented.
>     /home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/crypto_types.h:28:
>     warning: Member ODP_HANDLE_T(odp_crypto_compl_t) (function) of
>     group odp_crypto is not documented.
>     /home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/event_types.h:29:
>     warning: Member ODP_HANDLE_T(odp_event_t) (function) of group
>     odp_event is not documented.
>     /home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/packet_io_types.h:29:
>     warning: Member ODP_HANDLE_T(odp_pktio_t) (function) of group
>     odp_packet_io is not documented.
>     /home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/packet_types.h:29:
>     warning: Member ODP_HANDLE_T(odp_packet_t) (function) of group
>     odp_packet is not documented.
>     /home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/packet_types.h:35:
>     warning: Member ODP_HANDLE_T(odp_packet_seg_t) (function) of group
>     odp_packet is not documented.
>     /home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/pool_types.h:28:
>     warning: Member ODP_HANDLE_T(odp_pool_t) (function) of group
>     odp_buffer is not documented.
>     /home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/queue_types.h:28:
>     warning: Member ODP_HANDLE_T(odp_queue_t) (function) of group
>     odp_queue is not documented.
>     /home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/queue_types.h:30:
>     warning: Member ODP_HANDLE_T(odp_queue_group_t) (function) of
>     group odp_queue is not documented.
>     /home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/shared_memory_types.h:29:
>     warning: Member ODP_HANDLE_T(odp_shm_t) (function) of group
>     odp_shared_memory is not documented.
>     /home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/pool_types.h:28:
>     warning: Member ODP_HANDLE_T(odp_pool_t) (function) of group
>     odp_buffer is not documented.
>     /home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/classification_types.h:26:
>     warning: Member ODP_HANDLE_T(odp_cos_t) (function) of group
>     odp_classification is not documented.
>     /home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/classification_types.h:27:
>     warning: Member ODP_HANDLE_T(odp_flowsig_t) (function) of group
>     odp_classification is not documented.
>     /home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/classification_types.h:34:
>     warning: Member ODP_HANDLE_T(odp_pmr_t) (function) of group
>     odp_classification is not documented.
>     /home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/classification_types.h:37:
>     warning: Member ODP_HANDLE_T(odp_pmr_set_t) (function) of group
>     odp_classification is not documented.
>     /home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/crypto_types.h:28:
>     warning: Member ODP_HANDLE_T(odp_crypto_compl_t) (function) of
>     group odp_crypto is not documented.
>     /home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/event_types.h:29:
>     warning: Member ODP_HANDLE_T(odp_event_t) (function) of group
>     odp_event is not documented.
>     /home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/packet_types.h:29:
>     warning: Member ODP_HANDLE_T(odp_packet_t) (function) of group
>     odp_packet is not documented.
>     /home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/packet_types.h:35:
>     warning: Member ODP_HANDLE_T(odp_packet_seg_t) (function) of group
>     odp_packet is not documented.
>     /home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/packet_io_types.h:29:
>     warning: Member ODP_HANDLE_T(odp_pktio_t) (function) of group
>     odp_packet_io is not documented.
>     /home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/queue_types.h:28:
>     warning: Member ODP_HANDLE_T(odp_queue_t) (function) of group
>     odp_queue is not documented.
>     /home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/queue_types.h:30:
>     warning: Member ODP_HANDLE_T(odp_queue_group_t) (function) of
>     group odp_queue is not documented.
>     /home/bill/linaro/check-odp/build/odp-apply/platform/linux-generic/include/odp/plat/shared_memory_types.h:29:
>     warning: Member ODP_HANDLE_T(odp_shm_t) (function) of group
>     odp_shared_memory is not documented.
>
>
>
>     On Fri, Mar 20, 2015 at 5:16 PM, Ola Liljedahl
>     <ola.liljedahl@linaro.org <mailto:ola.liljedahl@linaro.org>> wrote:
>
>         Typedefs to anonymous structs creates problems for C++ programs:
>         GCC:
>         warning: ‘odp_crypto_op_params’ has a field
>         ‘odp_crypto_op_params::pkt’
>         whose type uses the anonymous namespace
>         error: anonymous type with no linkage used to declare function
>         ‘<anonymous struct>* ppp_packet::get_queue() const’ with linkage
>         CLANG:
>         extern odp_pool_t tmo_pool;
>         warning: variable 'tmo_pool' has internal linkage but is not
>         defined
>         When linking:
>         undefined reference to `tmo_pool'
>
>         The solution is to add a (unique) name to all structs used by
>         the strong
>         typing typedefs.
>
>         Signed-off-by: Ola Liljedahl <ola.liljedahl@linaro.org
>         <mailto:ola.liljedahl@linaro.org>>
>         ---
>         (This document/code contribution attached is provided under
>         the terms of
>         agreement LES-LTM-21309)
>
>          platform/linux-generic/include/odp/plat/buffer_types.h      
>          | 4 ++--
>          platform/linux-generic/include/odp/plat/classification_types.h |
>         8 ++++----
>          platform/linux-generic/include/odp/plat/crypto_types.h      
>          | 2 +-
>          platform/linux-generic/include/odp/plat/event_types.h        
>         | 2 +-
>          platform/linux-generic/include/odp/plat/packet_io_types.h    
>         | 2 +-
>          platform/linux-generic/include/odp/plat/packet_types.h      
>          | 4 ++--
>          platform/linux-generic/include/odp/plat/pool_types.h        
>          | 2 +-
>          platform/linux-generic/include/odp/plat/queue_types.h        
>         | 4 ++--
>          platform/linux-generic/include/odp/plat/shared_memory_types.h
>         | 2 +-
>          platform/linux-generic/include/odp/plat/strong_types.h      
>          | 6 +++++-
>          10 files changed, 20 insertions(+), 16 deletions(-)
>
>         diff --git
>         a/platform/linux-generic/include/odp/plat/buffer_types.h
>         b/platform/linux-generic/include/odp/plat/buffer_types.h
>         index 3e7070e..0c017ae 100644
>         --- a/platform/linux-generic/include/odp/plat/buffer_types.h
>         +++ b/platform/linux-generic/include/odp/plat/buffer_types.h
>         @@ -26,13 +26,13 @@ extern "C" {
>           */
>
>          /** ODP buffer */
>         -typedef odp_handle_t odp_buffer_t;
>         +typedef ODP_HANDLE_T(odp_buffer_t);
>
>          /** Invalid buffer */
>          #define ODP_BUFFER_INVALID _odp_cast_scalar(odp_buffer_t,
>         0xffffffff)
>
>          /** ODP buffer segment */
>         -typedef odp_handle_t odp_buffer_seg_t;
>         +typedef ODP_HANDLE_T(odp_buffer_seg_t);
>
>          /** Invalid segment */
>          #define ODP_SEGMENT_INVALID
>         ((odp_buffer_seg_t)ODP_BUFFER_INVALID)
>         diff --git
>         a/platform/linux-generic/include/odp/plat/classification_types.h
>         b/platform/linux-generic/include/odp/plat/classification_types.h
>         index 042d8c8..767da7d 100644
>         ---
>         a/platform/linux-generic/include/odp/plat/classification_types.h
>         +++
>         b/platform/linux-generic/include/odp/plat/classification_types.h
>         @@ -23,18 +23,18 @@ extern "C" {
>           *  @{
>           */
>
>         -typedef odp_handle_t odp_cos_t;
>         -typedef odp_handle_t odp_flowsig_t;
>         +typedef ODP_HANDLE_T(odp_cos_t);
>         +typedef ODP_HANDLE_T(odp_flowsig_t);
>
>          #define ODP_COS_INVALID _odp_cast_scalar(odp_cos_t, ~0)
>          #define ODP_COS_NAME_LEN 32
>
>          typedef uint16_t odp_cos_flow_set_t;
>
>         -typedef odp_handle_t odp_pmr_t;
>         +typedef ODP_HANDLE_T(odp_pmr_t);
>          #define ODP_PMR_INVAL _odp_cast_scalar(odp_pmr_t, ~0)
>
>         -typedef odp_handle_t odp_pmr_set_t;
>         +typedef ODP_HANDLE_T(odp_pmr_set_t);
>          #define ODP_PMR_SET_INVAL _odp_cast_scalar(odp_pmr_set_t, ~0)
>
>          /** Get printable format of odp_cos_t */
>         diff --git
>         a/platform/linux-generic/include/odp/plat/crypto_types.h
>         b/platform/linux-generic/include/odp/plat/crypto_types.h
>         index 1b10a5d..a91d88e 100644
>         --- a/platform/linux-generic/include/odp/plat/crypto_types.h
>         +++ b/platform/linux-generic/include/odp/plat/crypto_types.h
>         @@ -25,7 +25,7 @@ extern "C" {
>          #define ODP_CRYPTO_SESSION_INVALID (0xffffffffffffffffULL)
>
>          typedef uint64_t odp_crypto_session_t;
>         -typedef odp_handle_t odp_crypto_compl_t;
>         +typedef ODP_HANDLE_T(odp_crypto_compl_t);
>
>          enum odp_crypto_op_mode {
>                 ODP_CRYPTO_SYNC,
>         diff --git
>         a/platform/linux-generic/include/odp/plat/event_types.h
>         b/platform/linux-generic/include/odp/plat/event_types.h
>         index 24be22f..d91937d 100644
>         --- a/platform/linux-generic/include/odp/plat/event_types.h
>         +++ b/platform/linux-generic/include/odp/plat/event_types.h
>         @@ -26,7 +26,7 @@ extern "C" {
>           *  @{
>           */
>
>         -typedef odp_handle_t odp_event_t;
>         +typedef ODP_HANDLE_T(odp_event_t);
>
>          #define ODP_EVENT_INVALID _odp_cast_scalar(odp_event_t,
>         0xffffffff)
>
>         diff --git
>         a/platform/linux-generic/include/odp/plat/packet_io_types.h
>         b/platform/linux-generic/include/odp/plat/packet_io_types.h
>         index 60592e3..3cc64c6 100644
>         --- a/platform/linux-generic/include/odp/plat/packet_io_types.h
>         +++ b/platform/linux-generic/include/odp/plat/packet_io_types.h
>         @@ -26,7 +26,7 @@ extern "C" {
>           *  @{
>           */
>
>         -typedef odp_handle_t odp_pktio_t;
>         +typedef ODP_HANDLE_T(odp_pktio_t);
>
>          #define ODP_PKTIO_INVALID _odp_cast_scalar(odp_pktio_t, 0)
>
>         diff --git
>         a/platform/linux-generic/include/odp/plat/packet_types.h
>         b/platform/linux-generic/include/odp/plat/packet_types.h
>         index 57e9662..45cb801 100644
>         --- a/platform/linux-generic/include/odp/plat/packet_types.h
>         +++ b/platform/linux-generic/include/odp/plat/packet_types.h
>         @@ -26,13 +26,13 @@ extern "C" {
>           *  @{
>           */
>
>         -typedef odp_handle_t odp_packet_t;
>         +typedef ODP_HANDLE_T(odp_packet_t);
>
>          #define ODP_PACKET_INVALID _odp_cast_scalar(odp_packet_t,
>         0xffffffff)
>
>          #define ODP_PACKET_OFFSET_INVALID (0x0fffffff)
>
>         -typedef odp_handle_t odp_packet_seg_t;
>         +typedef ODP_HANDLE_T(odp_packet_seg_t);
>
>          #define ODP_PACKET_SEG_INVALID
>         _odp_cast_scalar(odp_packet_seg_t, 0xffffffff)
>
>         diff --git
>         a/platform/linux-generic/include/odp/plat/pool_types.h
>         b/platform/linux-generic/include/odp/plat/pool_types.h
>         index 71c7783..568556f 100644
>         --- a/platform/linux-generic/include/odp/plat/pool_types.h
>         +++ b/platform/linux-generic/include/odp/plat/pool_types.h
>         @@ -25,7 +25,7 @@ extern "C" {
>           *  @{
>           */
>
>         -typedef odp_handle_t odp_pool_t;
>         +typedef ODP_HANDLE_T(odp_pool_t);
>
>          #define ODP_POOL_INVALID _odp_cast_scalar(odp_pool_t, 0xffffffff)
>
>         diff --git
>         a/platform/linux-generic/include/odp/plat/queue_types.h
>         b/platform/linux-generic/include/odp/plat/queue_types.h
>         index 04a0be9..1cecc90 100644
>         --- a/platform/linux-generic/include/odp/plat/queue_types.h
>         +++ b/platform/linux-generic/include/odp/plat/queue_types.h
>         @@ -25,9 +25,9 @@ extern "C" {
>           *  @{
>           */
>
>         -typedef odp_handle_t odp_queue_t;
>         +typedef ODP_HANDLE_T(odp_queue_t);
>
>         -typedef odp_handle_t odp_queue_group_t;
>         +typedef ODP_HANDLE_T(odp_queue_group_t);
>
>          #define ODP_QUEUE_INVALID _odp_cast_scalar(odp_queue_t, 0)
>
>         diff --git
>         a/platform/linux-generic/include/odp/plat/shared_memory_types.h b/platform/linux-generic/include/odp/plat/shared_memory_types.h
>         index d2e92cf..4be7356 100644
>         ---
>         a/platform/linux-generic/include/odp/plat/shared_memory_types.h
>         +++
>         b/platform/linux-generic/include/odp/plat/shared_memory_types.h
>         @@ -26,7 +26,7 @@ extern "C" {
>           *  @{
>           */
>
>         -typedef odp_handle_t odp_shm_t;
>         +typedef ODP_HANDLE_T(odp_shm_t);
>
>          #define ODP_SHM_INVALID _odp_cast_scalar(odp_shm_t, 0)
>          #define ODP_SHM_NULL ODP_SHM_INVALID
>         diff --git
>         a/platform/linux-generic/include/odp/plat/strong_types.h
>         b/platform/linux-generic/include/odp/plat/strong_types.h
>         index cd15853..39bdea3 100644
>         --- a/platform/linux-generic/include/odp/plat/strong_types.h
>         +++ b/platform/linux-generic/include/odp/plat/strong_types.h
>         @@ -16,7 +16,11 @@
>          #define STRONG_TYPES_H_
>
>          /** Use strong typing for ODP types */
>         -#define odp_handle_t struct { uint8_t unused_dummy_var; } *
>         +#ifdef __cplusplus
>         +#define ODP_HANDLE_T(type) struct _##type { uint8_t
>         unused_dummy_var; } *type
>         +#else
>         +#define ODP_HANDLE_T(type) struct { } *type
>         +#endif
>
>          /** Internal macro to get value of an ODP handle */
>          #define _odp_typeval(handle) ((uint32_t)(uintptr_t)(handle))
>         --
>         1.9.1
>
>
>         _______________________________________________
>         lng-odp mailing list
>         lng-odp@lists.linaro.org <mailto:lng-odp@lists.linaro.org>
>         http://lists.linaro.org/mailman/listinfo/lng-odp
>
>
>
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
Ola Liljedahl March 23, 2015, 3:49 p.m. UTC | #4
On 23 March 2015 at 11:42, Maxim Uvarov <maxim.uvarov@linaro.org> wrote:

> On 03/23/15 13:25, Ola Liljedahl wrote:
>
>> On 21 March 2015 at 00:18, Bill Fischofer <bill.fischofer@linaro.org
>> <mailto:bill.fischofer@linaro.org>> wrote:
>>
>>     This patch seems to generate a raft of doxygen warnings:
>>
>> I didn't test that...
>> Doxygen doesn't use the preprocessor? And my patch requires the
>> preprocessor for generating the typedefs. I did not want to have to use
>> #ifdef __cplusplus in every header file, thus the macro.
>> Could have done it like this, for every type...
>> #ifdef __cplusplus
>> typedef struct _odp_packet_t { uint8_t unused_dummy_var; } *odp_packet_t;
>> //Or perhaps use the new macro here? Which #if path is used by doxygen?
>> Should we swap the C and C++ cases?
>> #else
>> typedef odp_handle_t odp_packet_t;
>> #endif
>>
>> What's the minimal changes we need to keep doxygen happy?
>>
>>
>>
> I think you patch is correct but you need add define to PREDEFINED in
> doxygen config:
> http://www.stack.nl/~dimitri/doxygen/manual/preprocessing.html
>
> Great there is a solution for this. I will try it out. Thanks Maxim.



> Maxim.
>
>
>>     rm -rf doc/output
>>     SRCDIR='.' PROJECT='OpenDataPlane' DOCDIR='doc/output'
>>     VERSION='1.0.1' WITH_PLATFORM='linux-generic'
>>     PERL_PATH='/usr/bin/perl' HAVE_DOT='NO' GENERATE_MAN='NO'
>>     GENERATE_RTF='NO' GENERATE_XML='NO' GENERATE_HTMLHELP='NO'
>>     GENERATE_CHI='NO' GENERATE_HTML='YES' GENERATE_LATEX='YES'
>>     /usr/bin/doxygen ./doc/doxygen.cfg
>>     /home/bill/linaro/check-odp/build/odp-apply/include/odp/
>> api/buffer.h:29:
>>     warning: documented symbol `odp_buffer_t' was not declared or defined.
>>     /home/bill/linaro/check-odp/build/odp-apply/include/odp/
>> api/buffer.h:39:
>>     warning: documented symbol `odp_buffer_seg_t' was not declared or
>>     defined.
>>     /home/bill/linaro/check-odp/build/odp-apply/include/odp/
>> api/classification.h:29:
>>     warning: documented symbol `odp_cos_t' was not declared or defined.
>>     /home/bill/linaro/check-odp/build/odp-apply/include/odp/
>> api/classification.h:34:
>>     warning: documented symbol `odp_flowsig_t' was not declared or
>>     defined.
>>     /home/bill/linaro/check-odp/build/odp-apply/include/odp/
>> api/classification.h:186:
>>     warning: documented symbol `odp_pmr_t' was not declared or defined.
>>     /home/bill/linaro/check-odp/build/odp-apply/include/odp/
>> api/classification.h:349:
>>     warning: documented symbol `odp_pmr_set_t' was not declared or
>>     defined.
>>     /home/bill/linaro/check-odp/build/odp-apply/include/odp/
>> api/crypto.h:37:
>>     warning: documented symbol `odp_crypto_compl_t' was not declared
>>     or defined.
>>     /home/bill/linaro/check-odp/build/odp-apply/include/odp/
>> api/event.h:29:
>>     warning: documented symbol `odp_event_t' was not declared or defined.
>>     /home/bill/linaro/check-odp/build/odp-apply/include/odp/
>> api/packet.h:27:
>>     warning: documented symbol `odp_packet_t' was not declared or defined.
>>     /home/bill/linaro/check-odp/build/odp-apply/include/odp/
>> api/packet.h:42:
>>     warning: documented symbol `odp_packet_seg_t' was not declared or
>>     defined.
>>     /home/bill/linaro/check-odp/build/odp-apply/include/odp/
>> api/packet_io.h:27:
>>     warning: documented symbol `odp_pktio_t' was not declared or defined.
>>     /home/bill/linaro/check-odp/build/odp-apply/include/odp/
>> api/pool.h:31:
>>     warning: documented symbol `odp_pool_t' was not declared or defined.
>>     /home/bill/linaro/check-odp/build/odp-apply/include/odp/
>> api/queue.h:28:
>>     warning: documented symbol `odp_queue_t' was not declared or defined.
>>     /home/bill/linaro/check-odp/build/odp-apply/include/odp/
>> api/queue.h:33:
>>     warning: documented symbol `odp_queue_group_t' was not declared or
>>     defined.
>>     /home/bill/linaro/check-odp/build/odp-apply/include/odp/
>> api/shared_memory.h:28:
>>     warning: documented symbol `odp_shm_t' was not declared or defined.
>>     /home/bill/linaro/check-odp/build/odp-apply/platform/
>> linux-generic/include/odp/plat/classification_types.h:26:
>>     warning: Member ODP_HANDLE_T(odp_cos_t) (function) of group
>>     odp_classification is not documented.
>>     /home/bill/linaro/check-odp/build/odp-apply/platform/
>> linux-generic/include/odp/plat/classification_types.h:27:
>>     warning: Member ODP_HANDLE_T(odp_flowsig_t) (function) of group
>>     odp_classification is not documented.
>>     /home/bill/linaro/check-odp/build/odp-apply/platform/
>> linux-generic/include/odp/plat/classification_types.h:34:
>>     warning: Member ODP_HANDLE_T(odp_pmr_t) (function) of group
>>     odp_classification is not documented.
>>     /home/bill/linaro/check-odp/build/odp-apply/platform/
>> linux-generic/include/odp/plat/classification_types.h:37:
>>     warning: Member ODP_HANDLE_T(odp_pmr_set_t) (function) of group
>>     odp_classification is not documented.
>>     /home/bill/linaro/check-odp/build/odp-apply/platform/
>> linux-generic/include/odp/plat/crypto_types.h:28:
>>     warning: Member ODP_HANDLE_T(odp_crypto_compl_t) (function) of
>>     group odp_crypto is not documented.
>>     /home/bill/linaro/check-odp/build/odp-apply/platform/
>> linux-generic/include/odp/plat/event_types.h:29:
>>     warning: Member ODP_HANDLE_T(odp_event_t) (function) of group
>>     odp_event is not documented.
>>     /home/bill/linaro/check-odp/build/odp-apply/platform/
>> linux-generic/include/odp/plat/packet_io_types.h:29:
>>     warning: Member ODP_HANDLE_T(odp_pktio_t) (function) of group
>>     odp_packet_io is not documented.
>>     /home/bill/linaro/check-odp/build/odp-apply/platform/
>> linux-generic/include/odp/plat/packet_types.h:29:
>>     warning: Member ODP_HANDLE_T(odp_packet_t) (function) of group
>>     odp_packet is not documented.
>>     /home/bill/linaro/check-odp/build/odp-apply/platform/
>> linux-generic/include/odp/plat/packet_types.h:35:
>>     warning: Member ODP_HANDLE_T(odp_packet_seg_t) (function) of group
>>     odp_packet is not documented.
>>     /home/bill/linaro/check-odp/build/odp-apply/platform/
>> linux-generic/include/odp/plat/pool_types.h:28:
>>     warning: Member ODP_HANDLE_T(odp_pool_t) (function) of group
>>     odp_buffer is not documented.
>>     /home/bill/linaro/check-odp/build/odp-apply/platform/
>> linux-generic/include/odp/plat/queue_types.h:28:
>>     warning: Member ODP_HANDLE_T(odp_queue_t) (function) of group
>>     odp_queue is not documented.
>>     /home/bill/linaro/check-odp/build/odp-apply/platform/
>> linux-generic/include/odp/plat/queue_types.h:30:
>>     warning: Member ODP_HANDLE_T(odp_queue_group_t) (function) of
>>     group odp_queue is not documented.
>>     /home/bill/linaro/check-odp/build/odp-apply/platform/
>> linux-generic/include/odp/plat/shared_memory_types.h:29:
>>     warning: Member ODP_HANDLE_T(odp_shm_t) (function) of group
>>     odp_shared_memory is not documented.
>>     /home/bill/linaro/check-odp/build/odp-apply/platform/
>> linux-generic/include/odp/plat/pool_types.h:28:
>>     warning: Member ODP_HANDLE_T(odp_pool_t) (function) of group
>>     odp_buffer is not documented.
>>     /home/bill/linaro/check-odp/build/odp-apply/platform/
>> linux-generic/include/odp/plat/classification_types.h:26:
>>     warning: Member ODP_HANDLE_T(odp_cos_t) (function) of group
>>     odp_classification is not documented.
>>     /home/bill/linaro/check-odp/build/odp-apply/platform/
>> linux-generic/include/odp/plat/classification_types.h:27:
>>     warning: Member ODP_HANDLE_T(odp_flowsig_t) (function) of group
>>     odp_classification is not documented.
>>     /home/bill/linaro/check-odp/build/odp-apply/platform/
>> linux-generic/include/odp/plat/classification_types.h:34:
>>     warning: Member ODP_HANDLE_T(odp_pmr_t) (function) of group
>>     odp_classification is not documented.
>>     /home/bill/linaro/check-odp/build/odp-apply/platform/
>> linux-generic/include/odp/plat/classification_types.h:37:
>>     warning: Member ODP_HANDLE_T(odp_pmr_set_t) (function) of group
>>     odp_classification is not documented.
>>     /home/bill/linaro/check-odp/build/odp-apply/platform/
>> linux-generic/include/odp/plat/crypto_types.h:28:
>>     warning: Member ODP_HANDLE_T(odp_crypto_compl_t) (function) of
>>     group odp_crypto is not documented.
>>     /home/bill/linaro/check-odp/build/odp-apply/platform/
>> linux-generic/include/odp/plat/event_types.h:29:
>>     warning: Member ODP_HANDLE_T(odp_event_t) (function) of group
>>     odp_event is not documented.
>>     /home/bill/linaro/check-odp/build/odp-apply/platform/
>> linux-generic/include/odp/plat/packet_types.h:29:
>>     warning: Member ODP_HANDLE_T(odp_packet_t) (function) of group
>>     odp_packet is not documented.
>>     /home/bill/linaro/check-odp/build/odp-apply/platform/
>> linux-generic/include/odp/plat/packet_types.h:35:
>>     warning: Member ODP_HANDLE_T(odp_packet_seg_t) (function) of group
>>     odp_packet is not documented.
>>     /home/bill/linaro/check-odp/build/odp-apply/platform/
>> linux-generic/include/odp/plat/packet_io_types.h:29:
>>     warning: Member ODP_HANDLE_T(odp_pktio_t) (function) of group
>>     odp_packet_io is not documented.
>>     /home/bill/linaro/check-odp/build/odp-apply/platform/
>> linux-generic/include/odp/plat/queue_types.h:28:
>>     warning: Member ODP_HANDLE_T(odp_queue_t) (function) of group
>>     odp_queue is not documented.
>>     /home/bill/linaro/check-odp/build/odp-apply/platform/
>> linux-generic/include/odp/plat/queue_types.h:30:
>>     warning: Member ODP_HANDLE_T(odp_queue_group_t) (function) of
>>     group odp_queue is not documented.
>>     /home/bill/linaro/check-odp/build/odp-apply/platform/
>> linux-generic/include/odp/plat/shared_memory_types.h:29:
>>     warning: Member ODP_HANDLE_T(odp_shm_t) (function) of group
>>     odp_shared_memory is not documented.
>>
>>
>>
>>     On Fri, Mar 20, 2015 at 5:16 PM, Ola Liljedahl
>>     <ola.liljedahl@linaro.org <mailto:ola.liljedahl@linaro.org>> wrote:
>>
>>         Typedefs to anonymous structs creates problems for C++ programs:
>>         GCC:
>>         warning: ‘odp_crypto_op_params’ has a field
>>         ‘odp_crypto_op_params::pkt’
>>         whose type uses the anonymous namespace
>>         error: anonymous type with no linkage used to declare function
>>         ‘<anonymous struct>* ppp_packet::get_queue() const’ with linkage
>>         CLANG:
>>         extern odp_pool_t tmo_pool;
>>         warning: variable 'tmo_pool' has internal linkage but is not
>>         defined
>>         When linking:
>>         undefined reference to `tmo_pool'
>>
>>         The solution is to add a (unique) name to all structs used by
>>         the strong
>>         typing typedefs.
>>
>>         Signed-off-by: Ola Liljedahl <ola.liljedahl@linaro.org
>>         <mailto:ola.liljedahl@linaro.org>>
>>
>>         ---
>>         (This document/code contribution attached is provided under
>>         the terms of
>>         agreement LES-LTM-21309)
>>
>>          platform/linux-generic/include/odp/plat/buffer_types.h
>>      | 4 ++--
>>          platform/linux-generic/include/odp/plat/classification_types.h |
>>         8 ++++----
>>          platform/linux-generic/include/odp/plat/crypto_types.h
>>      | 2 +-
>>          platform/linux-generic/include/odp/plat/event_types.h
>>       | 2 +-
>>          platform/linux-generic/include/odp/plat/packet_io_types.h
>>       | 2 +-
>>          platform/linux-generic/include/odp/plat/packet_types.h
>>      | 4 ++--
>>          platform/linux-generic/include/odp/plat/pool_types.h
>>      | 2 +-
>>          platform/linux-generic/include/odp/plat/queue_types.h
>>       | 4 ++--
>>          platform/linux-generic/include/odp/plat/shared_memory_types.h
>>         | 2 +-
>>          platform/linux-generic/include/odp/plat/strong_types.h
>>      | 6 +++++-
>>          10 files changed, 20 insertions(+), 16 deletions(-)
>>
>>         diff --git
>>         a/platform/linux-generic/include/odp/plat/buffer_types.h
>>         b/platform/linux-generic/include/odp/plat/buffer_types.h
>>         index 3e7070e..0c017ae 100644
>>         --- a/platform/linux-generic/include/odp/plat/buffer_types.h
>>         +++ b/platform/linux-generic/include/odp/plat/buffer_types.h
>>         @@ -26,13 +26,13 @@ extern "C" {
>>           */
>>
>>          /** ODP buffer */
>>         -typedef odp_handle_t odp_buffer_t;
>>         +typedef ODP_HANDLE_T(odp_buffer_t);
>>
>>          /** Invalid buffer */
>>          #define ODP_BUFFER_INVALID _odp_cast_scalar(odp_buffer_t,
>>         0xffffffff)
>>
>>          /** ODP buffer segment */
>>         -typedef odp_handle_t odp_buffer_seg_t;
>>         +typedef ODP_HANDLE_T(odp_buffer_seg_t);
>>
>>          /** Invalid segment */
>>          #define ODP_SEGMENT_INVALID
>>         ((odp_buffer_seg_t)ODP_BUFFER_INVALID)
>>         diff --git
>>         a/platform/linux-generic/include/odp/plat/classification_types.h
>>         b/platform/linux-generic/include/odp/plat/classification_types.h
>>         index 042d8c8..767da7d 100644
>>         ---
>>         a/platform/linux-generic/include/odp/plat/classification_types.h
>>         +++
>>         b/platform/linux-generic/include/odp/plat/classification_types.h
>>         @@ -23,18 +23,18 @@ extern "C" {
>>           *  @{
>>           */
>>
>>         -typedef odp_handle_t odp_cos_t;
>>         -typedef odp_handle_t odp_flowsig_t;
>>         +typedef ODP_HANDLE_T(odp_cos_t);
>>         +typedef ODP_HANDLE_T(odp_flowsig_t);
>>
>>          #define ODP_COS_INVALID _odp_cast_scalar(odp_cos_t, ~0)
>>          #define ODP_COS_NAME_LEN 32
>>
>>          typedef uint16_t odp_cos_flow_set_t;
>>
>>         -typedef odp_handle_t odp_pmr_t;
>>         +typedef ODP_HANDLE_T(odp_pmr_t);
>>          #define ODP_PMR_INVAL _odp_cast_scalar(odp_pmr_t, ~0)
>>
>>         -typedef odp_handle_t odp_pmr_set_t;
>>         +typedef ODP_HANDLE_T(odp_pmr_set_t);
>>          #define ODP_PMR_SET_INVAL _odp_cast_scalar(odp_pmr_set_t, ~0)
>>
>>          /** Get printable format of odp_cos_t */
>>         diff --git
>>         a/platform/linux-generic/include/odp/plat/crypto_types.h
>>         b/platform/linux-generic/include/odp/plat/crypto_types.h
>>         index 1b10a5d..a91d88e 100644
>>         --- a/platform/linux-generic/include/odp/plat/crypto_types.h
>>         +++ b/platform/linux-generic/include/odp/plat/crypto_types.h
>>         @@ -25,7 +25,7 @@ extern "C" {
>>          #define ODP_CRYPTO_SESSION_INVALID (0xffffffffffffffffULL)
>>
>>          typedef uint64_t odp_crypto_session_t;
>>         -typedef odp_handle_t odp_crypto_compl_t;
>>         +typedef ODP_HANDLE_T(odp_crypto_compl_t);
>>
>>          enum odp_crypto_op_mode {
>>                 ODP_CRYPTO_SYNC,
>>         diff --git
>>         a/platform/linux-generic/include/odp/plat/event_types.h
>>         b/platform/linux-generic/include/odp/plat/event_types.h
>>         index 24be22f..d91937d 100644
>>         --- a/platform/linux-generic/include/odp/plat/event_types.h
>>         +++ b/platform/linux-generic/include/odp/plat/event_types.h
>>         @@ -26,7 +26,7 @@ extern "C" {
>>           *  @{
>>           */
>>
>>         -typedef odp_handle_t odp_event_t;
>>         +typedef ODP_HANDLE_T(odp_event_t);
>>
>>          #define ODP_EVENT_INVALID _odp_cast_scalar(odp_event_t,
>>         0xffffffff)
>>
>>         diff --git
>>         a/platform/linux-generic/include/odp/plat/packet_io_types.h
>>         b/platform/linux-generic/include/odp/plat/packet_io_types.h
>>         index 60592e3..3cc64c6 100644
>>         --- a/platform/linux-generic/include/odp/plat/packet_io_types.h
>>         +++ b/platform/linux-generic/include/odp/plat/packet_io_types.h
>>         @@ -26,7 +26,7 @@ extern "C" {
>>           *  @{
>>           */
>>
>>         -typedef odp_handle_t odp_pktio_t;
>>         +typedef ODP_HANDLE_T(odp_pktio_t);
>>
>>          #define ODP_PKTIO_INVALID _odp_cast_scalar(odp_pktio_t, 0)
>>
>>         diff --git
>>         a/platform/linux-generic/include/odp/plat/packet_types.h
>>         b/platform/linux-generic/include/odp/plat/packet_types.h
>>         index 57e9662..45cb801 100644
>>         --- a/platform/linux-generic/include/odp/plat/packet_types.h
>>         +++ b/platform/linux-generic/include/odp/plat/packet_types.h
>>         @@ -26,13 +26,13 @@ extern "C" {
>>           *  @{
>>           */
>>
>>         -typedef odp_handle_t odp_packet_t;
>>         +typedef ODP_HANDLE_T(odp_packet_t);
>>
>>          #define ODP_PACKET_INVALID _odp_cast_scalar(odp_packet_t,
>>         0xffffffff)
>>
>>          #define ODP_PACKET_OFFSET_INVALID (0x0fffffff)
>>
>>         -typedef odp_handle_t odp_packet_seg_t;
>>         +typedef ODP_HANDLE_T(odp_packet_seg_t);
>>
>>          #define ODP_PACKET_SEG_INVALID
>>         _odp_cast_scalar(odp_packet_seg_t, 0xffffffff)
>>
>>         diff --git
>>         a/platform/linux-generic/include/odp/plat/pool_types.h
>>         b/platform/linux-generic/include/odp/plat/pool_types.h
>>         index 71c7783..568556f 100644
>>         --- a/platform/linux-generic/include/odp/plat/pool_types.h
>>         +++ b/platform/linux-generic/include/odp/plat/pool_types.h
>>         @@ -25,7 +25,7 @@ extern "C" {
>>           *  @{
>>           */
>>
>>         -typedef odp_handle_t odp_pool_t;
>>         +typedef ODP_HANDLE_T(odp_pool_t);
>>
>>          #define ODP_POOL_INVALID _odp_cast_scalar(odp_pool_t, 0xffffffff)
>>
>>         diff --git
>>         a/platform/linux-generic/include/odp/plat/queue_types.h
>>         b/platform/linux-generic/include/odp/plat/queue_types.h
>>         index 04a0be9..1cecc90 100644
>>         --- a/platform/linux-generic/include/odp/plat/queue_types.h
>>         +++ b/platform/linux-generic/include/odp/plat/queue_types.h
>>         @@ -25,9 +25,9 @@ extern "C" {
>>           *  @{
>>           */
>>
>>         -typedef odp_handle_t odp_queue_t;
>>         +typedef ODP_HANDLE_T(odp_queue_t);
>>
>>         -typedef odp_handle_t odp_queue_group_t;
>>         +typedef ODP_HANDLE_T(odp_queue_group_t);
>>
>>          #define ODP_QUEUE_INVALID _odp_cast_scalar(odp_queue_t, 0)
>>
>>         diff --git
>>         a/platform/linux-generic/include/odp/plat/shared_memory_types.h
>> b/platform/linux-generic/include/odp/plat/shared_memory_types.h
>>         index d2e92cf..4be7356 100644
>>         ---
>>         a/platform/linux-generic/include/odp/plat/shared_memory_types.h
>>         +++
>>         b/platform/linux-generic/include/odp/plat/shared_memory_types.h
>>         @@ -26,7 +26,7 @@ extern "C" {
>>           *  @{
>>           */
>>
>>         -typedef odp_handle_t odp_shm_t;
>>         +typedef ODP_HANDLE_T(odp_shm_t);
>>
>>          #define ODP_SHM_INVALID _odp_cast_scalar(odp_shm_t, 0)
>>          #define ODP_SHM_NULL ODP_SHM_INVALID
>>         diff --git
>>         a/platform/linux-generic/include/odp/plat/strong_types.h
>>         b/platform/linux-generic/include/odp/plat/strong_types.h
>>         index cd15853..39bdea3 100644
>>         --- a/platform/linux-generic/include/odp/plat/strong_types.h
>>         +++ b/platform/linux-generic/include/odp/plat/strong_types.h
>>         @@ -16,7 +16,11 @@
>>          #define STRONG_TYPES_H_
>>
>>          /** Use strong typing for ODP types */
>>         -#define odp_handle_t struct { uint8_t unused_dummy_var; } *
>>         +#ifdef __cplusplus
>>         +#define ODP_HANDLE_T(type) struct _##type { uint8_t
>>         unused_dummy_var; } *type
>>         +#else
>>         +#define ODP_HANDLE_T(type) struct { } *type
>>         +#endif
>>
>>          /** Internal macro to get value of an ODP handle */
>>          #define _odp_typeval(handle) ((uint32_t)(uintptr_t)(handle))
>>         --
>>         1.9.1
>>
>>
>>         _______________________________________________
>>         lng-odp mailing list
>>         lng-odp@lists.linaro.org <mailto:lng-odp@lists.linaro.org>
>>         http://lists.linaro.org/mailman/listinfo/lng-odp
>>
>>
>>
>>
>>
>> _______________________________________________
>> lng-odp mailing list
>> lng-odp@lists.linaro.org
>> http://lists.linaro.org/mailman/listinfo/lng-odp
>>
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
>
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 3e7070e..0c017ae 100644
--- a/platform/linux-generic/include/odp/plat/buffer_types.h
+++ b/platform/linux-generic/include/odp/plat/buffer_types.h
@@ -26,13 +26,13 @@  extern "C" {
  */
 
 /** ODP buffer */
-typedef odp_handle_t odp_buffer_t;
+typedef ODP_HANDLE_T(odp_buffer_t);
 
 /** Invalid buffer */
 #define ODP_BUFFER_INVALID _odp_cast_scalar(odp_buffer_t, 0xffffffff)
 
 /** ODP buffer segment */
-typedef odp_handle_t odp_buffer_seg_t;
+typedef ODP_HANDLE_T(odp_buffer_seg_t);
 
 /** Invalid segment */
 #define ODP_SEGMENT_INVALID ((odp_buffer_seg_t)ODP_BUFFER_INVALID)
diff --git a/platform/linux-generic/include/odp/plat/classification_types.h b/platform/linux-generic/include/odp/plat/classification_types.h
index 042d8c8..767da7d 100644
--- a/platform/linux-generic/include/odp/plat/classification_types.h
+++ b/platform/linux-generic/include/odp/plat/classification_types.h
@@ -23,18 +23,18 @@  extern "C" {
  *  @{
  */
 
-typedef odp_handle_t odp_cos_t;
-typedef odp_handle_t odp_flowsig_t;
+typedef ODP_HANDLE_T(odp_cos_t);
+typedef ODP_HANDLE_T(odp_flowsig_t);
 
 #define ODP_COS_INVALID  _odp_cast_scalar(odp_cos_t, ~0)
 #define ODP_COS_NAME_LEN 32
 
 typedef uint16_t odp_cos_flow_set_t;
 
-typedef odp_handle_t odp_pmr_t;
+typedef ODP_HANDLE_T(odp_pmr_t);
 #define ODP_PMR_INVAL _odp_cast_scalar(odp_pmr_t, ~0)
 
-typedef odp_handle_t odp_pmr_set_t;
+typedef ODP_HANDLE_T(odp_pmr_set_t);
 #define ODP_PMR_SET_INVAL _odp_cast_scalar(odp_pmr_set_t, ~0)
 
 /** Get printable format of odp_cos_t */
diff --git a/platform/linux-generic/include/odp/plat/crypto_types.h b/platform/linux-generic/include/odp/plat/crypto_types.h
index 1b10a5d..a91d88e 100644
--- a/platform/linux-generic/include/odp/plat/crypto_types.h
+++ b/platform/linux-generic/include/odp/plat/crypto_types.h
@@ -25,7 +25,7 @@  extern "C" {
 #define ODP_CRYPTO_SESSION_INVALID (0xffffffffffffffffULL)
 
 typedef uint64_t odp_crypto_session_t;
-typedef odp_handle_t odp_crypto_compl_t;
+typedef ODP_HANDLE_T(odp_crypto_compl_t);
 
 enum odp_crypto_op_mode {
 	ODP_CRYPTO_SYNC,
diff --git a/platform/linux-generic/include/odp/plat/event_types.h b/platform/linux-generic/include/odp/plat/event_types.h
index 24be22f..d91937d 100644
--- a/platform/linux-generic/include/odp/plat/event_types.h
+++ b/platform/linux-generic/include/odp/plat/event_types.h
@@ -26,7 +26,7 @@  extern "C" {
  *  @{
  */
 
-typedef odp_handle_t odp_event_t;
+typedef ODP_HANDLE_T(odp_event_t);
 
 #define ODP_EVENT_INVALID _odp_cast_scalar(odp_event_t, 0xffffffff)
 
diff --git a/platform/linux-generic/include/odp/plat/packet_io_types.h b/platform/linux-generic/include/odp/plat/packet_io_types.h
index 60592e3..3cc64c6 100644
--- a/platform/linux-generic/include/odp/plat/packet_io_types.h
+++ b/platform/linux-generic/include/odp/plat/packet_io_types.h
@@ -26,7 +26,7 @@  extern "C" {
  *  @{
  */
 
-typedef odp_handle_t odp_pktio_t;
+typedef ODP_HANDLE_T(odp_pktio_t);
 
 #define ODP_PKTIO_INVALID _odp_cast_scalar(odp_pktio_t, 0)
 
diff --git a/platform/linux-generic/include/odp/plat/packet_types.h b/platform/linux-generic/include/odp/plat/packet_types.h
index 57e9662..45cb801 100644
--- a/platform/linux-generic/include/odp/plat/packet_types.h
+++ b/platform/linux-generic/include/odp/plat/packet_types.h
@@ -26,13 +26,13 @@  extern "C" {
  *  @{
  */
 
-typedef odp_handle_t odp_packet_t;
+typedef ODP_HANDLE_T(odp_packet_t);
 
 #define ODP_PACKET_INVALID _odp_cast_scalar(odp_packet_t, 0xffffffff)
 
 #define ODP_PACKET_OFFSET_INVALID (0x0fffffff)
 
-typedef odp_handle_t odp_packet_seg_t;
+typedef ODP_HANDLE_T(odp_packet_seg_t);
 
 #define ODP_PACKET_SEG_INVALID _odp_cast_scalar(odp_packet_seg_t, 0xffffffff)
 
diff --git a/platform/linux-generic/include/odp/plat/pool_types.h b/platform/linux-generic/include/odp/plat/pool_types.h
index 71c7783..568556f 100644
--- a/platform/linux-generic/include/odp/plat/pool_types.h
+++ b/platform/linux-generic/include/odp/plat/pool_types.h
@@ -25,7 +25,7 @@  extern "C" {
  *  @{
  */
 
-typedef odp_handle_t odp_pool_t;
+typedef ODP_HANDLE_T(odp_pool_t);
 
 #define ODP_POOL_INVALID _odp_cast_scalar(odp_pool_t, 0xffffffff)
 
diff --git a/platform/linux-generic/include/odp/plat/queue_types.h b/platform/linux-generic/include/odp/plat/queue_types.h
index 04a0be9..1cecc90 100644
--- a/platform/linux-generic/include/odp/plat/queue_types.h
+++ b/platform/linux-generic/include/odp/plat/queue_types.h
@@ -25,9 +25,9 @@  extern "C" {
  *  @{
  */
 
-typedef odp_handle_t odp_queue_t;
+typedef ODP_HANDLE_T(odp_queue_t);
 
-typedef odp_handle_t odp_queue_group_t;
+typedef ODP_HANDLE_T(odp_queue_group_t);
 
 #define ODP_QUEUE_INVALID  _odp_cast_scalar(odp_queue_t, 0)
 
diff --git a/platform/linux-generic/include/odp/plat/shared_memory_types.h b/platform/linux-generic/include/odp/plat/shared_memory_types.h
index d2e92cf..4be7356 100644
--- a/platform/linux-generic/include/odp/plat/shared_memory_types.h
+++ b/platform/linux-generic/include/odp/plat/shared_memory_types.h
@@ -26,7 +26,7 @@  extern "C" {
  *  @{
  */
 
-typedef odp_handle_t odp_shm_t;
+typedef ODP_HANDLE_T(odp_shm_t);
 
 #define ODP_SHM_INVALID _odp_cast_scalar(odp_shm_t, 0)
 #define ODP_SHM_NULL ODP_SHM_INVALID
diff --git a/platform/linux-generic/include/odp/plat/strong_types.h b/platform/linux-generic/include/odp/plat/strong_types.h
index cd15853..39bdea3 100644
--- a/platform/linux-generic/include/odp/plat/strong_types.h
+++ b/platform/linux-generic/include/odp/plat/strong_types.h
@@ -16,7 +16,11 @@ 
 #define STRONG_TYPES_H_
 
 /** Use strong typing for ODP types */
-#define odp_handle_t struct { uint8_t unused_dummy_var; } *
+#ifdef __cplusplus
+#define ODP_HANDLE_T(type) struct _##type { uint8_t unused_dummy_var; } *type
+#else
+#define ODP_HANDLE_T(type) struct { } *type
+#endif
 
 /** Internal macro to get value of an ODP handle */
 #define _odp_typeval(handle) ((uint32_t)(uintptr_t)(handle))