Patchwork [Darwin] Suppress build warnings about struct cl_decoded_option.

login
register
mail settings
Submitter IainS
Date Dec. 17, 2010, 2:34 p.m.
Message ID <6C9F7F5D-9CCA-4978-B3DD-ECF2854CAAF7@sandoe-acoustics.co.uk>
Download mbox | patch
Permalink /patch/75903/
State New
Headers show

Comments

IainS - Dec. 17, 2010, 2:34 p.m.
On 17 Dec 2010, at 12:41, Joseph S. Myers wrote:

> On Fri, 17 Dec 2010, Paolo Bonzini wrote:
>
>> On 12/17/2010 11:22 AM, IainS wrote:
>>> Index: gcc/config/darwin.h
>>> ===================================================================
>>> --- gcc/config/darwin.h (revision 167881)
>>> +++ gcc/config/darwin.h (working copy)
>>> @@ -963,10 +968,10 @@ __enable_execute_stack (void *addr)
>>>
>>> #define TARGET_HAS_TARGETCM 1
>>>
>>> -extern void darwin_driver_init (unsigned int  
>>> *decoded_options_count,
>>> - struct cl_decoded_option **decoded_options);
>>
>> Can't you just add a "struct cl_decoded_option;" forward reference  
>> before the
>> extern?
>
> The place for such forward references is in coretypes.h, not random
> individual source files.  And indeed such a declaration is already  
> there.
> So if the warnings are from files not including coretypes.h, the  
> missing
> coretypes.h includes should be added (after config.h and system.h,  
> before
> any other headers are included).  Or if the issue is that this  
> declaration
> in coretypes.h is under "#ifndef USED_FOR_TARGET" and the warnings are
> building code for the target, then the prototype in darwin.h should  
> also
> be conditioned on "#ifndef USED_FOR_TARGET".

the latter, thanks,
Iain

priorities.  */
  #undef SUPPORTS_INIT_PRIORITY
Mike Stump - Dec. 17, 2010, 9:01 p.m.
Thanks.  I agree that simple things like this should just be fixed and are obvious.

Patch

Index: gcc/config/darwin.h
===================================================================
--- gcc/config/darwin.h	(revision 167976)
+++ gcc/config/darwin.h	(working copy)
@@ -963,10 +968,11 @@  __enable_execute_stack (void *addr)

  #define TARGET_HAS_TARGETCM 1

-extern void darwin_driver_init (unsigned int *decoded_options_count,
-				struct cl_decoded_option **decoded_options);
+#ifndef USED_FOR_TARGET
+extern void darwin_driver_init (unsigned int *,struct  
cl_decoded_option **);
  #define GCC_DRIVER_HOST_INITIALIZATION \
    darwin_driver_init (&decoded_options_count, &decoded_options)
+#endif

  /* The Apple assembler and linker do not support constructor