Skip to content

Commit

Permalink
libstdc++: Do not use isatty on avr [PR115482]
Browse files Browse the repository at this point in the history
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.

(cherry picked from commit 8439405)
  • Loading branch information
Detlef Vollmann authored and jwakely committed Jul 23, 2024
1 parent 084768c commit 5fad887
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libstdc++-v3/src/c++23/print.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down

0 comments on commit 5fad887

Please sign in to comment.