[dpdk-dev] [PATCH v2 2/2] use simple zero initializers

Olivier MATZ olivier.matz at 6wind.com
Thu Apr 16 12:12:25 CEST 2015


Hi Thomas,

On 04/15/2015 10:49 PM, Thomas Monjalon wrote:
> To initialize a structure with zeros, one field was explicitly set
> to avoid "missing initializer" bug with old GCC (e.g. 4.4).
> This warning is now disabled (commit <insertlater>) for old versions of GCC,
> so the workarounds may be removed.
>
> These initializers should not be needed for static variables but they
> are still used to workaround an ICC bug (see commit b2595c4aa92d).
>
> There is one remaining exception where {0} initializer doesn't work cleanly,
> even with recent GCC:
> lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c:735:9:
> error: missing braces around initializer [-Werror=missing-braces]
>    struct rte_mbuf mb_def = {0}; /* zeroed mbuf */
>
> Tested with GCC 4.4.7 (CentOS), 4.7.2 (Debian) and 4.9.2 (Arch).
>
> Signed-off-by: Thomas Monjalon <thomas.monjalon at 6wind.com>

I'm trying to compile the head of dpdk (without this patch applied),
and I have this error with clang:

     ixgbe_rxtx.c:2509:41: error: missing field 'driver_name' initializer
          [-Werror,-Wmissing-field-initializers]
             struct rte_eth_dev_info dev_info = { 0 };

I'm wondering if adding more {0} would compile on clang, at least with
the current clang flags.

$ clang --version
Debian clang version 3.5.0-10 (tags/RELEASE_350/final) (based on LLVM 3.5.0)
Target: x86_64-pc-linux-gnu
Thread model: posix


Regards,
Olivier



More information about the dev mailing list