summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--generic/tclDate.c17
-rw-r--r--generic/tclGetDate.y17
2 files changed, 8 insertions, 26 deletions
diff --git a/generic/tclDate.c b/generic/tclDate.c
index 10f2151..e714161 100644
--- a/generic/tclDate.c
+++ b/generic/tclDate.c
@@ -139,7 +139,7 @@
typedef struct _TABLE {
const char *name;
int type;
- Tcl_WideInt value;
+ long long value;
} TABLE;
/*
@@ -221,7 +221,7 @@ extern int TclDatedebug;
union YYSTYPE
{
- Tcl_WideInt Number;
+ long long Number;
enum _MERIDIAN Meridian;
@@ -2499,11 +2499,6 @@ LookupWord(
return tID;
}
-/* int overflows may happens here (expected case) */
-#if defined(__GNUC__) || defined(__GNUG__)
-# pragma GCC optimize("no-trapv")
-#endif
-
static int
TclDatelex(
YYSTYPE* yylvalPtr,
@@ -2534,7 +2529,7 @@ TclDatelex(
/*
* Convert the string into a number; count the number of digits.
*/
- int num = c - '0';
+ long long num = c - '0';
p = (char *)yyInput;
while (isdigit(UCHAR(c = *(++p)))) {
if (num >= 0) {
@@ -2566,7 +2561,7 @@ TclDatelex(
location->last_column = yyInput - info->dateStart - 1;
return tISOBASL;
}
- if (num < 0) { /* overflow */
+ if (yyDigitCount > 14) { /* overflow */
return tID;
}
if (yyDigitCount == 8) {
@@ -2641,10 +2636,6 @@ TclDatelex(
} while (Count > 0);
}
}
-
-#if defined(__GNUC__) || defined(__GNUG__)
-# pragma GCC reset_options
-#endif
int
TclClockFreeScan(
diff --git a/generic/tclGetDate.y b/generic/tclGetDate.y
index b0a8f85..92e1b26 100644
--- a/generic/tclGetDate.y
+++ b/generic/tclGetDate.y
@@ -89,7 +89,7 @@
typedef struct _TABLE {
const char *name;
int type;
- Tcl_WideInt value;
+ long long value;
} TABLE;
/*
@@ -103,7 +103,7 @@ typedef enum _DSTMODE {
%}
%union {
- Tcl_WideInt Number;
+ long long Number;
enum _MERIDIAN Meridian;
}
@@ -875,11 +875,6 @@ LookupWord(
return tID;
}
-/* int overflows may happens here (expected case) */
-#if defined(__GNUC__) || defined(__GNUG__)
-# pragma GCC optimize("no-trapv")
-#endif
-
static int
TclDatelex(
YYSTYPE* yylvalPtr,
@@ -910,7 +905,7 @@ TclDatelex(
/*
* Convert the string into a number; count the number of digits.
*/
- int num = c - '0';
+ long long num = c - '0';
p = (char *)yyInput;
while (isdigit(UCHAR(c = *(++p)))) {
if (num >= 0) {
@@ -942,7 +937,7 @@ TclDatelex(
location->last_column = yyInput - info->dateStart - 1;
return tISOBASL;
}
- if (num < 0) { /* overflow */
+ if (yyDigitCount > 14) { /* overflow */
return tID;
}
if (yyDigitCount == 8) {
@@ -1017,10 +1012,6 @@ TclDatelex(
} while (Count > 0);
}
}
-
-#if defined(__GNUC__) || defined(__GNUG__)
-# pragma GCC reset_options
-#endif
int
TclClockFreeScan(