switch missing default label warning under clang
- Ngôn ngữ chính
- C++
- Star
- 26
- Fork
- 58
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
When compiling under clang 19.1.7 with werror and a number of other flags (we run with most warnings enabled), the line https://github.com/boostorg/function/blob/develop/include/boost/function/function_base.hpp#L147 is flagged with `error: switch missing default label [-Werror,-Wswitch-default]`. Given this is based on the enum at https://github.com/boostorg/function/blob/f6b538dbed2e3047dcbd09eb3f5c7f1ffa90d0a9/include/boost/function/function_base.hpp#L105 and all cases are handled a pr has not been provided at this time. I see two approaches, one is doing a compiler warning suppression and the other is adding the default label with a throw or similar as it should be an unreachable place based on the current code. The suppression seems like the simpler answer but may cause a future update to the enum to be missed here while the throw would prevent that at the cost of potentially changing behavior if something is flagged nothrow. Happy to submit a PR but would need guidance no how it should be approached here.
Env:
Alma 9.6
Boost 1.88.0 via cmake
clang 19.1.7
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Hướng nghiên cứu
Đọc include/boost/function/function_base.hpp quanh enum ở dòng 105 và switch ở dòng 147, sau đó tái hiện cảnh báo bằng clang 19.1.7 và các cờ cảnh báo được báo cáo. Kiểm tra hướng dẫn của dự án trước khi chọn giữa việc suppression và một trường hợp default, đồng thời xem issue là hoàn tất khi lỗi -Wswitch-default được báo cáo không còn xảy ra mà không làm thay đổi hành vi ngoài ý muốn.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- cpp
- Lĩnh vực
- compilers
- Loại issue
- Lỗi
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 45/100