comparison packages/kernel/current/include/kapidata.h @ 771:710133d0d4c0

* include/kapidata.h: Revert change of 2001-08-23 and instead make it conditional on the GCC version. Also add comments explaining why this file has been apparently obfuscated.
author jlarmour
date Thu, 27 Feb 2003 06:14:31 +0000
parents c0d53837cb68
children
comparison
equal deleted inserted replaced
770:01bcbf116083 771:710133d0d4c0
53 // configuration and must be kept in step with their real 53 // configuration and must be kept in step with their real
54 // counterparts in the C++ headers. 54 // counterparts in the C++ headers.
55 // IMPORTANT: It is NOT guaranteed that the fields of these 55 // IMPORTANT: It is NOT guaranteed that the fields of these
56 // structures correspond to the equivalent fields in the 56 // structures correspond to the equivalent fields in the
57 // C++ classes they shadow. 57 // C++ classes they shadow.
58 //
59 // One oddity with this file is that the way many of the "mirror"
60 // classes are defined with macros. The resulting structures
61 // then have a "flat" layout, rather than just declaring a
62 // member structure directly in the structure. The reason for
63 // this is that as of GCC 3.x, the C++ compiler will optimise
64 // classes by removing padding and reusing it for subsequent
65 // members defined in a derived class. This affects some targets
66 // (including PowerPC and MIPS at least) when a C++ base class
67 // includes a long long. By instead arranging for the C structure
68 // to just list all the members directly, the compiler will then
69 // behave the same for the C structures as the C++ classes.
70 //
71 // This means that care has to be taken to follow the same
72 // methodology if new stuff is added to this file. Even if
73 // it doesn't contain long longs for your target, it may for
74 // others, depending on HAL definitions.
75 //
58 // Usage: included by kapi.h 76 // Usage: included by kapi.h
59 // 77 //
60 //####DESCRIPTIONEND#### 78 //####DESCRIPTIONEND####
61 // 79 //
62 //==========================================================================*/ 80 //==========================================================================*/
337 typedef struct 355 typedef struct
338 { 356 {
339 CYG_SCHEDTHREAD_MEMBERS 357 CYG_SCHEDTHREAD_MEMBERS
340 } cyg_schedthread; 358 } cyg_schedthread;
341 359
360 /* This compiler version test is required because the C++ ABI changed in
361 GCC v3.x and GCC could now reuse "spare" space from base classes in derived
362 classes, and in C++ land, cyg_alarm is a base class of cyg_threadtimer.
363 */
364 #if defined(__GNUC__) && (__GNUC__ < 3)
342 #define CYG_THREADTIMER_MEMBERS \ 365 #define CYG_THREADTIMER_MEMBERS \
343 cyg_alarm alarm; \ 366 cyg_alarm alarm; \
344 cyg_thread *thread; 367 cyg_thread *thread;
368 #else
369 #define CYG_THREADTIMER_MEMBERS \
370 CYG_ALARM_MEMBERS \
371 cyg_thread *thread;
372 #endif
345 373
346 /*---------------------------------------------------------------------------*/ 374 /*---------------------------------------------------------------------------*/
347 /* Thread structure */ 375 /* Thread structure */
348 376
349 typedef struct 377 typedef struct