This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Need to correct the function declaration.


On 7 November 2011 07:09, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
> On 7 November 2011 03:02, James Dennett wrote:
>> On Sun, Nov 6, 2011 at 6:55 PM, niXman wrote:
>>> When I try to build gcc-trunk on OpenBSD-5.0(gcc-4.2.1), I get the
>>> following error:
>>>> gcc-4.6.2/i686-pc-openbsd5.0/libstdc++-v3/include/mutex:818:64: error:
>>>> ? invalid conversion from 'void (*)(...)' to 'void (*)()' [-fpermissive]
>>>
>>> Please add the void into arguments list for function __once_proxy();,
>>> in file mutex:799.
>>
>> This source file is C++, not C, and so adding "void' should be a no-op.
>>
>> What makes you believe that this is the problem? ?Could you show the
>> line where the error occurs?
>
> Same problem on AIX:
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50982#c36
>
> I have no idea why that makes a difference, but I can check in the change.

This seems to be caused by the "implicit extern C" hack used on
platforms without C++-clean headers:

/* Parse a parameter-declaration-clause.

   parameter-declaration-clause:
     parameter-declaration-list [opt] ... [opt]
     parameter-declaration-list , ...

   Returns a representation for the parameter declarations.  A return
   value of NULL indicates a parameter-declaration-clause consisting
   only of an ellipsis.  */

static tree
cp_parser_parameter_declaration_clause (cp_parser* parser)
...
  else if (token->type == CPP_CLOSE_PAREN)
    /* There are no parameters.  */
    {
#ifndef NO_IMPLICIT_EXTERN_C
      if (in_system_header && current_class_type == NULL
          && current_lang_name == lang_name_c)
        return NULL_TREE;
      else
#endif
        return void_list_node;
    }


I suppose I'd better change libstdc++ to use the abominable (void)
parameter list, but I'll also open a bug report, it should be obvious
to G++ that a function explicitly declared extern "C" doesn't need the
implicit extern "C" rules.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]