Make it easier to suppress mismatched selector warnings. It's useful for the runtime to tell you when your code is bad. Not so useful for it to tell you when someone else's code is bad...

main
theraven 15 years ago
parent 95404fc7ba
commit 23b26820f5

@ -67,6 +67,7 @@ libobjc_HEADER_FILES = \
toydispatch.h toydispatch.h
endif endif
# Disable type dependent dispatch if tdd=no is specified
ifneq ($(tdd), no) ifneq ($(tdd), no)
libobjc_CPPFLAGS += -DTYPE_DEPENDENT_DISPATCH libobjc_CPPFLAGS += -DTYPE_DEPENDENT_DISPATCH
endif endif
@ -77,6 +78,12 @@ else
libobjc_LIBRARIES_DEPEND_UPON += -lpthread libobjc_LIBRARIES_DEPEND_UPON += -lpthread
endif endif
# If we're doing a release build, don't tell people that the code that they're
# using is rubbish - they complain.
#CPPFLAGS += -DNO_SELECTOR_MISMATCH_WARNINGS
libobjc_CFLAGS += -O3
# Deprecated functions are only deprecated for external use, not for us because # Deprecated functions are only deprecated for external use, not for us because
# we are special, precious, little flowers. # we are special, precious, little flowers.
libobjc_CPPFLAGS += -D__OBJC_RUNTIME_INTERNAL__=1 -D_XOPEN_SOURCE=500 libobjc_CPPFLAGS += -D__OBJC_RUNTIME_INTERNAL__=1 -D_XOPEN_SOURCE=500
@ -84,16 +91,13 @@ libobjc_CPPFLAGS += -D__OBJC_RUNTIME_INTERNAL__=1 -D_XOPEN_SOURCE=500
# useful on compilers that support C99 (currently only clang), so there is no # useful on compilers that support C99 (currently only clang), so there is no
# benefit from supporting platforms with no C99 compiler. # benefit from supporting platforms with no C99 compiler.
libobjc_CFLAGS += -std=gnu99 -g -fexceptions #-fvisibility=hidden libobjc_CFLAGS += -std=gnu99 -g -fexceptions #-fvisibility=hidden
libobjc_CFLAGS += -Wno-unused-function
libobjc_CCFLAGS += -std=c++98 -g -fexceptions #-fvisibility=hidden libobjc_CCFLAGS += -std=c++98 -g -fexceptions #-fvisibility=hidden
libobjc_CFLAGS += -Wno-unused-function
# Uncomment this when debugging - it makes everything slow, but means that the # Uncomment this when debugging - it makes everything slow, but means that the
# debugger actually works... # debugger actually works...
#libobjc_CFLAGS += -fno-inline #libobjc_CFLAGS += -fno-inline
libobjc_OBJCFLAGS += $(libobjc_CFLAGS) $(libobjc_CFLAGS) libobjc_OBJCFLAGS += $(libobjc_CFLAGS) $(libobjc_CFLAGS)
libobjc_LDFLAGS += -g
libobjc_CFLAGS += -O3
ifneq ($(findstring gcc, $(CC)),) ifneq ($(findstring gcc, $(CC)),)
# Hack to get the __sync_* GCC builtins to work with GCC # Hack to get the __sync_* GCC builtins to work with GCC

@ -12,6 +12,9 @@ CXXFLAGS += -fPIC
CPPFLAGS += -DTYPE_DEPENDENT_DISPATCH -DGNUSTEP CPPFLAGS += -DTYPE_DEPENDENT_DISPATCH -DGNUSTEP
CPPFLAGS += -D__OBJC_RUNTIME_INTERNAL__=1 -D_XOPEN_SOURCE=500 CPPFLAGS += -D__OBJC_RUNTIME_INTERNAL__=1 -D_XOPEN_SOURCE=500
# Suppress warnings about incorrect selectors
CPPFLAGS += -DNO_SELECTOR_MISMATCH_WARNINGS
PREFIX?= /usr/local PREFIX?= /usr/local
LIB_DIR= ${PREFIX}/lib LIB_DIR= ${PREFIX}/lib
HEADER_DIR= ${PREFIX}/include HEADER_DIR= ${PREFIX}/include

@ -25,6 +25,7 @@ static Slot_t objc_msg_forward3_null(id receiver, SEL op) { return &nil_slot; }
id (*objc_proxy_lookup)(id receiver, SEL op) = objc_proxy_lookup_null; id (*objc_proxy_lookup)(id receiver, SEL op) = objc_proxy_lookup_null;
Slot_t (*__objc_msg_forward3)(id receiver, SEL op) = objc_msg_forward3_null; Slot_t (*__objc_msg_forward3)(id receiver, SEL op) = objc_msg_forward3_null;
#ifdef NO_SELECTOR_MISMATCH_WARNINGS
static struct objc_slot* objc_selector_type_mismatch(Class cls, SEL static struct objc_slot* objc_selector_type_mismatch(Class cls, SEL
selector, Slot_t result) selector, Slot_t result)
{ {
@ -37,6 +38,13 @@ static struct objc_slot* objc_selector_type_mismatch(Class cls, SEL
sel_getType_np(selector)); sel_getType_np(selector));
return result; return result;
} }
#else
static struct objc_slot* objc_selector_type_mismatch(Class cls, SEL
selector, Slot_t result)
{
return result;
}
#endif
struct objc_slot* (*_objc_selector_type_mismatch)(Class cls, SEL struct objc_slot* (*_objc_selector_type_mismatch)(Class cls, SEL
selector, struct objc_slot *result) = objc_selector_type_mismatch; selector, struct objc_slot *result) = objc_selector_type_mismatch;
static static

Loading…
Cancel
Save