mapbox / mapbox/cpp

Recommendations for enabling more compiler checks

オープン
#37 コメント 5 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
言語のデータがありません
スター
110
フォーク
17
PR マージ指標
30日以内にマージされた PR はありません

説明

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:

1) 🍇 Which flags we should always enable for all code no matter what?

2) 🍊 What additional flags may be very useful in some scenarios/some code bases?

3) 🍏 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?

4) 🍎 What compiler specific flags should we recommend (that only currently work for clang++ or g++)?

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、clang++ 4.x における積極的な警告(-Wconversion と -Weverything を含む)について、issue にある4つの質問を確認します。どの flags が広く有用なのか、シナリオ依存なのか、コンパイラ固有なのかを調査し、その後、明確な推奨事項を文書化して、小規模なプロジェクトでどのように適用できるかを説明します。警告に関する指針が4つの質問すべてに答えられれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
cpp
領域
compilers
issue の種類
ドキュメント
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。