Topics on software tools like TileStudio, comments on documentation and tutorials (or the lack of) should go here.
nebososo
Posts: 188 Joined: Sun Oct 04, 2009 10:33 pm
Post
by nebososo » Fri Dec 09, 2016 8:38 pm
GCC 6 uses c++14 as default and uzem fails to compile as it's written in c++98:
Code: Select all
g++ -c gdbserver.cpp -o Debug/gdbserver.o -I/usr/include/SDL2 -D_REENTRANT -DLINUX -D_GNU_SOURCE=1 -DGUI=1 -DJOY_ANALOG_DEADZONE=8192 -g -MD -MP -MF Debug/gdbserver.d -DUSE_SPI_DEBUG=1 -DUSE_EEPROM_DEBUG=1 -DUSE_GDBSERVER_DEBUG=1
In file included from gdbserver.cpp:36:0:
gdbserver.cpp: In member function 'void GdbServer::exec()':
gdbserver.h:70:44: error: unable to find string literal operator 'operator""fmt' with 'const char [7]', 'long unsigned int' arguments
#define gdb_debug(fmt,...) fprintf(stderr,"[GDB] "fmt, ##__VA_ARGS__)
^
gdbserver.cpp:1347:3: note: in expansion of macro 'gdb_debug'
gdb_debug("Ctr+C issued. PC:0x%04x\n",core->pc*2);
^~~~~~~~~
gdbserver.cpp: In member function 'void GdbServer::SendPosition(int)':
gdbserver.h:70:44: error: unable to find string literal operator 'operator""fmt' with 'const char [7]', 'long unsigned int' arguments
#define gdb_debug(fmt,...) fprintf(stderr,"[GDB] "fmt, ##__VA_ARGS__)
^
gdbserver.cpp:1379:5: note: in expansion of macro 'gdb_debug'
gdb_debug("Sending position [signo:%i]\n",signo);
^~~~~~~~~
Setting -std=gnu++98 allows it to build.
My question is: should we make uzem c++14 conformant or just set -std in the Makefile?
Jubatian
Posts: 1564 Joined: Thu Oct 01, 2015 9:44 pm
Location: Hungary
Contact:
Post
by Jubatian » Fri Dec 09, 2016 9:08 pm
For now I think "-std=gnu++98" is the way to go, it is a proper long-term solution until someone wants to look into that thing. (I tried, this is the code necessary to support gdb, so I briefly looked over it regarding CUzeBox, and determined that gdb just won't happen for that emu in the near future. Although there the case is more complicated as I need to implement gdb support in C, so the heavily C++ code is even less useful for me).
nebososo
Posts: 188 Joined: Sun Oct 04, 2009 10:33 pm
Post
by nebososo » Sat Dec 10, 2016 3:48 am
I created a pull request for the simple change.
Funny that both emulators are important and useful right now
.
Artcfox
Posts: 1382 Joined: Thu Jun 04, 2015 5:35 pm
Contact:
Post
by Artcfox » Sat Dec 10, 2016 4:30 am
Oh, it is an easy fix to make that C++14 compatible.
Edit: This is the change that makes it C++14 compatible:
Code: Select all
diff --git a/tools/uzem/gdbserver.h b/tools/uzem/gdbserver.h
index 1b80f3f..76e1e89 100644
--- a/tools/uzem/gdbserver.h
+++ b/tools/uzem/gdbserver.h
@@ -67,7 +67,7 @@ class Breakpoints: public vector<dword> {
#define GET_BIG_ENDIAN16(byte1,byte2) ((byte2 << 8) | byte1)
#ifdef USE_GDBSERVER_DEBUG
- #define gdb_debug(fmt,...) fprintf(stderr,"[GDB] "fmt, ##__VA_ARGS__)
+ #define gdb_debug(fmt,...) fprintf(stderr,"[GDB] "/**/fmt, ##__VA_ARGS__)
#else
#define gdb_debug(fmt,...)
#endif
Edit 2: I merged the changes that make it C++14 (and backwards) compatible. The issue was with the C++14 tokenizer, so I inserted an empty comment between the string literal and the macro argument, so it will work with either the old tokenizer, or the C++14 tokenizer.