Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to use PC-Lint with MPLAB X or MPLAB IDE with XC8 Compiler.

Status
Not open for further replies.

xpress_embedo

Advanced Member level 4
Joined
Jul 5, 2011
Messages
1,154
Helped
161
Reputation
396
Reaction score
189
Trophy points
1,353
Location
India
Activity points
10,591

Not used PC-Lint, but I have used splint for some projects (only C). Its independent of the compiler.
 
Thanks.
But i need to use PC-Lint, i will try PC_lint forum and i am also reading there manual
 

Once you have installed PC-Lint and its associated plugin in MPLABX, you must properly configure the plugin via:

Tools->Options

Embedded Tab

PC-Lint Tab

Then open a source code file, right click within file view and select "Lint this File."
 
Once you have installed PC-Lint and its associated plugin in MPLABX, you must properly configure the plugin via:

Tools->Options

Embedded Tab

PC-Lint Tab
Done upto this part, but don't know the configuration file generated is correct or not.
Can you please tell the way to create configuration file using config tool, for pic XC8 compiler.


Then open a source code file, right click within file view and select "Lint this File."
Thanks for this, i hadn't seen this, will try this.
 

I believe there are configuration files supplied with the plugin, although that assumption maybe incorrect.

Once it is properly configured and the analysis started by the right click, "PC-Lint this File," there should be a PC-Lint tab available in the Output Window at the bottom of the IDE which displays the results.


BigDog
 
Yes there is a config file supplied with installation directory, its name is co-pic18.lnt

Here is the snapshot of my configuration setting in MPLAB X IDE

config.PNG

After this, i created a simple project in which this is written in main file.


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
/* 
 * File:   main.c
 * Author: 
 *
 * Created on May 25, 2015, 8:58 PM
 */
 
#include <xc.h>
void main()
{
}



When using Lint this file, i get this output

Code:
Execution Command:C:\lint\lint-nt.exe C:\lint\lnt\co-pic18.lnt -t2 -"format=%(%f:%l: %)%t %n: %m" -width(0,4) -i"C:/Users/Sharma/Desktop/pclint/StaticAnalysis.X" -i"C:\lint\lnt" "C:\lint\lnt\co-pic18.lnt" "C:/Users/Sharma/Desktop/pclint/StaticAnalysis.X/main.c"  


PC-lint for C/C++ (NT) Vers. 9.00a, Copyright Gimpel Software 1985-2008


Error 314: Previously used .lnt file: C:\lint\lnt\co-pic18.lnt

Log File Created

What do i understand this by previously used lint file.

- - - Updated - - -

Sorry i provided path in command option.

Now i removed it and now i am getting error, can't open <xc.h> file.
 

Finally its working now, but there are some problem which are still there.
I learned a lot about using this in this thread https://www.microchip.com/forums/m865957.aspx
Those guys who are facing the same issue can learn from the above thread.

But i still had an issue, here is my std.lnt file


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Microchip MPLAB XC8 C, -si4 -sp4, 
// Standard lint options
au-sm12.lnt
co-xc8.lnt
-d__PICC__
-d_16F877A
-d__PICCPRO__
-d_PIC14
C:\lint\options.lnt -si4 -sp4
-i"C:\Program Files\Microchip\xc8\v1.31\include"
-i"C:\Program Files\Microchip\xc8\v1.31\include\legacy"
-i"C:\Program Files\Microchip\xc8\v1.31\include\plib"
// -esym(40,TRISB, PORTB)
// -e40 // suppress undeclared identifier
-e63 // suppress Expected an lvalue
-e716 // suppress while(1) error
-e783 // suppress line doesn't end with new line



But now i am getting more errors related to assembly code in pic header files.
This log is very big, i am sharing little part of this.
Please suggest what can i do in this case.


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
asm("INDF equ 00h");
C:\Program Files\Microchip\xc8\v1.31\include\pic16f877a.h:49: Error 19: Useless Declaration
 _
asm("TMR0 equ 01h");
C:\Program Files\Microchip\xc8\v1.31\include\pic16f877a.h:55: Error 19: Useless Declaration
 _
asm("PCL equ 02h");
C:\Program Files\Microchip\xc8\v1.31\include\pic16f877a.h:61: Error 19: Useless Declaration
 _
asm("STATUS equ 03h");
C:\Program Files\Microchip\xc8\v1.31\include\pic16f877a.h:67: Error 19: Useless Declaration
 _
asm("FSR equ 04h");
C:\Program Files\Microchip\xc8\v1.31\include\pic16f877a.h:154: Error 19: Useless Declaration
 _
asm("PORTA equ 05h");
C:\Program Files\Microchip\xc8\v1.31\include\pic16f877a.h:160: Error 19: Useless Declaration



Please help what i am doing wrong in this case.
 

Hello!! Everyone,
I am using this in my code


Code C - [expand]
1
2
3
4
5
6
7
8
typedef enum _Man_e
{
MAN_LED_1 = 0,
MAN_LED_2,
MAN_UART_TX,
MAN_UART_RX,
MAN_MAX // must be last
} Man_e;



Now i haven't declared anything with Man_e in my code, but had used it in functions like this:
boolean Man_Active(Man_Error_e* p_error, Man_e e_task);

But Strange thing is that, i am getting error while Linting my Code, which is as follow:


Code C - [expand]
1
2
3
4
5
6
7
} Man_e;
D:\Dropbox\Projects\PC-Lint\ManManager\ManManager.X\config\Manman_cfg.h:19: Error 129: declaration expected, identifier 'Man_e' ignored
D:\Dropbox\Projects\PC-Lint\ManManager\ManManager.X\config\Manman_cfg.h:19: Error 19: Useless Declaration
                                                       _
boolean ManMan_Active (TM_Error_e* p_error, Man_e e_Man);
D:\Dropbox\Projects\PC-Lint\ManManager\ManManager.X\Service\Manman\Manman.h:54: Error 49: Expected a type
D:\Dropbox\Projects\PC-Lint\ManManager\ManManager.X\Service\Manman\Manman.h:54: Error 49: Expected a type



Due to these two errors i am getting rest of the errors, can anyone please tell me why, this is happening with enumerated types.
Error 129: declaration expected, identifier 'Man_e' ignored
Error 19: Useless Declaration
 

It's difficult to tell with the limited code snippets, could you zip and upload your project files so that I and others may take a closer look?

You will need to use the Advanced Reply Page (Go Advanced button), as there is currently a bug when attempting to upload the Manage Attachment feature under the Quick Reply box.

You might also temporarily disable Lint to determine if the warnings/errors are due strictly to Lint or an underlying compiler/code issue.

I do not currently have neither installed nor access to Lint at the moment, therefore my troubleshooting will only be from the viewpoint of the XC8 compiler and your code.

BigDog
 
Mine Bad Luck.
I can't upload the whole code.
Its big, and sharing will put me in trouble.
 

Can you post or upload the header files which are directly related to the warning/error messages?

Did you disable Lint to see if these warning/error messages are specific only to Lint?


BigDog
 
Okay I will extract some files which is giving this error and will upload it here.

My Compiler is working fine, even the application is working properly, this is an old code which i want to lint now.
newbie in the field of linting.

PC-Lint is giving these errors.
I will upload a smaller cut down version of my code.
 

I've compiled and reviewed your code and as you've indicated no errors or possible syntactically or semantically suspicious code appear to be present.

Therefore, the PC-Lint seems to be the issue here, with what settings are you currently running the PC-Lint code analysis?

Under its current settings, PC-Lint does not appear to fully check and analyze any previous typedef enum declarations, instead choosing to ignore them and thus being unable to discern any type declarations which utilize these previously declared typedef enum types.

Therefore, as the warning/error messages from PC-Lint indicated issues with any declarations which utilize previous valid typedef enums:

Reference: PC-Lint Messages

Error 129:
129 declaration expected, identifier 'Symbol' ignored -- In a
context in which a declaration was expected an identifier
was found. Moreover, the identifier was not followed by
'(' or a '['

Error 19:
19 Useless Declaration -- A type appeared by itself without
an associated variable, and the type was not a struct and
not a union and not an enum. A double semi-colon can
cause this as in:

int x;;

Error 49:
49 Expected a type -- Only types are allowed within
prototypes. A prototype is a function declaration with a
sequence of types within parentheses. The processor is at
a state where it has detected at least one type within
parentheses and so is expecting more types or a closing
right parenthesis.




Reference: PC-lint/FlexeLint Strong Type Checking
Although you may struggle hard to produce meaningful typedef names for all your various int options the compiler will generally ignore these names for type-checking purposes. Lint options -strong and -index will enable typedef-based type checking. For a detailed discussion, see Strong Type Checking

Reference: FlexeLint: A Modern Static Analyzer for C and C++
Strong Type Checking
Fully customizable strong type checking using typedefs. Strong checking can be enabled on all or only specified typedefs. Typedef hierarchies can be created and printed. Dimensional Analysis allows establishing relationships between typedefs that involve division or multiplication of types to create new types.



There appears to be several similar issues posed throughout the Internet, concerning the way PC-Lint handles typedef enum declarations and their later use in declarations, particularly in function prototypes parameter/argument lists. You might try modifying the current settings to either increase the depth of analysis or disable these specific code checks for typedef enum declarations and use.

You might also try breaking these typedef enum declarations into two parts, first declare the enum and then declare the typedef using the previous declared enum, however that would certainly be a bit redundant. It would probably be more prudent to simply disable these particular messages.

I also came across the following PDF which might be of interest:

How to wield PC Lint


BigDog
 
Thanks for your reply, i am reading all these documents and post which you mentioned in your post.

I found a person facing the same error, on this post.
**broken link removed**

He solved this by adding +linebuf but my problem is not solved yet.

Therefore, the PC-Lint seems to be the issue here, with what settings are you currently running the PC-Lint code analysis?
Are you asking for the settings??
I am uploading my lint files here.
View attachment lint.zip
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top