Skip to content

Commit

Permalink
Fixed bug 3508 - variably modified ?SDL_dummy_size? at file scope in …
Browse files Browse the repository at this point in the history
…test/testatomic.c

Ciro Santilli

GCC 6, Ubuntu 16.10, cd test; ./configure; make

/bin/sh config.status Makefile
config.status: creating Makefile
gcc -o loopwave loopwave.c -g -O2 -D_REENTRANT -I/usr/include/SDL2 -DHAVE_OPENGLES2 -DHAVE_OPENGL -DHAVE_SDL_TTF -g -lSDL2_test -lSDL2
gcc -o testatomic testatomic.c -g -O2 -D_REENTRANT -I/usr/include/SDL2 -DHAVE_OPENGLES2 -DHAVE_OPENGL -DHAVE_SDL_TTF -g -lSDL2_test -lSDL2
In file included from /usr/include/SDL2/SDL_main.h:25:0,
                 from /usr/include/SDL2/SDL.h:32,
                 from testatomic.c:14:
/usr/include/SDL2/SDL_stdinc.h:261:20: error: variably modified ?SDL_dummy_size? at file scope
        typedef int SDL_dummy_ ## name[(x) * 2 - 1]
                    ^
testatomic.c:106:1: note: in expansion of macro ?SDL_COMPILE_TIME_ASSERT?
 SDL_COMPILE_TIME_ASSERT(size, CountTo>0); /* check for rollover */
 ^~~~~~~~~~~~~~~~~~~~~~~
Makefile:114: recipe for target 'testatomic' failed
make: *** [testatomic] Error 1

If I remove the line SDL_COMPILE_TIME_ASSERT(size, CountTo>0); /* check for rollover */ it works, lazy to figure out the best way to do this.
  • Loading branch information
slouken committed Dec 6, 2016
1 parent af7f30d commit 68d7be3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion test/testatomic.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,10 @@ void RunBasicTest()
#define NInter (CountTo/CountInc/NThreads)
#define Expect (CountTo-NInter*CountInc*NThreads)

SDL_COMPILE_TIME_ASSERT(size, CountTo>0); /* check for rollover */
enum {
CountTo_GreaterThanZero = CountTo > 0,
};
SDL_COMPILE_TIME_ASSERT(size, CountTo_GreaterThanZero); /* check for rollover */

static SDL_atomic_t good = { 42 };

Expand Down

0 comments on commit 68d7be3

Please sign in to comment.