]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/d/dmd/objc.c
Add D front-end, libphobos library, and D2 testsuite.
[thirdparty/gcc.git] / gcc / d / dmd / objc.c
1
2 /* Compiler implementation of the D programming language
3 * Copyright (C) 2015-2018 by The D Language Foundation, All Rights Reserved
4 * written by Michel Fortin
5 * http://www.digitalmars.com
6 * Distributed under the Boost Software License, Version 1.0.
7 * http://www.boost.org/LICENSE_1_0.txt
8 * https://github.com/D-Programming-Language/dmd/blob/master/src/objc_stubs.c
9 */
10
11 #include "objc.h"
12 #include "aggregate.h"
13 #include "scope.h"
14
15 class FuncDeclaration;
16
17 // MARK: ObjcSelector
18
19 ObjcSelector::ObjcSelector(const char *, size_t, size_t)
20 {
21 printf("Should never be called when D_OBJC is false\n");
22 assert(0);
23 }
24
25 ObjcSelector *ObjcSelector::lookup(const char *)
26 {
27 printf("Should never be called when D_OBJC is false\n");
28 assert(0);
29 return NULL;
30 }
31
32 ObjcSelector *ObjcSelector::lookup(const char *, size_t, size_t)
33 {
34 printf("Should never be called when D_OBJC is false\n");
35 assert(0);
36 return NULL;
37 }
38
39 ObjcSelector *ObjcSelector::create(FuncDeclaration *)
40 {
41 printf("Should never be called when D_OBJC is false\n");
42 assert(0);
43 return NULL;
44 }
45
46 class UnsupportedObjc : public Objc
47 {
48 void setObjc(ClassDeclaration *cd)
49 {
50 cd->error("Objective-C classes not supported");
51 }
52
53 void setObjc(InterfaceDeclaration *id)
54 {
55 id->error("Objective-C interfaces not supported");
56 }
57
58 void setSelector(FuncDeclaration *, Scope *)
59 {
60 // noop
61 }
62
63 void validateSelector(FuncDeclaration *)
64 {
65 // noop
66 }
67
68 void checkLinkage(FuncDeclaration *)
69 {
70 // noop
71 }
72 };
73
74 static Objc *_objc;
75
76 Objc *objc()
77 {
78 return _objc;
79 }
80
81 void Objc::_init()
82 {
83 _objc = new UnsupportedObjc();
84 }