re checking -fdump-passes
[official-gcc.git] / libobjc / nil_method.c
blob15e3d528c497e7bfb65d09a788762937018ef45c
1 /* GNU Objective C Runtime nil receiver function
2 Copyright (C) 1993, 1995, 1996, 2002, 2009, 2010
3 Free Software Foundation, Inc.
4 Contributed by Kresten Krab Thorup
6 This file is part of GCC.
8 GCC is free software; you can redistribute it and/or modify it under the
9 terms of the GNU General Public License as published by the Free Software
10 Foundation; either version 3, or (at your option) any later version.
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
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.
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.
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/>. */
27 /* This is the nil method, the function that is called when the receiver
28 of a method is nil */
30 #include "objc-private/common.h"
31 #include "objc/objc.h"
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.
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 !).
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. :-)
53 nil_method (id receiver, SEL op __attribute__ ((__unused__)))
55 return receiver;