|
21 | 21 |
|
22 | 22 | import cpp |
23 | 23 | import codingstandards.c.cert |
24 | | -import codingstandards.cpp.types.Compatible |
25 | | -import ExternalIdentifiers |
| 24 | +import codingstandards.cpp.rules.incompatiblefunctiondeclaration.IncompatibleFunctionDeclaration |
26 | 25 |
|
27 | | -predicate interestedInFunctions( |
28 | | - FunctionDeclarationEntry f1, FunctionDeclarationEntry f2, ExternalIdentifiers d |
29 | | -) { |
30 | | - not f1 = f2 and |
31 | | - d = f1.getDeclaration() and |
32 | | - d = f2.getDeclaration() |
| 26 | +module IncompatibleFunctionDeclarationsCppConfig implements IncompatibleFunctionDeclarationConfigSig |
| 27 | +{ |
| 28 | + Query getQuery() { result = Declarations2Package::incompatibleFunctionDeclarationsQuery() } |
33 | 29 | } |
34 | 30 |
|
35 | | -predicate interestedInFunctions(FunctionDeclarationEntry f1, FunctionDeclarationEntry f2) { |
36 | | - interestedInFunctions(f1, f2, _) |
37 | | -} |
38 | | - |
39 | | -module FuncDeclEquiv = |
40 | | - FunctionDeclarationTypeEquivalence<TypesCompatibleConfig, interestedInFunctions/2>; |
41 | | - |
42 | | -from ExternalIdentifiers d, FunctionDeclarationEntry f1, FunctionDeclarationEntry f2 |
43 | | -where |
44 | | - not isExcluded(f1, Declarations2Package::incompatibleFunctionDeclarationsQuery()) and |
45 | | - not isExcluded(f2, Declarations2Package::incompatibleFunctionDeclarationsQuery()) and |
46 | | - interestedInFunctions(f1, f2, d) and |
47 | | - ( |
48 | | - //return type check |
49 | | - not FuncDeclEquiv::equalReturnTypes(f1, f2) |
50 | | - or |
51 | | - //parameter type check |
52 | | - not FuncDeclEquiv::equalParameterTypes(f1, f2) |
53 | | - ) and |
54 | | - // Apply ordering on start line, trying to avoid the optimiser applying this join too early |
55 | | - // in the pipeline |
56 | | - exists(int f1Line, int f2Line | |
57 | | - f1.getLocation().hasLocationInfo(_, f1Line, _, _, _) and |
58 | | - f2.getLocation().hasLocationInfo(_, f2Line, _, _, _) and |
59 | | - f1Line >= f2Line |
60 | | - ) |
61 | | -select f1, "The object $@ is not compatible with re-declaration $@", f1, f1.getName(), f2, |
62 | | - f2.getName() |
| 31 | +import IncompatibleFunctionDeclaration<IncompatibleFunctionDeclarationsCppConfig> |
0 commit comments