1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-02-07 08:00:48 -08:00

Fixing further pedantic compilation issues on xci3gc.

Copied from Perforce
 Change: 179057
 ServerID: perforce.ravenbrook.com
This commit is contained in:
Richard Brooksby 2012-08-26 17:07:32 +01:00
parent 7fe52ea4bd
commit 71d487d995
5 changed files with 81 additions and 65 deletions

View file

@ -277,7 +277,6 @@
#define RememberedSummaryBLOCK 15
/* Events
*
* EventBufferSIZE is the number of words in the global event buffer.
@ -286,63 +285,6 @@
#define EventBufferSIZE ((size_t)4096)
#define EventStringLengthMAX ((size_t)255) /* Not including NUL */
/* EVENT_CLOCK -- fast event timestamp clock
*
* On platforms that support it, we want to stamp events with a very cheap
* and fast high-resolution timer.
*/
/* http://msdn.microsoft.com/en-US/library/twchhe95%28v=vs.100%29.aspx */
#if (defined(MPS_ARCH_I3) || defined(MPS_ARCH_I6)) && defined(MPS_BUILD_MV)
#pragma intrinsic(__rdtsc)
typedef unsigned __int64 EventClock;
#define EVENT_CLOCK(lvalue) \
BEGIN \
(lvalue) = __rdtsc(); \
END
/* http://clang.llvm.org/docs/LanguageExtensions.html#builtins */
#elif defined(MPS_BUILD_LL)
#if __has_builtin(__builtin_readcyclecounter)
typedef unsigned long long EventClock;
#define EVENT_CLOCK(lvalue) \
BEGIN \
(lvalue) = __builtin_readcyclecounter(); \
END
#endif /* __has_builtin(__builtin_readcyclecounter) */
#endif
/* Assemble the rdtsc instruction */
#if !defined(EVENT_CLOCK) && \
(defined(MPS_ARCH_I3) || defined(MPS_ARCH_I6)) && \
(defined(MPS_BUILD_GC) || defined(MPS_BUILD_LL))
/* Use __extension__ to enable use of a 64-bit type on 32-bit pedantic GCC */
__extension__ typedef unsigned long long EventClock;
#define EVENT_CLOCK(lvalue) \
BEGIN \
unsigned _l, _h; \
__asm__ __volatile__("rdtsc" : "=a"(_l), "=d"(_h)); \
(lvalue) = ((EventClock)_h << 32) | _l; \
END
#endif
/* no fast clock, use plinth, probably from the C library */
#ifndef EVENT_CLOCK
#define EVENT_CLOCK(lvalue) \
BEGIN \
(lvalue) = mps_clock(); \
END
#endif
/* Assert Buffer */

View file

@ -15,7 +15,6 @@
#ifndef event_h
#define event_h
#include "config.h" /* for EVENT_CLOCK */
#include "eventcom.h"
#include "mpm.h"
#include "eventdef.h"

View file

@ -556,7 +556,7 @@ static void readLog(EventProc proc)
printf("(t");
} break;
case 'C': {
printf("%llu", eventTime+1);
EVENT_CLOCK_PRINT(stdout, eventTime+1);
} break;
}
reportEventResults(totalEventCount);
@ -568,7 +568,9 @@ static void readLog(EventProc proc)
if (eventEnabled[c])
printf(" %04X %s\n", (unsigned)c, EventCode2Name(c));
if (bucketSize == 0)
printf("\nevent clock stopped at %llu\n", eventTime);
printf("\nevent clock stopped at ");
EVENT_CLOCK_PRINT(stdout, eventTime);
printf("\n");
}
}
}

View file

@ -10,11 +10,84 @@
#define eventcom_h
#include <limits.h>
#include "config.h" /* for EventClock */
#include "mpmtypes.h" /* for Word */
#include "eventdef.h"
/* EVENT_CLOCK -- fast event timestamp clock
*
* On platforms that support it, we want to stamp events with a very cheap
* and fast high-resolution timer.
*/
/* http://msdn.microsoft.com/en-US/library/twchhe95%28v=vs.100%29.aspx */
#if (defined(MPS_ARCH_I3) || defined(MPS_ARCH_I6)) && defined(MPS_BUILD_MV)
#pragma intrinsic(__rdtsc)
typedef unsigned __int64 EventClock;
#define EVENT_CLOCK(lvalue) \
BEGIN \
(lvalue) = __rdtsc(); \
END
#define EVENT_CLOCK_PRINT(stream, clock) fprintf(stream, "%llu", clock)
/* http://clang.llvm.org/docs/LanguageExtensions.html#builtins */
#elif defined(MPS_BUILD_LL)
#if __has_builtin(__builtin_readcyclecounter)
typedef unsigned long long EventClock;
#define EVENT_CLOCK(lvalue) \
BEGIN \
(lvalue) = __builtin_readcyclecounter(); \
END
#define EVENT_CLOCK_PRINT(stream, clock) fprintf(stream, "%llu", clock)
#endif /* __has_builtin(__builtin_readcyclecounter) */
#endif
/* Assemble the rdtsc instruction */
#if !defined(EVENT_CLOCK) && \
(defined(MPS_ARCH_I3) || defined(MPS_ARCH_I6)) && \
(defined(MPS_BUILD_GC) || defined(MPS_BUILD_LL))
/* Use __extension__ to enable use of a 64-bit type on 32-bit pedantic GCC */
__extension__ typedef unsigned long long EventClock;
#define EVENT_CLOCK(lvalue) \
BEGIN \
unsigned _l, _h; \
__asm__ __volatile__("rdtsc" : "=a"(_l), "=d"(_h)); \
(lvalue) = ((EventClock)_h << 32) | _l; \
END
#define EVENT_CLOCK_PRINT(stream, clock) \
fprintf(stream, "%lu", (unsigned long)clock) /* FIXME: Should be %llu */
#endif /* Intel, GCC or Clang */
/* no fast clock, use plinth, probably from the C library */
#ifndef EVENT_CLOCK
typedef Word EventClock;
#define EVENT_CLOCK(lvalue) \
BEGIN \
(lvalue) = mps_clock(); \
END
#define EVENT_CLOCK_PRINT(stream, clock) \
fprintf(stream, "%llu", (unsigned long long)clock)
#endif
/* Types for event fields */
typedef unsigned short EventCode;

View file

@ -109,7 +109,7 @@ for i in range(1,15):
the offsets of the fields within an event structure with the specified
format.
for i in range(0, 15):
for i in range(1, 15):
plist = ", ".join(["p%d" % i for i in range(0, i)])
print "#define EVENT%d_OFFSETS(%s) {%s}" % (
i, plist,
@ -117,7 +117,7 @@ for i in range(0, 15):
for j in range(0, i)])
)
*/
#define EVENT0_OFFSETS() {}
#define EVENT0_OFFSETS() {0}
#define EVENT1_OFFSETS(p0) {offsetof(EVENT1_STRUCT(p0), f0)}
#define EVENT2_OFFSETS(p0, p1) {offsetof(EVENT2_STRUCT(p0, p1), f0), offsetof(EVENT2_STRUCT(p0, p1), f1)}
#define EVENT3_OFFSETS(p0, p1, p2) {offsetof(EVENT3_STRUCT(p0, p1, p2), f0), offsetof(EVENT3_STRUCT(p0, p1, p2), f1), offsetof(EVENT3_STRUCT(p0, p1, p2), f2)}
@ -134,7 +134,7 @@ for i in range(0, 15):
#define EVENT14_OFFSETS(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13) {offsetof(EVENT14_STRUCT(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13), f0), offsetof(EVENT14_STRUCT(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13), f1), offsetof(EVENT14_STRUCT(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13), f2), offsetof(EVENT14_STRUCT(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13), f3), offsetof(EVENT14_STRUCT(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13), f4), offsetof(EVENT14_STRUCT(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13), f5), offsetof(EVENT14_STRUCT(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13), f6), offsetof(EVENT14_STRUCT(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13), f7), offsetof(EVENT14_STRUCT(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13), f8), offsetof(EVENT14_STRUCT(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13), f9), offsetof(EVENT14_STRUCT(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13), f10), offsetof(EVENT14_STRUCT(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13), f11), offsetof(EVENT14_STRUCT(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13), f12), offsetof(EVENT14_STRUCT(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13), f13)}
static eventRecord eventTypes[] = {
{"(unused)", 0, 0, 0, "", {}},
{"(unused)", 0, 0, 0, "", {0}},
#define EVENT_INIT(X, name, code, always, kind, count, format) \
{#name, \
code, \