`DCL51-CPP`: Only reserve function names when used within the global namespace
@lcartey já está trabalhando nisso.
Desde 14/1/2024.
Avaliação
Esta issue ainda não foi avaliada.
Descrição
Affected rules
DCL51-CPP
Description
The rule currently enforces that function names defined in standard library headers are not reused in any namespace. However, a careful re-reading of the C++ standard suggests that's overly specific. [reserved.names] specifically states that the only kinds of name that are reserved are macros, "global names" and "names with external linkage". In [extern.names], the standard says:
Each global function signature declared with external linkage in a header is reserved to the implementation to designate that function signature with external linkage.
So only global function signatures are reserved, and only where they have external linkage. I think we need to do the following:
- Apply only to the global namespace
- Filter list of reserved function names by those that appear in the global namespace and have external linkage (this may already be the case).
- Match function signatures (I believe it is valid to reuse the name as long as the signature is different).
We may also need to review the rules for objects and _ prefixes.
Example
namespace MyNamespace {
void all_of(); // COMPLIANT
}
- Linguagem predominante
- CodeQL
- Estrelas
- 227
- Forks
- 82
- Merge médio
- 6d 7h
- PRs com merge (30d)
- 9
Guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de github/codeql-coding-standards
-
false positive/false negative Stardard-MISRA-C++
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
github/codeql-coding-standards#1172 ·
-
Difficulty-Low false positive/false negative false-negative Impact-Low Standard-MISRA-C
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
-
Difficulty-Medium false positive/false negative false-positive Impact-Medium Standard-CERT-C
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 48/100
github/codeql-coding-standards#1200 ·
-
`RULE-0-0-1`: "unreachable statement" false positives due to over-pruning of the control-flow graph Abertafalse positive/false negative
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 48/100
github/codeql-coding-standards#1190 ·
-
false positive/false negative
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 65/100
github/codeql-coding-standards#1175 ·