Fix ctor load priorities

This commit is contained in:
Aaron Culliney 2015-04-17 22:12:13 -07:00
parent c48e72c27f
commit dcd0207525
10 changed files with 16 additions and 13 deletions

View File

@ -64,9 +64,12 @@
#define OUTPARM
#define INOUT
#define CTOR_PRIORITY_FIRST 101
#define CTOR_PRIORITY_EARLY 111
#define CTOR_PRIORITY_LATE 201
#if VIDEO_OPENGL
#include "video_util/glUtil.h"
#define CRASH_APP_ON_LOAD_BECAUSE_YAY_GJ_APPLE 0
// 2015/04/01 ... early calls to glGetError()--before a context exists--causes segfaults on MacOS X
extern bool safe_to_do_opengl_logging;
static inline GLenum safeGLGetError(void) {

View File

@ -21,7 +21,7 @@
static double orwl_timebase = 0.0;
static uint64_t orwl_timestart = 0;
__attribute__((constructor))
__attribute__((constructor(CTOR_PRIORITY_LATE)))
static void __init_darwin_shim() {
mach_timebase_info_data_t tb = { 0 };
mach_timebase_info(&tb);

View File

@ -1273,9 +1273,9 @@ uint8_t floating_bus_hibit(const bool hibit) {
return (b & ~0x80) | (hibit ? 0x80 : 0);
}
__attribute__((constructor))
__attribute__((constructor(CTOR_PRIORITY_LATE)))
static void _init_interface(void) {
LOG("display subsystem startup");
LOG("Initializing display subsystem");
_load_interface_fonts();
}

View File

@ -30,7 +30,7 @@ bool is_headless = false;
color_mode_t color_mode = COLOR;
const char *data_dir = NULL;
__attribute__((constructor))
__attribute__((constructor(CTOR_PRIORITY_FIRST)))
static void _init_common() {
error_log = stderr;
#if defined(CONFIG_DATADIR)

View File

@ -79,7 +79,7 @@ pthread_cond_t cpu_thread_cond = PTHREAD_COND_INITIALIZER;
// -----------------------------------------------------------------------------
__attribute__((constructor))
__attribute__((constructor(CTOR_PRIORITY_LATE)))
static void _init_timing(void) {
pthread_mutexattr_t attr;
pthread_mutexattr_init(&attr);

View File

@ -159,9 +159,9 @@ static bool cpuanim_onTouchEvent(interface_touch_event_t action, int pointer_cou
}
#endif
__attribute__((constructor))
__attribute__((constructor(CTOR_PRIORITY_LATE)))
static void _init_glcpuanim(void) {
LOG("Registering CPU speed animations");
LOG("Initializing message animation subsystem");
video_backend->video_animation_show_cpuspeed = &cpuanim_show;
glnode_registerNode(RENDER_MIDDLE, (GLNode){
.setup = &cpuanim_init,

View File

@ -100,9 +100,9 @@ bool glnode_onTouchEvent(interface_touch_event_t action, int pointer_count, int
}
#endif
__attribute__((constructor))
__attribute__((constructor(CTOR_PRIORITY_LATE)))
static void _init_glnode_manager(void) {
LOG("Initializing GLNode manager routines");
LOG("Initializing GLNode manager subsystem");
#if INTERFACE_TOUCH
interface_onTouchEvent = &glnode_onTouchEvent;
#endif

View File

@ -645,7 +645,7 @@ static void gltouchjoy_setTouchAxisValues(char north, char west, char east, char
}
}
__attribute__((constructor))
__attribute__((constructor(CTOR_PRIORITY_LATE)))
static void _init_gltouchjoy(void) {
LOG("Registering OpenGL software touch joystick");

View File

@ -851,7 +851,7 @@ static void gldriver_main_loop(void) {
// fall through if not GLUT
}
__attribute__((constructor))
__attribute__((constructor(CTOR_PRIORITY_EARLY)))
static void _init_glvideo(void) {
LOG("Initializing OpenGL renderer");

View File

@ -938,7 +938,7 @@ static void xdriver_render(void) {
// no-op
}
__attribute__((constructor))
__attribute__((constructor(CTOR_PRIORITY_EARLY)))
static void _init_xvideo(void) {
LOG("Initializing X11 renderer");