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

            Bug ID: 82452
           Summary: <stdio.h> defines macros for getc and putc
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
  Target Milestone: ---

#include <stdio.h>
#ifdef getc
# error getc defined as macro
#endif
#ifdef putc
# error putc defined as macro
#endif

prog.cc:3:3: error: #error getc defined as macro
 # error getc defined as macro
   ^~~~~
prog.cc:6:3: error: #error putc defined as macro
 # error putc defined as macro
   ^~~~~

There are probably lots of other functions (in <stdio.h> and other C headers)
with the same problem.

Either we need to create our own <stdio.h> wrapper and then #include_next the C
one, or get libc to stop defining those macros for C++.

Creating the wrapper would work better (for all C libraries) but when we did
that for <stdlib.h> and <math.h> we broke lots of (invalid) code.

I'm inclined to do nothing.

Reply via email to