commit 87030f00ae46cfe479d1908c6355735ff89f9f4a parent 0d8aaceb0e2375fcb3e38b66b5529e3bfb2a72c9 Author: Michael Savage <mikejsavage@gmail.com> Date: Sun Nov 13 22:43:04 +0200 Don't directly use static_assert on Windows Diffstat:
build.bat | | | 3 | ++- |
intrinsics.h | | | 4 | ++++ |
main.cc | | | 1 | - |
mixer.cc | | | 2 | +- |
renderer.cc | | | 14 | +++++++------- |
diff --git a/build.bat b/build.bat @@ -5,7 +5,7 @@ set FLAGS=-I include -Z7 -Zo -W4 -Oi -Gm- -GR- -EHa- -nologo -MTd -Od -wd4100 -w REM -DGLAD_GLAPI_EXPORT set EXELIBS=glfw3dll.lib user32.lib shell32.lib opengl32.lib gdi32.lib set EXEFLAGS=%EXELIBS% %FLAGS% -set COMMONOBJS=log.obj memory_arena.obj work_queue.obj immediate.obj benchmark.obj stb_truetype.obj glsl.obj strlcpy.obj +set COMMONOBJS=log.obj memory_arena.obj work_queue.obj immediate.obj benchmark.obj stb_truetype.obj glsl.obj strlcpy.obj renderer.obj cl benchmark.cc -c %FLAGS% cl btt.cc -c %FLAGS% @@ -22,6 +22,7 @@ cl memory_arena.cc -c %FLAGS% cl mod_btt.cc -c %FLAGS% cl lz4.cc -c %FLAGS% cl lz4hc.cc -c %FLAGS% +cl renderer.cc -c %FLAGS% cl skybox.cc -c %FLAGS% cl -Tpstb_image.h -c %FLAGS% -DSTB_IMAGE_IMPLEMENTATION cl -Tpstb_truetype.h -c %FLAGS% -DSTB_TRUETYPE_IMPLEMENTATION diff --git a/intrinsics.h b/intrinsics.h @@ -7,6 +7,8 @@ #include <string.h> #include <errno.h> +#include "platform.h" + typedef int8_t s8; typedef int16_t s16; typedef int32_t s32; @@ -118,6 +120,8 @@ inline void mike_assert( const bool predicate, const char * message ) { #if __cplusplus < 201103L #define STATIC_ASSERT( p ) static int CONCAT( STATIC_ASSERT, __COUNTER__ )[ int( p ) - 1 ] +#elif COMPILER_MSVC +#define STATIC_ASSERT( p ) static_assert( p, #p ) #else #define STATIC_ASSERT( p ) static_assert( p ) #endif diff --git a/main.cc b/main.cc @@ -14,7 +14,6 @@ #include "intrinsics.h" #include "gl.h" #include "keys.h" -#include "platform.h" #include "platform_library.h" struct Game { diff --git a/mixer.cc b/mixer.cc @@ -32,7 +32,7 @@ struct MixerCommand { #define COMMAND_QUEUE_SIZE 256 #define RESET_SOUND_COUNTER 0 -static_assert( RESET_SOUND_COUNTER != INVALID_SOUND_ID ); +STATIC_ASSERT( RESET_SOUND_COUNTER != INVALID_SOUND_ID ); static PlayingSound playing_sounds[ MAX_CONCURRENT_SOUNDS ]; static PlayingSoundID ids[ MAX_CONCURRENT_SOUNDS ]; diff --git a/renderer.cc b/renderer.cc @@ -5,13 +5,13 @@ #include "log.h" // #include "nonblocking_fixed_spsc_queue.h" -static_assert( sizeof( VB ) == sizeof( GLuint ) ); -static_assert( sizeof( IB ) == sizeof( GLuint ) ); -static_assert( sizeof( UB ) == sizeof( GLuint ) ); -static_assert( sizeof( VAO ) == sizeof( GLuint ) ); -static_assert( sizeof( Shader ) == sizeof( GLuint ) ); -static_assert( sizeof( Texture ) == sizeof( GLuint ) ); -static_assert( sizeof( TextureBuffer ) == sizeof( GLuint ) ); +STATIC_ASSERT( sizeof( VB ) == sizeof( GLuint ) ); +STATIC_ASSERT( sizeof( IB ) == sizeof( GLuint ) ); +STATIC_ASSERT( sizeof( UB ) == sizeof( GLuint ) ); +STATIC_ASSERT( sizeof( VAO ) == sizeof( GLuint ) ); +STATIC_ASSERT( sizeof( Shader ) == sizeof( GLuint ) ); +STATIC_ASSERT( sizeof( Texture ) == sizeof( GLuint ) ); +STATIC_ASSERT( sizeof( TextureBuffer ) == sizeof( GLuint ) ); static const GLuint ATTR_POSITION = 0; static const GLuint ATTR_NORMAL = 1;