Truthfully, it does sort of, ProC pre-compiler coverts C code that has embedded SQL into pure C code.
The issue:
This ProC process will create some structs and variables before all your code in a filename.c file. At the top of your code, but not the top of this new file.
It is nice enough to set a #line 1 "orginalfname.sc" and it will do the same before/after sql statements because it is referencing the original file name.
The problem:
Occurs when cppcheck finds issue with the generated code that comes before all your code. Also, at times, it forgets the #line numbers and uses the absolute line numbers.
Tried it with cppcheck 2.8 and it still didn't work. It seems to ignore the directive at times and give you absolute line numbers. At other times, it seems like the "filename" given from the line directive is forgotten or it uses the wrong one.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Truthfully, it does sort of, ProC pre-compiler coverts C code that has embedded SQL into pure C code.
The issue:
This ProC process will create some structs and variables before all your code in a filename.c file. At the top of your code, but not the top of this new file.
It is nice enough to set a #line 1 "orginalfname.sc" and it will do the same before/after sql statements because it is referencing the original file name.
The problem:
Occurs when cppcheck finds issue with the generated code that comes before all your code. Also, at times, it forgets the #line numbers and uses the absolute line numbers.
Sample code:
main.sc (with errors)
main.c (generated)
main.cppcheck (cppcheck results)
Commands to generate:
Ideally:
I wouldn't mind the errors, but I would like to place a line at the top of the generated C file like so (manually is fine):
and still says all errors, warnings, etc are found in main.sc
Last edit: Luis Cortes 2022-06-08
Can you check what happens if you use gcc-compliant markers.
Instead of:
I think it should say:
Tried it with cppcheck 2.8 and it still didn't work. It seems to ignore the directive at times and give you absolute line numbers. At other times, it seems like the "filename" given from the line directive is forgotten or it uses the wrong one.
I am not sure I understand exactly what you want but I do see that it does not work well.
The issue I can see:
Reduced code:
And the error that is written is:
main.sc:21:12: error: Null pointer dereference: ptr [nullPointer]
The line number should be 16.
I have created this issue: https://github.com/danmar/simplecpp/issues/263