NagyD / SDLPoP

An open-source port of Prince of Persia, based on the disassembly of the DOS version.
GNU General Public License v3.0
1.1k stars 141 forks source link

Fix warnings about redefinition of SDL_COMPILE_TIME_ASSERT #136

Closed Falcury closed 7 years ago

Falcury commented 7 years ago

It seems that in SDL 2.0.6, SDL_COMPILE_TIME_ASSERT is no longer #undefined in the SDL header files, causing warnings about the macro being redefined.

Here, I've changed the name of the macro so it doesn't collide anymore. (Alternative of course would be to #undef it manually or add an #ifdef guard, but I thought this might be the cleanest.)

Edit: I initially thought that the change from 2.0.5 to 2.0.6 was that they removed the #undef, but that is probably incorrect. Instead, it seems that the definition changed slightly, so that the compiler didn't silently accept the redefinition anymore. See my post here: http://forum.princed.org/viewtopic.php?f=126&t=3512&p=21920#p21920

NagyD commented 7 years ago

I started SDLPoP development in 2014 with SDL 1.2.8, and it had the #undef (in SDL_types.h). But the #undef is already gone in SDL 1.2.15 (and the #define moved to SDL_stdinc.h).

The #undef was deleted here: https://hg.libsdl.org/SDL/diff/450721ad5436/include/SDL_types.h That was in 2006. (I guess I should not have used ancient SDL DevPaks...)

So maybe we don't need our own #define at all, and we could just use what's built into SDL2. But it's not documented. Does this mean we should not rely on it?

Falcury commented 7 years ago

So maybe we don't need our own #define at all, and we could just use what's built into SDL2. But it's not documented. Does this mean we should not rely on it?

Well, it has worked fine for us so far. It's probably not a problem if we continue to rely on it. And if it ever breaks, we should be able to relatively easily fix the problem.

On the other hand, if we use our own substitute, then that is probably also fine. It's just a C trick after all, not something specific to SDL, per se.

Whatever you prefer :-)

NagyD commented 7 years ago

I chose to delete my definition and use SDL's: 3528b2bbd19e1a809bd2b4c9f5c598a1a16affcf