Patchwork PING [PR46902/46912] Re: [Patch] Fix PR46916/46902

login
register
mail settings
Submitter IainS
Date Jan. 7, 2011, 9:19 p.m.
Message ID <A1EBDB19-EBE1-42FB-9A09-95AE4B1DFAAC@sandoe-acoustics.co.uk>
Download mbox | patch
Permalink /patch/77918/
State New
Headers show

Comments

IainS - Jan. 7, 2011, 9:19 p.m.
On 7 Jan 2011, at 18:08, Richard Guenther wrote:
>>>
>>> Index: gcc/plugin.c
>>> ===================================================================
>>> --- gcc/plugin.c        (revision 167973)
>>> +++ gcc/plugin.c        (working copy)
>>> @@ -21,16 +21,19 @@ along with GCC; see the file COPYING3.  If not  
>>> see
>>>   APIs described in doc/plugin.texi.  */
>>>
>>> #include "config.h"
>>> -#include "system.h"
>>>
>>> /* If plugin support is not enabled, do not try to execute any code
>>>   that may reference libdl.  The generic code is still compiled in  
>>> to
>>>   avoid including too many conditional compilation paths in the rest
>>> -   of the compiler.  */
>>> +   of the compiler.
>>> +
>>> +   We must include system headers before "system.h" or the override
>>> +   for bool might be upset. */
>>> #ifdef ENABLE_PLUGIN
>>> #include <dlfcn.h>
>>> #endif
>>>
>>> +#include "system.h"
>
> Hmm.  dlfcn should be included from system.h instead.

ah, that wasn't an obvious route to me - since it will affect all  
users of system.h, rather than just plugins.

However ... like so?
(passes plugin.exp=* on ppc-darwin9, thus solving the bug, full reg- 
test pending)

Iain
Richard Guenther - Jan. 8, 2011, 2:53 p.m.
On Fri, Jan 7, 2011 at 10:19 PM, IainS <developer@sandoe-acoustics.co.uk> wrote:
>
> On 7 Jan 2011, at 18:08, Richard Guenther wrote:
>>>>
>>>> Index: gcc/plugin.c
>>>> ===================================================================
>>>> --- gcc/plugin.c        (revision 167973)
>>>> +++ gcc/plugin.c        (working copy)
>>>> @@ -21,16 +21,19 @@ along with GCC; see the file COPYING3.  If not see
>>>>  APIs described in doc/plugin.texi.  */
>>>>
>>>> #include "config.h"
>>>> -#include "system.h"
>>>>
>>>> /* If plugin support is not enabled, do not try to execute any code
>>>>  that may reference libdl.  The generic code is still compiled in to
>>>>  avoid including too many conditional compilation paths in the rest
>>>> -   of the compiler.  */
>>>> +   of the compiler.
>>>> +
>>>> +   We must include system headers before "system.h" or the override
>>>> +   for bool might be upset. */
>>>> #ifdef ENABLE_PLUGIN
>>>> #include <dlfcn.h>
>>>> #endif
>>>>
>>>> +#include "system.h"
>>
>> Hmm.  dlfcn should be included from system.h instead.
>
> ah, that wasn't an obvious route to me - since it will affect all users of
> system.h, rather than just plugins.
>
> However ... like so?
> (passes plugin.exp=* on ppc-darwin9, thus solving the bug, full reg-test
> pending)

Yes.  Ok if it passes bootstrap.

Thanks,
Richard.

> Iain
>
> Index: gcc/system.h
> ===================================================================
> --- gcc/system.h        (revision 168582)
> +++ gcc/system.h        (working copy)
> @@ -583,6 +583,11 @@ extern int vsnprintf(char *, size_t, const char *,
>  # endif
>  #endif
>
> +#if defined (ENABLE_PLUGIN) && defined (HAVE_DLFCN_H)
> +/* If plugin support is enabled, we could use libdl.  */
> +#include <dlfcn.h>
> +#endif
> +
>  /* Get libiberty declarations.  */
>  #include "libiberty.h"
>
> Index: gcc/plugin.c
> ===================================================================
> --- gcc/plugin.c        (revision 168582)
> +++ gcc/plugin.c        (working copy)
> @@ -22,15 +22,6 @@ along with GCC; see the file COPYING3.  If not see
>
>  #include "config.h"
>  #include "system.h"
> -
> -/* If plugin support is not enabled, do not try to execute any code
> -   that may reference libdl.  The generic code is still compiled in to
> -   avoid including too many conditional compilation paths in the rest
> -   of the compiler.  */
> -#ifdef ENABLE_PLUGIN
> -#include <dlfcn.h>
> -#endif
> -
>  #include "coretypes.h"
>  #include "diagnostic-core.h"
>  #include "tree.h"
>
>
IainS - Jan. 9, 2011, 12:43 p.m.
On 8 Jan 2011, at 14:53, Richard Guenther wrote:

> On Fri, Jan 7, 2011 at 10:19 PM, IainS <developer@sandoe-acoustics.co.uk 
> > wrote:
>>
>> On 7 Jan 2011, at 18:08, Richard Guenther wrote:
>>>>>
>>
>> However ... like so?
>> (passes plugin.exp=* on ppc-darwin9, thus solving the bug, full reg- 
>> test
>> pending)
>
> Yes.  Ok if it passes bootstrap.

thanks,
bootstrapped x86_64-linux, ppc/i686-darwin9 & x86_64-darwin10.
applied as r168611.
Iain

Patch

Index: gcc/system.h
===================================================================
--- gcc/system.h	(revision 168582)
+++ gcc/system.h	(working copy)
@@ -583,6 +583,11 @@  extern int vsnprintf(char *, size_t, const char *,
  # endif
  #endif

+#if defined (ENABLE_PLUGIN) && defined (HAVE_DLFCN_H)
+/* If plugin support is enabled, we could use libdl.  */
+#include <dlfcn.h>
+#endif
+
  /* Get libiberty declarations.  */
  #include "libiberty.h"

Index: gcc/plugin.c
===================================================================
--- gcc/plugin.c	(revision 168582)
+++ gcc/plugin.c	(working copy)
@@ -22,15 +22,6 @@  along with GCC; see the file COPYING3.  If not see

  #include "config.h"
  #include "system.h"
-
-/* If plugin support is not enabled, do not try to execute any code
-   that may reference libdl.  The generic code is still compiled in to
-   avoid including too many conditional compilation paths in the rest
-   of the compiler.  */
-#ifdef ENABLE_PLUGIN
-#include <dlfcn.h>
-#endif
-
  #include "coretypes.h"
  #include "diagnostic-core.h"
  #include "tree.h"