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