From fb33a7f2a7df64dec778ba55eaedb987f894712b Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sun, 15 Mar 2020 20:27:43 +0900 Subject: [PATCH] [qfcc] Remove "impossible" code It is not possible to adorn Class with protocols, so no need to check for them when checking if a type is a class. --- tools/qfcc/include/class.h | 2 +- tools/qfcc/source/class.c | 9 --------- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/tools/qfcc/include/class.h b/tools/qfcc/include/class.h index 7f7f0920d..a468e19b5 100644 --- a/tools/qfcc/include/class.h +++ b/tools/qfcc/include/class.h @@ -116,7 +116,7 @@ struct symbol_s; int obj_is_id (const struct type_s *type) __attribute__((pure)); int obj_is_class (const struct type_s *type) __attribute__((pure)); -int obj_is_Class (const struct type_s *type) __attribute__((pure)); +int obj_is_Class (const struct type_s *type) __attribute__((const)); int obj_is_classptr (const struct type_s *type) __attribute__((pure)); int obj_types_assignable (const struct type_s *dst, const struct type_s *src); diff --git a/tools/qfcc/source/class.c b/tools/qfcc/source/class.c index 647a64716..d1322c174 100644 --- a/tools/qfcc/source/class.c +++ b/tools/qfcc/source/class.c @@ -345,15 +345,6 @@ obj_is_Class (const type_t *type) { if (type == &type_Class) return 1; - // type may be a qualified Class, in which case it will be a pointer to - // a qualified obj_class struct - if (type->type != ev_pointer) - return 0; - if (!is_struct (type->t.fldptr.type)) - return 0; - // if the the symtabs match, then type is Class in disguise - if (type->t.fldptr.type->t.symtab == type_obj_class.t.symtab) - return 1; return 0; }