Bug 279692

Summary: '#include <csetjmp>' is broken: error: "If libc++ starts defining <setjmp.h>, the __has_include check should move to libc++'s <setjmp.h>"
Product: Base System Reporter: Yuri Victorovich <yuri>
Component: miscAssignee: freebsd-toolchain (Nobody) <toolchain>
Status: Closed Not A Bug    
Severity: Affects Only Me CC: dim, salvadore
Priority: ---    
Version: 14.0-STABLE   
Hardware: Any   
OS: Any   

Description Yuri Victorovich freebsd_committer freebsd_triage 2024-06-12 08:46:16 UTC
This simple program can't be compiled on 14.1:
#include <csetjmp>

int main() {
}

$ c++ x.cpp 
In file included from x.cpp:2:
/usr/include/c++/v1/csetjmp:40:6: error: "If libc++ starts defining <setjmp.h>, the __has_include check should move to libc++'s <setjmp.h>"
   40 | #    error "If libc++ starts defining <setjmp.h>, the __has_include check should move to libc++'s <setjmp.h>"
      |      ^
1 error generated.


The error message doesn't explain what is wrong with the program.

The C++ standard says that <csetjmp> should be included for the C++ feature std::jmp_buf.

See here: https://en.cppreference.com/w/cpp/utility/program/jmp_buf
Comment 1 Dimitry Andric freebsd_committer freebsd_triage 2024-06-12 09:30:27 UTC
I can't reproduce this on freshly installed 14.1-RELEASE. The program compiles just fine. How have you installed your system?
Comment 2 Lorenzo Salvadore freebsd_committer freebsd_triage 2024-06-12 09:32:07 UTC
I had a similar issue recently on CURRENT. In my case the cause was that I had built base from sources forgetting to run "make delete-old". After running it everything was fixed.
Comment 3 Dimitry Andric freebsd_committer freebsd_triage 2024-06-12 09:35:31 UTC
(In reply to Lorenzo Salvadore from comment #2)
Ah yes, this is because the old copy of /usr/include/c++/v1/setjmp.h must be deleted upon an upgrade. A fresh install will never have this issue.