Skip to contentSkip to conversation

c99 or not?

Qemu-devel Ben Taylor 4 participants 6 messages Aug 17, 2008 – Aug 21, 2008

lore
Share & tools
lore

Ben Taylor

author
#0 lore raw

I've been hacking about on qemu again on Solaris 10, which I've run into an issue.

in the nbd.h file, it includes stdbool.h, but on Solaris 10, you have to enable c99
to get this to compile.

This has a rather nasty set of cascading effects, most of which are anonymous unions in nbd.c and vga_vmware.c, as well asm needing to be __asm scattered throughout the code.

Thoughts on this? I already have some prototype code to fix up nbd.c and vga_vmware.c to get rid of the anonymous unions, but will have some more work to complete to get a working compile.

Thanks,

Ben

#1 lore raw
Quoted 12 lines

I've been hacking about on qemu again on Solaris 10, which I've run into an issue.

in the nbd.h file, it includes stdbool.h, but on Solaris 10, you have to enable c99
to get this to compile.

This has a rather nasty set of cascading effects, most of which are anonymous
unions in nbd.c and vga_vmware.c, as well asm needing to be __asm scattered throughout the code.

Quoted 5 lines

Thoughts on this? I already have some prototype code to fix up nbd.c and vga_vmware.c to get rid of the anonymous unions, but will have some
more work to complete to get a working compile.

As a BeOS and Haiku dev, I'm used to having to "fix" apps back to c89 to get them working with gcc2 because we are forced to stick to it due to the C++ ABI breackage.
Haiku shall also provice gcc4 soon, and it might be possible to get gcc4 usable under BeOS, but it's like hunting a fly with a hand grenade.

Now, I didn't try to build QEMU on BeOS for quite some time, not even sure it'd still build. I don't know if Mickael Lotz (BeOS port maintainer IIRC) has recent builds either.
Still, avoiding C99 if possible would help, and possibly other platforms.

François.

#2 lore raw

Am 18.08.2008 um 00:33 schrieb François Revol:

Quoted 6 lines

As a BeOS and Haiku dev, I'm used to having to "fix" apps back to c89 to get them working with gcc2 because we are forced to stick to it due to the C++ ABI breackage.
Haiku shall also provice gcc4 soon, and it might be possible to get gcc4 usable under BeOS, but it's like hunting a fly with a hand grenade.

It's not just about where variables are declared or how fields are initialized, but also some assumptions that cannot safely be made in ANSI C (iirc someone from Plan 9 had complained, too). Anyway, a lot of code has recently been reworked to consequently use C99 features, so reverting those is unlikely to happen.

QEMU doesn't use C++ to my knowledge, so it should work just fine across ABIs. Just means you'd currently have to cross-compile for Haiku. TCG and the recent addition of a --disable-aio switch for OpenBSD should help with that if you want to do it.

Quoted 3 lines

I didn't try to build QEMU on BeOS for quite some time, not even sure it'd still build. I don't know if Mickael Lotz (BeOS port maintainer IIRC) has recent builds either.

Michael has apparently posted 0.9.1 on BeBits:
http://www.bebits.com/app/4208

Didn't try it though, I rather run BeOS or Haiku as guests. Michael said his patches were very intrusive, so he doesn't post them here.

Andreas

#3 lore raw
In reply to Ben Taylor
Quoted 7 lines · Ben Taylor

I've been hacking about on qemu again on Solaris 10, which I've run into an issue.

in the nbd.h file, it includes stdbool.h, but on Solaris 10, you have to enable c99
to get this to compile.

Are you not using GCC? QEMU is not known to support any compilers other than GCC.

Perhaps you need to specify -std=gnu99 instead of -std=c99?

Regards,

Anthony Liguori

Quoted 14 lines

This has a rather nasty set of cascading effects, most of which are anonymous unions in nbd.c and vga_vmware.c, as well asm needing to be __asm scattered throughout the code.

Thoughts on this? I already have some prototype code to fix up nbd.c and vga_vmware.c to get rid of the anonymous unions, but will have some more work to complete to get a working compile.

Thanks,

Ben

author
#4 lore raw
Quoted 5 lines · Anthony Liguori
Quoted 4 lines · Ben Taylor

I've been hacking about on qemu again on Solaris 10, which I've run into an issue.

Quoted 7 lines
Quoted 4 lines

in the nbd.h file, it includes stdbool.h, but on Solaris 10, you have to enable c99
to get this to compile.

Are you not using GCC? QEMU is not known to support any compilers other than GCC.

gcc-3.4.3. though once the tcg conversion is complete, I want to give studio 12 a whirl.

Quoted 1 line

Perhaps you need to specify -std=gnu99 instead of -std=c99?

I'll give that a shot.

#5 lore raw

Am 18.08.2008 um 01:34 schrieb Ben Taylor:

Quoted 15 lines

On Sun, Aug 17, 2008 at 7:28 PM, Anthony Liguori <[email protected]

Quoted 6 lines

wrote:

Quoted 4 lines · Ben Taylor

I've been hacking about on qemu again on Solaris 10, which I've run into an issue.

Quoted 7 lines
Quoted 4 lines

in the nbd.h file, it includes stdbool.h, but on Solaris 10, you have to enable c99
to get this to compile.

Are you not using GCC? QEMU is not known to support any compilers other than GCC.

Quoted 6 lines

gcc-3.4.3. though once the tcg conversion is complete, I want to give studio 12 a whirl.

Quoted 1 line

Perhaps you need to specify -std=gnu99 instead of -std=c99?

I'll give that a shot.

-std=gnu99 takes me further on S10, but compilation fails in cpu-exec.c:694 with "error: bp cannot be used in asm here".

There are also a lot of redefinition warnings for isnormal, isgreater etc. between Solaris' math[_c99].h and softfloat[_native].h.

Andreas