Bug 279692 - '#include <csetjmp>' is broken: error: "If libc++ starts defining <setjmp.h>, the __has_include check should move to libc++'s <setjmp.h>"
Summary: '#include <csetjmp>' is broken: error: "If libc++ starts defining <setjmp.h>,...
Status: Closed Not A Bug
Alias: None
Product: Base System
Classification: Unclassified
Component: misc (show other bugs)
Version: 14.0-STABLE
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-toolchain (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-06-12 08:46 UTC by Yuri Victorovich
Modified: 2024-06-12 09:35 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.