summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Angus <tim@ngus.net>2011-10-21 22:48:53 +0000
committerTim Angus <tim@ngus.net>2013-01-10 23:38:31 +0000
commit6fa292451d11608d1588f1b28569ccb2dd1cea57 (patch)
treec7e09270d36c450beb62b4b1bb8fced3a8bb4ed4
parentda2d020a143ebb13d4e3cfb3a360bdb763bf9251 (diff)
* clang support
-rw-r--r--Makefile2
-rw-r--r--src/asm/snapvector.c6
-rw-r--r--src/qcommon/common.c3
-rw-r--r--src/qcommon/q_platform.h5
-rw-r--r--src/qcommon/unzip.c2
-rw-r--r--src/renderer/tr_model_iqm.c9
-rw-r--r--src/renderer/tr_scene.c2
7 files changed, 17 insertions, 12 deletions
diff --git a/Makefile b/Makefile
index 2cb52a59..0af4d137 100644
--- a/Makefile
+++ b/Makefile
@@ -268,7 +268,7 @@ ifneq (,$(findstring "$(PLATFORM)", "linux" "gnu_kfreebsd" "kfreebsd-gnu"))
endif
BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes \
- -pipe -DUSE_ICON
+ -Wno-self-assign -pipe -DUSE_ICON
CLIENT_CFLAGS += $(SDL_CFLAGS)
OPTIMIZEVM = -O3 -funroll-loops -fomit-frame-pointer
diff --git a/src/asm/snapvector.c b/src/asm/snapvector.c
index a70a1069..2ba248df 100644
--- a/src/asm/snapvector.c
+++ b/src/asm/snapvector.c
@@ -55,9 +55,9 @@ void qsnapvectorsse(vec3_t vec)
#define QROUNDX87(src) \
"flds " src "\n" \
- "fistp " src "\n" \
- "fild " src "\n" \
- "fstp " src "\n"
+ "fistpl " src "\n" \
+ "fildl " src "\n" \
+ "fstpl " src "\n"
void qsnapvectorx87(vec3_t vec)
{
diff --git a/src/qcommon/common.c b/src/qcommon/common.c
index e8834d28..be91b245 100644
--- a/src/qcommon/common.c
+++ b/src/qcommon/common.c
@@ -2325,7 +2325,10 @@ A way to force a bus error for development reasons
=================
*/
static void Com_Crash_f( void ) {
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wnull-dereference"
* ( int * ) 0 = 0x12345678;
+#pragma clang diagnostic pop
}
/*
diff --git a/src/qcommon/q_platform.h b/src/qcommon/q_platform.h
index ea74278b..cc8e5062 100644
--- a/src/qcommon/q_platform.h
+++ b/src/qcommon/q_platform.h
@@ -180,7 +180,12 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define OS_STRING "kFreeBSD"
#endif
+#ifdef __clang__
+#define ID_INLINE static inline
+#else
#define ID_INLINE inline
+#endif
+
#define PATH_SEP '/'
#if defined __i386__
diff --git a/src/qcommon/unzip.c b/src/qcommon/unzip.c
index b307e98d..128502ce 100644
--- a/src/qcommon/unzip.c
+++ b/src/qcommon/unzip.c
@@ -1250,7 +1250,7 @@ extern int ZEXPORT unzReadCurrentFile (file, buf, len)
return UNZ_PARAMERROR;
- if ((pfile_in_zip_read_info->read_buffer == NULL))
+ if (pfile_in_zip_read_info->read_buffer == NULL)
return UNZ_END_OF_LIST_OF_FILE;
if (len==0)
return 0;
diff --git a/src/renderer/tr_model_iqm.c b/src/renderer/tr_model_iqm.c
index cad3aa6f..98517d55 100644
--- a/src/renderer/tr_model_iqm.c
+++ b/src/renderer/tr_model_iqm.c
@@ -284,9 +284,9 @@ qboolean R_LoadIQM( model_t *mod, void *buffer, int filesize, const char *mod_na
LL( triangle->vertex[1] );
LL( triangle->vertex[2] );
- if( triangle->vertex[0] < 0 || triangle->vertex[0] > header->num_vertexes ||
- triangle->vertex[1] < 0 || triangle->vertex[1] > header->num_vertexes ||
- triangle->vertex[2] < 0 || triangle->vertex[2] > header->num_vertexes ) {
+ if( triangle->vertex[0] > header->num_vertexes ||
+ triangle->vertex[1] > header->num_vertexes ||
+ triangle->vertex[2] > header->num_vertexes ) {
return qfalse;
}
}
@@ -323,9 +323,7 @@ qboolean R_LoadIQM( model_t *mod, void *buffer, int filesize, const char *mod_na
mesh->first_vertex + mesh->num_vertexes > header->num_vertexes ||
mesh->first_triangle >= header->num_triangles ||
mesh->first_triangle + mesh->num_triangles > header->num_triangles ||
- mesh->name < 0 ||
mesh->name >= header->num_text ||
- mesh->material < 0 ||
mesh->material >= header->num_text ) {
return qfalse;
}
@@ -354,7 +352,6 @@ qboolean R_LoadIQM( model_t *mod, void *buffer, int filesize, const char *mod_na
if( joint->parent < -1 ||
joint->parent >= (int)header->num_joints ||
- joint->name < 0 ||
joint->name >= (int)header->num_text ) {
return qfalse;
}
diff --git a/src/renderer/tr_scene.c b/src/renderer/tr_scene.c
index f7483e8f..aeea675c 100644
--- a/src/renderer/tr_scene.c
+++ b/src/renderer/tr_scene.c
@@ -220,7 +220,7 @@ void RE_AddRefEntityToScene( const refEntity_t *ent ) {
}
return;
}
- if ( ent->reType < 0 || ent->reType >= RT_MAX_REF_ENTITY_TYPE ) {
+ if ( (int)ent->reType < 0 || ent->reType >= RT_MAX_REF_ENTITY_TYPE ) {
ri.Error( ERR_DROP, "RE_AddRefEntityToScene: bad reType %i", ent->reType );
}