From 5ebf87c8d5645026ba410a050df493b15823b76f Mon Sep 17 00:00:00 2001 From: theraven Date: Sat, 24 Mar 2012 16:43:01 +0000 Subject: [PATCH] Fix some warnings. Remove the dependency on containing the vtable layout for std::type_info. This allows libobjc2 to be built against libc++ and libcxxrt and still provide working a unified exception model. Note: This is broken on FreeBSD < 9.1, because it ships a libsupc++ with a broken ABI. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/libobjc2/trunk@34993 72102866-910b-0410-8b05-ffd578937521 --- Makefile | 1 + dwarf_eh.h | 2 +- objcxx_eh.cc | 43 +++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 43 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 6c98267..0a24d06 100644 --- a/Makefile +++ b/Makefile @@ -14,6 +14,7 @@ LIBOBJCXX=libobjcxx SILENT=@ CFLAGS += -std=gnu99 -fPIC -fexceptions +CFLAGS += -Wno-deprecated-objc-isa-usage CXXFLAGS += -fPIC -fexceptions CPPFLAGS += -DTYPE_DEPENDENT_DISPATCH -DGNUSTEP CPPFLAGS += -D__OBJC_RUNTIME_INTERNAL__=1 -D_XOPEN_SOURCE=500 -D__BSD_VISIBLE=1 -D_BSD_SOURCE=1 diff --git a/dwarf_eh.h b/dwarf_eh.h index ea4e7fa..6dbe1e6 100644 --- a/dwarf_eh.h +++ b/dwarf_eh.h @@ -143,7 +143,7 @@ static uint64_t read_value(char encoding, unsigned char **data) { enum dwarf_data_encoding type = get_encoding(encoding); uint64_t v; - switch (type) + switch ((int)type) { // Read fixed-length types #define READ(dwarf, type) \ diff --git a/objcxx_eh.cc b/objcxx_eh.cc index 1dc98c2..0a29c3c 100644 --- a/objcxx_eh.cc +++ b/objcxx_eh.cc @@ -1,14 +1,53 @@ #include #include #include "dwarf_eh.h" -#include -#include #include "objcxx_eh.h" +#include + extern "C" { #include "objc/runtime.h" }; +namespace __cxxabiv1 +{ + struct __class_type_info; +} +using __cxxabiv1::__class_type_info; + +namespace std +{ + /** + * std::type_info defined with the GCC ABI. This may not be exposed in + * public headers, but is required for correctly implementing the unified + * exception model. + */ + class type_info + { + public: + virtual ~type_info(); + bool operator==(const type_info &) const; + bool operator!=(const type_info &) const; + bool before(const type_info &) const; + const char* name() const; + type_info(); + private: + type_info(const type_info& rhs); + type_info& operator= (const type_info& rhs); + const char *__type_name; + protected: + type_info(const char *name): __type_name(name) { } + public: + virtual bool __is_pointer_p() const; + virtual bool __is_function_p() const; + virtual bool __do_catch(const type_info *thrown_type, + void **thrown_object, + unsigned outer) const; + virtual bool __do_upcast( + const __class_type_info *target, + void **thrown_object) const; + }; +} using namespace std;