summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2022-01-12 16:33:51 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2022-01-12 16:33:51 (GMT)
commit05dc6d00c28c40fef2b65cf96d5753927599c4d5 (patch)
treef98150182654efa599cff14bb53a7108babff6a9 /generic
parent5608e51a46c5ddb594d05a3d9cbeace701b5dcc6 (diff)
downloadtcl-05dc6d00c28c40fef2b65cf96d5753927599c4d5.zip
tcl-05dc6d00c28c40fef2b65cf96d5753927599c4d5.tar.gz
tcl-05dc6d00c28c40fef2b65cf96d5753927599c4d5.tar.bz2
Fix [da6f155ca4]: STRING_SIZE() macro: parenthesize numChars usage. Fix more macro's like this.
Diffstat (limited to 'generic')
-rw-r--r--generic/tclCkalloc.c2
-rw-r--r--generic/tclDate.c4
-rw-r--r--generic/tclExecute.c14
-rw-r--r--generic/tclGetDate.y4
-rw-r--r--generic/tclIORChan.c2
-rw-r--r--generic/tclIORTrans.c2
-rw-r--r--generic/tclInt.h2
-rw-r--r--generic/tclOOInt.h2
-rw-r--r--generic/tclStringRep.h2
-rw-r--r--generic/tclTrace.c4
10 files changed, 19 insertions, 19 deletions
diff --git a/generic/tclCkalloc.c b/generic/tclCkalloc.c
index 48832d9..8c83aeb 100644
--- a/generic/tclCkalloc.c
+++ b/generic/tclCkalloc.c
@@ -41,7 +41,7 @@ typedef struct MemTag {
* last field in the structure. */
} MemTag;
-#define TAG_SIZE(bytesInString) ((unsigned) ((TclOffset(MemTag, string) + 1) + bytesInString))
+#define TAG_SIZE(bytesInString) ((unsigned) ((TclOffset(MemTag, string) + 1) + (bytesInString)))
static MemTag *curTagPtr = NULL;/* Tag to use in all future mem_headers (set
* by "memory tag" command). */
diff --git a/generic/tclDate.c b/generic/tclDate.c
index aa199c3..23cf336 100644
--- a/generic/tclDate.c
+++ b/generic/tclDate.c
@@ -185,9 +185,9 @@ typedef struct DateInfo {
#define TM_YEAR_BASE 1900
-#define HOUR(x) ((int) (60 * x))
+#define HOUR(x) ((int) (60 * (x)))
#define SECSPERDAY (24L * 60L * 60L)
-#define IsLeapYear(x) ((x % 4 == 0) && (x % 100 != 0 || x % 400 == 0))
+#define IsLeapYear(x) (((x) % 4 == 0) && ((x) % 100 != 0 || (x) % 400 == 0))
/*
* An entry in the lexical lookup table.
diff --git a/generic/tclExecute.c b/generic/tclExecute.c
index 7e014d4..5dc506a 100644
--- a/generic/tclExecute.c
+++ b/generic/tclExecute.c
@@ -193,10 +193,10 @@ typedef struct TEBCdata {
#define PUSH_TAUX_OBJ(objPtr) \
do { \
if (auxObjList) { \
- objPtr->length += auxObjList->length; \
+ (objPtr)->length += auxObjList->length; \
} \
- objPtr->internalRep.twoPtrValue.ptr1 = auxObjList; \
- auxObjList = objPtr; \
+ (objPtr)->internalRep.twoPtrValue.ptr1 = auxObjList; \
+ auxObjList = (objPtr); \
} while (0)
#define POP_TAUX_OBJ() \
@@ -8462,24 +8462,24 @@ ExecuteExtendedBinaryMathOp(
{
#define LONG_RESULT(l) \
if (Tcl_IsShared(valuePtr)) { \
- TclNewLongObj(objResultPtr, l); \
+ TclNewLongObj(objResultPtr, (l)); \
return objResultPtr; \
} else { \
- Tcl_SetLongObj(valuePtr, l); \
+ Tcl_SetLongObj(valuePtr, (l)); \
return NULL; \
}
#define WIDE_RESULT(w) \
if (Tcl_IsShared(valuePtr)) { \
return Tcl_NewWideIntObj(w); \
} else { \
- Tcl_SetWideIntObj(valuePtr, w); \
+ Tcl_SetWideIntObj(valuePtr, (w)); \
return NULL; \
}
#define BIG_RESULT(b) \
if (Tcl_IsShared(valuePtr)) { \
return Tcl_NewBignumObj(b); \
} else { \
- Tcl_SetBignumObj(valuePtr, b); \
+ Tcl_SetBignumObj(valuePtr, (b)); \
return NULL; \
}
#define DOUBLE_RESULT(d) \
diff --git a/generic/tclGetDate.y b/generic/tclGetDate.y
index e6748a4..7e26b37 100644
--- a/generic/tclGetDate.y
+++ b/generic/tclGetDate.y
@@ -136,9 +136,9 @@ typedef struct DateInfo {
#define TM_YEAR_BASE 1900
-#define HOUR(x) ((int) (60 * x))
+#define HOUR(x) ((int) (60 * (x)))
#define SECSPERDAY (24L * 60L * 60L)
-#define IsLeapYear(x) ((x % 4 == 0) && (x % 100 != 0 || x % 400 == 0))
+#define IsLeapYear(x) (((x) % 4 == 0) && ((x) % 100 != 0 || (x) % 400 == 0))
/*
* An entry in the lexical lookup table.
diff --git a/generic/tclIORChan.c b/generic/tclIORChan.c
index c48c904..8e358e0 100644
--- a/generic/tclIORChan.c
+++ b/generic/tclIORChan.c
@@ -200,7 +200,7 @@ typedef enum {
#define IMPLIES(a,b) ((!(a)) || (b))
#define NEGIMPL(a,b)
-#define HAS(x,f) (x & FLAG(f))
+#define HAS(x,f) ((x) & FLAG(f))
#ifdef TCL_THREADS
/*
diff --git a/generic/tclIORTrans.c b/generic/tclIORTrans.c
index 039b594..e0c39ad 100644
--- a/generic/tclIORTrans.c
+++ b/generic/tclIORTrans.c
@@ -216,7 +216,7 @@ typedef enum {
#define IMPLIES(a,b) ((!(a)) || (b))
#define NEGIMPL(a,b)
-#define HAS(x,f) (x & FLAG(f))
+#define HAS(x,f) ((x) & FLAG(f))
#ifdef TCL_THREADS
/*
diff --git a/generic/tclInt.h b/generic/tclInt.h
index 491abe6..1954a13 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -4958,7 +4958,7 @@ typedef struct NRE_callback {
#define TCLNR_FREE(interp, ptr) TclSmallFreeEx((interp), (ptr))
#else
#define TCLNR_ALLOC(interp, ptr) \
- (ptr = ((ClientData) ckalloc(sizeof(NRE_callback))))
+ ((ptr) = ((void *)ckalloc(sizeof(NRE_callback))))
#define TCLNR_FREE(interp, ptr) ckfree((char *) (ptr))
#endif
diff --git a/generic/tclOOInt.h b/generic/tclOOInt.h
index 44316ac..f061bc6 100644
--- a/generic/tclOOInt.h
+++ b/generic/tclOOInt.h
@@ -561,7 +561,7 @@ MODULE_SCOPE void TclOOSetupVariableResolver(Tcl_Namespace *nsPtr);
#define FOREACH(var,ary) \
for(i=0 ; i<(ary).num; i++) if ((ary).list[i] == NULL) { \
continue; \
- } else if (var = (ary).list[i], 1)
+ } else if ((var) = (ary).list[i], 1)
/*
* Convenience macros for iterating through hash tables. FOREACH_HASH_DECLS
diff --git a/generic/tclStringRep.h b/generic/tclStringRep.h
index 25b854e..59e9499 100644
--- a/generic/tclStringRep.h
+++ b/generic/tclStringRep.h
@@ -67,7 +67,7 @@ typedef struct String {
#define STRING_MAXCHARS \
(int)(((size_t)UINT_MAX - 1 - TclOffset(String, unicode))/sizeof(Tcl_UniChar))
#define STRING_SIZE(numChars) \
- (TclOffset(String, unicode) + ((numChars + 1) * sizeof(Tcl_UniChar)))
+ (TclOffset(String, unicode) + (((numChars) + 1) * sizeof(Tcl_UniChar)))
#define stringCheckLimits(numChars) \
do { \
if ((numChars) < 0 || (numChars) > STRING_MAXCHARS) { \
diff --git a/generic/tclTrace.c b/generic/tclTrace.c
index c82fc14..5ce4b95 100644
--- a/generic/tclTrace.c
+++ b/generic/tclTrace.c
@@ -160,8 +160,8 @@ typedef struct StringTraceData {
#define FOREACH_COMMAND_TRACE(interp, name, clientData) \
(clientData) = NULL; \
- while ((clientData = Tcl_CommandTraceInfo(interp, name, 0, \
- TraceCommandProc, clientData)) != NULL)
+ while (((clientData) = Tcl_CommandTraceInfo((interp), (name), 0, \
+ TraceCommandProc, (clientData))) != NULL)
/*
*----------------------------------------------------------------------