public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/57699] New: Disable empty parameter list misinterpretation in libstdc++ headers when !defined(NO_IMPLICIT_EXTERN_C)
@ 2013-06-24 12:12 redi at gcc dot gnu.org
  2013-06-25  4:34 ` [Bug c++/57699] " pinskia at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2013-06-24 12:12 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57699

            Bug ID: 57699
           Summary: Disable empty parameter list misinterpretation in
                    libstdc++ headers when !defined(NO_IMPLICIT_EXTERN_C)
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org

In cp/parser.c the function cp_parser_parameter_declaration_clause has:

  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;
    }

This means that on "implicit extern C" systems (ones not known to have C++
compatible libc headers) we interpret void(*)() as void(*)(...)

This might be necessary to properly handle libc headers on those systems, but
should not be enabled for libstdc++ headers (or more generally, any headers
actually written in C++) because when we write void(*)() in C++ we damn well
mean what we wrote, we shouldn't have to say void(*)(void)

This has caused problems more than once in libstdc++, where correct C++ code in
an explicit extern "C" block is misinterpreted by the front end, because
libstdc++ headers are system headers (due to the #pragma we use) and we
sometimes have to declare functions in extern "C" blocks.  The problems are not
found immediately because they only happen on less-tested targets such as AIX
and eCos:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57691
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50982#c40

It would be nice to have some way to mark libstdc++ headers to prevent the code
above returning NULL_TREE.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/57699] Disable empty parameter list misinterpretation in libstdc++ headers when !defined(NO_IMPLICIT_EXTERN_C)
  2013-06-24 12:12 [Bug c++/57699] New: Disable empty parameter list misinterpretation in libstdc++ headers when !defined(NO_IMPLICIT_EXTERN_C) redi at gcc dot gnu.org
@ 2013-06-25  4:34 ` pinskia at gcc dot gnu.org
  2013-06-29 11:05 ` bernd.edlinger at hotmail dot de
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2013-06-25  4:34 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57699

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
eCos  is open source so that should be fixed.

The easy fix for the libstdc++ headers is to use void as the argument.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/57699] Disable empty parameter list misinterpretation in libstdc++ headers when !defined(NO_IMPLICIT_EXTERN_C)
  2013-06-24 12:12 [Bug c++/57699] New: Disable empty parameter list misinterpretation in libstdc++ headers when !defined(NO_IMPLICIT_EXTERN_C) redi at gcc dot gnu.org
  2013-06-25  4:34 ` [Bug c++/57699] " pinskia at gcc dot gnu.org
@ 2013-06-29 11:05 ` bernd.edlinger at hotmail dot de
  2013-06-29 12:13 ` redi at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: bernd.edlinger at hotmail dot de @ 2013-06-29 11:05 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57699

Bernd Edlinger <bernd.edlinger at hotmail dot de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bernd.edlinger at hotmail dot de

--- Comment #3 from Bernd Edlinger <bernd.edlinger at hotmail dot de> ---
The eCos libc headers are 100% C++ compatible,
in fact the whole system is based on C++.

Is this NO_IMPLICIT_EXTERN_C define set by the
configure script? Should I make sure that the
configure script sets NO_IMPLICIT_EXTERN_C?


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/57699] Disable empty parameter list misinterpretation in libstdc++ headers when !defined(NO_IMPLICIT_EXTERN_C)
  2013-06-24 12:12 [Bug c++/57699] New: Disable empty parameter list misinterpretation in libstdc++ headers when !defined(NO_IMPLICIT_EXTERN_C) redi at gcc dot gnu.org
  2013-06-25  4:34 ` [Bug c++/57699] " pinskia at gcc dot gnu.org
  2013-06-29 11:05 ` bernd.edlinger at hotmail dot de
@ 2013-06-29 12:13 ` redi at gcc dot gnu.org
  2013-07-26  7:27 ` bernd.edlinger at hotmail dot de
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2013-06-29 12:13 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57699

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Bernd Edlinger from comment #3)
> Is this NO_IMPLICIT_EXTERN_C define set by the
> configure script?

It's set by headers under gcc/config/

> Should I make sure that the
> configure script sets NO_IMPLICIT_EXTERN_C?

Yes, but whether eCos defines it is not really relevant to this PR, which is
about the general feature not whether it's used on a given platform or not.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/57699] Disable empty parameter list misinterpretation in libstdc++ headers when !defined(NO_IMPLICIT_EXTERN_C)
  2013-06-24 12:12 [Bug c++/57699] New: Disable empty parameter list misinterpretation in libstdc++ headers when !defined(NO_IMPLICIT_EXTERN_C) redi at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2013-06-29 12:13 ` redi at gcc dot gnu.org
@ 2013-07-26  7:27 ` bernd.edlinger at hotmail dot de
  2013-07-26  8:13 ` redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: bernd.edlinger at hotmail dot de @ 2013-07-26  7:27 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57699

--- Comment #5 from Bernd Edlinger <bernd.edlinger at hotmail dot de> ---
Well, if a portable O/S like eCos would need such special treatment,
the NO_IMPLICIT_EXTERN_C should not be bound to the target architecture,
it would be far more appropriate to define the NO_IMPLICIT_EXTERN_C
from the configure command line instead.

Actually I would have expected that some fixinclude scripts should
be able to fix this kind of coding errors in the header files.

Are you sure we still need that kind of hack ?


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/57699] Disable empty parameter list misinterpretation in libstdc++ headers when !defined(NO_IMPLICIT_EXTERN_C)
  2013-06-24 12:12 [Bug c++/57699] New: Disable empty parameter list misinterpretation in libstdc++ headers when !defined(NO_IMPLICIT_EXTERN_C) redi at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2013-07-26  7:27 ` bernd.edlinger at hotmail dot de
@ 2013-07-26  8:13 ` redi at gcc dot gnu.org
  2013-07-26  8:41 ` bernd.edlinger at hotmail dot de
  2021-08-15 11:53 ` pinskia at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2013-07-26  8:13 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57699

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Bernd Edlinger from comment #5)
> Well, if a portable O/S like eCos would need such special treatment,

eCos doesn't need it


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/57699] Disable empty parameter list misinterpretation in libstdc++ headers when !defined(NO_IMPLICIT_EXTERN_C)
  2013-06-24 12:12 [Bug c++/57699] New: Disable empty parameter list misinterpretation in libstdc++ headers when !defined(NO_IMPLICIT_EXTERN_C) redi at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2013-07-26  8:13 ` redi at gcc dot gnu.org
@ 2013-07-26  8:41 ` bernd.edlinger at hotmail dot de
  2021-08-15 11:53 ` pinskia at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: bernd.edlinger at hotmail dot de @ 2013-07-26  8:41 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57699

--- Comment #7 from Bernd Edlinger <bernd.edlinger at hotmail dot de> ---
(In reply to Jonathan Wakely from comment #6)
> (In reply to Bernd Edlinger from comment #5)
> > Well, if a portable O/S like eCos would need such special treatment,
> 
> eCos doesn't need it

Of course. In that case, it would be much better, to be able to *disable*
the implicit extern "C" feature for X86 and ARM and whatever architecture,
just because I certainly know it when I call configure.

To my surprise a cross compiler for --target=arm-eabi has a completely
different syntax in the system headers than one for --target=i686-pc-linux-gnu.

In my eyes, configuring that somewhere in gcc/config is awkward in that
use case. Do you see my point?


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug c++/57699] Disable empty parameter list misinterpretation in libstdc++ headers when !defined(NO_IMPLICIT_EXTERN_C)
  2013-06-24 12:12 [Bug c++/57699] New: Disable empty parameter list misinterpretation in libstdc++ headers when !defined(NO_IMPLICIT_EXTERN_C) redi at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2013-07-26  8:41 ` bernd.edlinger at hotmail dot de
@ 2021-08-15 11:53 ` pinskia at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-15 11:53 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57699

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |9.0
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #9 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This was removed in GCC 9 by r9-2724.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-08-15 11:53 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-24 12:12 [Bug c++/57699] New: Disable empty parameter list misinterpretation in libstdc++ headers when !defined(NO_IMPLICIT_EXTERN_C) redi at gcc dot gnu.org
2013-06-25  4:34 ` [Bug c++/57699] " pinskia at gcc dot gnu.org
2013-06-29 11:05 ` bernd.edlinger at hotmail dot de
2013-06-29 12:13 ` redi at gcc dot gnu.org
2013-07-26  7:27 ` bernd.edlinger at hotmail dot de
2013-07-26  8:13 ` redi at gcc dot gnu.org
2013-07-26  8:41 ` bernd.edlinger at hotmail dot de
2021-08-15 11:53 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).