public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/107008] New: Combine config/os/*/error_constants.h into one file
@ 2022-09-22 10:33 redi at gcc dot gnu.org
  2022-09-22 10:38 ` [Bug libstdc++/107008] " redi at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2022-09-22 10:33 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 107008
           Summary: Combine config/os/*/error_constants.h into one file
           Product: gcc
           Version: 12.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
  Target Milestone: ---

There's no reason to have multiple files and select one for the target:

config/os/djgpp/error_constants.h
config/os/generic/error_constants.h
config/os/mingw32-w64/error_constants.h
config/os/mingw32/error_constants.h

We can just ensure the generic one has a #ifdef for every errno macro that
isn't present on all targets, and use that everywhere.

Once we only have one error_constants.h file for all targets, we can also make
it work for freestanding like so:

#if _GLIBCXX_HOSTED
#include <cerrno>
namespace std {
  enum class errc
    {
      address_family_not_supported =            EAFNOSUPPORT,
      address_in_use =                          EADDRINUSE,    
      // ...
    };
}
#else
namespace std {
  // For freestanding we have no <errno.h> but also no errors from the OS,
  // so we can just make up our own values for the library's purposes.
  enum class errc
    {
      address_family_not_supported = 1,
      address_in_use, 
      // ...
    };
}
#endif


This will allow a freestanding <charconv> to use std::errc.

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

end of thread, other threads:[~2022-09-22 10:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-22 10:33 [Bug libstdc++/107008] New: Combine config/os/*/error_constants.h into one file redi at gcc dot gnu.org
2022-09-22 10:38 ` [Bug libstdc++/107008] " redi at gcc dot gnu.org
2022-09-22 10:44 ` redi at gcc dot gnu.org
2022-09-22 10:45 ` redi 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).