[dpdk-dev] eal: fix cpu_feature_table[] compilation with -pedantic

Message ID 1435570492-19291-1-git-send-email-adrien.mazarguil@6wind.com (mailing list archive)
State Accepted, archived
Headers

Commit Message

Adrien Mazarguil June 29, 2015, 9:34 a.m. UTC
  Since the commit below includes rte_cpuflags.h in rte_spinlock.h,
compilation of the mlx4 driver fails when CONFIG_RTE_LIBRTE_MLX4_DEBUG=y.

This mode adds -pedantic to the compiler's command line for mlx4, which
complains about the static definition of an empty cpu_feature_table[] in
common rte_cpuflags.h, then about its redefinition as a larger array in
arch-specific rte_cpuflags.h.

While DPDK does not officially support -pedantic internally, external
applications may enable it and include rte_spinlock.h from the public API.

Instead of removing -pedantic from mlx4, this commit fixes rte_cpuflags.h.

Fixes: ba7468997ea6 ("spinlock: add HTM lock elision for x86")

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
---
 lib/librte_eal/common/include/generic/rte_cpuflags.h | 4 ++++
 1 file changed, 4 insertions(+)
  

Comments

David Marchand June 29, 2015, 12:10 p.m. UTC | #1
On Mon, Jun 29, 2015 at 11:34 AM, Adrien Mazarguil <
adrien.mazarguil@6wind.com> wrote:

> Since the commit below includes rte_cpuflags.h in rte_spinlock.h,
> compilation of the mlx4 driver fails when CONFIG_RTE_LIBRTE_MLX4_DEBUG=y.
>
> This mode adds -pedantic to the compiler's command line for mlx4, which
> complains about the static definition of an empty cpu_feature_table[] in
> common rte_cpuflags.h, then about its redefinition as a larger array in
> arch-specific rte_cpuflags.h.
>
> While DPDK does not officially support -pedantic internally, external
> applications may enable it and include rte_spinlock.h from the public API.
>
> Instead of removing -pedantic from mlx4, this commit fixes rte_cpuflags.h.
>
> Fixes: ba7468997ea6 ("spinlock: add HTM lock elision for x86")
>
> Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
>

Acked-by: David Marchand <david.marchand@6wind.com>
  
Thomas Monjalon June 29, 2015, 12:19 p.m. UTC | #2
2015-06-29 14:10, David Marchand:
> On Mon, Jun 29, 2015 at 11:34 AM, Adrien Mazarguil <
> adrien.mazarguil@6wind.com> wrote:
> 
> > Since the commit below includes rte_cpuflags.h in rte_spinlock.h,
> > compilation of the mlx4 driver fails when CONFIG_RTE_LIBRTE_MLX4_DEBUG=y.
> >
> > This mode adds -pedantic to the compiler's command line for mlx4, which
> > complains about the static definition of an empty cpu_feature_table[] in
> > common rte_cpuflags.h, then about its redefinition as a larger array in
> > arch-specific rte_cpuflags.h.
> >
> > While DPDK does not officially support -pedantic internally, external
> > applications may enable it and include rte_spinlock.h from the public API.
> >
> > Instead of removing -pedantic from mlx4, this commit fixes rte_cpuflags.h.
> >
> > Fixes: ba7468997ea6 ("spinlock: add HTM lock elision for x86")
> >
> > Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
> 
> Acked-by: David Marchand <david.marchand@6wind.com>

Applied, thanks
  

Patch

diff --git a/lib/librte_eal/common/include/generic/rte_cpuflags.h b/lib/librte_eal/common/include/generic/rte_cpuflags.h
index a04e021..61c4db1 100644
--- a/lib/librte_eal/common/include/generic/rte_cpuflags.h
+++ b/lib/librte_eal/common/include/generic/rte_cpuflags.h
@@ -74,8 +74,12 @@  struct feature_entry {
 
 /**
  * An array that holds feature entries
+ *
+ * Defined in arch-specific rte_cpuflags.h.
  */
+#ifdef __DOXYGEN__
 static const struct feature_entry cpu_feature_table[];
+#endif
 
 /**
  * Execute CPUID instruction and get contents of a specific register