summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Schleifer <js@webkeks.org>2011-06-26 02:59:33 +0200
committerJonathan Schleifer <js@webkeks.org>2011-06-26 02:59:33 +0200
commitcf5346e25dcd32c0fc06e309e7ba2bfa8cf88c45 (patch)
treec39eee17e5442ba53fb9f370a02b4b124ffa8907
parent3145488379da274ea762147c5bc1f8e23b071b76 (diff)
Check for buggy -Wcast-align.
-rw-r--r--configure.ac34
1 files changed, 29 insertions, 5 deletions
diff --git a/configure.ac b/configure.ac
index 22a5b7a7..1c898a81 100644
--- a/configure.ac
+++ b/configure.ac
@@ -506,8 +506,7 @@ AS_IF([test x"$objc_runtime" = x"Apple"], [
])
AS_IF([test x"$GOBJC" = x"yes"], [
- OBJCFLAGS="$OBJCFLAGS -Wwrite-strings -Wcast-align -Wpointer-arith"
- OBJCFLAGS="$OBJCFLAGS -Werror"
+ OBJCFLAGS="$OBJCFLAGS -Wwrite-strings -Wpointer-arith -Werror"
AC_MSG_CHECKING(whether gcc has bug objc/27438)
AC_TRY_COMPILE([
@@ -533,9 +532,9 @@ AS_IF([test x"$GOBJC" = x"yes"], [
AC_MSG_CHECKING(whether we need -Wno-strict-aliasing due to gcc bugs)
AC_TRY_COMPILE([
- @interface OFObject
+ @interface Foo
{
- Class isa;
+ struct objc_class *isa;
}
@end
@@ -543,7 +542,7 @@ AS_IF([test x"$GOBJC" = x"yes"], [
struct objc_class *isa;
} object;
], [
- OFObject *test = (OFObject*)&object;
+ Foo *test = (Foo*)&object;
(void)test; /* Get rid of unused variable warning */
], [
AC_MSG_RESULT(no)
@@ -551,6 +550,31 @@ AS_IF([test x"$GOBJC" = x"yes"], [
AC_MSG_RESULT(yes)
OBJCFLAGS="$OBJCFLAGS -Wno-strict-aliasing"
])
+
+ old_OBJCFLAGS="$OBJCFLAGS"
+ OBJCFLAGS="$OBJCFLAGS -Wcast-align"
+ AC_MSG_CHECKING(whether -Wcast-align is buggy)
+ AC_TRY_COMPILE([
+ @interface Foo
+ {
+ struct objc_class *isa;
+ }
+ @end
+
+ @implementation Foo
+ - (void)foo
+ {
+ struct objc_class *c = isa;
+ (void)c;
+ }
+ @end
+ ], [
+ ], [
+ AC_MSG_RESULT(no)
+ ], [
+ AC_MSG_RESULT(yes)
+ OBJCFLAGS="$old_OBJCFLAGS"
+ ])
])
AS_IF([test x"$cross_compiling" = x"yes"], [