From 8a63cf2a89141b1ca1a4d85c4095156843f33c4d Mon Sep 17 00:00:00 2001 From: Haru Date: Fri, 7 Oct 2016 00:56:49 +0200 Subject: Improved Makefile change detection - The build system's change detection is now more reliable when a new Makefile.in is added Signed-off-by: Haru --- Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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)"; \ -- cgit v1.2.3-70-g09d2 From f633010f6a3afbfa8b79dd6bcd5c917c42f1240a Mon Sep 17 00:00:00 2001 From: Haru Date: Fri, 7 Oct 2016 01:01:55 +0200 Subject: Suppressed the superuser check in CI builds - Speeds up GitLab builds by 1 minute Signed-off-by: Haru --- configure | 2 +- configure.ac | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 9fe0c9d5b..1d03a0b1f 100755 --- a/configure +++ b/configure @@ -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 "" -- cgit v1.2.3-70-g09d2 From 953feee90e47d75449151834707a165f9ce57fda Mon Sep 17 00:00:00 2001 From: Haru Date: Thu, 15 Sep 2016 11:49:26 +0200 Subject: Updated Xcode project to Xcode 8 Signed-off-by: Haru --- Hercules.xcodeproj/project.pbxproj | 14 +++++++++++++- .../xcshareddata/xcschemes/HPMHooking_char.xcscheme | 2 +- .../xcshareddata/xcschemes/HPMHooking_login.xcscheme | 2 +- .../xcshareddata/xcschemes/HPMHooking_map.xcscheme | 2 +- .../xcshareddata/xcschemes/char-server.xcscheme | 2 +- Hercules.xcodeproj/xcshareddata/xcschemes/db2sql.xcscheme | 2 +- .../xcshareddata/xcschemes/login-server.xcscheme | 2 +- .../xcshareddata/xcschemes/map-server.xcscheme | 2 +- .../xcshareddata/xcschemes/mapcache.xcscheme | 2 +- Hercules.xcodeproj/xcshareddata/xcschemes/sample.xcscheme | 2 +- 10 files changed, 22 insertions(+), 10 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 @@ Date: Thu, 15 Sep 2016 15:29:16 +0200 Subject: Fixed some issues detected by clang's static analyzer (Xcode 8/macOS Sierra) Signed-off-by: Haru --- src/common/HPM.c | 2 +- src/common/socket.c | 4 ---- src/common/timer.c | 4 ---- src/map/battle.c | 6 ++---- src/map/clif.c | 5 +---- src/map/path.c | 2 -- src/map/script.c | 2 -- 7 files changed, 4 insertions(+), 21 deletions(-) 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/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) -- cgit v1.2.3-70-g09d2 From 872fc8d4f4a8ea60a1d97da4ca724c7b70e1af18 Mon Sep 17 00:00:00 2001 From: Haru Date: Thu, 15 Sep 2016 15:30:18 +0200 Subject: Updated VECTOR_INIT() and VECTOR_ENSURE() to be more analyzer- (and human-reader-) friendly Signed-off-by: Haru --- src/common/db.h | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) 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) /** -- cgit v1.2.3-70-g09d2