compiler-warnings (C/C++): -Wshadow=global is -Wshadow, -Weverything includes everything, -Wno-pedantic negates warning_level's -Wpedantic; "found" and "missing" lines contradict

Ouverte
#247 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
3/5
Temps estimé
1-2 jours
Accessibilité débutants
45/100
Type d'issue
Bug
Clarté
Plutôt claire
Activité
Active
Stack technique
c, cmake, cpp, python

Piste de recherche

Start with the compiler-warnings check in the validator's Python source, looking at how it matches flag names such as -Wshadow and how it builds the "missing" and "found" messages. Reproduce the three cases from the corpus entries for nlohmann/json, fmtlib/fmt and GNOME/glib under corpus/. Done when -Wshadow=global, -Weverything and -Wno-pedantic are handled correctly and the fmt messages no longer contradict each other.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

nlohmann/json: FAIL "missing -Wshadow" though GCC gets -Wshadow=global/-Wshadow=local and Clang -Weverything; glib: -Wpedantic credited from Meson warning_level=3 although the project adds -Wno-pedantic; fmt: "missing -Wshadow for gcc; /W4 for msvc" directly above "found -Wall -Wextra -Wpedantic -Wshadow -Wconversion /W4" (per-compiler conditions not reflected in the wording).

Evidence from the corpus audit

nlohmann/json / compiler-warnings
  • kind: FALSE_NEGATIVE
  • actual: FAIL: "C/C++: missing compiler warning flags: -Wshadow for appleclang and clang and gcc and intel"
    ("found -Wall -Wextra -Wpedantic -Wconversion /W4 /permissive-")
  • expected: PASS for C/C++: GCC gets -Wshadow=global (a superset spelling of -Wshadow) and -Wshadow=local,
    Clang/AppleClang get -Weverything, which includes -Wshadow and every other warning.
  • evidence: cmake/gcc_flags.cmake:281-283: -Wshadow=compatible-local / -Wshadow=global / -Wshadow=local;
    cmake/clang_flags.cmake:16-18: set(CLANG_CXXFLAGS / -Werror / -Weverything; cmake/ci.cmake:80-81:
    include(clang_flags) / include(gcc_flags) (the ci_test_gcc/ci_test_clang targets CI builds via
    .github/workflows/ubuntu.yml:32 run: cmake --build build --target ci_test_gcc). The validator already credits
    -Wpedantic/-Wconversion from these same files, so it reads them; it just matches -Wshadow literally.
  • repro: target_compile_options(t PRIVATE -Wall -Wextra -Wpedantic -Wshadow=global -Wconversion) for gcc and
    -Weverything for clang; expect PASS.
  • confidence: high
fmtlib/fmt / compiler-warnings
  • kind: MESSAGE
  • actual: FAIL: "missing compiler warning flags: -Wshadow for gcc; /W4, /permissive- for msvc" and on the next line
    "found -Wall -Wextra -Wpedantic -Wshadow -Wconversion"
  • expected: the status is right (GCC < 5 and MSVC /W3 lack them) but the two lines contradict each other; say
    "-Wshadow for gcc only when CMAKE_CXX_COMPILER_VERSION >= 5.0" or list "found" per compiler.
  • evidence: CMakeLists.txt:180-189: if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) / set(PEDANTIC_COMPILE_FLAGS
    ... -Wshadow); :212 (Clang branch) -Wshadow; :225: set(PEDANTIC_COMPILE_FLAGS /W3).
  • repro: -Wshadow added only under a VERSION_LESS condition; expect the message to name the condition.
  • confidence: medium
GNOME/glib / compiler-warnings
  • kind: FALSE_POSITIVE
  • actual: FAIL: "... missing compiler warning flags: -Wshadow, -Wconversion ..." with detail "C/C++: found -Wall -Wextra -Wpedantic /W4"
  • expected: -Wpedantic should not be credited: warning_level=3 implies it, but the project adds -Wno-pedantic explicitly.
  • evidence: meson.build:7: 'warning_level=3',; meson.build:608-610: # Due to function casts through (void*) we cannot support -Wpedantic: / # ./docs/toolchain-requirements.md#Function_pointer_conversions. / '-Wno-pedantic',.
  • repro: project('x', 'c', default_options: ['warning_level=3']) + add_project_arguments('-Wno-pedantic', language: 'c').
  • confidence: medium

Found by the regression-corpus audit (235 real repositories, one or more per ecosystem profile; corpus and expected results in corpus/). Evidence is quoted from the audited checkouts at the commits pinned in corpus/projects.toml; <checkouts>/<owner>__<repo> is such a checkout.

🤖 Generated with Claude Code

https://claude.ai/code/session_01ByTXNqDWdM7HzezrFtEvQt

Langage dominant
Python
Étoiles
4
Forks
1
Merge moyen
10 h 41 min
PR mergées (30 j)
79

Préparer son environnement

Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de cpp-best-practices/project_validator

Toutes les issues de cpp-best-practices/project_validator

Issues similaires

Plus d'issues Python

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.