[openjk] 01/24: Consistently use "static QINLINE" for inline C code

Simon McVittie smcv at debian.org
Sat Jan 21 21:44:00 UTC 2017


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to branch debian/master
in repository openjk.

commit e5b98faa2084dda02fcac4329d60a48be7a308b6
Author: Simon McVittie <smcv at debian.org>
Date:   Sun Sep 25 22:11:27 2016 +0100

    Consistently use "static QINLINE" for inline C code
    
    The portable idiom for type-safe macro-like constructs in C is to use
    "static inline" where C99 inline is supported, or "static __inline"
    on compilers that implement that keyword as a compiler-specific
    extension (at least gcc, clang and MSVC do), falling back to just
    "static" as a last resort on terrible compilers from the distant past.
    
    Using "static QINLINE" everywhere means there is no point in defining
    QINLINE to "static inline" on clang, so stop doing that; QINLINE now
    consistently expands to Standard C/C++ inline, or __inline on MSVC,
    or to nothing if we don't know how to inline functions on this
    compiler.
    
    This silences warnings about redundant qualifiers (static static inline)
    for all the functions that were already inline.
    
    There are a couple of uses of non-static QINLINE in C++ code; I've
    left those intact, since inline has different (more useful)
    semantics in C++, and as far as I'm aware all reasonable C++ compilers
    implement it correctly.
---
 codemp/game/NPC_move.c      | 4 ++--
 codemp/game/bg_pmove.c      | 2 +-
 shared/qcommon/q_platform.h | 6 +-----
 3 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/codemp/game/NPC_move.c b/codemp/game/NPC_move.c
index 7fe0842..5809909 100644
--- a/codemp/game/NPC_move.c
+++ b/codemp/game/NPC_move.c
@@ -95,7 +95,7 @@ NPC_CheckCombatMove
 -------------------------
 */
 
-QINLINE qboolean NPC_CheckCombatMove( void )
+static QINLINE qboolean NPC_CheckCombatMove( void )
 {
 	//return NPCInfo->combatMove;
 	if ( ( NPCS.NPCInfo->goalEntity && NPCS.NPC->enemy && NPCS.NPCInfo->goalEntity == NPCS.NPC->enemy ) || ( NPCS.NPCInfo->combatMove ) )
@@ -143,7 +143,7 @@ NPC_GetMoveInformation
 -------------------------
 */
 
-QINLINE qboolean NPC_GetMoveInformation( vec3_t dir, float *distance )
+static QINLINE qboolean NPC_GetMoveInformation( vec3_t dir, float *distance )
 {
 	//NOTENOTE: Use path stacks!
 
diff --git a/codemp/game/bg_pmove.c b/codemp/game/bg_pmove.c
index 9b0b9ee..62ac9c8 100644
--- a/codemp/game/bg_pmove.c
+++ b/codemp/game/bg_pmove.c
@@ -259,7 +259,7 @@ qboolean BG_KnockDownable(playerState_t *ps)
 }
 
 //hacky assumption check, assume any client non-humanoid is a rocket trooper
-qboolean QINLINE PM_IsRocketTrooper(void)
+static QINLINE qboolean PM_IsRocketTrooper(void)
 {
 	/*
 	if (pm->ps->clientNum < MAX_CLIENTS &&
diff --git a/shared/qcommon/q_platform.h b/shared/qcommon/q_platform.h
index 0d60290..ee5392e 100644
--- a/shared/qcommon/q_platform.h
+++ b/shared/qcommon/q_platform.h
@@ -123,11 +123,7 @@ along with this program; if not, see <http://www.gnu.org/licenses/>.
 		#define OS_STRING "kFreeBSD"
 	#endif
 
-	#ifdef __clang__
-		#define QINLINE static inline
-	#else
-		#define QINLINE inline
-	#endif
+	#define QINLINE inline
 
 	#define PATH_SEP '/'
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/openjk.git



More information about the Pkg-games-commits mailing list