Recommendations for enabling more compiler checks
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Không có dữ liệu ngôn ngữ
- Star
- 110
- Fork
- 17
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
Compilers enable by default, a set of warnings they will emit on dodgy or less-than-ideal code. These defaults:
- a. change over time
- b. vary between compiler versions
- c. do not include some of the most valuable warnings that might help prevent bugs
This issue is designed to focus on the problem of c from the perspective of the latest clang++ 4.x versions.
Enabling more warnings than compilers do by default can be an important way of catching bugs early. For example integer truncation bugs can often be detected by enabling -Wconversion, which is not on by default.
Enabling more warnings is very difficult to do after a project is big (e.g. https://github.com/Project-OSRM/osrm-backend/pull/4495 and https://github.com/mapnik/mapnik/issues/2907 and https://github.com/mapnik/mapnik/issues/3204). It is best not to wait and rather to start a project with aggressive warnings from the beginning.
So, the question then becomes: what is a good set of aggressive warnings to enable at the start of a project (or to try to integrate into existing projects)?
In particular:
-
🍇 Which flags we should always enable for all code no matter what?
-
🍊 What additional flags may be very useful in some scenarios/some code bases?
-
🍏 For small projects where it is feasible, can we actually start with
clang++s-Weverything? This, when feasible, might be ideal. How to do it? -
🍎 What compiler specific flags should we recommend (that only currently work for clang++ or g++)?
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu bằng cách xem xét bốn câu hỏi của issue về các cảnh báo quá nghiêm ngặt trong clang++ 4.x, bao gồm -Wconversion và -Weverything. Nghiên cứu các flags nào hữu ích trong nhiều trường hợp, phụ thuộc vào kịch bản hoặc đặc thù của compiler, sau đó ghi lại một khuyến nghị rõ ràng và giải thích cách các dự án nhỏ có thể áp dụng chúng; công việc được hoàn thành khi hướng dẫn về cảnh báo trả lời cả bốn câu hỏi.
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
- Tài liệu
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Cần làm rõ
- Mức phù hợp với người mới
- 25/100