port-structs.c
上传用户:shenzhenrh
上传日期:2013-05-12
资源大小:2904k
文件大小:10k
源码类别:

信息检索与抽取

开发平台:

Unix_Linux

  1. /* To know more about structure passing conventions,
  2.  * compile this to assembly code: $(CC) -O -S port-structs.c
  3.  */
  4. typedef struct { char x1; } C1;
  5. typedef struct { char x1,x2; } C2;
  6. typedef struct { char x1,x2,x3; } C3;
  7. typedef struct { char x1,x2,x3,x4; } C4;
  8. typedef struct { char x1,x2,x3,x4,x5; } C5;
  9. typedef struct { char x1,x2,x3,x4,x5,x6; } C6;
  10. typedef struct { char x1,x2,x3,x4,x5,x6,x7; } C7;
  11. typedef struct { char x1,x2,x3,x4,x5,x6,x7,x8; } C8;
  12. typedef struct { char x1,x2,x3,x4,x5,x6,x7,x8,x9; } C9;
  13. typedef struct { char x1,x2,x3,x4,x5,x6,x7,x8,x9,x10; } C10;
  14. typedef struct { char x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11; } C11;
  15. typedef struct { char x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12; } C12;
  16. typedef struct { char x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13; } C13;
  17. typedef struct { char x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14; } C14;
  18. typedef struct { char x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15; } C15;
  19. typedef struct { char x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16; } C16;
  20. typedef struct { char x[1]; } CA1;
  21. typedef struct { char x[2]; } CA2;
  22. typedef struct { char x[3]; } CA3;
  23. typedef struct { char x[4]; } CA4;
  24. typedef struct { char x[5]; } CA5;
  25. typedef struct { char x[6]; } CA6;
  26. typedef struct { char x[7]; } CA7;
  27. typedef struct { char x[8]; } CA8;
  28. typedef struct { char x[9]; } CA9;
  29. typedef struct { char x[10]; } CA10;
  30. typedef struct { char x[11]; } CA11;
  31. typedef struct { char x[12]; } CA12;
  32. typedef struct { char x[13]; } CA13;
  33. typedef struct { char x[14]; } CA14;
  34. typedef struct { char x[15]; } CA15;
  35. typedef struct { char x[16]; } CA16;
  36. typedef struct { short x1; } S1;
  37. typedef struct { short x1,x2; } S2;
  38. typedef struct { short x1,x2,x3; } S3;
  39. typedef struct { short x1,x2,x3,x4; } S4;
  40. typedef struct { short x1,x2,x3,x4,x5; } S5;
  41. typedef struct { short x1,x2,x3,x4,x5,x6; } S6;
  42. typedef struct { short x1,x2,x3,x4,x5,x6,x7; } S7;
  43. typedef struct { short x1,x2,x3,x4,x5,x6,x7,x8; } S8;
  44. typedef struct { short x[1]; } SA1;
  45. typedef struct { short x[2]; } SA2;
  46. typedef struct { short x[3]; } SA3;
  47. typedef struct { short x[4]; } SA4;
  48. typedef struct { short x[5]; } SA5;
  49. typedef struct { short x[6]; } SA6;
  50. typedef struct { short x[7]; } SA7;
  51. typedef struct { short x[8]; } SA8;
  52. typedef struct { int x1; } I1;
  53. typedef struct { int x1,x2; } I2;
  54. typedef struct { int x1,x2,x3; } I3;
  55. typedef struct { int x1,x2,x3,x4; } I4;
  56. typedef struct { int x1,x2,x3,x4,x5; } I5;
  57. typedef struct { int x1,x2,x3,x4,x5,x6; } I6;
  58. typedef struct { int x1,x2,x3,x4,x5,x6,x7; } I7;
  59. typedef struct { int x1,x2,x3,x4,x5,x6,x7,x8; } I8;
  60. typedef struct { int x[1]; } IA1;
  61. typedef struct { int x[2]; } IA2;
  62. typedef struct { int x[3]; } IA3;
  63. typedef struct { int x[4]; } IA4;
  64. typedef struct { int x[5]; } IA5;
  65. typedef struct { int x[6]; } IA6;
  66. typedef struct { int x[7]; } IA7;
  67. typedef struct { int x[8]; } IA8;
  68. typedef struct { long x1; } L1;
  69. typedef struct { long x1,x2; } L2;
  70. typedef struct { long x1,x2,x3; } L3;
  71. typedef struct { long x1,x2,x3,x4; } L4;
  72. typedef struct { long x1,x2,x3,x4,x5; } L5;
  73. typedef struct { long x1,x2,x3,x4,x5,x6; } L6;
  74. typedef struct { long x1,x2,x3,x4,x5,x6,x7; } L7;
  75. typedef struct { long x1,x2,x3,x4,x5,x6,x7,x8; } L8;
  76. typedef struct { long x1,x2,x3,x4,x5,x6,x7,x8,x9; } L9;
  77. typedef struct { long x[1]; } LA1;
  78. typedef struct { long x[2]; } LA2;
  79. typedef struct { long x[3]; } LA3;
  80. typedef struct { long x[4]; } LA4;
  81. typedef struct { long x[5]; } LA5;
  82. typedef struct { long x[6]; } LA6;
  83. typedef struct { long x[7]; } LA7;
  84. typedef struct { long x[8]; } LA8;
  85. typedef struct { long x[9]; } LA9;
  86. typedef struct { float x1; } F1;
  87. typedef struct { float x1,x2; } F2;
  88. typedef struct { float x1,x2,x3; } F3;
  89. typedef struct { float x1,x2,x3,x4; } F4;
  90. typedef struct { float x[1]; } FA1;
  91. typedef struct { float x[2]; } FA2;
  92. typedef struct { float x[3]; } FA3;
  93. typedef struct { float x[4]; } FA4;
  94. typedef struct { double x1; } D1;
  95. typedef struct { double x1,x2; } D2;
  96. typedef struct { double x[1]; } DA1;
  97. typedef struct { double x[2]; } DA2;
  98. typedef struct { char c; float f; } CF;
  99. typedef struct { float f; int i; } FI;
  100. typedef struct { float f; int i,j; } FI2;
  101. typedef struct { float f; int i,j,k; } FI3;
  102. typedef struct { double d; int i; } DI;
  103. typedef struct { double d; int i,j; } DI2;
  104. typedef struct { double d; int i,j,k; } DI3;
  105. typedef struct { float f; double d; } FD;
  106. typedef struct { float f,g; double d; } F2D;
  107. typedef struct { double d; float f; } DF;
  108. typedef struct { double d; float f,g; } DF2;
  109. #if defined(__STDC__) || defined(__cplusplus)
  110. #define TEST_STRUCT_ARG(_type_)  
  111.   extern _type_ extern_##_type_;
  112.   void set_##_type_ (_type_ arg) { extern_##_type_ = arg; }
  113. #define TEST_STRUCT_RETURN(_type_)  
  114.   extern _type_ extern_##_type_;
  115.   _type_ get_##_type_ () { return extern_##_type_; }
  116. #else
  117. #define TEST_STRUCT_ARG(_type_)  
  118.   extern _type_ extern_/**/_type_;
  119.   void set_/**/_type_ (arg) _type_ arg; { extern_/**/_type_ = arg; }
  120. #define TEST_STRUCT_RETURN(_type_)  
  121.   extern _type_ extern_/**/_type_;
  122.   _type_ get_/**/_type_ () { return extern_/**/_type_; }
  123. #endif
  124. TEST_STRUCT_ARG(C1)
  125. TEST_STRUCT_ARG(C2)
  126. TEST_STRUCT_ARG(C3)
  127. TEST_STRUCT_ARG(C4)
  128. TEST_STRUCT_ARG(C5)
  129. TEST_STRUCT_ARG(C6)
  130. TEST_STRUCT_ARG(C7)
  131. TEST_STRUCT_ARG(C8)
  132. TEST_STRUCT_ARG(C9)
  133. TEST_STRUCT_ARG(C10)
  134. TEST_STRUCT_ARG(C11)
  135. TEST_STRUCT_ARG(C12)
  136. TEST_STRUCT_ARG(C13)
  137. TEST_STRUCT_ARG(C14)
  138. TEST_STRUCT_ARG(C15)
  139. TEST_STRUCT_ARG(C16)
  140. TEST_STRUCT_ARG(CA1)
  141. TEST_STRUCT_ARG(CA2)
  142. TEST_STRUCT_ARG(CA3)
  143. TEST_STRUCT_ARG(CA4)
  144. TEST_STRUCT_ARG(CA5)
  145. TEST_STRUCT_ARG(CA6)
  146. TEST_STRUCT_ARG(CA7)
  147. TEST_STRUCT_ARG(CA8)
  148. TEST_STRUCT_ARG(CA9)
  149. TEST_STRUCT_ARG(CA10)
  150. TEST_STRUCT_ARG(CA11)
  151. TEST_STRUCT_ARG(CA12)
  152. TEST_STRUCT_ARG(CA13)
  153. TEST_STRUCT_ARG(CA14)
  154. TEST_STRUCT_ARG(CA15)
  155. TEST_STRUCT_ARG(CA16)
  156. TEST_STRUCT_ARG(S1)
  157. TEST_STRUCT_ARG(S2)
  158. TEST_STRUCT_ARG(S3)
  159. TEST_STRUCT_ARG(S4)
  160. TEST_STRUCT_ARG(S5)
  161. TEST_STRUCT_ARG(S6)
  162. TEST_STRUCT_ARG(S7)
  163. TEST_STRUCT_ARG(S8)
  164. TEST_STRUCT_ARG(SA1)
  165. TEST_STRUCT_ARG(SA2)
  166. TEST_STRUCT_ARG(SA3)
  167. TEST_STRUCT_ARG(SA4)
  168. TEST_STRUCT_ARG(SA5)
  169. TEST_STRUCT_ARG(SA6)
  170. TEST_STRUCT_ARG(SA7)
  171. TEST_STRUCT_ARG(SA8)
  172. TEST_STRUCT_ARG(I1)
  173. TEST_STRUCT_ARG(I2)
  174. TEST_STRUCT_ARG(I3)
  175. TEST_STRUCT_ARG(I4)
  176. TEST_STRUCT_ARG(I5)
  177. TEST_STRUCT_ARG(I6)
  178. TEST_STRUCT_ARG(I7)
  179. TEST_STRUCT_ARG(I8)
  180. TEST_STRUCT_ARG(IA1)
  181. TEST_STRUCT_ARG(IA2)
  182. TEST_STRUCT_ARG(IA3)
  183. TEST_STRUCT_ARG(IA4)
  184. TEST_STRUCT_ARG(IA5)
  185. TEST_STRUCT_ARG(IA6)
  186. TEST_STRUCT_ARG(IA7)
  187. TEST_STRUCT_ARG(IA8)
  188. TEST_STRUCT_ARG(L1)
  189. TEST_STRUCT_ARG(L2)
  190. TEST_STRUCT_ARG(L3)
  191. TEST_STRUCT_ARG(L4)
  192. TEST_STRUCT_ARG(L5)
  193. TEST_STRUCT_ARG(L6)
  194. TEST_STRUCT_ARG(L7)
  195. TEST_STRUCT_ARG(L8)
  196. TEST_STRUCT_ARG(L9)
  197. TEST_STRUCT_ARG(LA1)
  198. TEST_STRUCT_ARG(LA2)
  199. TEST_STRUCT_ARG(LA3)
  200. TEST_STRUCT_ARG(LA4)
  201. TEST_STRUCT_ARG(LA5)
  202. TEST_STRUCT_ARG(LA6)
  203. TEST_STRUCT_ARG(LA7)
  204. TEST_STRUCT_ARG(LA8)
  205. TEST_STRUCT_ARG(LA9)
  206. TEST_STRUCT_ARG(F1)
  207. TEST_STRUCT_ARG(F2)
  208. TEST_STRUCT_ARG(F3)
  209. TEST_STRUCT_ARG(F4)
  210. TEST_STRUCT_ARG(FA1)
  211. TEST_STRUCT_ARG(FA2)
  212. TEST_STRUCT_ARG(FA3)
  213. TEST_STRUCT_ARG(FA4)
  214. TEST_STRUCT_ARG(D1)
  215. TEST_STRUCT_ARG(D2)
  216. TEST_STRUCT_ARG(DA1)
  217. TEST_STRUCT_ARG(DA2)
  218. TEST_STRUCT_ARG(CF)
  219. TEST_STRUCT_ARG(FI)
  220. TEST_STRUCT_ARG(FI2)
  221. TEST_STRUCT_ARG(FI3)
  222. TEST_STRUCT_ARG(DI)
  223. TEST_STRUCT_ARG(DI2)
  224. TEST_STRUCT_ARG(DI3)
  225. TEST_STRUCT_ARG(FD)
  226. TEST_STRUCT_ARG(F2D)
  227. TEST_STRUCT_ARG(DF)
  228. TEST_STRUCT_ARG(DF2)
  229. TEST_STRUCT_RETURN(C1)
  230. TEST_STRUCT_RETURN(C2)
  231. TEST_STRUCT_RETURN(C3)
  232. TEST_STRUCT_RETURN(C4)
  233. TEST_STRUCT_RETURN(C5)
  234. TEST_STRUCT_RETURN(C6)
  235. TEST_STRUCT_RETURN(C7)
  236. TEST_STRUCT_RETURN(C8)
  237. TEST_STRUCT_RETURN(C9)
  238. TEST_STRUCT_RETURN(C10)
  239. TEST_STRUCT_RETURN(C11)
  240. TEST_STRUCT_RETURN(C12)
  241. TEST_STRUCT_RETURN(C13)
  242. TEST_STRUCT_RETURN(C14)
  243. TEST_STRUCT_RETURN(C15)
  244. TEST_STRUCT_RETURN(C16)
  245. TEST_STRUCT_RETURN(CA1)
  246. TEST_STRUCT_RETURN(CA2)
  247. TEST_STRUCT_RETURN(CA3)
  248. TEST_STRUCT_RETURN(CA4)
  249. TEST_STRUCT_RETURN(CA5)
  250. TEST_STRUCT_RETURN(CA6)
  251. TEST_STRUCT_RETURN(CA7)
  252. TEST_STRUCT_RETURN(CA8)
  253. TEST_STRUCT_RETURN(CA9)
  254. TEST_STRUCT_RETURN(CA10)
  255. TEST_STRUCT_RETURN(CA11)
  256. TEST_STRUCT_RETURN(CA12)
  257. TEST_STRUCT_RETURN(CA13)
  258. TEST_STRUCT_RETURN(CA14)
  259. TEST_STRUCT_RETURN(CA15)
  260. TEST_STRUCT_RETURN(CA16)
  261. TEST_STRUCT_RETURN(S1)
  262. TEST_STRUCT_RETURN(S2)
  263. TEST_STRUCT_RETURN(S3)
  264. TEST_STRUCT_RETURN(S4)
  265. TEST_STRUCT_RETURN(S5)
  266. TEST_STRUCT_RETURN(S6)
  267. TEST_STRUCT_RETURN(S7)
  268. TEST_STRUCT_RETURN(S8)
  269. TEST_STRUCT_RETURN(SA1)
  270. TEST_STRUCT_RETURN(SA2)
  271. TEST_STRUCT_RETURN(SA3)
  272. TEST_STRUCT_RETURN(SA4)
  273. TEST_STRUCT_RETURN(SA5)
  274. TEST_STRUCT_RETURN(SA6)
  275. TEST_STRUCT_RETURN(SA7)
  276. TEST_STRUCT_RETURN(SA8)
  277. TEST_STRUCT_RETURN(I1)
  278. TEST_STRUCT_RETURN(I2)
  279. TEST_STRUCT_RETURN(I3)
  280. TEST_STRUCT_RETURN(I4)
  281. TEST_STRUCT_RETURN(I5)
  282. TEST_STRUCT_RETURN(I6)
  283. TEST_STRUCT_RETURN(I7)
  284. TEST_STRUCT_RETURN(I8)
  285. TEST_STRUCT_RETURN(IA1)
  286. TEST_STRUCT_RETURN(IA2)
  287. TEST_STRUCT_RETURN(IA3)
  288. TEST_STRUCT_RETURN(IA4)
  289. TEST_STRUCT_RETURN(IA5)
  290. TEST_STRUCT_RETURN(IA6)
  291. TEST_STRUCT_RETURN(IA7)
  292. TEST_STRUCT_RETURN(IA8)
  293. TEST_STRUCT_RETURN(L1)
  294. TEST_STRUCT_RETURN(L2)
  295. TEST_STRUCT_RETURN(L3)
  296. TEST_STRUCT_RETURN(L4)
  297. TEST_STRUCT_RETURN(L5)
  298. TEST_STRUCT_RETURN(L6)
  299. TEST_STRUCT_RETURN(L7)
  300. TEST_STRUCT_RETURN(L8)
  301. TEST_STRUCT_RETURN(L9)
  302. TEST_STRUCT_RETURN(LA1)
  303. TEST_STRUCT_RETURN(LA2)
  304. TEST_STRUCT_RETURN(LA3)
  305. TEST_STRUCT_RETURN(LA4)
  306. TEST_STRUCT_RETURN(LA5)
  307. TEST_STRUCT_RETURN(LA6)
  308. TEST_STRUCT_RETURN(LA7)
  309. TEST_STRUCT_RETURN(LA8)
  310. TEST_STRUCT_RETURN(LA9)
  311. TEST_STRUCT_RETURN(F1)
  312. TEST_STRUCT_RETURN(F2)
  313. TEST_STRUCT_RETURN(F3)
  314. TEST_STRUCT_RETURN(F4)
  315. TEST_STRUCT_RETURN(FA1)
  316. TEST_STRUCT_RETURN(FA2)
  317. TEST_STRUCT_RETURN(FA3)
  318. TEST_STRUCT_RETURN(FA4)
  319. TEST_STRUCT_RETURN(D1)
  320. TEST_STRUCT_RETURN(D2)
  321. TEST_STRUCT_RETURN(DA1)
  322. TEST_STRUCT_RETURN(DA2)
  323. TEST_STRUCT_RETURN(CF)
  324. TEST_STRUCT_RETURN(FI)
  325. TEST_STRUCT_RETURN(FI2)
  326. TEST_STRUCT_RETURN(FI3)
  327. TEST_STRUCT_RETURN(DI)
  328. TEST_STRUCT_RETURN(DI2)
  329. TEST_STRUCT_RETURN(DI3)
  330. TEST_STRUCT_RETURN(FD)
  331. TEST_STRUCT_RETURN(F2D)
  332. TEST_STRUCT_RETURN(DF)
  333. TEST_STRUCT_RETURN(DF2)