xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* Compilation Error in extras/mini-os/tpmback.c
@ 2014-07-16  5:55 Dushyant Behl
  2014-07-16  9:13 ` Ian Campbell
  0 siblings, 1 reply; 6+ messages in thread
From: Dushyant Behl @ 2014-07-16  5:55 UTC (permalink / raw)
  To: xen-devel

Hi,

I'm trying to compile xen from the source and i'm getting this
compilation error while running a make world.

tpmback.c: In function ‘tpmif_change_state’:
tpmback.c:350:4: error: format ‘%d’ expects argument of type ‘int *’,
but argument 3 has type ‘enum xenbus_state *’ [-Werror=format=]
    if(sscanf(value, "%d", &readst) != 1) {
    ^
cc1: all warnings being treated as errors
make[3]: *** [/home/corvo/gsoc/code/xen/stubdom/mini-os-x86_64-vtpm/tpmback.o]
Error 1

Could anyone explain that if this is just problem on my side or this
is not fixed in the git tree.

Thanks and Regards,
Dushyant

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

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

* Re: Compilation Error in extras/mini-os/tpmback.c
  2014-07-16  5:55 Compilation Error in extras/mini-os/tpmback.c Dushyant Behl
@ 2014-07-16  9:13 ` Ian Campbell
  2014-07-17 18:21   ` Samuel Thibault
  0 siblings, 1 reply; 6+ messages in thread
From: Ian Campbell @ 2014-07-16  9:13 UTC (permalink / raw)
  To: Dushyant Behl, Ian Jackson; +Cc: Samuel Thibault, Daniel De Graaf, xen-devel

On Wed, 2014-07-16 at 11:25 +0530, Dushyant Behl wrote:
> Hi,
> 
> I'm trying to compile xen from the source and i'm getting this
> compilation error while running a make world.
> 
> tpmback.c: In function ‘tpmif_change_state’:
> tpmback.c:350:4: error: format ‘%d’ expects argument of type ‘int *’,
> but argument 3 has type ‘enum xenbus_state *’ [-Werror=format=]
>     if(sscanf(value, "%d", &readst) != 1) {
>     ^
> cc1: all warnings being treated as errors
> make[3]: *** [/home/corvo/gsoc/code/xen/stubdom/mini-os-x86_64-vtpm/tpmback.o]
> Error 1
> 
> Could anyone explain that if this is just problem on my side or this
> is not fixed in the git tree.

It looks like a legitimate issue to me. I expect you are just the first
person to use a compiler which picks up in this particular issue.

I'm not sure what the correct fix is since C doesn't mandate very much
about the storage size of an enum, so casting is probably not the right
answer.

Probably the value needs to be read into an actual int variable and then
assigned to the enum. Perhaps Ian J (Ccd) knows what the right thing to
do is.

Also CCing the mini-os and tpmback maintainers...

Ian.


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

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

* Re: Compilation Error in extras/mini-os/tpmback.c
  2014-07-16  9:13 ` Ian Campbell
@ 2014-07-17 18:21   ` Samuel Thibault
  2014-07-18  9:55     ` Ian Campbell
  0 siblings, 1 reply; 6+ messages in thread
From: Samuel Thibault @ 2014-07-17 18:21 UTC (permalink / raw)
  To: Ian Campbell; +Cc: Ian Jackson, Daniel De Graaf, Dushyant Behl, xen-devel

Ian Campbell, le Wed 16 Jul 2014 10:13:31 +0100, a écrit :
> On Wed, 2014-07-16 at 11:25 +0530, Dushyant Behl wrote:
> > I'm trying to compile xen from the source and i'm getting this
> > compilation error while running a make world.
> > 
> > tpmback.c: In function ‘tpmif_change_state’:
> > tpmback.c:350:4: error: format ‘%d’ expects argument of type ‘int *’,
> > but argument 3 has type ‘enum xenbus_state *’ [-Werror=format=]
> >     if(sscanf(value, "%d", &readst) != 1) {
> >     ^
> > cc1: all warnings being treated as errors
> > make[3]: *** [/home/corvo/gsoc/code/xen/stubdom/mini-os-x86_64-vtpm/tpmback.o]
> > Error 1
> > 
> > Could anyone explain that if this is just problem on my side or this
> > is not fixed in the git tree.
> 
> It looks like a legitimate issue to me. I expect you are just the first
> person to use a compiler which picks up in this particular issue.
> 
> I'm not sure what the correct fix is since C doesn't mandate very much
> about the storage size of an enum, so casting is probably not the right
> answer.

Indeed, C99 apparently says “The choice of type is
implementation-defined”, so

> Probably the value needs to be read into an actual int variable and then
> assigned to the enum.

that seems like the proper solution.

Samuel

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

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

* Re: Compilation Error in extras/mini-os/tpmback.c
  2014-07-17 18:21   ` Samuel Thibault
@ 2014-07-18  9:55     ` Ian Campbell
  2014-07-18 10:01       ` Dushyant Behl
  0 siblings, 1 reply; 6+ messages in thread
From: Ian Campbell @ 2014-07-18  9:55 UTC (permalink / raw)
  To: Samuel Thibault; +Cc: Ian Jackson, Daniel De Graaf, Dushyant Behl, xen-devel

On Thu, 2014-07-17 at 20:21 +0200, Samuel Thibault wrote:
> Ian Campbell, le Wed 16 Jul 2014 10:13:31 +0100, a écrit :
> > On Wed, 2014-07-16 at 11:25 +0530, Dushyant Behl wrote:
> > > I'm trying to compile xen from the source and i'm getting this
> > > compilation error while running a make world.
> > > 
> > > tpmback.c: In function ‘tpmif_change_state’:
> > > tpmback.c:350:4: error: format ‘%d’ expects argument of type ‘int *’,
> > > but argument 3 has type ‘enum xenbus_state *’ [-Werror=format=]
> > >     if(sscanf(value, "%d", &readst) != 1) {
> > >     ^
> > > cc1: all warnings being treated as errors
> > > make[3]: *** [/home/corvo/gsoc/code/xen/stubdom/mini-os-x86_64-vtpm/tpmback.o]
> > > Error 1
> > > 
> > > Could anyone explain that if this is just problem on my side or this
> > > is not fixed in the git tree.
> > 
> > It looks like a legitimate issue to me. I expect you are just the first
> > person to use a compiler which picks up in this particular issue.
> > 
> > I'm not sure what the correct fix is since C doesn't mandate very much
> > about the storage size of an enum, so casting is probably not the right
> > answer.
> 
> Indeed, C99 apparently says “The choice of type is
> implementation-defined”, so
> 
> > Probably the value needs to be read into an actual int variable and then
> > assigned to the enum.
> 
> that seems like the proper solution.

Great. Dushyant, are you able to rustle up a patch?

http://wiki.xen.org/wiki/Submitting_Xen_Patches has some guidance on the
procedure.

Ian.


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

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

* Re: Compilation Error in extras/mini-os/tpmback.c
  2014-07-18  9:55     ` Ian Campbell
@ 2014-07-18 10:01       ` Dushyant Behl
  2014-07-18 10:09         ` Ian Campbell
  0 siblings, 1 reply; 6+ messages in thread
From: Dushyant Behl @ 2014-07-18 10:01 UTC (permalink / raw)
  To: Ian Campbell; +Cc: Samuel Thibault, Daniel De Graaf, Ian Jackson, xen-devel

Sure, I'll be happy to do it.

On Fri, Jul 18, 2014 at 3:25 PM, Ian Campbell <Ian.Campbell@citrix.com> wrote:
> On Thu, 2014-07-17 at 20:21 +0200, Samuel Thibault wrote:
>> Ian Campbell, le Wed 16 Jul 2014 10:13:31 +0100, a écrit :
>> > On Wed, 2014-07-16 at 11:25 +0530, Dushyant Behl wrote:
>> > > I'm trying to compile xen from the source and i'm getting this
>> > > compilation error while running a make world.
>> > >
>> > > tpmback.c: In function ‘tpmif_change_state’:
>> > > tpmback.c:350:4: error: format ‘%d’ expects argument of type ‘int *’,
>> > > but argument 3 has type ‘enum xenbus_state *’ [-Werror=format=]
>> > >     if(sscanf(value, "%d", &readst) != 1) {
>> > >     ^
>> > > cc1: all warnings being treated as errors
>> > > make[3]: *** [/home/corvo/gsoc/code/xen/stubdom/mini-os-x86_64-vtpm/tpmback.o]
>> > > Error 1
>> > >
>> > > Could anyone explain that if this is just problem on my side or this
>> > > is not fixed in the git tree.
>> >
>> > It looks like a legitimate issue to me. I expect you are just the first
>> > person to use a compiler which picks up in this particular issue.
>> >
>> > I'm not sure what the correct fix is since C doesn't mandate very much
>> > about the storage size of an enum, so casting is probably not the right
>> > answer.
>>
>> Indeed, C99 apparently says “The choice of type is
>> implementation-defined”, so
>>
>> > Probably the value needs to be read into an actual int variable and then
>> > assigned to the enum.
>>
>> that seems like the proper solution.
>
> Great. Dushyant, are you able to rustle up a patch?
>
> http://wiki.xen.org/wiki/Submitting_Xen_Patches has some guidance on the
> procedure.
>
> Ian.
>

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

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

* Re: Compilation Error in extras/mini-os/tpmback.c
  2014-07-18 10:01       ` Dushyant Behl
@ 2014-07-18 10:09         ` Ian Campbell
  0 siblings, 0 replies; 6+ messages in thread
From: Ian Campbell @ 2014-07-18 10:09 UTC (permalink / raw)
  To: Dushyant Behl; +Cc: Samuel Thibault, Daniel De Graaf, Ian Jackson, xen-devel

On Fri, 2014-07-18 at 15:31 +0530, Dushyant Behl wrote:
> Sure, I'll be happy to do it.

THanks!

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

end of thread, other threads:[~2014-07-18 10:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-16  5:55 Compilation Error in extras/mini-os/tpmback.c Dushyant Behl
2014-07-16  9:13 ` Ian Campbell
2014-07-17 18:21   ` Samuel Thibault
2014-07-18  9:55     ` Ian Campbell
2014-07-18 10:01       ` Dushyant Behl
2014-07-18 10:09         ` Ian Campbell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).