-
Notifications
You must be signed in to change notification settings - Fork 362
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PC-Lint Plus new rules #2085 #2210
PC-Lint Plus new rules #2085 #2210
Conversation
Added new PC-Lint Plus rules to implement changes SonarOpenCommunity#2085
Updated total rules count to implement change SonarOpenCommunity#2085
@Vishal-Gaikwad thx, I will have a look |
@guwirth Please let me know if anything else is pending from my side. I hope the review approval has to be done by you. If not then please let me know the next step. |
@Vishal-Gaikwad looks good but I need some time to do the final merge. Meanwhile you can use this https://ci.appveyor.com/project/SonarOpenCommunity/sonar-cxx/builds/39794679/artifacts |
Hello @Vishal-Gaikwad, thanks a lot for your PR. I had some time to look into it now. In some of the added XML blocks you have to escape signs with HTML entities (see comments below): e.g. line 19 column 14 - Warning: unescaped & or unknown entity "&a" wrong: g(&a);
right: g(&a); You can use a page like this one to support you: https://www.htmlescape.net/htmlescape_tool.html ('### CHECK ', '/home/travis/build/SonarOpenCommunity/sonar-cxx/cxx-sensors/src/main/resources/pclint.xml')
('### TIDY ', '/tmp/2601.ruledump')
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>L2601: passing address of auto variable symbol to parameter integer of function symbol</title>
</head>
<body>
<p>A pointer to automatic storage was passed as an argument to a function parameter with the no_ptr_to_auto
semantic. Note that during a specific walk this message is not limited to local variables in the immediate
function performing the call, for example:</p>
<pre><code>
1 //lint -sem(save, no_ptr_to_auto(1))
2 void save(int* p);
3 void g(int* x) {
4 save(x);
5 }
6 void f(void) {
7 int a = 5;
8 g(&a);
9 }
</code></pre>
<p>will report:</p>
<p> 4 warning 2601: passing address of auto variable ’a’ to parameter 1 of
function ’save’
save(x);
^</p>
<p> 8 supplemental 894: during specific walk g(&(5))
g(&a);
^
</p><h2>References</h2>
<p><a href="https://wiki.sei.cmu.edu/confluence/display/c/POS34-C.+Do+not+call+putenv%28%29+with+a+pointer+to+an+automatic+variable+as+the+argument"
target="_blank">POS34-C. Do not call putenv() with a pointer to an automatic variable as the argument</a></p>
</body>
</html>
### ERR
line 19 column 14 - Warning: unescaped & or unknown entity "&a"
line 28 column 13 - Warning: unescaped & or unknown entity "&a"
('### TIDY ', '/tmp/2765.ruledump')
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>L2765: reference to variable symbol which is neither atomic nor volatile sig_atomic_t within signalhandler-category symbol</title>
</head>
<body>
<p>A signal handler referenced a non-local variable that was not _Atomic, std::atomic<T>, nor volatile
sig_atomic_t. This is likely to cause undefined behavior.</p><h2>References</h2>
<p><a href="https://wiki.sei.cmu.edu/confluence/display/c/SIG31-C.+Do+not+access+shared+objects+in+signal+handlers"
target="_blank">SIG31-C. Do not access shared objects in signal handlers</a></p>
</body>
</html>
### ERR
line 8 column 91 - Error: <t> is not recognized!
line 8 column 91 - Warning: discarding unexpected <t>
('### TIDY ', '/tmp/9415.ruledump')
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>L9415: 'auto' variable symbol initialized using 'string' list initialization</title>
</head>
<body>
<p>Initializing an auto variable using list initialization can result in unexpected and compiler-dependent results.
Additionally, the rules governing the type deduced when using list initialization with auto variables changed
in C++17 which can result in code that has different meaning depending on the target language of the
compiler. For example:</p>
<pre><code>
auto j1{1}; // direct list initialization
// j1 is std::initializer_list<int> in C++11 and int in C++17
auto j2 = {1}; // copy list initialization
// j2 is always std::initializer_list<int>
auto j3 = 1; // copy initialization - NOT list initialization
// j3 is always int
</code></pre>
<p>This message will be issued for the initialization of j1 and j2. Avoiding list initialization for auto variables
can prevent unintended results. The string parameter is either ’direct’ or ’copy’ indicating the type of list
initialization employed (copy list initialization uses an equal sign, direct list initialization does not).</p>
</body>
</html>
### ERR
line 14 column 55 - Error: <int> is not recognized!
line 14 column 55 - Warning: discarding unexpected <int>
line 16 column 62 - Error: <int> is not recognized!
line 16 column 62 - Warning: discarding unexpected <int> Regards, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see comments
Creating PR to add PC-Lint Plus new rules to implement #2085
This change is