* [[PATCH]] libxl/arm: Fix ARM build.
@ 2017-05-16 10:23 Andrii Anisov
2017-05-16 10:59 ` Andrii Anisov
0 siblings, 1 reply; 6+ messages in thread
From: Andrii Anisov @ 2017-05-16 10:23 UTC (permalink / raw)
To: xen-devel; +Cc: Julien Grall, Andrii Anisov
From: Andrii Anisov <andrii_anisov@epam.com>
Some compilers do not (validly?) detect that size will always be
initialized when (rc > 0), so implicitly initialize it.
Signed-off-by: Julien Grall <julien.grall@arm.com>
---
tools/libxl/libxl_arm_acpi.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/libxl/libxl_arm_acpi.c b/tools/libxl/libxl_arm_acpi.c
index db113db..f61aec6 100644
--- a/tools/libxl/libxl_arm_acpi.c
+++ b/tools/libxl/libxl_arm_acpi.c
@@ -73,6 +73,8 @@ static int libxl__estimate_madt_size(libxl__gc *gc,
{
int rc = 0;
+ *size = 0;
+
switch (info->arch_arm.gic_version) {
case LIBXL_GIC_VERSION_V2:
*size = sizeof(struct acpi_table_madt) +
--
2.7.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [[PATCH]] libxl/arm: Fix ARM build.
2017-05-16 10:23 [[PATCH]] libxl/arm: Fix ARM build Andrii Anisov
@ 2017-05-16 10:59 ` Andrii Anisov
2017-05-16 11:03 ` Wei Liu
0 siblings, 1 reply; 6+ messages in thread
From: Andrii Anisov @ 2017-05-16 10:59 UTC (permalink / raw)
To: xen-devel; +Cc: Ian Jackson, Julien Grall, Andrii Anisov, Wei Liu
[-- Attachment #1.1: Type: text/plain, Size: 899 bytes --]
CC Ian Jakson and Wei Liu as maintainers.
Sincerely,
Andrii Anisov.
2017-05-16 13:23 GMT+03:00 Andrii Anisov <andrii.anisov@gmail.com>:
> From: Andrii Anisov <andrii_anisov@epam.com>
>
> Some compilers do not (validly?) detect that size will always be
> initialized when (rc > 0), so implicitly initialize it.
>
> Signed-off-by: Julien Grall <julien.grall@arm.com>
> ---
> tools/libxl/libxl_arm_acpi.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/tools/libxl/libxl_arm_acpi.c b/tools/libxl/libxl_arm_acpi.c
> index db113db..f61aec6 100644
> --- a/tools/libxl/libxl_arm_acpi.c
> +++ b/tools/libxl/libxl_arm_acpi.c
> @@ -73,6 +73,8 @@ static int libxl__estimate_madt_size(libxl__gc *gc,
> {
> int rc = 0;
>
> + *size = 0;
> +
> switch (info->arch_arm.gic_version) {
> case LIBXL_GIC_VERSION_V2:
> *size = sizeof(struct acpi_table_madt) +
> --
> 2.7.4
>
>
[-- Attachment #1.2: Type: text/html, Size: 1559 bytes --]
[-- Attachment #2: Type: text/plain, Size: 127 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [[PATCH]] libxl/arm: Fix ARM build.
2017-05-16 10:59 ` Andrii Anisov
@ 2017-05-16 11:03 ` Wei Liu
2017-05-16 11:06 ` Wei Liu
2017-05-16 15:14 ` Andrii Anisov
0 siblings, 2 replies; 6+ messages in thread
From: Wei Liu @ 2017-05-16 11:03 UTC (permalink / raw)
To: Andrii Anisov
Cc: xen-devel, Julien Grall, Andrii Anisov, Ian Jackson, Wei Liu
On Tue, May 16, 2017 at 01:59:40PM +0300, Andrii Anisov wrote:
> CC Ian Jakson and Wei Liu as maintainers.
>
> Sincerely,
> Andrii Anisov.
>
> 2017-05-16 13:23 GMT+03:00 Andrii Anisov <andrii.anisov@gmail.com>:
>
> > From: Andrii Anisov <andrii_anisov@epam.com>
> >
> > Some compilers do not (validly?) detect that size will always be
> > initialized when (rc > 0), so implicitly initialize it.
> >
I'm confused by the commit message.
When rc > 0 (the default branch), size is not initialised. I guess
that's what gcc complains about?
If I'm right, would it be better to set *size to 0 in the default
branch?
> > Signed-off-by: Julien Grall <julien.grall@arm.com>
> > ---
> > tools/libxl/libxl_arm_acpi.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/tools/libxl/libxl_arm_acpi.c b/tools/libxl/libxl_arm_acpi.c
> > index db113db..f61aec6 100644
> > --- a/tools/libxl/libxl_arm_acpi.c
> > +++ b/tools/libxl/libxl_arm_acpi.c
> > @@ -73,6 +73,8 @@ static int libxl__estimate_madt_size(libxl__gc *gc,
> > {
> > int rc = 0;
> >
> > + *size = 0;
> > +
> > switch (info->arch_arm.gic_version) {
> > case LIBXL_GIC_VERSION_V2:
> > *size = sizeof(struct acpi_table_madt) +
> > --
> > 2.7.4
> >
> >
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [[PATCH]] libxl/arm: Fix ARM build.
2017-05-16 11:03 ` Wei Liu
@ 2017-05-16 11:06 ` Wei Liu
2017-05-16 15:14 ` Andrii Anisov
1 sibling, 0 replies; 6+ messages in thread
From: Wei Liu @ 2017-05-16 11:06 UTC (permalink / raw)
To: Andrii Anisov
Cc: xen-devel, Julien Grall, Andrii Anisov, Ian Jackson, Wei Liu
On Tue, May 16, 2017 at 12:03:49PM +0100, Wei Liu wrote:
> On Tue, May 16, 2017 at 01:59:40PM +0300, Andrii Anisov wrote:
> > CC Ian Jakson and Wei Liu as maintainers.
> >
> > Sincerely,
> > Andrii Anisov.
> >
> > 2017-05-16 13:23 GMT+03:00 Andrii Anisov <andrii.anisov@gmail.com>:
> >
> > > From: Andrii Anisov <andrii_anisov@epam.com>
> > >
> > > Some compilers do not (validly?) detect that size will always be
> > > initialized when (rc > 0), so implicitly initialize it.
> > >
>
> I'm confused by the commit message.
>
> When rc > 0 (the default branch), size is not initialised. I guess
Also rc can't be >0 because ERROR_* is negative...
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [[PATCH]] libxl/arm: Fix ARM build.
2017-05-16 11:03 ` Wei Liu
2017-05-16 11:06 ` Wei Liu
@ 2017-05-16 15:14 ` Andrii Anisov
2017-05-16 15:27 ` Wei Liu
1 sibling, 1 reply; 6+ messages in thread
From: Andrii Anisov @ 2017-05-16 15:14 UTC (permalink / raw)
To: Wei Liu, Andrii Anisov; +Cc: xen-devel, Julien Grall, Ian Jackson
Dear Wei,
On 16.05.17 14:03, Wei Liu wrote:
> I'm confused by the commit message.
My bad, I did not pay enough attention to write the message. Would
following be better?
Implicitly initialize a referenced ouput parameter for all code
branches
in order to not face a "variable may be used uninitialized"
compilation
error in a caller function, fired by some compilers under
circumstances.
> If I'm right, would it be better to set *size to 0 in the default
> branch?
Agree.
--
*Andrii Anisov*
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [[PATCH]] libxl/arm: Fix ARM build.
2017-05-16 15:14 ` Andrii Anisov
@ 2017-05-16 15:27 ` Wei Liu
0 siblings, 0 replies; 6+ messages in thread
From: Wei Liu @ 2017-05-16 15:27 UTC (permalink / raw)
To: Andrii Anisov
Cc: xen-devel, Julien Grall, Wei Liu, Ian Jackson, Andrii Anisov
On Tue, May 16, 2017 at 06:14:43PM +0300, Andrii Anisov wrote:
> Dear Wei,
>
>
> On 16.05.17 14:03, Wei Liu wrote:
> > I'm confused by the commit message.
>
> My bad, I did not pay enough attention to write the message. Would following
> be better?
>
> Implicitly initialize a referenced ouput parameter for all code branches
> in order to not face a "variable may be used uninitialized" compilation
> error in a caller function, fired by some compilers under circumstances.
>
> > If I'm right, would it be better to set *size to 0 in the default
> > branch?
>
> Agree.
>
I suspect if you take this approach the commit message you proposed
doesn't quite match either.
Just say:
Initialise *size in default branch to prevent certain compilers (which
ones?) from reporting "variable may be used uninitialized" errors in
caller function.
> --
>
> *Andrii Anisov*
>
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> https://lists.xen.org/xen-devel
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-05-16 15:27 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-16 10:23 [[PATCH]] libxl/arm: Fix ARM build Andrii Anisov
2017-05-16 10:59 ` Andrii Anisov
2017-05-16 11:03 ` Wei Liu
2017-05-16 11:06 ` Wei Liu
2017-05-16 15:14 ` Andrii Anisov
2017-05-16 15:27 ` Wei Liu
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.