VOGONS


First post, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

Compiling (or trying) DOSBox with clang http://clang.llvm.org/ fails at first with compiling the dynrec core

In file included from core_dyn_x86.cpp:234:
In file included from ./core_dyn_x86/decoder.h:1151:
./core_dyn_x86/string.h:100:11: warning: 18 enumeration values not handled in
switch: 'STR_INSB', 'STR_INSW', 'STR_INSD'... [-Wswitch-enum]
switch (op) {
^
In file included from core_dyn_x86.cpp:234:
./core_dyn_x86/decoder.h:1837:10: warning: enumeration values 'LOOP_NONE' and
'LOOP_JCXZ' not handled in switch [-Wswitch-enum]
switch (type) {
^
In file included from core_dyn_x86.cpp:234:
In file included from ./core_dyn_x86/decoder.h:1988:
In file included from ./core_dyn_x86/dyn_fpu.h:49:
./core_dyn_x86/../../fpu/fpu_instructions_x86.h:1164:2: error: ambiguous
instructions require an explicit suffix (could be 'filds', or 'fildl')
FPUD_LOAD(fild,WORD,)
^
./core_dyn_x86/../../fpu/fpu_instructions_x86.h:560:4: note: instantiated from:
#op #szA " (%2, %%eax) \n" \
^
<scratch space>:27:2: note: instantiated from:
"fild"
^
<inline asm>:5:1: note: instantiated into assembly here
fild (%edx, %eax)
^
In file included from core_dyn_x86.cpp:234:
In file included from ./core_dyn_x86/decoder.h:1988:
In file included from ./core_dyn_x86/dyn_fpu.h:49:
./core_dyn_x86/../../fpu/fpu_instructions_x86.h:1214:2: error: ambiguous
instructions require an explicit suffix (could be 'fistps', or 'fistpl')
FPUD_STORE(fistp,WORD,)
^
./core_dyn_x86/../../fpu/fpu_instructions_x86.h:621:4: note: instantiated from:
#op #szA " (%3, %%eax) \n" \
^
<scratch space>:43:2: note: instantiated from:
"fistp"
^
<inline asm>:8:1: note: instantiated into assembly here
fistp (%esi, %eax)
^
In file included from core_dyn_x86.cpp:234:
In file included from ./core_dyn_x86/decoder.h:1988:
In file included from ./core_dyn_x86/dyn_fpu.h:49:
./core_dyn_x86/../../fpu/fpu_instructions_x86.h:1224:2: error: invalid
instruction mnemonic 'fistpq'
FPUD_STORE(fistp,QWORD,q)
^
./core_dyn_x86/../../fpu/fpu_instructions_x86.h:621:4: note: instantiated from:
#op #szA " (%3, %%eax) \n" \
^
<scratch space>:47:2: note: instantiated from:
"fistp"
^
<inline asm>:8:1: note: instantiated into assembly here
fistpq (%edx, %eax)
^
In file included from core_dyn_x86.cpp:234:
Show last 17 lines
In file included from ./core_dyn_x86/decoder.h:1988:
In file included from ./core_dyn_x86/dyn_fpu.h:49:
./core_dyn_x86/../../fpu/fpu_instructions_x86.h:1169:2: error: ambiguous
instructions require an explicit suffix (could be 'filds', or 'fildl')
FPUD_LOAD_EA(fild,WORD,)
^
./core_dyn_x86/../../fpu/fpu_instructions_x86.h:586:4: note: instantiated from:
#op #szA " (%1, %%eax) \n" \
^
<scratch space>:29:2: note: instantiated from:
"fild"
^
<inline asm>:4:1: note: instantiated into assembly here
fild (%edx, %eax)
^
2 warnings and 4 errors generated.
make[4]: *** [core_dyn_x86.o] Error 1.

disabling dynamic lets it fail in compiling fpu

In file included from fpu.cpp:45:
./fpu_instructions_x86.h:1169:2: error: ambiguous instructions require an
explicit suffix (could be 'filds', or 'fildl')
FPUD_LOAD_EA(fild,WORD,)
^
./fpu_instructions_x86.h:586:4: note: instantiated from:
#op #szA " (%1, %%eax) \n" \
^
<scratch space>:47:2: note: instantiated from:
"fild"
^
<inline asm>:4:1: note: instantiated into assembly here
fild (%ecx, %eax)
^
In file included from fpu.cpp:45:
./fpu_instructions_x86.h:1164:2: error: ambiguous instructions require an
explicit suffix (could be 'filds', or 'fildl')
FPUD_LOAD(fild,WORD,)
^
./fpu_instructions_x86.h:560:4: note: instantiated from:
#op #szA " (%2, %%eax) \n" \
^
<scratch space>:45:2: note: instantiated from:
"fild"
^
<inline asm>:5:1: note: instantiated into assembly here
fild (%ecx, %eax)
^
In file included from fpu.cpp:45:
./fpu_instructions_x86.h:1214:2: error: ambiguous instructions require an
explicit suffix (could be 'fistps', or 'fistpl')
FPUD_STORE(fistp,WORD,)
^
./fpu_instructions_x86.h:621:4: note: instantiated from:
#op #szA " (%3, %%eax) \n" \
^
<scratch space>:61:2: note: instantiated from:
"fistp"
^
<inline asm>:8:1: note: instantiated into assembly here
fistp (%edx, %eax)
^
In file included from fpu.cpp:45:
./fpu_instructions_x86.h:1214:2: error: ambiguous instructions require an
explicit suffix (could be 'fistps', or 'fistpl')
FPUD_STORE(fistp,WORD,)
^
./fpu_instructions_x86.h:621:4: note: instantiated from:
#op #szA " (%3, %%eax) \n" \
^
<scratch space>:61:2: note: instantiated from:
"fistp"
^
<inline asm>:8:1: note: instantiated into assembly here
fistp (%edx, %eax)
^
In file included from fpu.cpp:45:
./fpu_instructions_x86.h:1224:2: error: invalid instruction mnemonic 'fistpq'
FPUD_STORE(fistp,QWORD,q)
^
Show last 11 lines
./fpu_instructions_x86.h:621:4: note: instantiated from:
#op #szA " (%3, %%eax) \n" \
^
<scratch space>:65:2: note: instantiated from:
"fistp"
^
<inline asm>:8:1: note: instantiated into assembly here
fistpq (%edx, %eax)
^
5 errors generated.
make[3]: *** [fpu.o] Error 1

disabling fpu will let it finish compiling with lots of warnings:

sdlmain.cpp:1627:9: warning: format string is not a string literal
(potentially insecure) [-Wformat-security]
printf(message);
^~~~~~~
1 warning generated.
softmodem.cpp:148:10: warning: enumeration value 'ResBUSY' not handled in switch
[-Wswitch-enum]
switch (response)
^
softmodem.cpp:273:28: warning: using the result of an assignment as a condition
without parentheses [-Wparentheses]
while(waitingclientsocket=serversocket->Accept())
~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
softmodem.cpp:273:28: note: place parentheses around the assignment to silence
this warning
while(waitingclientsocket=serversocket->Accept())
^
( )
softmodem.cpp:273:28: note: use '==' to turn this assignment into an equality
comparison
while(waitingclientsocket=serversocket->Accept())
^
==
2 warnings generated.
adlib.cpp:656:11: warning: enumeration values 'OPL_none' and 'OPL_cms' not
handled in switch [-Wswitch-enum]
switch ( oplmode ) {
^
1 warning generated.
In file included from hardware.cpp:35:
./../libs/zmbv/zmbv.cpp:342:11: warning: 5 enumeration values not handled in
switch: 'ZMBV_FORMAT_NONE', 'ZMBV_FORMAT_1BPP', 'ZMBV_FORMAT_2BPP'...
[-Wswitch-enum]
switch (format) {
^
./../libs/zmbv/zmbv.cpp:463:11: warning: 5 enumeration values not handled in
switch: 'ZMBV_FORMAT_NONE', 'ZMBV_FORMAT_1BPP', 'ZMBV_FORMAT_2BPP'...
[-Wswitch-enum]
switch (format) {
^
./../libs/zmbv/zmbv.cpp:487:11: warning: 5 enumeration values not handled in
switch: 'ZMBV_FORMAT_NONE', 'ZMBV_FORMAT_1BPP', 'ZMBV_FORMAT_2BPP'...
[-Wswitch-enum]
switch (format) {
^
3 warnings generated.
tandy_sound.cpp:408:45: warning: '&' within '|' [-Wbitwise-op-parentheses]
tandy.dac.frequency = tandy.dac.frequency & 0xf00 | ...
~~~~~~~~~~~~~~~~~~~~^~~~~~~ ~
tandy_sound.cpp:408:45: note: place parentheses around the '&' expression to
silence this warning
tandy.dac.frequency = tandy.dac.frequency & 0xf00 | ...
^
( )
tandy_sound.cpp:421:45: warning: '&' within '|' [-Wbitwise-op-parentheses]
tandy.dac.frequency = tandy.dac.frequency & 0x00ff | ...
~~~~~~~~~~~~~~~~~~~~^~~~~~~~ ~
tandy_sound.cpp:421:45: note: place parentheses around the '&' expression to
silence this warning
tandy.dac.frequency = tandy.dac.frequency & 0x00ff | ...
^
( )
2 warnings generated.
vga_other.cpp:262:9: warning: 14 enumeration values not handled in switch:
'M_CGA2', 'M_CGA4', 'M_EGA'... [-Wswitch-enum]
switch(vga.mode) {
^
1 warning generated.
vga_xga.cpp:975:9: warning: 14 enumeration values not handled in switch:
'M_CGA2', 'M_CGA4', 'M_EGA'... [-Wswitch-enum]
switch(XGA_COLOR_MODE) {
^
vga_xga.cpp:30:25: note: instantiated from:
#define XGA_COLOR_MODE vga.s3.xga_color_mode
^
vga_xga.cpp:994:9: warning: 14 enumeration values not handled in switch:
'M_CGA2', 'M_CGA4', 'M_EGA'... [-Wswitch-enum]
switch(XGA_COLOR_MODE) {
^
vga_xga.cpp:30:25: note: instantiated from:
#define XGA_COLOR_MODE vga.s3.xga_color_mode
^
2 warnings generated.
dbopl.cpp:847:10: warning: no case matching constant switch condition '11'
switch( mode ) {
^~~~
dbopl.cpp:1034:28: note: in instantiation of function template specialization
'DBOPL::Channel::BlockTemplate<11>' requested here
chan[6].synthHandler = &...
^
dbopl.cpp:937:11: warning: no case matching constant switch condition '11'
switch( mode ) {
^~~~
dbopl.cpp:847:10: warning: no case matching constant switch condition '10'
switch( mode ) {
^~~~
dbopl.cpp:1036:28: note: in instantiation of function template specialization
'DBOPL::Channel::BlockTemplate<10>' requested here
chan[6].synthHandler = &...
^
dbopl.cpp:937:11: warning: no case matching constant switch condition '10'
switch( mode ) {
^~~~
4 warnings generated.
int10_char.cpp:515:21: warning: equality comparison with extraneous parentheses
[-Wparentheses]
if ((CurMode->mode == 0x6)/* || (CurMode->mode==0x11)*/) attr = ...
~~~~~~~~~~~~~~^~~~~~
int10_char.cpp:515:21: note: remove extraneous parentheses around the comparison
to silence this warning
if ((CurMode->mode == 0x6)/* || (CurMode->mode==0x11)*/) attr = ...
~ ^ ~
int10_char.cpp:515:21: note: use '=' to turn this equality comparison into an
assignment
if ((CurMode->mode == 0x6)/* || (CurMode->mode==0x11)*/) attr = ...
^~
=
int10_char.cpp:545:11: warning: enumeration values 'MCH_HERC' and 'MCH_TANDY'
not handled in switch [-Wswitch-enum]
switch (machine) {
^
2 warnings generated.
int10_modes.cpp:388:11: warning: 7 enumeration values not handled in switch:
'M_HERC_GFX', 'M_HERC_TEXT', 'M_CGA16'... [-Wswitch-enum]
switch (CurMode->type) {
^
int10_modes.cpp:447:10: warning: enumeration values 'MCH_EGA' and 'MCH_VGA' not
handled in switch [-Wswitch-enum]
switch (machine) {
^
int10_modes.cpp:490:9: warning: 14 enumeration values not handled in switch:
'M_EGA', 'M_VGA', 'M_LIN4'... [-Wswitch-enum]
switch(CurMode->type) {
^
int10_modes.cpp:524:10: warning: enumeration values 'MCH_EGA' and 'MCH_VGA' not
handled in switch [-Wswitch-enum]
switch (machine) {
^
int10_modes.cpp:737:10: warning: 8 enumeration values not handled in switch:
'M_HERC_GFX', 'M_HERC_TEXT', 'M_CGA16'... [-Wswitch-enum]
switch (CurMode->type) {
^
int10_modes.cpp:892:10: warning: 10 enumeration values not handled in switch:
'M_EGA', 'M_LIN4', 'M_HERC_GFX'... [-Wswitch-enum]
switch (CurMode->type) {
^
int10_modes.cpp:961:10: warning: 8 enumeration values not handled in switch:
'M_HERC_GFX', 'M_HERC_TEXT', 'M_CGA16'... [-Wswitch-enum]
switch (CurMode->type) {
^
int10_modes.cpp:1034:10: warning: 8 enumeration values not handled in switch:
'M_HERC_GFX', 'M_HERC_TEXT', 'M_CGA16'... [-Wswitch-enum]
switch (CurMode->type) {
^
int10_modes.cpp:1072:10: warning: 7 enumeration values not handled in switch:
'M_HERC_GFX', 'M_HERC_TEXT', 'M_CGA16'... [-Wswitch-enum]
switch (CurMode->type) {
^
int10_modes.cpp:1171:11: warning: 7 enumeration values not handled in switch:
'M_HERC_GFX', 'M_HERC_TEXT', 'M_CGA16'... [-Wswitch-enum]
switch (CurMode->type) {
^
int10_modes.cpp:1252:10: warning: 11 enumeration values not handled in switch:
'M_LIN8', 'M_LIN15', 'M_LIN16'... [-Wswitch-enum]
switch (CurMode->type) {
^
int10_modes.cpp:1415:9: warning: 12 enumeration values not handled in switch:
'M_CGA2', 'M_CGA4', 'M_EGA'... [-Wswitch-enum]
switch(vmodeBlock->type) {
^
12 warnings generated.
int10_vesa.cpp:568:10: warning: 4 enumeration values not handled in switch:
'SVGA_None', 'SVGA_TsengET4K', 'SVGA_TsengET3K'... [-Wswitch-enum]
switch (svgaCard) {
^
1 warning generated.
int10_pal.cpp:37:10: warning: enumeration values 'MCH_HERC' and 'MCH_CGA' not
handled in switch [-Wswitch-enum]
switch (machine) {
^
int10_pal.cpp:91:10: warning: enumeration values 'MCH_HERC' and 'MCH_CGA' not
handled in switch [-Wswitch-enum]
switch (machine) {
^
int10_pal.cpp:106:10: warning: enumeration values 'MCH_HERC' and 'MCH_CGA' not
handled in switch [-Wswitch-enum]
switch (machine) {
^
3 warnings generated.
messages.cpp:92:4: warning: expression result unused [-Wunused-value]
*parser++;
^~~~~~~~~
1 warning generated.
setup.cpp:654:31: warning: field width should have type 'int', but argument has
type 'size_t' (aka 'unsigned long') [-Wformat]
snprintf(prefix,80, "\n# %*s ", maxwidth, "");
~~^ ~~~~~~~~
setup.cpp:662:27: warning: field width should have type 'int', but argument has
type 'size_t' (aka 'unsigned long') [-Wformat]
fprintf(outfile, "# %*s: %s", maxwidth, ...
~~^ ~~~~~~~~
2 warnings generated.

Just reporting these since some of these could be actual problems (in Exult five out of a couple warnings were actual problems and not just style warnings).

I wonder what's up with dynamic and fpu. Maybe clang sucks at assembly?

There was another warning about coremidi deprecated stuff, but for that I can provide a patch.

Reply 1 of 8, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

You could try
FPUD_STORE(fistp,WORD,s) and FPUD_STORE(fistp,WORD,s)
instead of
FPUD_STORE(fistp,WORD,) and FPUD_STORE(fistp,WORD,)
and the same for the _EA functions. But dunno if all gccs would like that.

No idea why it doesn't like the fistpq instruction.

The warnings about unhandled switch cases are irrelevant, if somebody is bored he can add
a whole lot of default cases everywhere but it's in a lot places.

Thanks for posting!

Reply 2 of 8, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

the ,s thing works. still fails with the fistpq though 🙁

(only tried fpu yet)

I also looked at the deprecated warning in coreAUDIO but it seems for now that warning to fix leads to more problems with incompatibilities with OS X < (=?) 10.5

Reply 3 of 8, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Does it work if you have it generate fistpll instead? That would certainly not be the official size qualifier though.

Reply 4 of 8, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

with that it compiles fine and dynamic core does work 😀
No complaints from apple-gcc 4.2 with these changes (and dynamic core does work as well).
Generally the warnings of clang seem to be trustworthy, so maybe these need to be changed?

Windows 3.1x guide for DOSBox
60 seconds guide to DOSBox
DOSBox SVN snapshot for macOS (10.4-11.x ppc/intel 32/64bit) notarized for gatekeeper

Reply 5 of 8, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Don't have any justification for the fistpq (integer quadword is integer quadword...), but the iword thing is ok.

Reply 6 of 8, by slacka

User metadata
Rank Newbie
Rank
Newbie

I'd love to get DosBOX compiling with clang under OS X. I'm getting the same errors as above.

fpu_instructions_x86.h:1165:2: error: ambiguous instructions require an explicit suffix (could be 'filds', or 'fildl')
fpu_instructions_x86.h:1215:2: error: ambiguous instructions require an explicit suffix (could be 'fistps', or 'fistpl')
FPUD_STORE(fistp,WORD,)
fpu_instructions_x86.h:1170:2: error: ambiguous instructions require an explicit suffix (could be 'filds', or 'fildl')
FPUD_LOAD_EA(fild,WORD,)

Is there a proper patch for this yet?