Searching for variable definitions in C++ source files
Hello,
Will the Coccinelle software become able to find variable definitions also within C++ source code by the following script variant for the semantic patch language?
https://gitlab.inria.fr/coccinelle/coccinelle/-/issues/22
SmPL script:
@display@
identifier x;
@@
*RPC x(...);
C++ source file excerpt:
// deleted part
// See also:
// https://github.com/BOINC/boinc/blob/44295c1a50d84e44992d97b9e949700d3b9af2d1/lib/gui_rpc_client.cpp#L262
int RPC_CLIENT::authorize(const char* passwd) {
bool found=false, authorized;
int retval, n;
char nonce[256], nonce_hash[256], buf[1024];
RPC rpc(this);
XML_PARSER xp(&rpc.fin);
// deleted part
return ERR_AUTHENTICATOR;
}// deleted part
Regards,
Markus
Quoted 7 lines · Markus Elfring
Hello,
Will the Coccinelle software become able to find variable definitions also within C++ source code by the following script variant for the semantic patch language?
https://gitlab.inria.fr/coccinelle/coccinelle/-/issues/22
Quoted 5 lines
SmPL script:
@display@
identifier x;
@@
*RPC x(...);
Some dy we will be able to parse more of C++. This will not happen immediately.
julia
Quoted 21 lines
C++ source file excerpt:
// deleted part
// See also:
// https://github.com/BOINC/boinc/blob/44295c1a50d84e44992d97b9e949700d3b9af2d1/lib/gui_rpc_client.cpp#L262int RPC_CLIENT::authorize(const char* passwd) { bool found=false, authorized; int retval, n; char nonce[256], nonce_hash[256], buf[1024]; RPC rpc(this); XML_PARSER xp(&rpc.fin); // deleted part return ERR_AUTHENTICATOR; }// deleted part
Regards,
Markus
Quoted 6 lines
Quoted 4 lines
@display@
identifier x;
@@
*RPC x(...);Some dy we will be able to parse more of C++.
Is the current Coccinelle software status so far that the search for variables (where a constructor initialisation is applied) is not supported?
https://en.cppreference.com/w/cpp/language/definition
https://en.cppreference.com/w/cpp/language/constructor#Example
Regards,
Markus
Quoted 11 lines · Markus Elfring
Quoted 6 lines
Quoted 4 lines
@display@
identifier x;
@@
*RPC x(...);Some dy we will be able to parse more of C++.
Is the current Coccinelle software status so far that the search for variables (where a constructor initialisation is applied) is not supported?
https://en.cppreference.com/w/cpp/language/definition
https://en.cppreference.com/w/cpp/language/constructor#Example
I don't understand the question, but I think that the parenthesis notation of C++ causes a severe parser conflict.
julia
Quoted 7 lines
Quoted 4 lines
Is the current Coccinelle software status so far that the search for variables (where a constructor initialisation is applied) is not supported?
https://en.cppreference.com/w/cpp/language/definition
https://en.cppreference.com/w/cpp/language/constructor#ExampleI don't understand the question, but I think that the parenthesis notation of C++ causes a severe parser conflict.
Can source code like “RPC rpc(this);” be interpreted in the way that a macro call would be applied there?
Regards,
Markus
Quoted 10 lines · Markus Elfring
Quoted 7 lines
Quoted 4 lines
Is the current Coccinelle software status so far that the search for variables (where a constructor initialisation is applied) is not supported?
https://en.cppreference.com/w/cpp/language/definition
https://en.cppreference.com/w/cpp/language/constructor#ExampleI don't understand the question, but I think that the parenthesis notation of C++ causes a severe parser conflict.
Can source code like “RPC rpc(this);” be interpreted in the way that a macro call would be applied there?
It is indeed a parser conflict with function calls. I don't think it matters whether it would be a function call or a macro call.
julia
Quoted 4 lines
Quoted 2 lines
Can source code like “RPC rpc(this);” be interpreted in the way that a macro call would be applied there?
It is indeed a parser conflict with function calls.
Will the chances grow to support such an use case better?
Regards,
Markus