Commit 55cbf824 by Ziemowit Laski Committed by Jim Wilson

Fix LP64 failures.

	* objc.dg/proto-qual-1.m (ROUND, aligned_sizeof): New.
	(scan_initial, main): Use aligned_sizeof instead of sizeof.

From-SVN: r76842
parent b1a95e0b
2004-01-28 Ziemowit Laski <zlaski@apple.com>
* objc.dg/proto-qual-1.m (ROUND, aligned_sizeof): New.
(scan_initial, main): Use aligned_sizeof instead of sizeof.
2004-01-28 Mark Mitchell <mark@codesourcery.com>
PR c++/13791
......
......@@ -8,6 +8,10 @@
#include <objc/objc-api.h>
#endif
/* The encoded parameter sizes will be rounded up to match pointer alignment. */
#define ROUND(s,a) (a * ((s + a - 1) / a))
#define aligned_sizeof(T) ROUND(sizeof(T),__alignof(void *))
extern int sscanf(const char *str, const char *format, ...);
extern void abort(void);
#define CHECK_IF(expr) if(!(expr)) abort()
......@@ -34,15 +38,15 @@ static void scan_initial(const char *pattern) {
totsize = offs0 = offs1 = offs2 = offs3 = offs4 = offs5 = offs6 = offs7 = (unsigned)-1;
sscanf(meth->types, pattern, &totsize, &offs0, &offs1, &offs2, &offs3,
&offs4, &offs5, &offs6, &offs7);
CHECK_IF(!offs0 && offs1 == sizeof(id) && offs2 == offs1 + sizeof(SEL) && totsize >= offs2);
CHECK_IF(!offs0 && offs1 == aligned_sizeof(id) && offs2 == offs1 + aligned_sizeof(SEL) && totsize >= offs2);
}
int main(void) {
meth = [proto descriptionForInstanceMethod: @selector(address:with:)];
scan_initial("O@%u@%u:%uNR@%uo^^S%u");
CHECK_IF(offs3 == offs2 + sizeof(id) && totsize == offs3 + sizeof(unsigned));
CHECK_IF(offs3 == offs2 + aligned_sizeof(id) && totsize == offs3 + aligned_sizeof(unsigned));
meth = [proto descriptionForClassMethod: @selector(retainArgument:with:)];
scan_initial("Vv%u@%u:%uOo@%un^*%u");
CHECK_IF(offs3 == offs2 + sizeof(id) && totsize == offs3 + sizeof(char **));
CHECK_IF(offs3 == offs2 + aligned_sizeof(id) && totsize == offs3 + aligned_sizeof(char **));
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment