2007-07-30 Ralf Corsépius <ralf.corsepius@rtems.org>

* shttpd/log.c: Add preliminary version of SPLIT_SNPRINTF to
	  work-around bug m68k/coldfire -fomit-frame-pointer bug
	  http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32307.
This commit is contained in:
Ralf Corsepius
2007-07-30 07:54:14 +00:00
parent f6cd0dbead
commit f29163ab49
2 changed files with 36 additions and 0 deletions

View File

@@ -1,3 +1,9 @@
2007-07-30 Ralf Corsépius <ralf.corsepius@rtems.org>
* shttpd/log.c: Add preliminary version of SPLIT_SNPRINTF to
work-around bug m68k/coldfire -fomit-frame-pointer bug
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32307.
2007-07-27 Chris Johns <chrisj@rtems.org>
* wrapup/Makefile.am: Create archive from a file for hosts

View File

@@ -61,6 +61,22 @@ elog(int flags, struct conn *c, const char *fmt, ...)
exit(EXIT_FAILURE);
}
/* HACK: m68k-gcc <= 4.2.1 ICEs on the snprintf below for some
* coldfire variants for yet unknown reasons.
*/
#if defined(__GNUC__) && \
( (__GNUC__ < 4 ) || \
( (__GNUC__ == 4 ) && (__GNUC_MINOR__ < 2 ) ) || \
( (__GNUC__ == 4 ) && (__GNUC_MINOR__ == 2 ) && (__GNUC_PATCHLEVEL__ <= 1 ) ) )
#if defined(__mcf528x__)
//# define SPLIT_SNPRINTF 1
#endif /* __mcf528x__ */
#if defined(__mcf5200__)
#endif /* __mcf5200__ */
#if defined(__mcoldfire__)
#endif /* __mcoldfire__ */
#endif /* __GNUC__ */
void
log_access(FILE *fp, const struct conn *c)
{
@@ -87,6 +103,19 @@ log_access(FILE *fp, const struct conn *c)
(void) strftime(date, sizeof(date), "%d/%b/%Y:%H:%M:%S",
localtime(&current_time));
#if SPLIT_SNPRINTF
{
int num;
num = my_snprintf(buf, sizeof(buf),
"%s - %.*s [%s %+05d] \"%s\" %d %lu",
inet_ntoa(c->sa.u.sin.sin_addr), user->len, user->ptr,
date, tz_offset, c->request ? c->request : "-",
c->status, c->loc.io.total );
my_snprintf(&buf[num], sizeof(buf)-num, " %s%.*s%s" " %s%.*s%s",
q1, referer->len, referer->ptr, q1,
q2, user_agent->len, user_agent->ptr, q2);
}
#else
(void) my_snprintf(buf, sizeof(buf),
"%s - %.*s [%s %+05d] \"%s\" %d %lu %s%.*s%s %s%.*s%s",
inet_ntoa(c->sa.u.sin.sin_addr), user->len, user->ptr,
@@ -94,6 +123,7 @@ log_access(FILE *fp, const struct conn *c)
c->status, (unsigned long) c->loc.io.total,
q1, referer->len, referer->ptr, q1,
q2, user_agent->len, user_agent->ptr, q2);
#endif
if (fp != NULL) {
(void) fprintf(fp, "%s\n", buf);