commit deb315bc225a227e18d4dc19da17f8c36c01fa65
parent 7b537c112cf4f061b6e6cfc6e6d91775ced2a303
Author: Michael Savage <mikejsavage@gmail.com>
Date: Wed, 25 Oct 2017 18:32:59 +0300
Move the #if PLATFORM_LINUX stuff inside autogdb.h
Diffstat:
4 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/audio.cc b/audio.cc
@@ -7,6 +7,7 @@
#include "wave.h"
#include "assets.h"
#include "platform_audio_output.h"
+#include "autogdb.h"
static SoundData make_sin_wave( u32 sample_rate, u32 frequency ) {
const u32 num_samples = sample_rate * ( 1.0f / frequency );
@@ -28,6 +29,8 @@ static SoundData make_sin_wave( u32 sample_rate, u32 frequency ) {
static u8 memory[ megabytes( 64 ) ];
int main( int argc, char ** argv ) {
+ install_debug_signal_handlers( true );
+
MemoryArena arena;
memarena_init( &arena, memory, sizeof( memory ) );
diff --git a/autogdb.h b/autogdb.h
@@ -1,5 +1,7 @@
#pragma once
+#if PLATFORM_LINUX
+
#include <sys/ptrace.h>
#include <sys/wait.h>
@@ -117,3 +119,9 @@ static void install_debug_signal_handlers( bool debug_on_sigint ) {
signal( SIGABRT, prompt_to_run_gdb );
signal( SIGSEGV, prompt_to_run_gdb );
}
+
+#else
+
+static void install_debug_signal_handlers( bool ) { }
+
+#endif
diff --git a/main.cc b/main.cc
@@ -11,6 +11,7 @@
#include "work_queue.h"
#include "shaders.h"
#include "text_renderer.h"
+#include "autogdb.h"
#define GLFW_INCLUDE_NONE
#include "libs/glfw/include/GLFW/glfw3.h"
@@ -18,14 +19,8 @@
GameInit game_init;
GameFrame game_frame;
-#if PLATFORM_LINUX
-#include "autogdb.h"
-#endif
-
int main( int argc, char ** argv ) {
-#if PLATFORM_LINUX
install_debug_signal_handlers( true );
-#endif
size_t persistent_size = megabytes( 64 );
u8 * persistent_memory = ( u8 * ) malloc( persistent_size );
diff --git a/pp.cc b/pp.cc
@@ -13,6 +13,7 @@
#include "platform_io.h"
#include "linear_algebra.h"
#include "renderer.h"
+#include "autogdb.h"
#include "rng/well512.h"
@@ -304,10 +305,6 @@ static void write_quadtree(
"{}/{}_{}_quadtree.lz4", dir.c_str(), tx, ty );
}
-#if PLATFORM_LINUX
-#include "autogdb.h"
-#endif
-
static u16 bswap16( u16 x ) {
return ( x >> 8 ) | ( x << 8 );
}
@@ -319,9 +316,7 @@ static void bswap16s( u16 * xs, size_t n ) {
}
int main( int argc, char ** argv ) {
-#if PLATFORM_LINUX
install_debug_signal_handlers( true );
-#endif
static u8 arena_memory[ megabytes( 512 ) ];
MemoryArena arena;