diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2024-03-15 16:16:39 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2024-03-15 16:16:39 (GMT) |
commit | 2a9e281535fc3fa44638d1c2b049316a55d48b87 (patch) | |
tree | 416cf2a4c5a234234c3cd9461c4930ae5ce9c5fc /generic/tclDate.c | |
parent | f81c7c620816c8a89bc363903c29f338bf7d6162 (diff) | |
download | tcl-2a9e281535fc3fa44638d1c2b049316a55d48b87.zip tcl-2a9e281535fc3fa44638d1c2b049316a55d48b87.tar.gz tcl-2a9e281535fc3fa44638d1c2b049316a55d48b87.tar.bz2 |
Better solution for tclDate.c (since Number is not an int)
Diffstat (limited to 'generic/tclDate.c')
-rw-r--r-- | generic/tclDate.c | 17 |
1 files changed, 4 insertions, 13 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( |