From mboxrd@z Thu Jan 1 00:00:00 1970 From: George Dunlap Subject: Re: [PATCH v5] coverity: Store the modelling file in the source tree. Date: Fri, 24 Jan 2014 17:24:58 +0000 Message-ID: <52E2A1EA.2020203@eu.citrix.com> References: <1390487303-31765-1-git-send-email-andrew.cooper3@citrix.com> <52E131AB.7020603@eu.citrix.com> <52E132EE.2030101@citrix.com> <52E29A35.9060205@eu.citrix.com> <52E29B6D.6070208@citrix.com> <52E29BE6.6050601@eu.citrix.com> <52E29CAE.8050701@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <52E29CAE.8050701@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Andrew Cooper Cc: Keir Fraser , Ian Campbell , Tim Deegan , Ian Jackson , Xen-devel , Jan Beulich List-Id: xen-devel@lists.xenproject.org On 01/24/2014 05:02 PM, Andrew Cooper wrote: > On 24/01/14 16:59, George Dunlap wrote: >> On 01/24/2014 04:57 PM, Andrew Cooper wrote: >>> On 24/01/14 16:52, George Dunlap wrote: >>>> On 01/23/2014 03:19 PM, Andrew Cooper wrote: >>>>> On 23/01/14 15:13, George Dunlap wrote: >>>>>> On 01/23/2014 02:28 PM, Andrew Cooper wrote: >>>>>>> Signed-off-by: Andrew Cooper >>>>>>> CC: Keir Fraser >>>>>>> CC: Jan Beulich >>>>>>> CC: Tim Deegan >>>>>>> CC: Ian Campbell >>>>>>> CC: Ian Jackson >>>>>>> CC: George Dunlap >>>>>>> >>>>>>> --- >>>>>>> >>>>>>> George: >>>>>>> This is just documentation, and it would be nice to include >>>>>>> it as >>>>>>> part of >>>>>>> the 4.4 release. >>>>>>> --- >>>>>>> misc/coverity_model.c | 98 >>>>>>> +++++++++++++++++++++++++++++++++++++++++++++++++ >>>>>>> 1 file changed, 98 insertions(+) >>>>>>> create mode 100644 misc/coverity_model.c >>>>>>> >>>>>>> diff --git a/misc/coverity_model.c b/misc/coverity_model.c >>>>>>> new file mode 100644 >>>>>>> index 0000000..418d25e >>>>>>> --- /dev/null >>>>>>> +++ b/misc/coverity_model.c >>>>>>> @@ -0,0 +1,98 @@ >>>>>>> +/* Coverity Scan model >>>>>>> + * >>>>>>> + * This is a modelling file for Coverity Scan. Modelling helps to >>>>>>> avoid false >>>>>>> + * positives. >>>>>>> + * >>>>>>> + * - A model file can't import any header files. >>>>>>> + * - Therefore only some built-in primitives like int, char and >>>>>>> void >>>>>>> are >>>>>>> + * available but not NULL etc. >>>>>>> + * - Mode-ling doesn't need full structs and typedefs. Rudimentary >>>>>>> structs >>>>>>> + * and similar types are sufficient. >>>>>>> + * - An uninitialized local pointer is not an error. It signifies >>>>>>> that the >>>>>>> + * variable could be either NULL or have some data. >>>>>>> + * >>>>>>> + * Coverity Scan doesn't pick up modifications automatically. The >>>>>>> model file >>>>>>> + * must be uploaded by an admin in the analysis. >>>>>> So this file isn't compiled; it's manually uploaded as part of the >>>>>> coverity scanning process; and could be provided out-of-band, but >>>>>> it's >>>>>> just convenient to put it in the tree, particularly if any of these >>>>>> things should change as things go forward. (Hence comparing it to >>>>>> documentation.) Is that right? >>>>>> >>>>>> -George >>>>>> >>>>> Correct. I believe internally Coverity compiles it (at least to an >>>>> AST), but that is completely opaque to users of Scan. >>>> Right; I have a hard time coming up with a compelling reason to wait >>>> for this one. >>>> >>>> Release-acked-by: George Dunlap >>>> >>>> The name of the file might be a bit confusing though, if people think >>>> it is supposed to be compliled... would it make sense maybe to call it >>>> ".txt", and include some instructions at the top with a line that says >>>> "---- cut here 8< ---" or something? >>>> >>>> -George >>> Not really - Coverity uses the file extension to work out how to >>> interpret the modelling file. ".c" is correct here, and will cause >>> smart text editors to apply proper syntax highlighting. >>> >>> Alternates are .cpp and .java, depending on the primary language of the >>> project. >> Yes, I assumed that *coverity* needs it to be a .c. But it doesn't >> need to be a .c file in the xen tree -- the instructions could say, >> "Place the text below into a file named coverity_model.c". >> >> -George > This file was deliberately placed in a brand new directory, away from > any Makefiles which might try to compile it for this reason. > > Requiring users to post-process this file just to help prevent someone > from accidentally trying to compile it seems crazy IMO. The worst that > happens is that someone tries to compile it and it fails to compile. Right, well a directory named "misc" probably won't remain empty for long. :-) I'd prefer Ian's suggestion of misc/coverity/, or maybe just coverity/; but I'm not too particular about it. (And the consensus seems to be that .c shoud be fine, so I'll go along with that too.) -George