Re: [PATCH 2/2] add support for -fdiagnostic-prefix[=prefix]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 12/06/18 17:43, Luc Van Oostenryck wrote:
> On Tue, Jun 12, 2018 at 04:25:39PM +0100, Ramsay Jones wrote:
>>
>>
>> On 11/06/18 03:00, Luc Van Oostenryck wrote:
>>> When using sparse it's common to compile a file and directly
>>> run sparse on the same file, like it is done for the kernel.
>>> In this case, error messages from sparse are interspersed with
>>> those from the compiler. It's thus not always easy to know from
>>> which tools they come.
>>>
>>> Fix this by allowing to prefix all the diagnostic messages
>>> by some configurable string, by default "sparse". More exactly,
>>> an error message that was emitted like:
>>> 	file.c:<line>:<col>: error: this is invalid code
>>> can now be emitted as:
>>> 	file.c:<line>:<col>: sparse: error: this is invalid code
>>>
>>> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
>>> ---
>>>  lib.c                     | 22 +++++++++++++++++++---
>>>  sparse.1                  |  6 ++++++
>>>  validation/fdiag-prefix.c | 11 +++++++++++
>>>  3 files changed, 36 insertions(+), 3 deletions(-)
>>>  create mode 100644 validation/fdiag-prefix.c
>>
>> Don't you need to filter this out in cgcc, so that you don't
>> pass this option on to gcc? (ie, add this to the regex in the
>> 'check_only_option' subroutine).
> 
> Maybe yes but OTOH, I'm not really sure about it.
> I thought that cgcc was theer to use sparse transparently:

Indeed.

> instead of using gcc you use cgcc et voila. In this case
> the options given to cgcc are the same ypu would pass to gcc

I only have quick access to gcc-5 documentation, but I am not
seeing -fdiagnostic-prefix as an option supported by gcc.

> itself and thus won't contains sparse-specific options.

when using cgcc (without -no-compile), sparse is run over the
source (with all given options - sparse and gcc options) and
then (assuming no errors etc.,) gcc is then run _minus_ the
sparse specific options. The filtering of the sparse specific
options is done in the 'check_only_options' subroutine.

[Yes, I've been meaning to change that to 'sparse_only_options']

ATB,
Ramsay Jones


--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux