Skip to content

Commit 5d86126

Browse files
Move -L-w flag to d_do_test and use IN_LLVM in objc.d/h
1 parent 7423d0a commit 5d86126

14 files changed

+28
-16
lines changed

dmd/objc.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ extern (C++) struct ObjcClassDeclaration
157157
bool isExtern = false;
158158

159159
/// `true` if this class is a Swift stub
160-
bool isSwiftStub = false;
160+
version(IN_LLVM) bool isSwiftStub = false;
161161

162162
/// Name of this class.
163163
Identifier identifier;

dmd/objc.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ struct ObjcClassDeclaration
3737
{
3838
d_bool isMeta;
3939
d_bool isExtern;
40+
#if IN_LLVM
4041
d_bool isSwiftStub;
42+
#endif
4143

4244
Identifier* identifier;
4345
ClassDeclaration* classDeclaration;

tests/dmd/runnable/extra-files/test16096a.d

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,22 @@ module test16096a;
33
import core.attribute : selector;
44

55
extern (Objective-C)
6-
interface Class {
6+
interface Class
7+
{
78
NSObject alloc() @selector("alloc");
89
}
910

1011
extern (Objective-C)
11-
interface NSObject {
12-
NSObject initWithUTF8String(const(char)* str) @selector("initWithUTF8String:");
12+
interface NSObject
13+
{
14+
NSObject initWithUTF8String(in char* str) @selector("initWithUTF8String:");
1315
void release() @selector("release");
1416
}
1517

16-
extern (C) Class objc_lookUpClass(const(char)* name);
18+
extern (C) Class objc_lookUpClass(in char* name);
1719

18-
void test() {
20+
void test()
21+
{
1922
auto c = objc_lookUpClass("NSString");
2023
auto o = c.alloc().initWithUTF8String("hello");
2124
o.release();

tests/dmd/runnable/objc_call.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// EXTRA_OBJC_SOURCES:
2-
// REQUIRED_ARGS: -L-framework -LFoundation -L-w
2+
// REQUIRED_ARGS: -L-framework -LFoundation
33

44
import core.attribute : selector;
55

tests/dmd/runnable/objc_call_static.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// EXTRA_OBJC_SOURCES:
2-
// REQUIRED_ARGS: -L-framework -LFoundation -L-w
2+
// REQUIRED_ARGS: -L-framework -LFoundation
33

44
import core.attribute : selector;
55

tests/dmd/runnable/objc_class.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// EXTRA_OBJC_SOURCES: objc_class.m
2-
// REQUIRED_ARGS: -L-framework -LFoundation -L-w
2+
// REQUIRED_ARGS: -L-framework -LFoundation
33

44
import core.attribute : selector;
55

tests/dmd/runnable/objc_external_class_19700.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// EXTRA_OBJC_SOURCES: objc_instance_variable.m
2-
// REQUIRED_ARGS: -L-framework -LFoundation -L-w
2+
// REQUIRED_ARGS: -L-framework -LFoundation
33

44
import core.attribute : selector;
55

tests/dmd/runnable/objc_instance_variable.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// EXTRA_OBJC_SOURCES: objc_instance_variable.m
2-
// REQUIRED_ARGS: -L-framework -LFoundation -L-w
2+
// REQUIRED_ARGS: -L-framework -LFoundation
33

44
import core.attribute : selector;
55

tests/dmd/runnable/objc_objc_msgSend.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// EXTRA_OBJC_SOURCES: objc_objc_msgSend.m
2-
// REQUIRED_ARGS: -L-framework -LFoundation -L-w
2+
// REQUIRED_ARGS: -L-framework -LFoundation
33

44
import core.attribute : selector;
55

tests/dmd/runnable/objc_protocol.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// EXTRA_OBJC_SOURCES: objc_protocol.m
2-
// REQUIRED_ARGS: -L-lobjc -L-w
2+
// REQUIRED_ARGS: -L-lobjc
33

44
import core.attribute : selector;
55

tests/dmd/runnable/objc_protocol_sections.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// EXTRA_OBJC_SOURCES:
2-
// REQUIRED_ARGS: -L-lobjc -L-w
2+
// REQUIRED_ARGS: -L-lobjc
33

44
// This file verifies that Objective-C protocols are put in the correct segments
55
// and sections in the binary. If not, functions from the Objective-C runtime

tests/dmd/runnable/objc_self_test.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// EXTRA_OBJC_SOURCES: objc_self_test.m
2-
// REQUIRED_ARGS: -L-framework -LFoundation -L-w
2+
// REQUIRED_ARGS: -L-framework -LFoundation
33

44
extern (C) int getValue();
55

tests/dmd/runnable/objc_super_call.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// EXTRA_OBJC_SOURCES: objc_super_call.m
2-
// REQUIRED_ARGS: -L-framework -LFoundation -L-w
2+
// REQUIRED_ARGS: -L-framework -LFoundation
33

44
import core.attribute : selector;
55

tests/dmd/tools/d_do_test.d

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -816,6 +816,13 @@ bool gatherTestParameters(ref TestArgs testArgs, string input_dir, string input_
816816

817817
testArgs.objcSources = split(extraObjcSourcesStr);
818818

819+
// Using the ld64 linker may result in linker warnings being generated
820+
// which are irrelevant to the parts of Objective-C ABI which D implements.
821+
// As such we supress linker warnings for Objective-C tests to avoid
822+
// linker errors when linking against Objective-C compiler output.
823+
if (objc && testArgs.objcSources.length > 0)
824+
testArgs.requiredArgs ~= " -L-w";
825+
819826
// swap / with $SEP
820827
if (envData.sep && envData.sep != "/")
821828
foreach (ref s; testArgs.sources)

0 commit comments

Comments
 (0)