[2/4] net/cxgbe: fix macros related to logs for Windows

Message ID 1544713333-32239-3-git-send-email-rahul.lakkireddy@chelsio.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers
Series net/cxgbe: fix build for Microsoft Windows OS support |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Rahul Lakkireddy Dec. 13, 2018, 3:02 p.m. UTC
  Replace "args..." with "fmt, ..." and directly use __VA_ARGS__.

Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
---
 drivers/net/cxgbe/cxgbe_compat.h | 40 ++++++++++++++++++--------------
 1 file changed, 22 insertions(+), 18 deletions(-)
  

Comments

Ferruh Yigit Dec. 18, 2018, 6:25 p.m. UTC | #1
On 12/13/2018 3:02 PM, Rahul Lakkireddy wrote:
> Replace "args..." with "fmt, ..." and directly use __VA_ARGS__.

What do you mean exactly by "for Windows"? Which compiler? Is there a specific C
standard version you target? What is the issue with existing macros?

Since we don't have a Windows support in DPDK, yet, it is not clear what you are
targeting.

> 
> Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
<...>
  
Rahul Lakkireddy Dec. 19, 2018, 12:39 p.m. UTC | #2
On Tuesday, December 12/18/18, 2018 at 23:55:26 +0530, Ferruh Yigit wrote:
> On 12/13/2018 3:02 PM, Rahul Lakkireddy wrote:
> > Replace "args..." with "fmt, ..." and directly use __VA_ARGS__.
> 
> What do you mean exactly by "for Windows"? Which compiler? Is there a specific C
> standard version you target? What is the issue with existing macros?
> 
> Since we don't have a Windows support in DPDK, yet, it is not clear what you are
> targeting.
> 

These patches are a pre-requisite to enable compilation for CXGBE PMD for
Windows OS. It currently uses Intel C++ compiler [1]. Our plan is to
integrate these compilation fixes to dpdk-next-net and then ask for a
pull request to pull these to dpdk-draft-windows tree [2].

These existing macros result in following errors in Windows build:

# cxgbe_compat.h(28): error : expected a ")"
    #define dev_printf(level, fmt, args...) \
                                       ^

# cxgbe_compat.h(31): error : expected a ")"
    #define dev_err(x, args...) dev_printf(ERR, args)

[...]

[1] https://software.intel.com/en-us/parallel-studio-xe
[2] http://git.dpdk.org/draft/dpdk-draft-windows/

Thanks,
Rahul
  
Ferruh Yigit Dec. 19, 2018, 1:45 p.m. UTC | #3
On 12/19/2018 12:39 PM, Rahul Lakkireddy wrote:
> On Tuesday, December 12/18/18, 2018 at 23:55:26 +0530, Ferruh Yigit wrote:
>> On 12/13/2018 3:02 PM, Rahul Lakkireddy wrote:
>>> Replace "args..." with "fmt, ..." and directly use __VA_ARGS__.
>>
>> What do you mean exactly by "for Windows"? Which compiler? Is there a specific C
>> standard version you target? What is the issue with existing macros?
>>
>> Since we don't have a Windows support in DPDK, yet, it is not clear what you are
>> targeting.
>>
> 
> These patches are a pre-requisite to enable compilation for CXGBE PMD for
> Windows OS. It currently uses Intel C++ compiler [1]. Our plan is to
> integrate these compilation fixes to dpdk-next-net and then ask for a
> pull request to pull these to dpdk-draft-windows tree [2].

I think that is OK as long as we don't break the existing platforms, which is
the case already. I am asking from documentation / keeping record point of view.

Would you mind sending a new version of the patchset, with more detailed commit
logs, target compiler and its version, target Windows OS and dependencies if
any, the log of the error the patch fixes (like below ones) ?

Thanks,
ferruh

> 
> These existing macros result in following errors in Windows build:
> 
> # cxgbe_compat.h(28): error : expected a ")"
>     #define dev_printf(level, fmt, args...) \
>                                        ^
> 
> # cxgbe_compat.h(31): error : expected a ")"
>     #define dev_err(x, args...) dev_printf(ERR, args)
> 
> [...]
> 
> [1] https://software.intel.com/en-us/parallel-studio-xe
> [2] http://git.dpdk.org/draft/dpdk-draft-windows/
> 
> Thanks,
> Rahul
>
  
Rahul Lakkireddy Dec. 19, 2018, 2:11 p.m. UTC | #4
On Wednesday, December 12/19/18, 2018 at 19:15:39 +0530, Ferruh Yigit wrote:
> On 12/19/2018 12:39 PM, Rahul Lakkireddy wrote:
> > On Tuesday, December 12/18/18, 2018 at 23:55:26 +0530, Ferruh Yigit wrote:
> >> On 12/13/2018 3:02 PM, Rahul Lakkireddy wrote:
> >>> Replace "args..." with "fmt, ..." and directly use __VA_ARGS__.
> >>
> >> What do you mean exactly by "for Windows"? Which compiler? Is there a specific C
> >> standard version you target? What is the issue with existing macros?
> >>
> >> Since we don't have a Windows support in DPDK, yet, it is not clear what you are
> >> targeting.
> >>
> > 
> > These patches are a pre-requisite to enable compilation for CXGBE PMD for
> > Windows OS. It currently uses Intel C++ compiler [1]. Our plan is to
> > integrate these compilation fixes to dpdk-next-net and then ask for a
> > pull request to pull these to dpdk-draft-windows tree [2].
> 
> I think that is OK as long as we don't break the existing platforms, which is
> the case already. I am asking from documentation / keeping record point of view.
> 
> Would you mind sending a new version of the patchset, with more detailed commit
> logs, target compiler and its version, target Windows OS and dependencies if
> any, the log of the error the patch fixes (like below ones) ?
> 

Sure, will update the commit messages with above information and send a v2.

Thanks,
Rahul

> > 
> > These existing macros result in following errors in Windows build:
> > 
> > # cxgbe_compat.h(28): error : expected a ")"
> >     #define dev_printf(level, fmt, args...) \
> >                                        ^
> > 
> > # cxgbe_compat.h(31): error : expected a ")"
> >     #define dev_err(x, args...) dev_printf(ERR, args)
> > 
> > [...]
> > 
> > [1] https://software.intel.com/en-us/parallel-studio-xe
> > [2] http://git.dpdk.org/draft/dpdk-draft-windows/
> > 
> > Thanks,
> > Rahul
> > 
>
  

Patch

diff --git a/drivers/net/cxgbe/cxgbe_compat.h b/drivers/net/cxgbe/cxgbe_compat.h
index 5d47c5f3d..ce4662d54 100644
--- a/drivers/net/cxgbe/cxgbe_compat.h
+++ b/drivers/net/cxgbe/cxgbe_compat.h
@@ -19,41 +19,45 @@ 
 #include <rte_log.h>
 #include <rte_io.h>
 
-#define dev_printf(level, fmt, args...) \
-	RTE_LOG(level, PMD, "rte_cxgbe_pmd: " fmt, ## args)
+#define dev_printf(level, fmt, ...) \
+	RTE_LOG(level, PMD, "rte_cxgbe_pmd: " fmt, ##__VA_ARGS__)
 
-#define dev_err(x, args...) dev_printf(ERR, args)
-#define dev_info(x, args...) dev_printf(INFO, args)
-#define dev_warn(x, args...) dev_printf(WARNING, args)
+#define dev_err(x, fmt, ...) dev_printf(ERR, fmt, ##__VA_ARGS__)
+#define dev_info(x, fmt, ...) dev_printf(INFO, fmt, ##__VA_ARGS__)
+#define dev_warn(x, fmt, ...) dev_printf(WARNING, fmt, ##__VA_ARGS__)
 
 #ifdef RTE_LIBRTE_CXGBE_DEBUG
-#define dev_debug(x, args...) dev_printf(DEBUG, args)
+#define dev_debug(x, fmt, ...) dev_printf(INFO, fmt, ##__VA_ARGS__)
 #else
-#define dev_debug(x, args...) do { } while (0)
+#define dev_debug(x, fmt, ...) do { } while (0)
 #endif
 
 #ifdef RTE_LIBRTE_CXGBE_DEBUG_REG
-#define CXGBE_DEBUG_REG(x, args...) dev_printf(DEBUG, "REG:" args)
+#define CXGBE_DEBUG_REG(x, fmt, ...) \
+	dev_printf(INFO, "REG:" fmt, ##__VA_ARGS__)
 #else
-#define CXGBE_DEBUG_REG(x, args...) do { } while (0)
+#define CXGBE_DEBUG_REG(x, fmt, ...) do { } while (0)
 #endif
 
 #ifdef RTE_LIBRTE_CXGBE_DEBUG_MBOX
-#define CXGBE_DEBUG_MBOX(x, args...) dev_printf(DEBUG, "MBOX:" args)
+#define CXGBE_DEBUG_MBOX(x, fmt, ...) \
+	dev_printf(INFO, "MBOX:" fmt, ##__VA_ARGS__)
 #else
-#define CXGBE_DEBUG_MBOX(x, args...) do { } while (0)
+#define CXGBE_DEBUG_MBOX(x, fmt, ...) do { } while (0)
 #endif
 
 #ifdef RTE_LIBRTE_CXGBE_DEBUG_TX
-#define CXGBE_DEBUG_TX(x, args...) dev_printf(DEBUG, "TX:" args)
+#define CXGBE_DEBUG_TX(x, fmt, ...) \
+	dev_printf(INFO, "TX:" fmt, ##__VA_ARGS__)
 #else
-#define CXGBE_DEBUG_TX(x, args...) do { } while (0)
+#define CXGBE_DEBUG_TX(x, fmt, ...) do { } while (0)
 #endif
 
 #ifdef RTE_LIBRTE_CXGBE_DEBUG_RX
-#define CXGBE_DEBUG_RX(x, args...) dev_printf(DEBUG, "RX:" args)
+#define CXGBE_DEBUG_RX(x, fmt, ...) \
+	dev_printf(INFO, "RX:" fmt, ##__VA_ARGS__)
 #else
-#define CXGBE_DEBUG_RX(x, args...) do { } while (0)
+#define CXGBE_DEBUG_RX(x, fmt, ...) do { } while (0)
 #endif
 
 #ifdef RTE_LIBRTE_CXGBE_DEBUG
@@ -63,9 +67,9 @@ 
 #define CXGBE_FUNC_TRACE() do { } while (0)
 #endif
 
-#define pr_err(y, args...) dev_err(0, y, ##args)
-#define pr_warn(y, args...) dev_warn(0, y, ##args)
-#define pr_info(y, args...) dev_info(0, y, ##args)
+#define pr_err(fmt, ...) dev_err(0, fmt, ##__VA_ARGS__)
+#define pr_warn(fmt, ...) dev_warn(0, fmt, ##__VA_ARGS__)
+#define pr_info(fmt, ...) dev_info(0, fmt, ##__VA_ARGS__)
 #define BUG() pr_err("BUG at %s:%d", __func__, __LINE__)
 
 #define ASSERT(x) do {\