mupen64plus / mupen64plus-user-issues

Issue reports from users go here
http://www.mupen64plus.org/
17 stars 3 forks source link

glide64 build failure with gcc-7.1.0 #689

Closed orbea closed 6 years ago

orbea commented 7 years ago

OS:Slackware64-current gcc-7.1.0

Kind of a strange error...

make: Entering directory '/tmp/SBo/mupen64plus/mupen64plus-video-glide64/projects/unix'
    CC  _obj/osal_dynamiclib_unix.o
    CXX _obj/3dmath.o
    CXX _obj/CRC.o
    CXX _obj/Combine.o
    CXX _obj/Config.o
    CXX _obj/Debugger.o
    CXX _obj/DepthBufferRender.o
    CXX _obj/Ini.o
    CXX _obj/Main.o
../../src/Main.cpp:1203:30: warning: invalid suffix on literal; C++11 requires a space between literal and string macro [-Wliteral-suffix]
   sprintf (PluginInfo->Name, "Glide64 "G64_VERSION);  // Name of the DLL
                              ^
    CXX _obj/TexBuffer.o
    CXX _obj/TexCache.o
    CXX _obj/Util.o
    CXX _obj/rdp.o
../../src/TexBuffer.cpp: In function ‘HIRES_COLOR_IMAGE* AllocateTextureBuffer(COLOR_IMAGE&)’:
../../src/TexBuffer.cpp:143:3: warning: this ‘else’ clause does not guard... [-Wmisleading-indentation]
   else
   ^~~~
../../src/TexBuffer.cpp:146:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘else’
     float lr_u = 256.0f * texbuf.scr_width / (float)tex_size;// + 1.0f;
     ^~~~~
In file included from /usr/include/c++/7.1.0/bits/char_traits.h:39:0,
                 from /usr/include/c++/7.1.0/ios:40,
                 from /usr/include/c++/7.1.0/ostream:38,
                 from ../../src/Gfx1.3.h:84,
                 from ../../src/Combine.h:38,
                 from ../../src/rdp.cpp:46:
/usr/include/c++/7.1.0/bits/stl_algobase.h:243:56: error: macro "min" passed 3 arguments, but takes just 2
     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
                                                        ^
/usr/include/c++/7.1.0/bits/stl_algobase.h:265:56: error: macro "max" passed 3 arguments, but takes just 2
     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
                                                        ^
    CXX _obj/wrapper/2xsai.o
In file included from ../../src/3dmath.h:37:0,
                 from ../../src/rdp.cpp:43:
/usr/include/c++/7.1.0/bits/stl_algobase.h:195:5: error: expected unqualified-id before ‘const’
     min(const _Tp& __a, const _Tp& __b)
     ^
/usr/include/c++/7.1.0/bits/stl_algobase.h:195:5: error: expected ‘)’ before ‘const’
/usr/include/c++/7.1.0/bits/stl_algobase.h:195:5: error: expected ‘)’ before ‘const’
/usr/include/c++/7.1.0/bits/stl_algobase.h:195:5: error: expected initializer before ‘const’
/usr/include/c++/7.1.0/bits/stl_algobase.h:219:5: error: expected unqualified-id before ‘const’
     max(const _Tp& __a, const _Tp& __b)
     ^
/usr/include/c++/7.1.0/bits/stl_algobase.h:219:5: error: expected ‘)’ before ‘const’
/usr/include/c++/7.1.0/bits/stl_algobase.h:219:5: error: expected ‘)’ before ‘const’
/usr/include/c++/7.1.0/bits/stl_algobase.h:219:5: error: expected initializer before ‘const’
In file included from /usr/include/c++/7.1.0/bits/char_traits.h:39:0,
                 from /usr/include/c++/7.1.0/ios:40,
                 from /usr/include/c++/7.1.0/ostream:38,
                 from ../../src/Gfx1.3.h:84,
                 from ../../src/Combine.h:38,
                 from ../../src/rdp.cpp:46:
/usr/include/c++/7.1.0/bits/stl_algobase.h:246:7: error: expected primary-expression before ‘if’
       if (__comp(__b, __a))
       ^~
/usr/include/c++/7.1.0/bits/stl_algobase.h:246:7: error: expected ‘}’ before ‘if’
/usr/include/c++/7.1.0/bits/stl_algobase.h:246:7: error: expected ‘;’ before ‘if’
/usr/include/c++/7.1.0/bits/stl_algobase.h:248:7: error: expected unqualified-id before ‘return’
       return __a;
       ^~~~~~
/usr/include/c++/7.1.0/bits/stl_algobase.h:268:7: error: expected primary-expression before ‘if’
       if (__comp(__a, __b))
       ^~
/usr/include/c++/7.1.0/bits/stl_algobase.h:268:7: error: expected ‘}’ before ‘if’
/usr/include/c++/7.1.0/bits/stl_algobase.h:268:7: error: expected ‘;’ before ‘if’
/usr/include/c++/7.1.0/bits/stl_algobase.h:270:7: error: expected unqualified-id before ‘return’
       return __a;
       ^~~~~~
/usr/include/c++/7.1.0/bits/stl_algobase.h:271:5: error: expected declaration before ‘}’ token
     }
     ^
make: *** [Makefile:399: _obj/rdp.o] Error 1
make: Leaving directory '/tmp/SBo/mupen64plus/mupen64plus-video-glide64/projects/unix'
richard42 commented 7 years ago

this appears to be happening because "min" and "max" are defined as preprocessor macros in rdp.h, which is included before in Gfx_1.3.h. It's possible that this error could be avoided by moving the c++ includes to the top, before the local header includes.

ghost commented 6 years ago

Now it doesn't build anymore under win32 with the min/max change from https://github.com/mupen64plus/mupen64plus-video-glide64/commit/d40da0bd9f7fb1746c0e8b2b2b8f2f7ac49e16a2

orbea commented 6 years ago

@bsmiles32 Thanks for the solution! As I don't use windows I cant confirm or deny the new win32 build issue.

richard42 commented 6 years ago

I just pushed a fix for this, can you please test your Win32 build again?

ghost commented 6 years ago

@richard42 thanks, seems to work fine