1 # GCC Objective-C testsuite that uses the `dg.exp' driver.
2 # Copyright (C) 1997-2023 Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 3 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with GCC; see the file COPYING3. If not see
16 # <http://www.gnu.org/licenses/>.
21 # If a testcase doesn't have special options, use these.
23 if ![info exists DEFAULT_CFLAGS] then {
30 # TODO: All these testcases compile and link two Objective-C modules.
31 # Remove code duplication and factor the common code out.
34 # unclaimed-category-1 test
36 # This test is special because we must compile two different modules,
37 # unclaimed-category-1a.m and unclaimed-category-1.m, then link
38 # together, then run the resulting executable.
39 # for all systems we point to the libobjc includes and use the -fgnu-runtime
40 set add_flags "additional_flags=-I${srcdir}/../../libobjc"
41 lappend add_flags "additional_flags=-fgnu-runtime"
42 lappend add_flags "additional_flags=-Wno-objc-root-class"
43 set lines [objc_target_compile "$srcdir/$subdir/unclaimed-category-1a.m" "unclaimed-category-1a.o" object $add_flags ]
44 if ![string match "" $lines] then {
45 fail "unclaimed-category-1a.o"
47 dg-runtest "$srcdir/$subdir/unclaimed-category-1.m" "unclaimed-category-1a.o" "-I${srcdir}/../../libobjc -fgnu-runtime"
48 file delete unclaimed-category-1a.o
51 if [istarget "*-*-darwin*" ] {
53 lappend add_flags "additional_flags=-fnext-runtime"
54 lappend add_flags "additional_flags=-Wno-objc-root-class"
55 set lines [objc_target_compile "$srcdir/$subdir/unclaimed-category-1a.m" "unclaimed-category-1a.o" object $add_flags ]
56 if ![string match "" $lines] then {
57 fail "unclaimed-category-1a.o"
59 dg-runtest "$srcdir/$subdir/unclaimed-category-1.m" "unclaimed-category-1a.o" "-fnext-runtime"
60 file delete unclaimed-category-1a.o
65 # load-category-1 test
67 # This test is similar to the one above. We compile load-category-1.m
68 # and load-category-1a.m, link them together, and execute the result.
69 set add_flags "additional_flags=-I${srcdir}/../../libobjc"
70 lappend add_flags "additional_flags=-fgnu-runtime"
71 lappend add_flags "additional_flags=-Wno-objc-root-class"
72 set lines [objc_target_compile "$srcdir/$subdir/load-category-1a.m" "load-category-1a.o" object $add_flags ]
73 if ![string match "" $lines] then {
74 fail "load-category-1a.o"
76 dg-runtest "$srcdir/$subdir/load-category-1.m" "load-category-1a.o" "-I${srcdir}/../../libobjc -fgnu-runtime"
77 file delete load-category-1a.o
80 if [istarget "*-*-darwin*" ] {
82 lappend add_flags "additional_flags=-fnext-runtime"
83 lappend add_flags "additional_flags=-Wno-objc-root-class"
84 set lines [objc_target_compile "$srcdir/$subdir/load-category-1a.m" "load-category-1a.o" object $add_flags ]
85 if ![string match "" $lines] then {
86 fail "load-category-1a.o"
88 dg-runtest "$srcdir/$subdir/load-category-1.m" "load-category-1a.o" "-fnext-runtime"
89 file delete load-category-1a.o
94 # load-category-2 test
96 # This test is similar to the one above. We compile load-category-2.m
97 # and load-category-2a.m, link them together, and execute the result.
98 set add_flags "additional_flags=-I${srcdir}/../../libobjc"
99 lappend add_flags "additional_flags=-fgnu-runtime"
100 lappend add_flags "additional_flags=-Wno-objc-root-class"
101 set lines [objc_target_compile "$srcdir/$subdir/load-category-2a.m" "load-category-2a.o" object $add_flags ]
102 if ![string match "" $lines] then {
103 fail "load-category-2a.o"
105 dg-runtest "$srcdir/$subdir/load-category-2.m" "load-category-2a.o" "-I${srcdir}/../../libobjc -fgnu-runtime"
106 file delete load-category-2a.o
109 if [istarget "*-*-darwin*" ] {
111 lappend add_flags "additional_flags=-fnext-runtime"
112 lappend add_flags "additional_flags=-Wno-objc-root-class"
113 set lines [objc_target_compile "$srcdir/$subdir/load-category-2a.m" "load-category-2a.o" object $add_flags ]
114 if ![string match "" $lines] then {
115 fail "load-category-2a.o"
117 dg-runtest "$srcdir/$subdir/load-category-2.m" "load-category-2a.o" "-fnext-runtime"
118 file delete load-category-2a.o
123 # load-category-3 test
125 # This test is similar to the one above. We compile load-category-3.m
126 # and load-category-3a.m, link them together, and execute the result.
127 set add_flags "additional_flags=-I${srcdir}/../../libobjc"
128 lappend add_flags "additional_flags=-fgnu-runtime"
129 lappend add_flags "additional_flags=-Wno-objc-root-class"
130 set lines [objc_target_compile "$srcdir/$subdir/load-category-3a.m" "load-category-3a.o" object $add_flags ]
131 if ![string match "" $lines] then {
132 fail "load-category-3a.o"
134 dg-runtest "$srcdir/$subdir/load-category-3.m" "load-category-3a.o" "-I${srcdir}/../../libobjc -fgnu-runtime"
135 file delete load-category-3a.o
138 if [istarget "*-*-darwin*" ] {
140 lappend add_flags "additional_flags=-fnext-runtime"
141 lappend add_flags "additional_flags=-Wno-objc-root-class"
142 set lines [objc_target_compile "$srcdir/$subdir/load-category-3a.m" "load-category-3a.o" object $add_flags ]
143 if ![string match "" $lines] then {
144 fail "load-category-3a.o"
146 dg-runtest "$srcdir/$subdir/load-category-3.m" "load-category-3a.o" "-fnext-runtime"
147 file delete load-category-3a.o