[dpdk-dev] i40e: fix build with gcc 5

Message ID 442c1d71592455d2f3c8df4cc944cc48c1092fc6.1424341431.git.pmatilai@redhat.com (mailing list archive)
State Superseded, archived
Headers

Commit Message

Panu Matilainen Feb. 19, 2015, 10:25 a.m. UTC
  Eliminate embiguity in the condition which trips up a "logical not
is only applied to the left..." warning from gcc 5, causing build
failure with -Werror.

Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
---
 lib/librte_pmd_i40e/i40e_rxtx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Ananyev, Konstantin Feb. 19, 2015, 11:05 a.m. UTC | #1
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Panu Matilainen
> Sent: Thursday, February 19, 2015 10:25 AM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH] i40e: fix build with gcc 5
> 
> Eliminate embiguity in the condition which trips up a "logical not
> is only applied to the left..." warning from gcc 5, causing build
> failure with -Werror.
> 
> Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
> ---
>  lib/librte_pmd_i40e/i40e_rxtx.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/librte_pmd_i40e/i40e_rxtx.c b/lib/librte_pmd_i40e/i40e_rxtx.c
> index c9f1026..ede5405 100644
> --- a/lib/librte_pmd_i40e/i40e_rxtx.c
> +++ b/lib/librte_pmd_i40e/i40e_rxtx.c
> @@ -613,7 +613,7 @@ check_rx_burst_bulk_alloc_preconditions(__rte_unused struct i40e_rx_queue *rxq)
>  			     "rxq->nb_rx_desc=%d",
>  			     rxq->rx_free_thresh, rxq->nb_rx_desc);
>  		ret = -EINVAL;
> -	} else if (!(rxq->nb_rx_desc % rxq->rx_free_thresh) == 0) {
> +	} else if (!(rxq->nb_rx_desc % rxq->rx_free_thresh == 0)) {

Why just not:
else if (rxq->nb_rx_desc % rxq->rx_free_thresh != 0)
?

>  		PMD_INIT_LOG(DEBUG, "Rx Burst Bulk Alloc Preconditions: "
>  			     "rxq->nb_rx_desc=%d, "
>  			     "rxq->rx_free_thresh=%d",
> --
> 2.1.0
  
Panu Matilainen Feb. 19, 2015, 11:09 a.m. UTC | #2
On 02/19/2015 01:05 PM, Ananyev, Konstantin wrote:
>
>
>> -----Original Message-----
>> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Panu Matilainen
>> Sent: Thursday, February 19, 2015 10:25 AM
>> To: dev@dpdk.org
>> Subject: [dpdk-dev] [PATCH] i40e: fix build with gcc 5
>>
>> Eliminate embiguity in the condition which trips up a "logical not
>> is only applied to the left..." warning from gcc 5, causing build
>> failure with -Werror.
>>
>> Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
>> ---
>>   lib/librte_pmd_i40e/i40e_rxtx.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/lib/librte_pmd_i40e/i40e_rxtx.c b/lib/librte_pmd_i40e/i40e_rxtx.c
>> index c9f1026..ede5405 100644
>> --- a/lib/librte_pmd_i40e/i40e_rxtx.c
>> +++ b/lib/librte_pmd_i40e/i40e_rxtx.c
>> @@ -613,7 +613,7 @@ check_rx_burst_bulk_alloc_preconditions(__rte_unused struct i40e_rx_queue *rxq)
>>   			     "rxq->nb_rx_desc=%d",
>>   			     rxq->rx_free_thresh, rxq->nb_rx_desc);
>>   		ret = -EINVAL;
>> -	} else if (!(rxq->nb_rx_desc % rxq->rx_free_thresh) == 0) {
>> +	} else if (!(rxq->nb_rx_desc % rxq->rx_free_thresh == 0)) {
>
> Why just not:
> else if (rxq->nb_rx_desc % rxq->rx_free_thresh != 0)
> ?

The same occurred to me right after hitting send, it'll make it a whole 
lot more obvious. I'll send another version.

	- Panu -
  

Patch

diff --git a/lib/librte_pmd_i40e/i40e_rxtx.c b/lib/librte_pmd_i40e/i40e_rxtx.c
index c9f1026..ede5405 100644
--- a/lib/librte_pmd_i40e/i40e_rxtx.c
+++ b/lib/librte_pmd_i40e/i40e_rxtx.c
@@ -613,7 +613,7 @@  check_rx_burst_bulk_alloc_preconditions(__rte_unused struct i40e_rx_queue *rxq)
 			     "rxq->nb_rx_desc=%d",
 			     rxq->rx_free_thresh, rxq->nb_rx_desc);
 		ret = -EINVAL;
-	} else if (!(rxq->nb_rx_desc % rxq->rx_free_thresh) == 0) {
+	} else if (!(rxq->nb_rx_desc % rxq->rx_free_thresh == 0)) {
 		PMD_INIT_LOG(DEBUG, "Rx Burst Bulk Alloc Preconditions: "
 			     "rxq->nb_rx_desc=%d, "
 			     "rxq->rx_free_thresh=%d",