[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 10/10] objc, objc++: test support for compilation flags
From: |
Stefano Lattarini |
Subject: |
[PATCH 10/10] objc, objc++: test support for compilation flags |
Date: |
Tue, 1 May 2012 15:52:28 +0200 |
* t/objc-flags.sh, t/objcxx-flags.sh: New tests.
* t/list-of-tests.mk: Add them.
Co-authored-by: Peter Breitenlohner <address@hidden>
Signed-off-by: Stefano Lattarini <address@hidden>
---
t/list-of-tests.mk | 2 ++
t/objc-flags.sh | 62 ++++++++++++++++++++++++++++++++++++++++++++
t/objcxx-flags.sh | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 136 insertions(+)
create mode 100755 t/objc-flags.sh
create mode 100755 t/objcxx-flags.sh
diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk
index 4bfbb89..c95a836 100644
--- a/t/list-of-tests.mk
+++ b/t/list-of-tests.mk
@@ -704,9 +704,11 @@ t/notrans.sh \
t/number.sh \
t/objc-basic.sh \
t/objc-minidemo.sh \
+t/objc-flags.sh \
t/objc-deps.sh \
t/objcxx-basic.sh \
t/objcxx-minidemo.sh \
+t/objcxx-flags.sh \
t/objcxx-deps.sh \
t/objc-megademo.sh \
t/objext-pr10128.sh \
diff --git a/t/objc-flags.sh b/t/objc-flags.sh
new file mode 100755
index 0000000..6c2b1e6
--- /dev/null
+++ b/t/objc-flags.sh
@@ -0,0 +1,62 @@
+#! /bin/sh
+# Copyright (C) 2012 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Test Objective C compilation flags.
+
+. ./defs || Exit 1
+
+cat >> configure.ac << 'END'
+AC_PROG_OBJC
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+AM_DEFAULT_SOURCE_EXT = .m
+bin_PROGRAMS = foo2 foo4
+AM_OBJCFLAGS = -DVALUE=2 -DERROR=1
+foo4_OBJCFLAGS = -DVALUE=4 -DERROR=1
+END
+
+for i in 2 4; do
+ unindent > foo$i.m << END
+ /* Let's make this file valid Objective C but invalid C. */
+ #import <stdlib.h>
+ @interface Who_Cares { } @end
+ #ifdef ERROR
+ # error "macro ERROR is defined for foo.m"
+ #else
+ # if VALUE == $i
+ int main (void) { exit (0); }
+ # else
+ # error "VALUE is != $i in foo.m"
+ # endif
+ #endif
+END
+done
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+$FGREP OBJCFLAGS Makefile.in # For debugging.
+grep '\$(OBJCFLAGS).*\$(AM_OBJCFLAGS)' Makefile.in && Exit 1
+grep '\$(OBJCFLAGS).*\$(foo.*_OBJCFLAGS)' Makefile.in && Exit 1
+grep '\$(foo.*_OBJCFLAGS).*\$(AM_OBJCFLAGS)' Makefile.in && Exit 1
+
+./configure OBJCFLAGS=-UERROR
+$MAKE
+
+:
diff --git a/t/objcxx-flags.sh b/t/objcxx-flags.sh
new file mode 100755
index 0000000..aea7e19
--- /dev/null
+++ b/t/objcxx-flags.sh
@@ -0,0 +1,72 @@
+#! /bin/sh
+# Copyright (C) 2012 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Test Objective C++ compilation flags.
+# See also sister test 'objc-flags.sh'.
+
+. ./defs || Exit 1
+
+cat >> configure.ac << 'END'
+dnl Support for Object C++ was introduced only in Autoconf 2.65.
+AC_PREREQ([2.65])
+AC_PROG_OBJCXX
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+AM_DEFAULT_SOURCE_EXT = .mm
+bin_PROGRAMS = foo2 foo4
+AM_OBJCXXFLAGS = -DVALUE=2 -DERROR=1
+foo4_OBJCXXFLAGS = -DVALUE=4 -DERROR=1
+END
+
+for i in 2 4; do
+ unindent > foo$i.mm << END
+ /* Let's make this file valid Objective C but invalid C. */
+ #import <stdlib.h>
+ @interface Who_Cares { } @end
+ #ifdef ERROR
+ # error "macro ERROR is defined for foo.mm"
+ #else
+ # if VALUE == $i
+ int main (void) { exit (0); }
+ # else
+ # error "VALUE is != $i in foo.mm"
+ # endif
+ #endif
+END
+done
+
+if $ACLOCAL; then
+ : We have a modern enough autoconf, go ahead.
+elif test $? -eq 63; then
+ skip_ "Object C++ support requires Autoconf 2.65 or later"
+else
+ Exit 1 # Some other aclocal failure.
+fi
+
+$AUTOCONF
+$AUTOMAKE -a
+
+$FGREP OBJCXXFLAGS Makefile.in # For debugging.
+grep '\$(OBJCXXFLAGS).*\$(AM_OBJCXXFLAGS)' Makefile.in && Exit 1
+grep '\$(OBJCXXFLAGS).*\$(foo.*_OBJCXXFLAGS)' Makefile.in && Exit 1
+grep '\$(foo.*_OBJCXXFLAGS).*\$(AM_OBJCXXFLAGS)' Makefile.in && Exit 1
+
+./configure OBJCXXFLAGS=-UERROR
+$MAKE
+
+:
--
1.7.9.5
- [PATCH 05/10] objc++: add first basic test, (continued)
- [PATCH 06/10] objc++, objc: add first semantic tests, Stefano Lattarini, 2012/05/01
- [PATCH 07/10] objc: reorganize basic tests, Stefano Lattarini, 2012/05/01
- [PATCH 08/10] objc, objc++: test automatic dependency tracking, Stefano Lattarini, 2012/05/01
- [PATCH 09/10] objc, objc++: add stress test, Stefano Lattarini, 2012/05/01
- [PATCH 10/10] objc, objc++: test support for compilation flags,
Stefano Lattarini <=