diff mbox

linux-generic: remove forward declarations of cos_t and pmr_t

Message ID 1424193621-13884-1-git-send-email-maxim.uvarov@linaro.org
State Accepted
Commit bdd6a5dc36cd709a93d946ee7f57967eba825194
Headers show

Commit Message

Maxim Uvarov Feb. 17, 2015, 5:20 p.m. UTC
cos_t and pmr_t used only once, use union in that place
to make clang happy.
https://bugs.linaro.org/show_bug.cgi?id=1023

Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
---
 Note: did not test if clang error went away due to on my machine clang -k generates early warnings.

 platform/linux-generic/include/odp_classification_datamodel.h | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

Comments

Mike Holmes Feb. 17, 2015, 5:36 p.m. UTC | #1
On 17 February 2015 at 12:20, Maxim Uvarov <maxim.uvarov@linaro.org> wrote:

> cos_t and pmr_t used only once, use union in that place
> to make clang happy.
> https://bugs.linaro.org/show_bug.cgi?id=1023
>
> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
>

Tested-by: Mike Holmes <mike.holmes@linaro.org>


> ---
>  Note: did not test if clang error went away due to on my machine clang -k
> generates early warnings.
>

I applied my Static_assert patch that is on the list to clean up the noise
first and then this patch and it fixed the bug 1023


>
>  platform/linux-generic/include/odp_classification_datamodel.h | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/platform/linux-generic/include/odp_classification_datamodel.h
> b/platform/linux-generic/include/odp_classification_datamodel.h
> index 3b42e99..83500b0 100644
> --- a/platform/linux-generic/include/odp_classification_datamodel.h
> +++ b/platform/linux-generic/include/odp_classification_datamodel.h
> @@ -47,9 +47,6 @@ extern "C" {
>  /* Max PMR Term bits */
>  #define ODP_PMR_TERM_BYTES_MAX         8
>
> -/* forward declaration */
> -typedef union pmr_u pmr_t;
> -
>  /**
>  Packet Matching Rule Term Value
>
> @@ -71,15 +68,14 @@ typedef struct pmr_term_value {
>         };
>  } pmr_term_value_t;
>
> -typedef union cos_u cos_t;
>  /*
>  Class Of Service
>  */
>  struct cos_s {
>         queue_entry_t *queue;           /* Associated Queue */
>         pool_entry_t *pool;             /* Associated Buffer pool */
> -       pmr_t *pmr;                     /* Chained PMR */
> -       cos_t *linked_cos;              /* CoS linked with the PMR */
> +       union pmr_u *pmr;               /* Chained PMR */
> +       union cos_u *linked_cos;        /* CoS linked with the PMR */
>         uint32_t valid;                 /* validity Flag */
>         odp_drop_e drop_policy;         /* Associated Drop Policy */
>         odp_queue_group_t queue_group;  /* Associated Queue Group */
> --
> 1.8.5.1.163.gd7aced9
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
>
Balasubramanian Manoharan Feb. 17, 2015, 8:28 p.m. UTC | #2
Reviewed-by: Bala Manoharan < bala.manoharan@linaro.org>
P.S: A similar patch was proposed earlier by Taras also. 

> On 17-Feb-2015, at 11:06 pm, Mike Holmes <mike.holmes@linaro.org> wrote:
> 
> 
> 
>> On 17 February 2015 at 12:20, Maxim Uvarov <maxim.uvarov@linaro.org> wrote:
>> cos_t and pmr_t used only once, use union in that place
>> to make clang happy.
>> https://bugs.linaro.org/show_bug.cgi?id=1023
>> 
>> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
>  
> Tested-by: Mike Holmes <mike.holmes@linaro.org>
>  
>> ---
>>  Note: did not test if clang error went away due to on my machine clang -k generates early warnings.
> 
> I applied my Static_assert patch that is on the list to clean up the noise first and then this patch and it fixed the bug 1023
>  
>> 
>>  platform/linux-generic/include/odp_classification_datamodel.h | 8 ++------
>>  1 file changed, 2 insertions(+), 6 deletions(-)
>> 
>> diff --git a/platform/linux-generic/include/odp_classification_datamodel.h b/platform/linux-generic/include/odp_classification_datamodel.h
>> index 3b42e99..83500b0 100644
>> --- a/platform/linux-generic/include/odp_classification_datamodel.h
>> +++ b/platform/linux-generic/include/odp_classification_datamodel.h
>> @@ -47,9 +47,6 @@ extern "C" {
>>  /* Max PMR Term bits */
>>  #define ODP_PMR_TERM_BYTES_MAX         8
>> 
>> -/* forward declaration */
>> -typedef union pmr_u pmr_t;
>> -
>>  /**
>>  Packet Matching Rule Term Value
>> 
>> @@ -71,15 +68,14 @@ typedef struct pmr_term_value {
>>         };
>>  } pmr_term_value_t;
>> 
>> -typedef union cos_u cos_t;
>>  /*
>>  Class Of Service
>>  */
>>  struct cos_s {
>>         queue_entry_t *queue;           /* Associated Queue */
>>         pool_entry_t *pool;             /* Associated Buffer pool */
>> -       pmr_t *pmr;                     /* Chained PMR */
>> -       cos_t *linked_cos;              /* CoS linked with the PMR */
>> +       union pmr_u *pmr;               /* Chained PMR */
>> +       union cos_u *linked_cos;        /* CoS linked with the PMR */
>>         uint32_t valid;                 /* validity Flag */
>>         odp_drop_e drop_policy;         /* Associated Drop Policy */
>>         odp_queue_group_t queue_group;  /* Associated Queue Group */
>> --
>> 1.8.5.1.163.gd7aced9
>> 
>> 
>> _______________________________________________
>> lng-odp mailing list
>> lng-odp@lists.linaro.org
>> http://lists.linaro.org/mailman/listinfo/lng-odp
> 
> 
> 
> -- 
> Mike Holmes 
> Linaro  Sr Technical Manager
> LNG - ODP
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
Maxim Uvarov Feb. 17, 2015, 9:35 p.m. UTC | #3
On 02/17/2015 11:28 PM, Bala wrote:
> Reviewed-by: Bala Manoharan < bala.manoharan@linaro.org 
> <mailto:bala.manoharan@linaro.org>>
> P.S: A similar patch was proposed earlier by Taras also.
>
Yes, somehow everybody skipped review of Tarases patch set.
In current patch there is small difference, Taras left:

+union cos_u;
+union pmr_u;

And I don't. That is not needed.

Maxim.

> On 17-Feb-2015, at 11:06 pm, Mike Holmes <mike.holmes@linaro.org 
> <mailto:mike.holmes@linaro.org>> wrote:
>
>>
>>
>> On 17 February 2015 at 12:20, Maxim Uvarov <maxim.uvarov@linaro.org 
>> <mailto:maxim.uvarov@linaro.org>> wrote:
>>
>>     cos_t and pmr_t used only once, use union in that place
>>     to make clang happy.
>>     https://bugs.linaro.org/show_bug.cgi?id=1023
>>
>>     Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org
>>     <mailto:maxim.uvarov@linaro.org>>
>>
>> Tested-by: Mike Holmes <mike.holmes@linaro.org 
>> <mailto:mike.holmes@linaro.org>>
>>
>>     ---
>>      Note: did not test if clang error went away due to on my machine
>>     clang -k generates early warnings.
>>
>>
>> I applied my Static_assert patch that is on the list to clean up the 
>> noise first and then this patch and it fixed the bug 1023
>>
>>
>>      platform/linux-generic/include/odp_classification_datamodel.h |
>>     8 ++------
>>      1 file changed, 2 insertions(+), 6 deletions(-)
>>
>>     diff --git
>>     a/platform/linux-generic/include/odp_classification_datamodel.h
>>     b/platform/linux-generic/include/odp_classification_datamodel.h
>>     index 3b42e99..83500b0 100644
>>     --- a/platform/linux-generic/include/odp_classification_datamodel.h
>>     +++ b/platform/linux-generic/include/odp_classification_datamodel.h
>>     @@ -47,9 +47,6 @@ extern "C" {
>>      /* Max PMR Term bits */
>>      #define ODP_PMR_TERM_BYTES_MAX         8
>>
>>     -/* forward declaration */
>>     -typedef union pmr_u pmr_t;
>>     -
>>      /**
>>      Packet Matching Rule Term Value
>>
>>     @@ -71,15 +68,14 @@ typedef struct pmr_term_value {
>>             };
>>      } pmr_term_value_t;
>>
>>     -typedef union cos_u cos_t;
>>      /*
>>      Class Of Service
>>      */
>>      struct cos_s {
>>             queue_entry_t *queue;           /* Associated Queue */
>>             pool_entry_t *pool;             /* Associated Buffer pool */
>>     -       pmr_t *pmr;                     /* Chained PMR */
>>     -       cos_t *linked_cos;              /* CoS linked with the PMR */
>>     +       union pmr_u *pmr;               /* Chained PMR */
>>     +       union cos_u *linked_cos;        /* CoS linked with the PMR */
>>             uint32_t valid;                 /* validity Flag */
>>             odp_drop_e drop_policy;         /* Associated Drop Policy */
>>             odp_queue_group_t queue_group;  /* Associated Queue Group */
>>     --
>>     1.8.5.1.163.gd7aced9
>>
>>
>>     _______________________________________________
>>     lng-odp mailing list
>>     lng-odp@lists.linaro.org <mailto:lng-odp@lists.linaro.org>
>>     http://lists.linaro.org/mailman/listinfo/lng-odp
>>
>>
>>
>>
>> -- 
>> *Mike Holmes*
>> Linaro  Sr Technical Manager
>> LNG - ODP
>> _______________________________________________
>> lng-odp mailing list
>> lng-odp@lists.linaro.org <mailto:lng-odp@lists.linaro.org>
>> http://lists.linaro.org/mailman/listinfo/lng-odp
Taras Kondratiuk Feb. 18, 2015, 11:32 a.m. UTC | #4
On 02/17/2015 11:35 PM, Maxim Uvarov wrote:
> On 02/17/2015 11:28 PM, Bala wrote:
>> Reviewed-by: Bala Manoharan < bala.manoharan@linaro.org
>> <mailto:bala.manoharan@linaro.org>>
>> P.S: A similar patch was proposed earlier by Taras also.
>>
> Yes, somehow everybody skipped review of Tarases patch set.

Yes, please review that series if we still need Clang support.

> In current patch there is small difference, Taras left:
>
> +union cos_u;
> +union pmr_u;
>
> And I don't. That is not needed.

I used to explicitly forward define structures or unions if they are 
used before definition, but in this case it seems to be redundant.
diff mbox

Patch

diff --git a/platform/linux-generic/include/odp_classification_datamodel.h b/platform/linux-generic/include/odp_classification_datamodel.h
index 3b42e99..83500b0 100644
--- a/platform/linux-generic/include/odp_classification_datamodel.h
+++ b/platform/linux-generic/include/odp_classification_datamodel.h
@@ -47,9 +47,6 @@  extern "C" {
 /* Max PMR Term bits */
 #define ODP_PMR_TERM_BYTES_MAX		8
 
-/* forward declaration */
-typedef union pmr_u pmr_t;
-
 /**
 Packet Matching Rule Term Value
 
@@ -71,15 +68,14 @@  typedef struct pmr_term_value {
 	};
 } pmr_term_value_t;
 
-typedef union cos_u cos_t;
 /*
 Class Of Service
 */
 struct cos_s {
 	queue_entry_t *queue;		/* Associated Queue */
 	pool_entry_t *pool;		/* Associated Buffer pool */
-	pmr_t *pmr;			/* Chained PMR */
-	cos_t *linked_cos;		/* CoS linked with the PMR */
+	union pmr_u *pmr;		/* Chained PMR */
+	union cos_u *linked_cos;	/* CoS linked with the PMR */
 	uint32_t valid;			/* validity Flag */
 	odp_drop_e drop_policy;		/* Associated Drop Policy */
 	odp_queue_group_t queue_group;	/* Associated Queue Group */