On Tue, 4 Oct 2022 at 19:05, Jonathan Wakely wrote: > > On Tue, 4 Oct 2022 at 17:51, Jonathan Wakely via Libstdc++ > wrote: > > > > Does anybody see any issues with generating the list of error numbers at > > build time? > > > > > > -- >8 -- > > > > Instead of having several very similar target-specific headers with > > slightly different sets of enumerators, generate the error_constants.h > > file as part of the build. This ensures that all enumerators are always > > defined, with the value from the corresponding errno macro if present, > > or a libstdc++-specific alternative value. > > > > The libstdc++-specific values will be values greater than the positive > > integer _GLIBCXX_ERRC_ORIGIN, which defaults to 9999 but can be set in > > os_defines.h if a more suitable value exists for the OS (e.g. ELAST > > could be used for BSD targets). > ... > > +${CXXCPP} -P -D_POSIX_C_SOURCE=200809L -x c++ "$constants_h" \ > > + | sed -e '1,/^GLIBCXX ERROR CONSTANTS BELOW HERE$/d' \ > > + >> "$output_h" || exit $? > > Gah, this is the wrong version of the script! It's supposed to replace > unexpanded EXXX tokens with __LINE__ (which is why #line is used to > set the origin) but I seem to have committed the wrong version. > > Let me dig that out of my git reflog ... I was looking on the wrong machine. Here's the working patch that expands undefined EXXX constants to __LINE__, which has been offset by the _GLIBCXX_ERRC_ORIGIN value.