clang-tidy v. -Weffc++
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Keine Sprachdaten
- Sterne
- 110
- Forks
- 17
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
Context
Recent versions of clang-tidy added readability-redundant-member-init: https://clang.llvm.org/extra/clang-tidy/checks/readability-redundant-member-init.html
This is handy! When a class member has a default initializer it is redundent to initialize it in the member list.
But, because some types don't have default initializers, forgetting to initialize them in the member list (or using c++11 initialization in the class definition) can lead to serious trouble like mapbox/wagyu#69 - refs mapbox/wagyu#70.
So, this is the reason, at https://github.com/mapbox/cpp/issues/37#issuecomment-336200744, that we recommend using g++ and the -Weffc++ flag because it can catch this (note, clang++ plus -Weffc++ cannot):
-Weffc++ - useful when building with g++ (does not do much with clang++). With g++ it can catch uninitialized class members and prevent crashes like mapbox/wagyu#69 - refs mapbox/wagyu#70
Problem
-Weffc++will warn on all class members not explicitly initialized in the initializer listclang-tidywill automatically remove variables from the initializer list that have default constructors
So, the two will fight: causing each other warnings. For this reason I think we should likely:
- let clang-tidy win
- recommend no longer using g++ with
-Weffc++ - figure out what alternative way we can catch when members, without default initializers, are uninitialized (without needing to use
-Weffc++). Maybe anotherclang-tidycheck?
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginnen Sie mit der Dokumentation zu clang-tidy's readability-redundant-member-init und den verknüpften Diskussionen mapbox/cpp#37, wagyu#69 und wagyu#70; es ist keine Repository-Datei oder kein Test angegeben. Bestimmen Sie einen abgestimmten Ansatz für -Weffc++, die clang-tidy-Anleitung und das Erkennen nicht initialisierter Member; als abgeschlossen gilt die Aufgabe, wenn eine dokumentierte Empfehlung und Konfiguration vorliegen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- cpp
- Bereich
- tooling
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 30/100