[dpdk-dev] cryptodev: fix compilation error in SUSE 11 SP2

Message ID 1474926635-13290-1-git-send-email-pablo.de.lara.guarch@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Pablo de Lara Guarch
Headers

Commit Message

De Lara Guarch, Pablo Sept. 26, 2016, 9:50 p.m. UTC
  This commit fixes following build error, which happens in SUSE 11 SP2,
with gcc 4.5.1:

In file included from lib/librte_cryptodev/rte_cryptodev.c:71:0:
lib/librte_cryptodev/rte_cryptodev_pmd.h:76:7:
error: flexible array member in otherwise empty struct

Fixes: 347a1e037fd3 ("lib: use C99 syntax for zero-size arrays")

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
 lib/librte_cryptodev/rte_cryptodev.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Adrien Mazarguil Sept. 27, 2016, 7:45 a.m. UTC | #1
On Mon, Sep 26, 2016 at 10:50:35PM +0100, Pablo de Lara wrote:
> This commit fixes following build error, which happens in SUSE 11 SP2,
> with gcc 4.5.1:
> 
> In file included from lib/librte_cryptodev/rte_cryptodev.c:71:0:
> lib/librte_cryptodev/rte_cryptodev_pmd.h:76:7:
> error: flexible array member in otherwise empty struct
> 
> Fixes: 347a1e037fd3 ("lib: use C99 syntax for zero-size arrays")
> 
> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>

Hmm, this error message does not seem related to your patch. Assuming a
similar error is caused by the original code, I think there is a more
important issue as the struct should not be empty. Can you check the
error?

> ---
>  lib/librte_cryptodev/rte_cryptodev.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h
> index 7fb5f6e..d19b378 100644
> --- a/lib/librte_cryptodev/rte_cryptodev.h
> +++ b/lib/librte_cryptodev/rte_cryptodev.h
> @@ -769,7 +769,7 @@ struct rte_cryptodev_sym_session {
>  	} __rte_aligned(8);
>  	/**< Public symmetric session details */
>  
> -	char _private[];
> +	__extension__ char _private[0];
>  	/**< Private session material */
>  };
>  
> -- 
> 2.7.4
  

Patch

diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h
index 7fb5f6e..d19b378 100644
--- a/lib/librte_cryptodev/rte_cryptodev.h
+++ b/lib/librte_cryptodev/rte_cryptodev.h
@@ -769,7 +769,7 @@  struct rte_cryptodev_sym_session {
 	} __rte_aligned(8);
 	/**< Public symmetric session details */
 
-	char _private[];
+	__extension__ char _private[0];
 	/**< Private session material */
 };