]>
Commit | Line | Data |
---|---|---|
88e17b57 | 1 | /* GNU Objective C Runtime nil receiver function |
d652f226 JJ |
2 | Copyright (C) 1993, 1995, 1996, 2002, 2009, 2010 |
3 | Free Software Foundation, Inc. | |
88e17b57 BE |
4 | Contributed by Kresten Krab Thorup |
5 | ||
38709cad | 6 | This file is part of GCC. |
88e17b57 | 7 | |
38709cad | 8 | GCC is free software; you can redistribute it and/or modify it under the |
88e17b57 | 9 | terms of the GNU General Public License as published by the Free Software |
748086b7 | 10 | Foundation; either version 3, or (at your option) any later version. |
88e17b57 | 11 | |
38709cad | 12 | GCC is distributed in the hope that it will be useful, but WITHOUT ANY |
88e17b57 BE |
13 | WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
14 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | |
15 | details. | |
16 | ||
748086b7 JJ |
17 | Under Section 7 of GPL version 3, you are granted additional |
18 | permissions described in the GCC Runtime Library Exception, version | |
19 | 3.1, as published by the Free Software Foundation. | |
20 | ||
21 | You should have received a copy of the GNU General Public License and | |
22 | a copy of the GCC Runtime Library Exception along with this program; | |
23 | see the files COPYING3 and COPYING.RUNTIME respectively. If not, see | |
24 | <http://www.gnu.org/licenses/>. */ | |
88e17b57 | 25 | |
88e17b57 BE |
26 | |
27 | /* This is the nil method, the function that is called when the receiver | |
28 | of a method is nil */ | |
29 | ||
6dead247 | 30 | #include "objc-private/common.h" |
a19fac96 | 31 | #include "objc/objc.h" |
88e17b57 | 32 | |
d90ad6d3 NP |
33 | /* When the receiver of a method invocation is nil, the runtime |
34 | returns nil_method() as the method implementation. This function | |
35 | will be casted to whatever function was supposed to be executed to | |
36 | execute that method (that function will take an id, followed by a | |
37 | SEL, followed by who knows what arguments, depends on the method), | |
38 | and executed. | |
39 | ||
40 | For this reason, nil_method() should be a function which can be | |
41 | called in place of any function taking an 'id' argument followed by | |
42 | a 'SEL' argument, followed by zero, or one, or any number of | |
43 | arguments (both a fixed number, or a variable number !). | |
44 | ||
45 | There is no "proper" implementation of such a nil_method function | |
46 | in C, however in all existing implementations it does not matter | |
47 | when extra arguments are present, so we can simply create a function | |
48 | taking a receiver and a selector, and all other arguments will be | |
49 | ignored. :-) | |
50 | */ | |
51 | ||
88e17b57 | 52 | id |
edf4d41e | 53 | nil_method (id receiver, SEL op __attribute__ ((__unused__))) |
88e17b57 BE |
54 | { |
55 | return receiver; | |
56 | } |