From 4a7aff2eac739cac9911a2396c736243fd919770 Mon Sep 17 00:00:00 2001 From: punkrockguy318 Date: Sun, 17 Mar 2013 01:09:49 +0000 Subject: [PATCH] sdl: import an upstream fix for a bakward-cpp issue with clang that was previously haked around in the build script --- trunk/SConstruct | 5 +---- trunk/src/utils/backward.hpp | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/trunk/SConstruct b/trunk/SConstruct index a6d37a30..7b401786 100644 --- a/trunk/SConstruct +++ b/trunk/SConstruct @@ -27,7 +27,7 @@ opts.AddVariables( BoolVariable('SYSTEM_LUA','Use system lua instead of static lua provided with fceux', 1), BoolVariable('SYSTEM_MINIZIP', 'Use system minizip instead of static minizip provided with fceux', 0), BoolVariable('LSB_FIRST', 'Least signficant byte first (non-PPC)', 1), - BoolVariable('CLANG', 'Compile with llvm-clang instead of gcc', 0), + BoolVariable('CLANG', 'Compile with llvm-clang instead of gcc', 1), BoolVariable('SDL2', 'Compile using SDL2 instead of SDL 1.2 (experimental/non-functional)', 0) ) AddOption('--prefix', dest='prefix', type='string', nargs=1, action='store', metavar='DIR', help='installation prefix') @@ -87,9 +87,6 @@ else: if conf.CheckLib('dw'): conf.env.Append(CCFLAGS = "-DBACKWARD_HAS_DW=1") conf.env.Append(LINKFLAGS = "-ldw") - # workaround for upstream backward-cpp issue (https://github.com/bombela/backward-cpp/issues/2) - if env['CLANG']: - conf.env.Append(CCFLAGS = "-DBACKWARD_HAS_BACKTRACE=1") if conf.CheckFunc('asprintf'): conf.env.Append(CCFLAGS = "-DHAVE_ASPRINTF") if env['SYSTEM_MINIZIP']: diff --git a/trunk/src/utils/backward.hpp b/trunk/src/utils/backward.hpp index 612765fe..b88e75a5 100644 --- a/trunk/src/utils/backward.hpp +++ b/trunk/src/utils/backward.hpp @@ -146,6 +146,23 @@ # if BACKWARD_HAS_UNWIND == 1 # include +// while gcc's unwind.h defines something like that: +// extern _Unwind_Ptr _Unwind_GetIP (struct _Unwind_Context *); +// extern _Unwind_Ptr _Unwind_GetIPInfo (struct _Unwind_Context *, int *); +// +// clang's unwind.h defines something like this: +// uintptr_t _Unwind_GetIP(struct _Unwind_Context* __context); +// +// Even if the _Unwind_GetIPInfo can be linked to, it is not declared, worse we +// cannot just redeclare it because clang's unwind.h doesn't define _Unwind_Ptr +// anyway. +// +// Luckily we can play on the fact that the guard macros have a different name: +#ifdef __CLANG_UNWIND_H +// In fact, this function still comes from libgcc (on my different linux boxes, +// clang links against libgcc). +extern "C" uintptr_t _Unwind_GetIPInfo(_Unwind_Context*, int*); +#endif # endif # include