diff options
21 files changed, 39 insertions, 41 deletions
diff --git a/Hercules.xcodeproj/project.pbxproj b/Hercules.xcodeproj/project.pbxproj index 66d46e7f5..fc7aa8dc4 100644 --- a/Hercules.xcodeproj/project.pbxproj +++ b/Hercules.xcodeproj/project.pbxproj @@ -1075,7 +1075,7 @@ A56CC652185642B4009EB79C /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0710; + LastUpgradeCheck = 0800; ORGANIZATIONNAME = herc.ws; }; buildConfigurationList = A56CC655185642B4009EB79C /* Build configuration list for PBXProject "Hercules" */; @@ -1503,13 +1503,18 @@ CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CONFIGURATION_BUILD_DIR = "$(PROJECT_DIR)"; COPY_PHASE_STRIP = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_FAST_MATH = YES; + GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", @@ -1522,6 +1527,7 @@ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_CHECK_SWITCH_STATEMENTS = NO; GCC_WARN_SHADOW = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; @@ -1588,19 +1594,25 @@ CLANG_WARN_CONSTANT_CONVERSION = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CONFIGURATION_BUILD_DIR = "$(PROJECT_DIR)"; COPY_PHASE_STRIP = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_FAST_MATH = YES; + GCC_NO_COMMON_BLOCKS = YES; GCC_STRICT_ALIASING = NO; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_MISSING_NEWLINE = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_CHECK_SWITCH_STATEMENTS = NO; GCC_WARN_SHADOW = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; diff --git a/Hercules.xcodeproj/xcshareddata/xcschemes/HPMHooking_char.xcscheme b/Hercules.xcodeproj/xcshareddata/xcschemes/HPMHooking_char.xcscheme index 8fc8f9cbb..5aa519349 100644 --- a/Hercules.xcodeproj/xcshareddata/xcschemes/HPMHooking_char.xcscheme +++ b/Hercules.xcodeproj/xcshareddata/xcschemes/HPMHooking_char.xcscheme @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <Scheme - LastUpgradeVersion = "0710" + LastUpgradeVersion = "0800" version = "1.3"> <BuildAction parallelizeBuildables = "YES" diff --git a/Hercules.xcodeproj/xcshareddata/xcschemes/HPMHooking_login.xcscheme b/Hercules.xcodeproj/xcshareddata/xcschemes/HPMHooking_login.xcscheme index 6ce9de3a6..52ae334ba 100644 --- a/Hercules.xcodeproj/xcshareddata/xcschemes/HPMHooking_login.xcscheme +++ b/Hercules.xcodeproj/xcshareddata/xcschemes/HPMHooking_login.xcscheme @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <Scheme - LastUpgradeVersion = "0710" + LastUpgradeVersion = "0800" version = "1.3"> <BuildAction parallelizeBuildables = "YES" diff --git a/Hercules.xcodeproj/xcshareddata/xcschemes/HPMHooking_map.xcscheme b/Hercules.xcodeproj/xcshareddata/xcschemes/HPMHooking_map.xcscheme index a62507de0..ce5cd9554 100644 --- a/Hercules.xcodeproj/xcshareddata/xcschemes/HPMHooking_map.xcscheme +++ b/Hercules.xcodeproj/xcshareddata/xcschemes/HPMHooking_map.xcscheme @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <Scheme - LastUpgradeVersion = "0710" + LastUpgradeVersion = "0800" version = "1.3"> <BuildAction parallelizeBuildables = "YES" diff --git a/Hercules.xcodeproj/xcshareddata/xcschemes/char-server.xcscheme b/Hercules.xcodeproj/xcshareddata/xcschemes/char-server.xcscheme index a64514c1d..40648c0dc 100644 --- a/Hercules.xcodeproj/xcshareddata/xcschemes/char-server.xcscheme +++ b/Hercules.xcodeproj/xcshareddata/xcschemes/char-server.xcscheme @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <Scheme - LastUpgradeVersion = "0710" + LastUpgradeVersion = "0800" version = "1.3"> <BuildAction parallelizeBuildables = "YES" diff --git a/Hercules.xcodeproj/xcshareddata/xcschemes/db2sql.xcscheme b/Hercules.xcodeproj/xcshareddata/xcschemes/db2sql.xcscheme index 603e02228..37f127142 100644 --- a/Hercules.xcodeproj/xcshareddata/xcschemes/db2sql.xcscheme +++ b/Hercules.xcodeproj/xcshareddata/xcschemes/db2sql.xcscheme @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <Scheme - LastUpgradeVersion = "0710" + LastUpgradeVersion = "0800" version = "1.3"> <BuildAction parallelizeBuildables = "YES" diff --git a/Hercules.xcodeproj/xcshareddata/xcschemes/login-server.xcscheme b/Hercules.xcodeproj/xcshareddata/xcschemes/login-server.xcscheme index 82cd4764d..1e14dc985 100644 --- a/Hercules.xcodeproj/xcshareddata/xcschemes/login-server.xcscheme +++ b/Hercules.xcodeproj/xcshareddata/xcschemes/login-server.xcscheme @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <Scheme - LastUpgradeVersion = "0710" + LastUpgradeVersion = "0800" version = "1.3"> <BuildAction parallelizeBuildables = "YES" diff --git a/Hercules.xcodeproj/xcshareddata/xcschemes/map-server.xcscheme b/Hercules.xcodeproj/xcshareddata/xcschemes/map-server.xcscheme index 30cc2a2e3..115168afc 100644 --- a/Hercules.xcodeproj/xcshareddata/xcschemes/map-server.xcscheme +++ b/Hercules.xcodeproj/xcshareddata/xcschemes/map-server.xcscheme @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <Scheme - LastUpgradeVersion = "0710" + LastUpgradeVersion = "0800" version = "1.3"> <BuildAction parallelizeBuildables = "YES" diff --git a/Hercules.xcodeproj/xcshareddata/xcschemes/mapcache.xcscheme b/Hercules.xcodeproj/xcshareddata/xcschemes/mapcache.xcscheme index 756fb2794..f437d0718 100644 --- a/Hercules.xcodeproj/xcshareddata/xcschemes/mapcache.xcscheme +++ b/Hercules.xcodeproj/xcshareddata/xcschemes/mapcache.xcscheme @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <Scheme - LastUpgradeVersion = "0710" + LastUpgradeVersion = "0800" version = "1.3"> <BuildAction parallelizeBuildables = "YES" diff --git a/Hercules.xcodeproj/xcshareddata/xcschemes/sample.xcscheme b/Hercules.xcodeproj/xcshareddata/xcschemes/sample.xcscheme index 49d1cc5e8..02924f4b2 100644 --- a/Hercules.xcodeproj/xcshareddata/xcschemes/sample.xcscheme +++ b/Hercules.xcodeproj/xcshareddata/xcschemes/sample.xcscheme @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <Scheme - LastUpgradeVersion = "0710" + LastUpgradeVersion = "0800" version = "1.3"> <BuildAction parallelizeBuildables = "YES" diff --git a/Makefile.in b/Makefile.in index be7ae674f..3de5e0bf3 100644 --- a/Makefile.in +++ b/Makefile.in @@ -80,7 +80,7 @@ all: $(ALL_DEPENDS) sql: $(SQL_DEPENDS) -$(MF_TARGETS): %: %.in +$(MF_TARGETS): %: %.in config.status @echo " CONFIGURE" @if [ -x config.status ]; then \ echo "Reconfiguring with options: $$(./config.status --config)"; \ @@ -3454,7 +3454,7 @@ case $host_os in CYGWIN*) ;; *) - if type id >/dev/null 2>&1; then + if type id >/dev/null 2>&1 && test -n "$CI"; then euid="`id -u`" if test "$euid" == "0"; then echo "" diff --git a/configure.ac b/configure.ac index 6cad8146c..10692f957 100644 --- a/configure.ac +++ b/configure.ac @@ -44,7 +44,7 @@ case $host_os in CYGWIN*) ;; *) - if type id >/dev/null 2>&1; then + if type id >/dev/null 2>&1 && test -n "$CI"; then euid="`id -u`" if test "$euid" == "0"; then echo "" diff --git a/src/common/HPM.c b/src/common/HPM.c index c34828010..ff1371b14 100644 --- a/src/common/HPM.c +++ b/src/common/HPM.c @@ -898,7 +898,7 @@ bool hplugins_parse_conf(const struct config_t *config, const char *filename, en for (i = 0; i < VECTOR_LENGTH(HPM->config_listeners[point]); i++) { const struct HPConfListenStorage *entry = &VECTOR_INDEX(HPM->config_listeners[point], i); const char *config_name = entry->key; - const char *str = buf; + const char *str = NULL; if ((setting = libconfig->lookup(config, config_name)) == NULL) { if (!imported && entry->required) { ShowWarning("Missing configuration '%s' in file %s!\n", config_name, filename); diff --git a/src/common/db.h b/src/common/db.h index 1c0955221..4cbc66ade 100644 --- a/src/common/db.h +++ b/src/common/db.h @@ -1114,7 +1114,11 @@ HPShared struct db_interface *DB; * @param _vec Vector. */ #define VECTOR_INIT(_vec) \ - memset(&(_vec), 0, sizeof(_vec)) + do { \ + VECTOR_DATA(_vec) = NULL; \ + VECTOR_CAPACITY(_vec) = 0; \ + VECTOR_LENGTH(_vec) = 0; \ + } while(false) /** * Returns the internal array of values. @@ -1220,12 +1224,11 @@ HPShared struct db_interface *DB; */ #define VECTOR_ENSURE(_vec, _n, _step) \ do { \ - int _empty_ = VECTOR_CAPACITY(_vec)-VECTOR_LENGTH(_vec); \ - if ((_n) > _empty_) { \ - while ((_n) > _empty_) \ - _empty_ += (_step); \ - VECTOR_RESIZE(_vec, _empty_+VECTOR_LENGTH(_vec)); \ - } \ + int _newcapacity_ = VECTOR_CAPACITY(_vec); \ + while ((_n) + VECTOR_LENGTH(_vec) > _newcapacity_) \ + _newcapacity_ += (_step); \ + if (_newcapacity_ > VECTOR_CAPACITY(_vec)) \ + VECTOR_RESIZE(_vec, _newcapacity_); \ } while(false) /** diff --git a/src/common/socket.c b/src/common/socket.c index 5f284587a..d4b8bb43f 100644 --- a/src/common/socket.c +++ b/src/common/socket.c @@ -1023,10 +1023,6 @@ int do_sockets(int next) } } -#ifdef __clang_analyzer__ - // Let Clang's static analyzer know this never happens (it thinks it might because of a NULL check in session_is_valid) - if (!sockt->session[i]) continue; -#endif // __clang_analyzer__ sockt->session[i]->func_parse(i); if(!sockt->session[i]) diff --git a/src/common/timer.c b/src/common/timer.c index 0b28f6a06..f820ebe12 100644 --- a/src/common/timer.c +++ b/src/common/timer.c @@ -258,10 +258,6 @@ int64 timer_gettick(void) { /// Adds a timer to the timer_heap static void push_timer_heap(int tid) { BHEAP_ENSURE(timer_heap, 1, 256); -#ifdef __clang_analyzer__ // Clang's static analyzer warns that BHEAP_ENSURE might set BHEAP_DATA(timer_heap) to NULL. -#include "assert.h" - assert(BHEAP_DATA(timer_heap) != NULL); -#endif // __clang_analyzer__ BHEAP_PUSH(timer_heap, tid, DIFFTICK_MINTOPCMP, swap); } diff --git a/src/map/battle.c b/src/map/battle.c index daef8f6a8..67ab8c9b8 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -6008,20 +6008,18 @@ int battle_damage_area(struct block_list *bl, va_list ap) { if (bl->type == BL_MOB && BL_UCCAST(BL_MOB, bl)->class_ == MOBID_EMPELIUM) return 0; if( bl != src && battle->check_target(src,bl,BCT_ENEMY) > 0 ) { - struct map_session_data *sd = NULL; nullpo_ret(src); map->freeblock_lock(); - sd = BL_CAST(BL_PC, src); if (src->type == BL_PC) - battle->drain(sd, bl, damage, damage, status_get_race(bl), is_boss(bl)); + battle->drain(BL_UCAST(BL_PC, src), bl, damage, damage, status_get_race(bl), is_boss(bl)); if( amotion ) battle->delay_damage(tick, amotion,src,bl,0,CR_REFLECTSHIELD,0,damage,ATK_DEF,0,true); else status_fix_damage(src,bl,damage,0); clif->damage(bl,bl,amotion,dmotion,damage,1,BDT_ENDURE,0); - if (src->type != BL_PC || !sd->state.autocast) + if (src->type != BL_PC || !BL_UCCAST(BL_PC, src)->state.autocast) skill->additional_effect(src, bl, CR_REFLECTSHIELD, 1, BF_WEAPON|BF_SHORT|BF_NORMAL,ATK_DEF,tick); map->freeblock_unlock(); } diff --git a/src/map/clif.c b/src/map/clif.c index 040f86a58..3e6b4937b 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -3249,10 +3249,7 @@ void clif_changelook(struct block_list *bl,int type,int val) #endif break; case LOOK_BODY2: - if (val && ( - sd->sc.option&OPTION_WEDDING || sd->sc.option&OPTION_XMAS || - sd->sc.option&OPTION_SUMMER || sd->sc.option&OPTION_HANBOK || - sd->sc.option&OPTION_OKTOBERFEST)) + if (sd != NULL && (sd->sc.option&OPTION_COSTUME) != OPTION_NOTHING) val = 0; vd->body_style = val; break; diff --git a/src/map/path.c b/src/map/path.c index f5e08d4df..07b38b740 100644 --- a/src/map/path.c +++ b/src/map/path.c @@ -192,10 +192,8 @@ bool path_search_long(struct shootpath_data *spd,struct block_list *bl,int16 m,i /// Ensures there is enough space in array to store new element. static void heap_push_node(struct node_heap *heap, struct path_node *node) { -#ifndef __clang_analyzer__ // TODO: Figure out why clang's static analyzer doesn't like this BHEAP_ENSURE(*heap, 1, 256); BHEAP_PUSH2(*heap, node, NODE_MINTOPCMP, swap_ptr); -#endif // __clang_analyzer__ } /// Updates path_node in the binary node_heap. diff --git a/src/map/script.c b/src/map/script.c index a1efbb3b8..d1aee29bf 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -5482,8 +5482,6 @@ bool script_sprintf(struct script_state *st, int start, struct StringBuf *out) safestrncpy(buf, p, len); StrBuf->AppendStr(out, buf); } - - p = np; np++; // placeholder = "%%" ; (special case) |