libs/libc/time/lib_gmtimer.c: Spurious reorganization of a loop to work around and ZDD-II internal compiler error. Might be a little bigger now, but is also probably a more structured use of C.

This commit is contained in:
Gregory Nutt 2019-06-10 09:49:11 -06:00
parent 750e45ad6e
commit 417e681cbb
4 changed files with 32 additions and 135 deletions

View File

@ -62,39 +62,10 @@ Version 5.2.1
Version 5.3.0
I started verification using 5.30 on June 2, 2019. To use this toolchain,
I had to suppress the gmtime() and gmtimer() because these were causing an
internal compiler error:
time\lib_gmtimer.c
P2: Internal Error(0xB47E59):
Please contact Technical Support
This is the change to suppress building these files:
diff --git a/libs/libc/time/Make.defs b/libs/libc/time/Make.defs
index 5c9b746778..8327e287f4 100644
--- a/libs/libc/time/Make.defs
+++ b/libs/libc/time/Make.defs
@@ -44,7 +44,7 @@ ifdef CONFIG_LIBC_LOCALTIME
CSRCS += lib_localtime.c lib_asctime.c lib_asctimer.c lib_ctime.c
CSRCS += lib_ctimer.c
else
-CSRCS += lib_mktime.c lib_gmtime.c lib_gmtimer.c
+CSRCS += lib_mktime.c # lib_gmtime.c lib_gmtimer.c
ifdef CONFIG_TIME_EXTENDED
CSRCS += lib_dayofweek.c lib_asctime.c lib_asctimer.c lib_ctime.c
CSRCS += lib_ctimer.c
The consequence is, of course, that these interfaces will not be available
to applications.
Alternatively, you can use 'make -i' to build the system. The above
errors will occur, but will not stop the build (unless the failed build
objects are brought into the link). The has the negative side effects
that (1) the archives will always be rebuild in the directories where
the error occur, and (2) you might miss other, real compilation error
since these will no longer stop the compilation.
I verifed compilation using 5.30 on June 2, 2019. To use this version,
I had to make spurious modification to the implementation of gmtimer() to
work around an internal compiler error. I have still not verified that
are no errors in the compiled code.
Other Versions
If you use any version of ZDS-II other than 5.1.1, 5.2.1, or 5.3.0 or

View File

@ -62,47 +62,10 @@ Version 5.2.1
Version 5.3.0
I started verification using 5.30 on June 2, 2019. To use this toolchain,
I had to suppress the gmtime() and gmtimer() because these were causing an
internal compiler error:
time\lib_gmtimer.c
P2: Internal Error(0xB47E59):
Please contact Technical Support
This is the change to suppress building these files:
diff --git a/libs/libc/time/Make.defs b/libs/libc/time/Make.defs
index 5c9b746778..8327e287f4 100644
--- a/libs/libc/time/Make.defs
+++ b/libs/libc/time/Make.defs
@@ -44,7 +44,7 @@ ifdef CONFIG_LIBC_LOCALTIME
CSRCS += lib_localtime.c lib_asctime.c lib_asctimer.c lib_ctime.c
CSRCS += lib_ctimer.c
else
-CSRCS += lib_mktime.c lib_gmtime.c lib_gmtimer.c
+CSRCS += lib_mktime.c # lib_gmtime.c lib_gmtimer.c
ifdef CONFIG_TIME_EXTENDED
CSRCS += lib_dayofweek.c lib_asctime.c lib_asctimer.c lib_ctime.c
CSRCS += lib_ctimer.c
And this:
stdlib\lib_strtof.c
stdlib\lib_strtof.c (76,36) : WARNING (32) Division by zero encountered
stdlib\lib_strtof.c (102,36) : WARNING (32) Division by zero encountered
Which can be worked around by removing it from the build
The consequence is, of course, that these interfaces will not be available
to applications.
Alternatively, you can use 'make -i' to build the system. The above
errors will occur, but will not stop the build (unless the failed build
objects are brought into the link). The has the negative side effects
that (1) the archives will always be rebuild in the directories where
the error occur, and (2) you might miss other, real compilation error
since these will no longer stop the compilation.
I verifed compilation using 5.30 on June 2, 2019. To use this version,
I had to make spurious modification to the implementation of gmtimer() to
work around an internal compiler error. I have still not verified that
are no errors in the compiled code.
Other Versions
If you use any version of ZDS-II other than 5.1.1, 5.2.1, or 5.3.0 or

View File

@ -37,47 +37,10 @@ ZDS-II Compiler Versions
Version 5.3.0
The initial bring-up of the MakerLisp board used the ZiLOG ZDS-II 5.3.0
toolchain. To use this toolchain, I had to suppress the gmtime() and
gmtimer() because these were causing an internal compiler error:
time\lib_gmtimer.c
P2: Internal Error(0xB47E59):
Please contact Technical Support
This is the change to suppress building these files:
diff --git a/libs/libc/time/Make.defs b/libs/libc/time/Make.defs
index 5c9b746778..8327e287f4 100644
--- a/libs/libc/time/Make.defs
+++ b/libs/libc/time/Make.defs
@@ -44,7 +44,7 @@ ifdef CONFIG_LIBC_LOCALTIME
CSRCS += lib_localtime.c lib_asctime.c lib_asctimer.c lib_ctime.c
CSRCS += lib_ctimer.c
else
-CSRCS += lib_mktime.c lib_gmtime.c lib_gmtimer.c
+CSRCS += lib_mktime.c # lib_gmtime.c lib_gmtimer.c
ifdef CONFIG_TIME_EXTENDED
CSRCS += lib_dayofweek.c lib_asctime.c lib_asctimer.c lib_ctime.c
CSRCS += lib_ctimer.c
And there is also this:
stdlib\lib_strtof.c
stdlib\lib_strtof.c (76,36) : WARNING (32) Division by zero encountered
stdlib\lib_strtof.c (102,36) : WARNING (32) Division by zero encountered
Which can be worked around by removing it from the build
The consequence is, of course, that these interfaces will not be available
to applications.
Alternatively, you can use 'make -i' to build the system. The above
errors will occur, but will not stop the build (unless the failed build
objects are brought into the link). The has the negative side effects
that (1) the archives will always be rebuild in the directories where
the error occur, and (2) you might miss other, real compilation error
since these will no longer stop the compilation.
I verifed compilation using 5.30 on June 2, 2019. To use this version,
I had to make spurious modification to the implementation of gmtimer() to
work around an internal compiler error. I have still not verified that
are no errors in the compiled code.
Other Versions
If you use any version of ZDS-II other than 5.3.0 or if you install ZDS-II

View File

@ -188,33 +188,33 @@ static void clock_utc2calendar(time_t days, FAR int *year, FAR int *month,
days -= value * (4 * 365 + 1); /* Remaining days */
value <<= 2; /* Years since the epoch */
/* Then we will brute force the next 0-3 years */
/* Then we will brute force the next 0-3 years
*
* Is this year a leap year? (we'll need this later too)
*/
for (; ; )
leapyear = clock_isleapyear(value + 1970);
/* Get the number of days in the year */
tmp = (leapyear ? 366 : 365);
/* Do we have that many days left to account for? */
while (days >= tmp)
{
/* Is this year a leap year (we'll need this later too) */
/* Yes.. bump up the year and subtract the number of days in the year */
value++;
days -= tmp;
/* Is the next year a leap year? */
leapyear = clock_isleapyear(value + 1970);
/* Get the number of days in the year */
/* Get the number of days in the next year */
tmp = (leapyear ? 366 : 365);
/* Do we have that many days? */
if (days >= tmp)
{
/* Yes.. bump up the year */
value++;
days -= tmp;
}
else
{
/* Nope... then go handle months */
break;
}
}
/* At this point, value has the year and days has number days into this