libretro / snes9x

Snes9x - Portable Super Nintendo Entertainment System (TM) emulator
http://www.snes9x.com
Other
47 stars 56 forks source link

Add core option sublabels #219

Closed jdgleaver closed 5 years ago

jdgleaver commented 5 years ago

This PR adds core option sublabels.

All credit goes to @Tatsuya79 (I just tweaked some strings and added a build fix!)

Tatsuya79 commented 5 years ago

It works, I can compile it but got some warnings:

In file included from ../libretro/libretro.cpp:2:0:
../libretro/libretro_core_options.h:664:1: warning: missing initializer for member 'retro_core_option_value::label' [-Wmissing-field-initializers]
 };
 ^

and

cc1.exe: warning: command line option '-fno-rtti' is valid for C++/ObjC++ but not for C
jdgleaver commented 5 years ago

@Tatsuya79:

cc1.exe: warning: command line option '-fno-rtti' is valid for C++/ObjC++ but not for C

This is an old warning that comes from compiling snes_ntsc.c.

It's due to the fact that someone doesn't know how to write Makefiles :)

The original Makefile contained this:

CFLAGS = $(CXXFLAGS)

when it should have been this:

CFLAGS := $(CXXFLAGS)

The former 'links' the two variables - update one and you update the other (i.e. C++-specific flags were being incorrectly added to CFLAGS after this line). The latter sets the value at that instant.

warning: missing initializer for member 'retro_core_option_value::label' [-Wmissing-field-initializers]

This one is 100% bogus, and it's something that's annoyed developers for a very long time... :)

The initialisers are missing because I want/need them to be missing. This should not generate a warning. GCC is just being a dumb-ass.

This warning can be disabled either by adding the compiler flag -Wno-missing-field-initializers, or for GCC one can alternatively wrap the affected code with:

/* Save current warning state */
#pragma GCC diagnostic push
/* Disable stupid/pointless 'missing initialiser' warnings
 * (we actively *want* missing initialisers...) */
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"

/* Initialise struct array... */

/* Restore previous warning state */
#pragma GCC diagnostic pop

...but I don't know how to do this selectively for other compilers.


Anyway, I've pushed a commit that: