Index: gcc/testsuite/ChangeLog
===================================================================
--- gcc/testsuite/ChangeLog     (revision 168034)
+++ gcc/testsuite/ChangeLog     (working copy)
@@ -1,3 +1,8 @@
+2010-12-19  Nicola Pero  <nicola.pero@meta-innovation.com>
+
+       * objc.dg/gnu-api-2-resolve-method.m: Include objc/message.h.
+       * obj-c++.dg/gnu-api-2-resolve-method.m: Include objc/message.h.
+
 2010-12-18  Jakub Jelinek  <jakub@redhat.com>
 
        PR tree-optimization/46969
Index: gcc/testsuite/objc.dg/gnu-api-2-resolve-method.m
===================================================================
--- gcc/testsuite/objc.dg/gnu-api-2-resolve-method.m    (revision 168034)
+++ gcc/testsuite/objc.dg/gnu-api-2-resolve-method.m    (working copy)
@@ -9,6 +9,10 @@
 /* To get the modern GNU Objective-C Runtime API, you include
    objc/runtime.h.  */
 #include <objc/runtime.h>
+
+/* For __objc_msg_forward2.  */
+#include <objc/message.h>
+
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
Index: gcc/testsuite/obj-c++.dg/gnu-api-2-resolve-method.mm
===================================================================
--- gcc/testsuite/obj-c++.dg/gnu-api-2-resolve-method.mm        (revision 168034)
+++ gcc/testsuite/obj-c++.dg/gnu-api-2-resolve-method.mm        (working copy)
@@ -9,6 +9,10 @@
 /* To get the modern GNU Objective-C Runtime API, you include
    objc/runtime.h.  */
 #include <objc/runtime.h>
+
+/* For __objc_msg_forward2.  */
+#include <objc/message.h>
+
 #include <stdlib.h>
 #include <iostream>
 #include <cstring>
Index: libobjc/sendmsg.c
===================================================================
--- libobjc/sendmsg.c   (revision 168039)
+++ libobjc/sendmsg.c   (working copy)
@@ -34,6 +34,7 @@ see the files COPYING3 and COPYING.RUNTIME respect
 #include "coretypes.h"
 #include "tm.h"
 #include "objc/runtime.h"
+#include "objc/message.h"          /* For objc_msg_lookup(), objc_msg_lookup_super().  */
 #include "objc/thr.h"
 #include "objc-private/module-abi-8.h"
 #include "objc-private/runtime.h"
Index: libobjc/Makefile.in
===================================================================
--- libobjc/Makefile.in (revision 168040)
+++ libobjc/Makefile.in (working copy)
@@ -142,6 +142,7 @@ OBJC_DEPRECATED_H = \
   objc_error.h \
   objc_get_uninstalled_dtable.h \
   objc_malloc.h \
+  objc_msg_sendv.h \
   objc_object_alloc.h \
   objc_unexpected_exception.h \
   objc_valloc.h \
Index: libobjc/thr.c
===================================================================
--- libobjc/thr.c       (revision 168039)
+++ libobjc/thr.c       (working copy)
@@ -38,6 +38,7 @@ see the files COPYING3 and COPYING.RUNTIME respect
 #include "tm.h"
 #include "defaults.h"
 #include "objc/thr.h"
+#include "objc/message.h" /* For objc_msg_lookup().  */
 #include "objc/runtime.h"
 #include "objc-private/runtime.h"
 #include <gthr.h>
Index: libobjc/ChangeLog
===================================================================
--- libobjc/ChangeLog   (revision 168041)
+++ libobjc/ChangeLog   (working copy)
@@ -1,5 +1,17 @@
 2010-12-19  Nicola Pero  <nicola.pero@meta-innovation.com>
 
+       * Makefile.in (OBJC_DEPRECATED_H): Added objc_msg_sendv.h.
+       * objc/deprecated/objc_msg_sendv.h: New.
+       * objc/message.h: Do not define retval_t, apply_t, arglist,
+       arglist_t, objc_msg_sendv, now in
+       objc/deprecated/objc_msg_sendv.h.
+       * objc/objc.h: Do not include message.h; include
+       objc/deprecated/objc_msg_sendv.h instead.  Tidied up comments.
+       * sendmsg.c: Include objc/message.h.
+       * thr.c: Include objc/message.h.
+       
+2010-12-19  Nicola Pero  <nicola.pero@meta-innovation.com>
+
        * objc/objc-exception.h: Include objc-decls.h.  Mark all
        functions with objc_EXPORT.
        * objc/objc-sync.h: Same change.
Index: libobjc/objc/deprecated/objc_msg_sendv.h
===================================================================
--- libobjc/objc/deprecated/objc_msg_sendv.h    (revision 0)
+++ libobjc/objc/deprecated/objc_msg_sendv.h    (revision 0)
@@ -0,0 +1,12 @@
+/* The following types and functions are provided only for
+   backwards-compatibility and should not be used in new code.  They
+   were deprecated in GCC 4.6 and will be removed in the next
+   release.  */
+typedef void* retval_t;                /* return value */
+typedef void(*apply_t)(void);  /* function pointer */
+typedef union arglist {
+  char *arg_ptr;
+  char arg_regs[sizeof (char*)];
+} *arglist_t;                  /* argument frame */
+
+objc_EXPORT retval_t objc_msg_sendv(id, SEL, arglist_t);
Index: libobjc/objc/objc.h
===================================================================
--- libobjc/objc/objc.h (revision 168039)
+++ libobjc/objc/objc.h (working copy)
@@ -28,8 +28,7 @@ see the files COPYING3 and COPYING.RUNTIME respect
 
 /* This file contains the definition of the basic types used by the
    Objective-C language.  It needs to be included to do almost
-   anything with Objective-C.
-*/
+   anything with Objective-C.  */
 
 #ifdef __cplusplus
 extern "C" {
@@ -37,25 +36,27 @@ extern "C" {
 
 #include <stddef.h>
 
+/* objc-decls.h is included because deprecated/objc_msg_sendv.h needs
+   it.  When that goes away, the include of objc-decls.h should be
+   removed.  */
+#include "objc-decls.h"
+
 /* The current version of the GNU Objective-C Runtime library in
    compressed ISO date format.  This should be updated any time a new
    version is released with changes to the public API (there is no
    need to update it if there were no API changes since the previous
    release).  This macro is only defined starting with the GNU
    Objective-C Runtime shipped with GCC 4.6.0.  If it is not defined,
-   it is either an older version of the runtime, or another runtime.
-*/
+   it is either an older version of the runtime, or another runtime.  */
 #define __GNU_LIBOBJC__ 20100911
 
-/*
-  Definition of the boolean type.
+/* Definition of the boolean type.
 
-  Compatibility note: the Apple/NeXT runtime defines a BOOL as a
-  'signed char'.  The GNU runtime uses an 'unsigned char'.
+   Compatibility note: the Apple/NeXT runtime defines a BOOL as a
+   'signed char'.  The GNU runtime uses an 'unsigned char'.
 
-  Important: this could change and we could switch to 'typedef bool
-  BOOL' in the future.  Do not depend on the type of BOOL.
-*/
+   Important: this could change and we could switch to 'typedef bool
+   BOOL' in the future.  Do not depend on the type of BOOL.  */
 #undef BOOL
 typedef unsigned char  BOOL;
 
@@ -65,8 +66,7 @@ typedef unsigned char  BOOL;
 /* The basic Objective-C types (SEL, Class, id) are defined as pointer
    to opaque structures.  The details of the structures are private to
    the runtime and may potentially change from one version to the
-   other.
-*/
+   other.  */
 
 /* A SEL (selector) represents an abstract method (in the
    object-oriented sense) and includes all the details of how to
@@ -74,16 +74,14 @@ typedef unsigned char  BOOL;
    types) but provides no implementation of its own.  You can check
    whether a class implements a selector or not, and if you have a
    selector and know that the class implements it, you can use it to
-   call the method for an object in the class.
- */
+   call the method for an object in the class.  */
 typedef const struct objc_selector *SEL;
 #include "deprecated/struct_objc_selector.h"
 
 /* A Class is a class (in the object-oriented sense).  In Objective-C
    there is the complication that each Class is an object itself, and
    so belongs to a class too.  This class that a class belongs to is
-   called its 'meta class'.
-*/
+   called its 'meta class'.  */
 typedef struct objc_class *Class;
 #include "deprecated/MetaClass.h"
 #include "deprecated/struct_objc_class.h"
@@ -91,32 +89,29 @@ typedef struct objc_class *Class;
 /* An 'id' is an object of an unknown class.  The way the object data
    is stored inside the object is private and what you see here is
    only the beginning of the actual struct.  The first field is always
-   a pointer to the Class that the object belongs to.
-*/
+   a pointer to the Class that the object belongs to.  */
 typedef struct objc_object
 {
   /* 'class_pointer' is the Class that the object belongs to.  In case
      of a Class object, this pointer points to the meta class.
 
      Compatibility Note: The Apple/NeXT runtime calls this field
-     'isa'.  To access this field in a portable way, use
-     object_getClass() from runtime.h, which is an inline function so
-     does not add any overhead.  */
+     'isa'.  To access this field, use object_getClass() from
+     runtime.h, which is an inline function so does not add any
+     overhead and is also portable to other runtimes.  */
   Class class_pointer;
 } *id;
 
-/*
-  'IMP' is a C function that implements a method.  When retrieving the
-  implementation of a method from the runtime, this is the type of the
-  pointer returned.  The idea of the definition of IMP is to represent
-  a 'pointer to a general function taking an id, a SEL, followed by
-  other unspecified arguments'.  You must always cast an IMP to a
-  pointer to a function taking the appropriate, specific types for
-  that function, before calling it - to make sure the appropriate
-  arguments are passed to it.  The code generated by the compiler to
-  perform method calls automatically does this cast inside method
-  calls.
-*/
+/* 'IMP' is a C function that implements a method.  When retrieving
+   the implementation of a method from the runtime, this is the type
+   of the pointer returned.  The idea of the definition of IMP is to
+   represent a 'pointer to a general function taking an id, a SEL,
+   followed by other unspecified arguments'.  You must always cast an
+   IMP to a pointer to a function taking the appropriate, specific
+   types for that function, before calling it - to make sure the
+   appropriate arguments are passed to it.  The code generated by the
+   compiler to perform method calls automatically does this cast
+   inside method calls.  */
 typedef id (*IMP)(id, SEL, ...); 
 
 /* 'nil' is the null object.  Messages to nil do nothing and always
@@ -135,21 +130,18 @@ typedef id (*IMP)(id, SEL, ...);
 /* TODO: Move the 'Protocol' declaration into objc/runtime.h.  A
    Protocol is simply an object, not a basic Objective-C type.  The
    Apple runtime defines Protocol in objc/runtime.h too, so it's good
-   to move it there for API compatibility.
-*/
+   to move it there for API compatibility.  */
 
 /* A 'Protocol' is a formally defined list of selectors (normally
    created using the @protocol Objective-C syntax).  It is mostly used
    at compile-time to check that classes implement all the methods
    that they are supposed to.  Protocols are also available in the
-   runtime system as Protocol objects.
- */
+   runtime system as Protocol objects.  */
 #ifndef __OBJC__
   /* Once we stop including the deprecated struct_objc_protocol.h
      there is no reason to even define a 'struct objc_protocol'.  As
      all the structure details will be hidden, a Protocol basically is
-     simply an object (as it should be).
-   */
+     simply an object (as it should be).  */
   /* typedef struct objc_object Protocol; */
   #include "deprecated/struct_objc_protocol.h"
 #else /* __OBJC__ */
@@ -158,8 +150,9 @@ typedef id (*IMP)(id, SEL, ...);
 
 /* Deprecated include - here temporarily, for backwards-compatibility
    as reval_t, apply_t, arglist_t and objc_msg_lookup() used to be
-   defined here.  */
-#include "message.h"
+   defined here.  objc_msg_lookup() is now defined in message.h,
+   included by objc-api.h or runtime.h.  */
+#include "deprecated/objc_msg_sendv.h"
 
 /* Compatibility note: the Apple/NeXT runtime defines sel_getName(),
    sel_registerName(), object_getClassName(), object_getIndexedIvars()
@@ -167,8 +160,7 @@ typedef id (*IMP)(id, SEL, ...);
 
    The reason the GNU runtime does not define them here is that they
    are not basic Objective-C types (defined in this file), but are
-   part of the runtime API (defined in runtime.h).
-*/
+   part of the runtime API (defined in runtime.h).  */
 
 #ifdef __cplusplus
 }
Index: libobjc/objc/message.h
===================================================================
--- libobjc/objc/message.h      (revision 168039)
+++ libobjc/objc/message.h      (working copy)
@@ -137,20 +137,6 @@ objc_EXPORT IMP objc_msg_lookup_super (struct objc
 objc_EXPORT IMP (*__objc_msg_forward)(SEL);
 objc_EXPORT IMP (*__objc_msg_forward2)(id, SEL);
 
-
-/* The following types and functions are provided only for
-   backwards-compatibility and should not be used in new code.  They
-   were deprecated in GCC 4.6 and will be removed in the next
-   release.  */
-typedef void* retval_t;                /* return value */
-typedef void(*apply_t)(void);  /* function pointer */
-typedef union arglist {
-  char *arg_ptr;
-  char arg_regs[sizeof (char*)];
-} *arglist_t;                  /* argument frame */
-
-objc_EXPORT retval_t objc_msg_sendv(id, SEL, arglist_t);
-
 #ifdef __cplusplus
 }
 #endif
