aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDetlef Vollmann <dv@vollmann.ch>2024-07-23 09:25:22 +0100
committerJonathan Wakely <redi@gcc.gnu.org>2024-07-23 10:25:36 +0100
commit8439405e38c56b774cf3c65bdafae5f9e11d470a (patch)
tree6675d736cf6614714ffe9da05b60cc0302e7229a
parentb9cefd67a2a464a3c9413e6b3f28e7dc7a9ef162 (diff)
downloadgcc-8439405e38c56b774cf3c65bdafae5f9e11d470a.zip
gcc-8439405e38c56b774cf3c65bdafae5f9e11d470a.tar.gz
gcc-8439405e38c56b774cf3c65bdafae5f9e11d470a.tar.bz2
libstdc++: Do not use isatty on avr [PR115482]
avrlibc has an incomplete unistd.h that doesn't have isatty. So building libstdc++ fails when compiling c++23/print.cc. As a workaround I added a check for AVR. libstdc++-v3/ChangeLog: PR libstdc++/115482 * src/c++23/print.cc (__open_terminal) [__AVR__]: Do not use isatty.
-rw-r--r--libstdc++-v3/src/c++23/print.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/libstdc++-v3/src/c++23/print.cc b/libstdc++-v3/src/c++23/print.cc
index 99a19cd..558dc149 100644
--- a/libstdc++-v3/src/c++23/print.cc
+++ b/libstdc++-v3/src/c++23/print.cc
@@ -75,7 +75,7 @@ namespace
#ifdef _WIN32
if (int fd = ::_fileno(f); fd >= 0)
return check_for_console((void*)_get_osfhandle(fd));
-#elifdef _GLIBCXX_HAVE_UNISTD_H
+#elif defined _GLIBCXX_HAVE_UNISTD_H && ! defined __AVR__
if (int fd = (::fileno)(f); fd >= 0 && ::isatty(fd))
return f;
#endif
@@ -100,7 +100,7 @@ namespace
#ifdef _WIN32
if (auto fb = dynamic_cast<filebuf*>(sb))
return check_for_console(fb->native_handle());
-#elifdef _GLIBCXX_HAVE_UNISTD_H
+#elif defined _GLIBCXX_HAVE_UNISTD_H && ! defined __AVR__
if (auto fb = dynamic_cast<filebuf*>(sb))
if (int fd = fb->native_handle(); fd >= 0 && ::isatty(fd))
return ::fdopen(::dup(fd), "w"); // Caller must call fclose.