Attempting to compile a 32-bit C++ program that uses fcntl.h or sys/ioctl.h if _TIME_BITS=64 results in an error related to exception handling. Sample code: #include <fcntl.h> int main(void) { return 0; } Compile with: g++ -m32 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_TIME_BITS=64 -c test.cpp Results: In file included from /usr/include/features.h:488, from /usr/include/fcntl.h:25, from test.cpp:1: /usr/include/fcntl.h:191:41: error: expected initializer before ‘noexcept’ 191 | __fcntl_time64) __THROW; | ^~~~~~~ /usr/include/fcntl.h:193:41: error: expected initializer before ‘noexcept’ 193 | __fcntl_time64) __THROW; | ^~~~~~~ The same code does compile if built as C code instead of as C++. Software versions: OS: Gentoo Linux Arch: amd64 (Intel Core i7-3520M) Compiler: gcc-11.1.0 glibc: 2.34
Fixed for 2.35 via: commit c87fcacc50505d550f1bb038382bcc7ea73a5926 Author: Florian Weimer <fweimer@redhat.com> Date: Fri Aug 6 09:51:38 2021 +0200 Linux: Fix fcntl, ioctl, prctl redirects for _TIME_BITS=64 (bug 28182) __REDIRECT and __THROW are not compatible with C++ due to the ordering of the __asm__ alias and the throw specifier. __REDIRECT_NTH has to be used instead. Fixes commit 8a40aff86ba5f64a3a84883e539cb67b ("io: Add time64 alias for fcntl"), commit 82c395d91ea4f69120d453aeec398e30 ("misc: Add time64 alias for ioctl"), commit b39ffab860cd743a82c91946619f1b8158 ("Linux: Add time64 alias for prctl"). Reviewed-by: Carlos O'Donell <carlos@redhat.com>