Commit 4f90a782 authored by Christian Dietrich's avatar Christian Dietrich
Browse files

plugin/bugfix: don't ignore extern definition

In C you can have extern definition and declaration in one place:

extern void foo() {
 ...
}

These must not be ignored.
parent 7f70209e
Pipeline #3051 passed with stage
in 0 seconds
......@@ -60,9 +60,8 @@ void HashVisitor::hashDecl(const Decl *D) {
}
if (const auto FD = dyn_cast<FunctionDecl>(Child)) {
if (FD->getStorageClass() == StorageClass::SC_Extern ||
FD->getStorageClass() == StorageClass::SC_PrivateExtern ||
!FD->isThisDeclarationADefinition()) {
// We try to avoid hashing of declarations that have no definition
if (! FD->isThisDeclarationADefinition()) {
bool doHashing = false;
// look for alias attribute. if alias, hash, else ignore
if (FD->hasAttrs()) {
......
extern void lua_strtonum() {} {{A}}
extern void lua_stringtonum() {} {{B}}
extern void lua_strtonum() {} {{C}}
void unused_prototype(); {{C}}
extern void lua_strtonum() {} {{D}}
extern void unused_prototype(); {{D}}
extern void lua_strtonum() {} {{E}}
void unused_prototype(); {{E}}
void unused_prototype() {} {{E}}
extern void lua_strtonum() {} {{F}}
void unused_prototype() {} {{F}}
extern void lua_strtonum() {} {{G}}
extern void unused_prototype() {} {{G}}
/*
* check-name: function name and extern
* assert-obj: A != B
* assert-ast: A == C, C == D, D != E, E == F
* obj-not-diff: maybe
*/
......@@ -245,7 +245,7 @@ def run_testcase_helper(test_case_opts, future):
results = {}
for variant in variants:
for variant in sorted(variants):
source_file = "{basename}.{variant}.var{ext}".format(
basename=basename,
variant=variant,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment