All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cryptodev: fix compilation error in SUSE 11 SP2
@ 2016-09-26 21:50 Pablo de Lara
  2016-09-27  7:45 ` Adrien Mazarguil
  2016-10-05  2:45 ` [PATCH v2] " Pablo de Lara
  0 siblings, 2 replies; 8+ messages in thread
From: Pablo de Lara @ 2016-09-26 21:50 UTC (permalink / raw)
  To: dev; +Cc: adrien.mazarguil, declan.doherty, Pablo de Lara

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(-)

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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] cryptodev: fix compilation error in SUSE 11 SP2
  2016-09-26 21:50 [PATCH] cryptodev: fix compilation error in SUSE 11 SP2 Pablo de Lara
@ 2016-09-27  7:45 ` Adrien Mazarguil
  2016-09-29 19:30   ` De Lara Guarch, Pablo
  2016-10-05  2:45 ` [PATCH v2] " Pablo de Lara
  1 sibling, 1 reply; 8+ messages in thread
From: Adrien Mazarguil @ 2016-09-27  7:45 UTC (permalink / raw)
  To: Pablo de Lara; +Cc: dev, declan.doherty

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

-- 
Adrien Mazarguil
6WIND

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] cryptodev: fix compilation error in SUSE 11 SP2
  2016-09-27  7:45 ` Adrien Mazarguil
@ 2016-09-29 19:30   ` De Lara Guarch, Pablo
  2016-09-30  8:33     ` Adrien Mazarguil
  0 siblings, 1 reply; 8+ messages in thread
From: De Lara Guarch, Pablo @ 2016-09-29 19:30 UTC (permalink / raw)
  To: Adrien Mazarguil; +Cc: dev, Doherty, Declan



> -----Original Message-----
> From: Adrien Mazarguil [mailto:adrien.mazarguil@6wind.com]
> Sent: Tuesday, September 27, 2016 12:45 AM
> To: De Lara Guarch, Pablo
> Cc: dev@dpdk.org; Doherty, Declan
> Subject: Re: [PATCH] cryptodev: fix compilation error in SUSE 11 SP2
> 
> 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?

Well, I don't really understand what is the difference between array[] and array[0],
I thought both were the same, but some compilers only accept the latter.
In any case, the struct will not be empty, as there are other fields, that are not variable sized.

I saw that in your patch you made these two changes (among others):

diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h
index affbdec..1e30a19 100644
--- a/lib/librte_cryptodev/rte_cryptodev.h
+++ b/lib/librte_cryptodev/rte_cryptodev.h
@@ -759,7 +759,7 @@ struct rte_cryptodev_sym_session {
        } __rte_aligned(8);
        /**< Public symmetric session details */

-       char _private[0];
+       char _private[];
        /**< Private session material */
 };

diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
index 7d049ea..42e7b79 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
@@ -71,7 +71,7 @@ struct rte_cryptodev_session {
                struct rte_mempool *mp;
        } __rte_aligned(8);

-       char _private[0];
+       __extension__ char _private[0];
 };

So I would expect the same change in both, as they are almost identical,
but you took different approaches (do you know why? I would like to know :))

Basically, I noticed that gcc 4.5 doesn't complain when using your second approach,
that's why I changed it.

Thanks,
Pablo

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] cryptodev: fix compilation error in SUSE 11 SP2
  2016-09-29 19:30   ` De Lara Guarch, Pablo
@ 2016-09-30  8:33     ` Adrien Mazarguil
  2016-10-05  2:31       ` De Lara Guarch, Pablo
  0 siblings, 1 reply; 8+ messages in thread
From: Adrien Mazarguil @ 2016-09-30  8:33 UTC (permalink / raw)
  To: De Lara Guarch, Pablo; +Cc: dev, Doherty, Declan

On Thu, Sep 29, 2016 at 07:30:31PM +0000, De Lara Guarch, Pablo wrote:
> > -----Original Message-----
> > From: Adrien Mazarguil [mailto:adrien.mazarguil@6wind.com]
> > Sent: Tuesday, September 27, 2016 12:45 AM
> > To: De Lara Guarch, Pablo
> > Cc: dev@dpdk.org; Doherty, Declan
> > Subject: Re: [PATCH] cryptodev: fix compilation error in SUSE 11 SP2
> > 
> > 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?
> 
> Well, I don't really understand what is the difference between array[] and array[0],
> I thought both were the same, but some compilers only accept the latter.

Before array[] got standardized by C99, a common trick was to use array[0],
in a sense they are similar except for this one case: a struct with a single
array[] field is explicitly not allowed in C99 since it causes the structure
to be empty (this syntax only provides an alignment constraint for what
follows in case padding is required), no such problem with array[0] which
although nonstandard, is an accepted behavior, sizeof(struct foo) may yield
0 without complaint.

> In any case, the struct will not be empty, as there are other fields, that are not variable sized.
> 
> I saw that in your patch you made these two changes (among others):
> 
> diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h
> index affbdec..1e30a19 100644
> --- a/lib/librte_cryptodev/rte_cryptodev.h
> +++ b/lib/librte_cryptodev/rte_cryptodev.h
> @@ -759,7 +759,7 @@ struct rte_cryptodev_sym_session {
>         } __rte_aligned(8);
>         /**< Public symmetric session details */
> 
> -       char _private[0];
> +       char _private[];
>         /**< Private session material */
>  };
> 
> diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
> index 7d049ea..42e7b79 100644
> --- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
> +++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
> @@ -71,7 +71,7 @@ struct rte_cryptodev_session {
>                 struct rte_mempool *mp;
>         } __rte_aligned(8);
> 
> -       char _private[0];
> +       __extension__ char _private[0];
>  };
> 
> So I would expect the same change in both, as they are almost identical,
> but you took different approaches (do you know why? I would like to know :))

Yes, this was done to address the exact same error (probably with the same
old GCC version (4.4.7 perhaps?)), hence my surprise to see it fixed once
again according to your commit log, I think your only mistake was to paste
the error message for the wrong header in there (rte_cryptodev_pmd.h instead
of rte_cryptodev.h), nothing wrong with your patch besides this.

> Basically, I noticed that gcc 4.5 doesn't complain when using your second approach,
> that's why I changed it.

For the record GCC wrongly thinks the structure is empty because a unnamed
struct field is declared inside. Before C11 such declarations only created a
new type that did not occupy any space and not an actual field, hence why it
complains when faced with [] instead of the well-behaved [0].

In this particular case it's a parsing error fixed in subsequent GCC
versions, the unnamed struct actually uses some space otherwise it would
have crashed during non-regression testing (right?)

-- 
Adrien Mazarguil
6WIND

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] cryptodev: fix compilation error in SUSE 11 SP2
  2016-09-30  8:33     ` Adrien Mazarguil
@ 2016-10-05  2:31       ` De Lara Guarch, Pablo
  0 siblings, 0 replies; 8+ messages in thread
From: De Lara Guarch, Pablo @ 2016-10-05  2:31 UTC (permalink / raw)
  To: Adrien Mazarguil; +Cc: dev, Doherty, Declan

Hi Adrien,

> -----Original Message-----
> From: Adrien Mazarguil [mailto:adrien.mazarguil@6wind.com]
> Sent: Friday, September 30, 2016 1:34 AM
> To: De Lara Guarch, Pablo
> Cc: dev@dpdk.org; Doherty, Declan
> Subject: Re: [PATCH] cryptodev: fix compilation error in SUSE 11 SP2
> 
> On Thu, Sep 29, 2016 at 07:30:31PM +0000, De Lara Guarch, Pablo wrote:
> > > -----Original Message-----
> > > From: Adrien Mazarguil [mailto:adrien.mazarguil@6wind.com]
> > > Sent: Tuesday, September 27, 2016 12:45 AM
> > > To: De Lara Guarch, Pablo
> > > Cc: dev@dpdk.org; Doherty, Declan
> > > Subject: Re: [PATCH] cryptodev: fix compilation error in SUSE 11 SP2
> > >
> > > 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?
> >
> > Well, I don't really understand what is the difference between array[] and
> array[0],
> > I thought both were the same, but some compilers only accept the latter.
> 
> Before array[] got standardized by C99, a common trick was to use array[0],
> in a sense they are similar except for this one case: a struct with a single
> array[] field is explicitly not allowed in C99 since it causes the structure
> to be empty (this syntax only provides an alignment constraint for what
> follows in case padding is required), no such problem with array[0] which
> although nonstandard, is an accepted behavior, sizeof(struct foo) may yield
> 0 without complaint.
> 
> > In any case, the struct will not be empty, as there are other fields, that are
> not variable sized.
> >
> > I saw that in your patch you made these two changes (among others):
> >
> > diff --git a/lib/librte_cryptodev/rte_cryptodev.h
> b/lib/librte_cryptodev/rte_cryptodev.h
> > index affbdec..1e30a19 100644
> > --- a/lib/librte_cryptodev/rte_cryptodev.h
> > +++ b/lib/librte_cryptodev/rte_cryptodev.h
> > @@ -759,7 +759,7 @@ struct rte_cryptodev_sym_session {
> >         } __rte_aligned(8);
> >         /**< Public symmetric session details */
> >
> > -       char _private[0];
> > +       char _private[];
> >         /**< Private session material */
> >  };
> >
> > diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h
> b/lib/librte_cryptodev/rte_cryptodev_pmd.h
> > index 7d049ea..42e7b79 100644
> > --- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
> > +++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
> > @@ -71,7 +71,7 @@ struct rte_cryptodev_session {
> >                 struct rte_mempool *mp;
> >         } __rte_aligned(8);
> >
> > -       char _private[0];
> > +       __extension__ char _private[0];
> >  };
> >
> > So I would expect the same change in both, as they are almost identical,
> > but you took different approaches (do you know why? I would like to know
> :))
> 
> Yes, this was done to address the exact same error (probably with the same
> old GCC version (4.4.7 perhaps?)), hence my surprise to see it fixed once
> again according to your commit log, I think your only mistake was to paste
> the error message for the wrong header in there (rte_cryptodev_pmd.h
> instead
> of rte_cryptodev.h), nothing wrong with your patch besides this.

Ohhh, all right! I understand now. Will send a v2 with the commit message fixed.

Thanks!
Pablo

> 
> > Basically, I noticed that gcc 4.5 doesn't complain when using your second
> approach,
> > that's why I changed it.
> 
> For the record GCC wrongly thinks the structure is empty because a unnamed
> struct field is declared inside. Before C11 such declarations only created a
> new type that did not occupy any space and not an actual field, hence why it
> complains when faced with [] instead of the well-behaved [0].
> 
> In this particular case it's a parsing error fixed in subsequent GCC
> versions, the unnamed struct actually uses some space otherwise it would
> have crashed during non-regression testing (right?)
> 
> --
> Adrien Mazarguil
> 6WIND

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2] cryptodev: fix compilation error in SUSE 11 SP2
  2016-09-26 21:50 [PATCH] cryptodev: fix compilation error in SUSE 11 SP2 Pablo de Lara
  2016-09-27  7:45 ` Adrien Mazarguil
@ 2016-10-05  2:45 ` Pablo de Lara
  2016-10-05  8:51   ` Adrien Mazarguil
  1 sibling, 1 reply; 8+ messages in thread
From: Pablo de Lara @ 2016-10-05  2:45 UTC (permalink / raw)
  To: dev; +Cc: adrien.mazarguil, declan.doherty, Pablo de Lara

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:70:0:
lib/librte_cryptodev/rte_cryptodev.h:772: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>
---

Changes in v2:
- Fixed commit message

 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 d565f39..6ad5e91 100644
--- a/lib/librte_cryptodev/rte_cryptodev.h
+++ b/lib/librte_cryptodev/rte_cryptodev.h
@@ -773,7 +773,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

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] cryptodev: fix compilation error in SUSE 11 SP2
  2016-10-05  2:45 ` [PATCH v2] " Pablo de Lara
@ 2016-10-05  8:51   ` Adrien Mazarguil
  2016-10-06 21:00     ` De Lara Guarch, Pablo
  0 siblings, 1 reply; 8+ messages in thread
From: Adrien Mazarguil @ 2016-10-05  8:51 UTC (permalink / raw)
  To: Pablo de Lara; +Cc: dev, declan.doherty

On Wed, Oct 05, 2016 at 03:45:51AM +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:70:0:
> lib/librte_cryptodev/rte_cryptodev.h:772: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>
> ---
> 
> Changes in v2:
> - Fixed commit message
> 
>  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 d565f39..6ad5e91 100644
> --- a/lib/librte_cryptodev/rte_cryptodev.h
> +++ b/lib/librte_cryptodev/rte_cryptodev.h
> @@ -773,7 +773,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

Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>

-- 
Adrien Mazarguil
6WIND

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] cryptodev: fix compilation error in SUSE 11 SP2
  2016-10-05  8:51   ` Adrien Mazarguil
@ 2016-10-06 21:00     ` De Lara Guarch, Pablo
  0 siblings, 0 replies; 8+ messages in thread
From: De Lara Guarch, Pablo @ 2016-10-06 21:00 UTC (permalink / raw)
  To: Adrien Mazarguil; +Cc: dev, Doherty, Declan



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Adrien Mazarguil
> Sent: Wednesday, October 05, 2016 1:52 AM
> To: De Lara Guarch, Pablo
> Cc: dev@dpdk.org; Doherty, Declan
> Subject: Re: [dpdk-dev] [PATCH v2] cryptodev: fix compilation error in SUSE 11
> SP2
> 
> On Wed, Oct 05, 2016 at 03:45:51AM +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:70:0:
> > lib/librte_cryptodev/rte_cryptodev.h:772: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>
> > ---
> >
> > Changes in v2:
> > - Fixed commit message
> >
> >  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 d565f39..6ad5e91 100644
> > --- a/lib/librte_cryptodev/rte_cryptodev.h
> > +++ b/lib/librte_cryptodev/rte_cryptodev.h
> > @@ -773,7 +773,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
> 
> Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>

Applied to dpdk-next-crypto.

Pablo

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-10-06 21:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-26 21:50 [PATCH] cryptodev: fix compilation error in SUSE 11 SP2 Pablo de Lara
2016-09-27  7:45 ` Adrien Mazarguil
2016-09-29 19:30   ` De Lara Guarch, Pablo
2016-09-30  8:33     ` Adrien Mazarguil
2016-10-05  2:31       ` De Lara Guarch, Pablo
2016-10-05  2:45 ` [PATCH v2] " Pablo de Lara
2016-10-05  8:51   ` Adrien Mazarguil
2016-10-06 21:00     ` De Lara Guarch, Pablo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.