diff mbox series

[v2,1/1] net/ionic: use standard stdbool.h

Message ID 20200309075328.23351-1-skori@marvell.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers show
Series [v2,1/1] net/ionic: use standard stdbool.h | expand

Checks

Context Check Description
ci/travis-robot success Travis build: passed
ci/iol-mellanox-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-testing success Testing PASS
ci/iol-intel-Performance fail Performance Testing issues
ci/checkpatch warning coding style issues

Commit Message

Sunil Kumar Kori March 9, 2020, 7:53 a.m. UTC
Any DPDK public header file which includes stdbool.h may conflict with
local definition of bool, if any, which further results in compilation
error. To avoid, used standard stdbool.h instead of defining bool
internally.

I observed this issue during a development where I included rte_uuid.h
into rte_ethdev.h. As rte_ethdev.h is included to PMD driver, it started
throwing error as given below:

  CC ionic_rxtx.o
In file included from .../dpdk/build/include/rte_uuid.h:17:0,
                 from .../dpdk/build/include/rte_ethdev.h:161,
                 from .../dpdk/build/include/rte_ethdev_driver.h:18,
                 from .../dpdk/drivers/net/ionic/ionic_rxtx.c:34:
.../dpdk/drivers/net/ionic/ionic_osdep.h:48:17: error: two or more data types in declaration specifiers
typedef uint8_t bool;
                 ^
In file included from .../dpdk/drivers/net/ionic/ionic_dev.h:8:0,
                 from .../dpdk/drivers/net/ionic/ionic.h:13,
                 from .../dpdk/drivers/net/ionic/ionic_mac_api.h:8,
                 from .../dpdk/drivers/net/ionic/ionic_rxtx.c:45:
.../dpdk/drivers/net/ionic/ionic_osdep.h:48:1: warning: useless type name in empty declaration
typedef uint8_t bool;
^~~~~~~
cc1: warning: unrecognized command line option ‘-Wno-address-of-packed-member’
.../dpdk/mk/internal/rte.compile-pre.mk:114: recipe for target 'ionic_rxtx.o' failed

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
---
v2:
 - include stdbool.h in ionic_dev.h.

 drivers/net/ionic/ionic_dev.c       | 1 +
 drivers/net/ionic/ionic_dev.h       | 2 ++
 drivers/net/ionic/ionic_mac_api.c   | 1 +
 drivers/net/ionic/ionic_main.c      | 1 +
 drivers/net/ionic/ionic_osdep.h     | 1 -
 drivers/net/ionic/ionic_rx_filter.c | 1 +
 6 files changed, 6 insertions(+), 1 deletion(-)

Comments

Jerin Jacob March 9, 2020, 8:16 a.m. UTC | #1
On Mon, Mar 9, 2020 at 1:23 PM Sunil Kumar Kori <skori@marvell.com> wrote:
>
> Any DPDK public header file which includes stdbool.h may conflict with
> local definition of bool, if any, which further results in compilation
> error. To avoid, used standard stdbool.h instead of defining bool
> internally.
>
> I observed this issue during a development where I included rte_uuid.h
> into rte_ethdev.h. As rte_ethdev.h is included to PMD driver, it started
> throwing error as given below:
>
>   CC ionic_rxtx.o
> In file included from .../dpdk/build/include/rte_uuid.h:17:0,
>                  from .../dpdk/build/include/rte_ethdev.h:161,
>                  from .../dpdk/build/include/rte_ethdev_driver.h:18,
>                  from .../dpdk/drivers/net/ionic/ionic_rxtx.c:34:
> .../dpdk/drivers/net/ionic/ionic_osdep.h:48:17: error: two or more data types in declaration specifiers
> typedef uint8_t bool;
>                  ^
> In file included from .../dpdk/drivers/net/ionic/ionic_dev.h:8:0,
>                  from .../dpdk/drivers/net/ionic/ionic.h:13,
>                  from .../dpdk/drivers/net/ionic/ionic_mac_api.h:8,
>                  from .../dpdk/drivers/net/ionic/ionic_rxtx.c:45:
> .../dpdk/drivers/net/ionic/ionic_osdep.h:48:1: warning: useless type name in empty declaration
> typedef uint8_t bool;
> ^~~~~~~
> cc1: warning: unrecognized command line option ‘-Wno-address-of-packed-member’
> .../dpdk/mk/internal/rte.compile-pre.mk:114: recipe for target 'ionic_rxtx.o' failed
>
> Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
> ---

>
> diff --git a/drivers/net/ionic/ionic_osdep.h b/drivers/net/ionic/ionic_osdep.h
> index ecdbc24e6..6ca5426ec 100644
> --- a/drivers/net/ionic/ionic_osdep.h
> +++ b/drivers/net/ionic/ionic_osdep.h
> @@ -45,7 +45,6 @@ typedef uint32_t __le32;
>  typedef uint64_t __le64;
>
>  #ifndef __cplusplus
> -typedef uint8_t bool;
>  #define false   0
>  #define true    1

You could remove the above  as well(#define false and #define true)

>  #endif
Ferruh Yigit March 9, 2020, 8:43 a.m. UTC | #2
On 3/9/2020 8:16 AM, Jerin Jacob wrote:
> On Mon, Mar 9, 2020 at 1:23 PM Sunil Kumar Kori <skori@marvell.com> wrote:
>>
>> Any DPDK public header file which includes stdbool.h may conflict with
>> local definition of bool, if any, which further results in compilation
>> error. To avoid, used standard stdbool.h instead of defining bool
>> internally.
>>
>> I observed this issue during a development where I included rte_uuid.h
>> into rte_ethdev.h. As rte_ethdev.h is included to PMD driver, it started
>> throwing error as given below:
>>
>>   CC ionic_rxtx.o
>> In file included from .../dpdk/build/include/rte_uuid.h:17:0,
>>                  from .../dpdk/build/include/rte_ethdev.h:161,
>>                  from .../dpdk/build/include/rte_ethdev_driver.h:18,
>>                  from .../dpdk/drivers/net/ionic/ionic_rxtx.c:34:
>> .../dpdk/drivers/net/ionic/ionic_osdep.h:48:17: error: two or more data types in declaration specifiers
>> typedef uint8_t bool;
>>                  ^
>> In file included from .../dpdk/drivers/net/ionic/ionic_dev.h:8:0,
>>                  from .../dpdk/drivers/net/ionic/ionic.h:13,
>>                  from .../dpdk/drivers/net/ionic/ionic_mac_api.h:8,
>>                  from .../dpdk/drivers/net/ionic/ionic_rxtx.c:45:
>> .../dpdk/drivers/net/ionic/ionic_osdep.h:48:1: warning: useless type name in empty declaration
>> typedef uint8_t bool;
>> ^~~~~~~
>> cc1: warning: unrecognized command line option ‘-Wno-address-of-packed-member’
>> .../dpdk/mk/internal/rte.compile-pre.mk:114: recipe for target 'ionic_rxtx.o' failed
>>
>> Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
>> ---
> 
>>
>> diff --git a/drivers/net/ionic/ionic_osdep.h b/drivers/net/ionic/ionic_osdep.h
>> index ecdbc24e6..6ca5426ec 100644
>> --- a/drivers/net/ionic/ionic_osdep.h
>> +++ b/drivers/net/ionic/ionic_osdep.h
>> @@ -45,7 +45,6 @@ typedef uint32_t __le32;
>>  typedef uint64_t __le64;
>>
>>  #ifndef __cplusplus
>> -typedef uint8_t bool;
>>  #define false   0
>>  #define true    1
> 
> You could remove the above  as well(#define false and #define true)

+1,
I need to do same thing for ionic in other patch to be able to use bool:
https://patches.dpdk.org/patch/66225/
Sunil Kumar Kori March 9, 2020, 9:10 a.m. UTC | #3
Updated. Sent next version(v3).

Regards
Sunil Kumar Kori

>-----Original Message-----
>From: Ferruh Yigit <ferruh.yigit@intel.com>
>Sent: Monday, March 9, 2020 2:14 PM
>To: Jerin Jacob <jerinjacobk@gmail.com>; Sunil Kumar Kori
><skori@marvell.com>
>Cc: Alfredo Cardigliano <cardigliano@ntop.org>; dpdk-dev <dev@dpdk.org>;
>dpdk stable <stable@dpdk.org>
>Subject: [EXT] Re: [dpdk-dev] [PATCH v2 1/1] net/ionic: use standard stdbool.h
>
>External Email
>
>----------------------------------------------------------------------
>On 3/9/2020 8:16 AM, Jerin Jacob wrote:
>> On Mon, Mar 9, 2020 at 1:23 PM Sunil Kumar Kori <skori@marvell.com>
>wrote:
>>>
>>> Any DPDK public header file which includes stdbool.h may conflict
>>> with local definition of bool, if any, which further results in
>>> compilation error. To avoid, used standard stdbool.h instead of
>>> defining bool internally.
>>>
>>> I observed this issue during a development where I included
>>> rte_uuid.h into rte_ethdev.h. As rte_ethdev.h is included to PMD
>>> driver, it started throwing error as given below:
>>>
>>>   CC ionic_rxtx.o
>>> In file included from .../dpdk/build/include/rte_uuid.h:17:0,
>>>                  from .../dpdk/build/include/rte_ethdev.h:161,
>>>                  from .../dpdk/build/include/rte_ethdev_driver.h:18,
>>>                  from .../dpdk/drivers/net/ionic/ionic_rxtx.c:34:
>>> .../dpdk/drivers/net/ionic/ionic_osdep.h:48:17: error: two or more
>>> data types in declaration specifiers typedef uint8_t bool;
>>>                  ^
>>> In file included from .../dpdk/drivers/net/ionic/ionic_dev.h:8:0,
>>>                  from .../dpdk/drivers/net/ionic/ionic.h:13,
>>>                  from .../dpdk/drivers/net/ionic/ionic_mac_api.h:8,
>>>                  from .../dpdk/drivers/net/ionic/ionic_rxtx.c:45:
>>> .../dpdk/drivers/net/ionic/ionic_osdep.h:48:1: warning: useless type
>>> name in empty declaration typedef uint8_t bool; ^~~~~~~
>>> cc1: warning: unrecognized command line option ‘-Wno-address-of-
>packed-member’
>>> .../dpdk/mk/internal/rte.compile-pre.mk:114: recipe for target
>>> 'ionic_rxtx.o' failed
>>>
>>> Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
>>> ---
>>
>>>
>>> diff --git a/drivers/net/ionic/ionic_osdep.h
>>> b/drivers/net/ionic/ionic_osdep.h index ecdbc24e6..6ca5426ec 100644
>>> --- a/drivers/net/ionic/ionic_osdep.h
>>> +++ b/drivers/net/ionic/ionic_osdep.h
>>> @@ -45,7 +45,6 @@ typedef uint32_t __le32;  typedef uint64_t __le64;
>>>
>>>  #ifndef __cplusplus
>>> -typedef uint8_t bool;
>>>  #define false   0
>>>  #define true    1
>>
>> You could remove the above  as well(#define false and #define true)
>
>+1,
>I need to do same thing for ionic in other patch to be able to use bool:
>https://urldefense.proofpoint.com/v2/url?u=https-
>3A__patches.dpdk.org_patch_66225_&d=DwIDaQ&c=nKjWec2b6R0mOyPaz7x
>tfQ&r=dXeXaAMkP5COgn1zxHMyaF1_d9IIuq6vHQO6NrIPjaE&m=T5C3CnQeBz
>RfXkKcooV3-FN-
>R3e5MZhMonknLFnZhyE&s=OEYWfU4EaPmiYf6FXpwxDOaWV75g1wDeaASYN
>wIJiJI&e=
diff mbox series

Patch

diff --git a/drivers/net/ionic/ionic_dev.c b/drivers/net/ionic/ionic_dev.c
index aba388115..fe111a515 100644
--- a/drivers/net/ionic/ionic_dev.c
+++ b/drivers/net/ionic/ionic_dev.c
@@ -1,6 +1,7 @@ 
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
  * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
  */
+#include <stdbool.h>
 
 #include <rte_malloc.h>
 
diff --git a/drivers/net/ionic/ionic_dev.h b/drivers/net/ionic/ionic_dev.h
index 8c1ec13a6..532255a60 100644
--- a/drivers/net/ionic/ionic_dev.h
+++ b/drivers/net/ionic/ionic_dev.h
@@ -5,6 +5,8 @@ 
 #ifndef _IONIC_DEV_H_
 #define _IONIC_DEV_H_
 
+#include <stdbool.h>
+
 #include "ionic_osdep.h"
 #include "ionic_if.h"
 #include "ionic_regs.h"
diff --git a/drivers/net/ionic/ionic_mac_api.c b/drivers/net/ionic/ionic_mac_api.c
index 189b8b81a..40421fd4e 100644
--- a/drivers/net/ionic/ionic_mac_api.c
+++ b/drivers/net/ionic/ionic_mac_api.c
@@ -1,6 +1,7 @@ 
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
  * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
  */
+#include <stdbool.h>
 
 #include "ionic_mac_api.h"
 
diff --git a/drivers/net/ionic/ionic_main.c b/drivers/net/ionic/ionic_main.c
index b828d230d..9d74ec73e 100644
--- a/drivers/net/ionic/ionic_main.c
+++ b/drivers/net/ionic/ionic_main.c
@@ -1,6 +1,7 @@ 
 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
  * Copyright(c) 2018-2019 Pensando Systems, Inc. All rights reserved.
  */
+#include <stdbool.h>
 
 #include <rte_memzone.h>
 
diff --git a/drivers/net/ionic/ionic_osdep.h b/drivers/net/ionic/ionic_osdep.h
index ecdbc24e6..6ca5426ec 100644
--- a/drivers/net/ionic/ionic_osdep.h
+++ b/drivers/net/ionic/ionic_osdep.h
@@ -45,7 +45,6 @@  typedef uint32_t __le32;
 typedef uint64_t __le64;
 
 #ifndef __cplusplus
-typedef uint8_t bool;
 #define false   0
 #define true    1
 #endif
diff --git a/drivers/net/ionic/ionic_rx_filter.c b/drivers/net/ionic/ionic_rx_filter.c
index f75b81a27..fe624538d 100644
--- a/drivers/net/ionic/ionic_rx_filter.c
+++ b/drivers/net/ionic/ionic_rx_filter.c
@@ -3,6 +3,7 @@ 
  */
 
 #include <errno.h>
+#include <stdbool.h>
 
 #include <rte_malloc.h>