public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/58952] New: Construct "std::getchar()" rejected when getchar is macro in C library
@ 2013-11-01  2:51 michael at talamasca dot ocis.net
  2013-11-01 10:36 ` [Bug libstdc++/58952] " redi at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: michael at talamasca dot ocis.net @ 2013-11-01  2:51 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 58952
           Summary: Construct "std::getchar()" rejected when getchar is
                    macro in C library
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: michael at talamasca dot ocis.net

On my system, the following C++ code refuses to compile:

#include <cstdio>

int foo (void)
{
     return std::getchar();
}

The immediate cause is that getchar() is a macro in my underlying C library
(uClibc-0.9.33.2).  Changing it to (std::getchar)() works.

Looking at the /usr/include/c++/4.8.2/cstdio file, there are a number of #undef
directives apparently intended to prevent similar problems with other stdio
functions.  But there is no #undef for getchar.


GNU automake's test suite uses this construct as part of a test to make sure
that a C++ file generated using yacc actually reaches a C++ compiler and not a
C one.


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

* [Bug libstdc++/58952] Construct "std::getchar()" rejected when getchar is macro in C library
  2013-11-01  2:51 [Bug libstdc++/58952] New: Construct "std::getchar()" rejected when getchar is macro in C library michael at talamasca dot ocis.net
@ 2013-11-01 10:36 ` redi at gcc dot gnu.org
  2013-11-01 10:36 ` redi at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2013-11-01 10:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
That's a bug in uclibc, it should be a function (not a macro) in C++


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

* [Bug libstdc++/58952] Construct "std::getchar()" rejected when getchar is macro in C library
  2013-11-01  2:51 [Bug libstdc++/58952] New: Construct "std::getchar()" rejected when getchar is macro in C library michael at talamasca dot ocis.net
  2013-11-01 10:36 ` [Bug libstdc++/58952] " redi at gcc dot gnu.org
@ 2013-11-01 10:36 ` redi at gcc dot gnu.org
  2013-11-01 10:48 ` paolo.carlini at oracle dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2013-11-01 10:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Oh sorry, I didn't read your report properly - so we're missing the #undef that
would fix it


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

* [Bug libstdc++/58952] Construct "std::getchar()" rejected when getchar is macro in C library
  2013-11-01  2:51 [Bug libstdc++/58952] New: Construct "std::getchar()" rejected when getchar is macro in C library michael at talamasca dot ocis.net
  2013-11-01 10:36 ` [Bug libstdc++/58952] " redi at gcc dot gnu.org
  2013-11-01 10:36 ` redi at gcc dot gnu.org
@ 2013-11-01 10:48 ` paolo.carlini at oracle dot com
  2013-11-01 11:11 ` paolo at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-11-01 10:48 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2013-11-01
           Assignee|unassigned at gcc dot gnu.org      |paolo.carlini at oracle dot com
   Target Milestone|---                         |4.8.3
     Ever confirmed|0                           |1

--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Weird that nobody noticed for so many years. Let's add the undef.


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

* [Bug libstdc++/58952] Construct "std::getchar()" rejected when getchar is macro in C library
  2013-11-01  2:51 [Bug libstdc++/58952] New: Construct "std::getchar()" rejected when getchar is macro in C library michael at talamasca dot ocis.net
                   ` (2 preceding siblings ...)
  2013-11-01 10:48 ` paolo.carlini at oracle dot com
@ 2013-11-01 11:11 ` paolo at gcc dot gnu.org
  2013-11-01 11:17 ` paolo.carlini at oracle dot com
  2013-11-01 11:17 ` paolo at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: paolo at gcc dot gnu.org @ 2013-11-01 11:11 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> ---
Author: paolo
Date: Fri Nov  1 11:10:55 2013
New Revision: 204291

URL: http://gcc.gnu.org/viewcvs?rev=204291&root=gcc&view=rev
Log:
2013-11-01  Paolo Carlini  <paolo.carlini@oracle.com>

    PR libstdc++/58952
    * include/c_global/cstdio: Undef getchar.

Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/include/c_global/cstdio


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

* [Bug libstdc++/58952] Construct "std::getchar()" rejected when getchar is macro in C library
  2013-11-01  2:51 [Bug libstdc++/58952] New: Construct "std::getchar()" rejected when getchar is macro in C library michael at talamasca dot ocis.net
                   ` (4 preceding siblings ...)
  2013-11-01 11:17 ` paolo.carlini at oracle dot com
@ 2013-11-01 11:17 ` paolo at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: paolo at gcc dot gnu.org @ 2013-11-01 11:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> ---
Author: paolo
Date: Fri Nov  1 11:16:56 2013
New Revision: 204292

URL: http://gcc.gnu.org/viewcvs?rev=204292&root=gcc&view=rev
Log:
2013-11-01  Paolo Carlini  <paolo.carlini@oracle.com>

    PR libstdc++/58952
    * include/c_global/cstdio: Undef getchar.

Modified:
    branches/gcc-4_8-branch/libstdc++-v3/ChangeLog
    branches/gcc-4_8-branch/libstdc++-v3/include/c_global/cstdio


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

* [Bug libstdc++/58952] Construct "std::getchar()" rejected when getchar is macro in C library
  2013-11-01  2:51 [Bug libstdc++/58952] New: Construct "std::getchar()" rejected when getchar is macro in C library michael at talamasca dot ocis.net
                   ` (3 preceding siblings ...)
  2013-11-01 11:11 ` paolo at gcc dot gnu.org
@ 2013-11-01 11:17 ` paolo.carlini at oracle dot com
  2013-11-01 11:17 ` paolo at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-11-01 11:17 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
           Assignee|paolo.carlini at oracle dot com    |unassigned at gcc dot gnu.org

--- Comment #6 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Fixed mainline and 4.8.3.


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

end of thread, other threads:[~2013-11-01 11:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-01  2:51 [Bug libstdc++/58952] New: Construct "std::getchar()" rejected when getchar is macro in C library michael at talamasca dot ocis.net
2013-11-01 10:36 ` [Bug libstdc++/58952] " redi at gcc dot gnu.org
2013-11-01 10:36 ` redi at gcc dot gnu.org
2013-11-01 10:48 ` paolo.carlini at oracle dot com
2013-11-01 11:11 ` paolo at gcc dot gnu.org
2013-11-01 11:17 ` paolo.carlini at oracle dot com
2013-11-01 11:17 ` paolo 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).