summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/db.c2
-rw-r--r--src/common/db.h4
-rw-r--r--src/common/ers.h14
-rw-r--r--src/common/memmgr.c22
-rw-r--r--src/common/memmgr.h2
-rw-r--r--src/common/showmsg.c2
-rw-r--r--src/common/sql.h4
-rw-r--r--src/common/sysinfo.c2
8 files changed, 26 insertions, 26 deletions
diff --git a/src/common/db.c b/src/common/db.c
index 361e212cb..ca9a70f7c 100644
--- a/src/common/db.c
+++ b/src/common/db.c
@@ -353,7 +353,7 @@ static struct db_stats {
};
#define DB_COUNTSTAT(token) do { if ((stats.token) != UINT32_MAX) ++(stats.token); } while(0)
#else /* !defined(DB_ENABLE_STATS) */
-#define DB_COUNTSTAT(token)
+#define DB_COUNTSTAT(token) (void)0
#endif /* !defined(DB_ENABLE_STATS) */
/* [Ind/Hercules] */
diff --git a/src/common/db.h b/src/common/db.h
index 205288f13..b73970947 100644
--- a/src/common/db.h
+++ b/src/common/db.h
@@ -1717,7 +1717,7 @@ HPShared struct db_interface *DB;
* @return negative if v1 is top, positive if v2 is top, 0 if equal.
*/
#define BHEAP_MINTOPCMP(v1, v2) \
- ( v1 == v2 ? 0 : v1 < v2 ? -1 : 1 )
+ ( (v1) == (v2) ? 0 : (v1) < (v2) ? -1 : 1 )
/**
* Generic comparator for a max-heap (maximum value at top).
@@ -1732,6 +1732,6 @@ HPShared struct db_interface *DB;
* @return negative if v1 is top, positive if v2 is top, 0 if equal.
*/
#define BHEAP_MAXTOPCMP(v1, v2) \
- ( v1 == v2 ? 0 : v1 > v2 ? -1 : 1 )
+ ( (v1) == (v2) ? 0 : (v1) > (v2) ? -1 : 1 )
#endif /* COMMON_DB_H */
diff --git a/src/common/ers.h b/src/common/ers.h
index 938882edd..1689345dc 100644
--- a/src/common/ers.h
+++ b/src/common/ers.h
@@ -148,15 +148,15 @@ typedef struct eri {
#ifdef DISABLE_ERS
// Use memory manager to allocate/free and disable other interface functions
-# define ers_alloc(obj,type) (type *)aMalloc(sizeof(type))
-# define ers_free(obj,entry) aFree(entry)
-# define ers_entry_size(obj) (size_t)0
-# define ers_destroy(obj)
-# define ers_chunk_size(obj,size)
+# define ers_alloc(obj,type) ((void)(obj), (type *)aMalloc(sizeof(type)))
+# define ers_free(obj,entry) ((void)(obj), aFree(entry))
+# define ers_entry_size(obj) ((void)(obj), (size_t)0)
+# define ers_destroy(obj) ((void)(obj), (void)0)
+# define ers_chunk_size(obj,size) ((void)(obj), (void)(size), (size_t)0)
// Disable the public functions
# define ers_new(size,name,options) NULL
-# define ers_report()
-# define ers_final()
+# define ers_report() (void)0
+# define ers_final() (void)0
#else /* not DISABLE_ERS */
// These defines should be used to allow the code to keep working whenever
// the system is disabled
diff --git a/src/common/memmgr.c b/src/common/memmgr.c
index 97991ceaa..93c23ff18 100644
--- a/src/common/memmgr.c
+++ b/src/common/memmgr.c
@@ -45,7 +45,7 @@ struct malloc_interface *iMalloc;
# define REALLOC(p,n,file,line,func) mwRealloc((p),(n),(file),(line))
# define STRDUP(p,file,line,func) mwStrdup((p),(file),(line))
# define FREE(p,file,line,func) mwFree((p),(file),(line))
-# define MEMORY_USAGE() (size_t)0
+# define MEMORY_USAGE() ((size_t)0)
# define MEMORY_VERIFY(ptr) mwIsSafeAddr((ptr), 1)
# define MEMORY_CHECK() CHECK()
@@ -67,21 +67,21 @@ struct malloc_interface *iMalloc;
# include <gc.h>
# ifdef GC_ADD_CALLER
-# define RETURN_ADDR 0,
+# define MALLOC(n,file,line,func) GC_debug_malloc((n), 0, (file), (line))
+# define CALLOC(m,n,file,line,func) GC_debug_malloc((m)*(n), 0, (file), (line))
+# define REALLOC(p,n,file,line,func) GC_debug_realloc((p),(n), 0, (file), (line))
+# define STRDUP(p,file,line,func) GC_debug_strdup((p), 0, (file), (line))
# else
-# define RETURN_ADDR
+# define MALLOC(n,file,line,func) GC_debug_malloc((n), (file), (line))
+# define CALLOC(m,n,file,line,func) GC_debug_malloc((m)*(n), (file), (line))
+# define REALLOC(p,n,file,line,func) GC_debug_realloc((p),(n), (file), (line))
+# define STRDUP(p,file,line,func) GC_debug_strdup((p), (file), (line))
# endif
-# define MALLOC(n,file,line,func) GC_debug_malloc((n), RETURN_ADDR (file),(line))
-# define CALLOC(m,n,file,line,func) GC_debug_malloc((m)*(n), RETURN_ADDR (file),(line))
-# define REALLOC(p,n,file,line,func) GC_debug_realloc((p),(n), RETURN_ADDR (file),(line))
-# define STRDUP(p,file,line,func) GC_debug_strdup((p), RETURN_ADDR (file),(line))
# define FREE(p,file,line,func) GC_debug_free(p)
# define MEMORY_USAGE() GC_get_heap_size()
# define MEMORY_VERIFY(ptr) (GC_base(ptr) != NULL)
# define MEMORY_CHECK() GC_gcollect()
-# undef RETURN_ADDR
-
#else
# define MALLOC(n,file,line,func) malloc(n)
@@ -89,9 +89,9 @@ struct malloc_interface *iMalloc;
# define REALLOC(p,n,file,line,func) realloc((p),(n))
# define STRDUP(p,file,line,func) strdup(p)
# define FREE(p,file,line,func) free(p)
-# define MEMORY_USAGE() (size_t)0
+# define MEMORY_USAGE() ((size_t)0)
# define MEMORY_VERIFY(ptr) true
-# define MEMORY_CHECK()
+# define MEMORY_CHECK() (void)0
#endif
diff --git a/src/common/memmgr.h b/src/common/memmgr.h
index 4b06ae56e..5975f55c4 100644
--- a/src/common/memmgr.h
+++ b/src/common/memmgr.h
@@ -60,7 +60,7 @@
#ifdef __GNUC__ // GCC has variable length arrays
#define CREATE_BUFFER(name, type, size) type name[size]
-#define DELETE_BUFFER(name)
+#define DELETE_BUFFER(name) (void)0
#else // others don't, so we emulate them
diff --git a/src/common/showmsg.c b/src/common/showmsg.c
index e60b9f536..956222a7d 100644
--- a/src/common/showmsg.c
+++ b/src/common/showmsg.c
@@ -478,7 +478,7 @@ int FPRINTF(HANDLE handle, const char *fmt, ...) {
return ret;
}
-#define FFLUSH(handle)
+#define FFLUSH(handle) (void)(handle)
#define STDOUT GetStdHandle(STD_OUTPUT_HANDLE)
#define STDERR GetStdHandle(STD_ERROR_HANDLE)
diff --git a/src/common/sql.h b/src/common/sql.h
index 33643407d..e949a8280 100644
--- a/src/common/sql.h
+++ b/src/common/sql.h
@@ -272,13 +272,13 @@ void Sql_HerculesUpdateSkip(Sql* self,const char *filename);
HPShared struct sql_interface *SQL;
#if defined(SQL_REMOVE_SHOWDEBUG)
-#define Sql_ShowDebug(self) (void)0
+#define Sql_ShowDebug(self) (void)(self)
#else
#define Sql_ShowDebug(self) (SQL->ShowDebug_((self), __FILE__, __LINE__))
#endif
#if defined(SQL_REMOVE_SHOWDEBUG)
-#define SqlStmt_ShowDebug(self) (void)0
+#define SqlStmt_ShowDebug(self) (void)(self)
#else
/// Shows debug information (with statement).
#define SqlStmt_ShowDebug(self) (SQL->StmtShowDebug_((self), __FILE__, __LINE__))
diff --git a/src/common/sysinfo.c b/src/common/sysinfo.c
index dbedfa2db..7cc4cd16a 100644
--- a/src/common/sysinfo.c
+++ b/src/common/sysinfo.c
@@ -65,7 +65,7 @@ struct sysinfo_interface *sysinfo;
#define VCSTYPE_UNKNOWN 0
#define VCSTYPE_GIT 1
#define VCSTYPE_SVN 2
-#define VCSTYPE_NONE -1
+#define VCSTYPE_NONE (-1)
#ifdef WIN32
/**