Author Topic: Clang warnings  (Read 3599 times)

NecroRomancist

  • Scoobies
  • Newbie
  • *****
  • Posts: 31
    • View Profile
Clang warnings
« on: September 03, 2012, 11:45:15 PM »
I've tried to build Yabause using Clang , without success unfortunately however while compiling it did output some warnings:

Code: [Select]
vidogl.c:502:37: warning: & has lower precedence than ==; == will be evaluated first [-Wparentheses]
               else if( dot == 0xFF & !END ) *texture->textdata++ = 0x0;
                        ~~~~~~~~~~~~^
vidogl.c:502:37: note: place parentheses around the == expression to silence this warning
               else if( dot == 0xFF & !END ) *texture->textdata++ = 0x0;
                                    ^
                                      (   )
vidogl.c:502:37: note: place parentheses around the & expression to evaluate it first
               else if( dot == 0xFF & !END ) *texture->textdata++ = 0x0;
                                    ^
                               (          )
vidogl.c:523:39: warning: & has lower precedence than ==; == will be evaluated first [-Wparentheses]
               else if( dot == 0x7FFF & !END ) *texture->textdata++ = 0x0;

Code: [Select]
smpc.c:435:39: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
   if (SmpcInternalVars->intbackIreg0 = (SmpcRegs->IREG[0] & 1)) {
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
smpc.c:435:39: note: place parentheses around the assignment to silence this warning
   if (SmpcInternalVars->intbackIreg0 = (SmpcRegs->IREG[0] & 1)) {
                                      ^
       (                                                       )
smpc.c:435:39: note: use '==' to turn this assignment into an equality comparison
   if (SmpcInternalVars->intbackIreg0 = (SmpcRegs->IREG[0] & 1)) {

It breaks compiling the dynarec.

Guillaume

  • Administrator
  • Sr. Member
  • *****
  • Posts: 359
    • View Profile
    • ./confiture && cake
Re: Clang warnings
« Reply #1 on: September 04, 2012, 05:54:01 AM »
It breaks compiling the dynarec.

You can disable the dynarec with -DSH2_DYNAREC=0 or by using ccmake.

Guillaume

  • Administrator
  • Sr. Member
  • *****
  • Posts: 359
    • View Profile
    • ./confiture && cake
Re: Clang warnings
« Reply #2 on: September 04, 2012, 09:29:50 AM »
I just gave a quick try to clang and it compiled Yabause (even the dynarec) though there's indeed a lot of warnings :)

clang --version outputs:

Debian clang version 3.0-6 (tags/RELEASE_30/final) (based on LLVM 3.0)
Target: x86_64-pc-linux-gnu
Thread model: posix
« Last Edit: September 04, 2012, 09:32:40 AM by Guillaume »

NecroRomancist

  • Scoobies
  • Newbie
  • *****
  • Posts: 31
    • View Profile
Re: Clang warnings
« Reply #3 on: September 04, 2012, 11:02:21 AM »
Strange  :o

Mine is

clang version 3.1 (branches/release_31)
Target: x86_64-unknown-linux-gnu
Thread model: posix

This is on ArchLinux x86-64.

Guillaume

  • Administrator
  • Sr. Member
  • *****
  • Posts: 359
    • View Profile
    • ./confiture && cake
Re: Clang warnings
« Reply #4 on: September 04, 2012, 11:11:06 AM »
Could you paste your full error log somewhere?

Btw, there's less warnings now: https://github.com/Guillaumito/yabause/commit/2d53568e02015b8e10f4a2b250ab51338567300c ;)

NecroRomancist

  • Scoobies
  • Newbie
  • *****
  • Posts: 31
    • View Profile
Re: Clang warnings
« Reply #5 on: September 04, 2012, 11:23:21 AM »
Output is attached. Despite all the warnings it seems to be crashing at linkage stage

Guillaume

  • Administrator
  • Sr. Member
  • *****
  • Posts: 359
    • View Profile
    • ./confiture && cake
Re: Clang warnings
« Reply #6 on: September 04, 2012, 11:47:33 AM »
ouch... that's the autotools based compilation...

Could you try it with cmake:

mkdir build
cd build
CC=/usr/bin/clang CXX=/usr/bin/clang++ cmake path/to/yabause/
make

NecroRomancist

  • Scoobies
  • Newbie
  • *****
  • Posts: 31
    • View Profile
Re: Clang warnings
« Reply #7 on: September 04, 2012, 12:19:52 PM »
Oh sorry about that  :-\ It does compile with cmake.

Only these warnings appear
Code: [Select]
In file included from trunk/yabause/src/sh2_dynarec/sh2_dynarec.c:715:0:
trunk/yabause/src/sh2_dynarec/assem_x64.c: In function 'set_jump_target':
trunk/yabause/src/sh2_dynarec/assem_x64.c:87:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
trunk/yabause/src/sh2_dynarec/assem_x64.c:97:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
trunk/yabause/src/sh2_dynarec/assem_x64.c: In function 'verify_dirty':
trunk/yabause/src/sh2_dynarec/assem_x64.c:144:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
trunk/yabause/src/sh2_dynarec/assem_x64.c: In function 'get_bounds':
trunk/yabause/src/sh2_dynarec/assem_x64.c:189:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
In file included from trunk/yabause/src/sh2_dynarec/sh2_dynarec.c:715:0:
trunk/yabause/src/sh2_dynarec/assem_x64.c: In function 'alloc_reg':
trunk/yabause/src/sh2_dynarec/assem_x64.c:286:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
trunk/yabause/src/sh2_dynarec/assem_x64.c:288:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
trunk/yabause/src/sh2_dynarec/assem_x64.c: In function 'alloc_reg_temp':
trunk/yabause/src/sh2_dynarec/assem_x64.c:410:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
trunk/yabause/src/sh2_dynarec/assem_x64.c:412:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
trunk/yabause/src/sh2_dynarec/assem_x64.c: In function 'output_modrm':
trunk/yabause/src/sh2_dynarec/assem_x64.c:531:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
trunk/yabause/src/sh2_dynarec/assem_x64.c: In function 'output_sib':
trunk/yabause/src/sh2_dynarec/assem_x64.c:539:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
trunk/yabause/src/sh2_dynarec/assem_x64.c: In function 'output_rex':
trunk/yabause/src/sh2_dynarec/assem_x64.c:548:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
trunk/yabause/src/sh2_dynarec/assem_x64.c: In function 'save_regs':
trunk/yabause/src/sh2_dynarec/assem_x64.c:2968:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
trunk/yabause/src/sh2_dynarec/assem_x64.c: In function 'restore_regs':
trunk/yabause/src/sh2_dynarec/assem_x64.c:2986:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
trunk/yabause/src/sh2_dynarec/assem_x64.c: In function 'do_readstub':
trunk/yabause/src/sh2_dynarec/assem_x64.c:3036:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
trunk/yabause/src/sh2_dynarec/assem_x64.c: In function 'inline_readstub':
trunk/yabause/src/sh2_dynarec/assem_x64.c:3140:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
trunk/yabause/src/sh2_dynarec/assem_x64.c: In function 'do_writestub':
trunk/yabause/src/sh2_dynarec/assem_x64.c:3172:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
trunk/yabause/src/sh2_dynarec/assem_x64.c: In function 'inline_writestub':
trunk/yabause/src/sh2_dynarec/assem_x64.c:3238:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
trunk/yabause/src/sh2_dynarec/assem_x64.c: In function 'do_rmwstub':
trunk/yabause/src/sh2_dynarec/assem_x64.c:3258:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
trunk/yabause/src/sh2_dynarec/assem_x64.c: In function 'do_dirty_stub':
trunk/yabause/src/sh2_dynarec/assem_x64.c:3356:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
trunk/yabause/src/sh2_dynarec/assem_x64.c:3365:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]


Guillaume

  • Administrator
  • Sr. Member
  • *****
  • Posts: 359
    • View Profile
    • ./confiture && cake
Re: Clang warnings
« Reply #8 on: September 04, 2012, 12:32:31 PM »
mmm, this time it looks like gcc output... you should have more warnings with clang