[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-sparse
Subject:    Re: [PATCH 3/3 v4] Add Wall_off switch to disable errors and warnings
From:       Tony Camuso <tcamuso () redhat ! com>
Date:       2016-01-13 14:39:45
Message-ID: 569661B1.9030903 () redhat ! com
[Download RAW message or body]

On 01/04/2016 08:19 PM, Luc Van Oostenryck wrote:
> On Mon, Aug 03, 2015 at 12:35:59PM -0400, Tony Camuso wrote:
>> Disable all error reporting. Useful when semantic parsing checks are
>> being done elsewhere or all you need is a tokenizer.
>>
>> Signed-off-by: Tony Camuso <tcamuso@redhat.com>
>> ---
>>   lib.c | 27 +++++++++++++++++++++++----
>>   lib.h |  1 +
>>   2 files changed, 24 insertions(+), 4 deletions(-)
>>
>> diff --git a/lib.c b/lib.c
>> index 8dc5bcf..08f6a6b 100644
>> --- a/lib.c
>> +++ b/lib.c
>
> ...
>
>> @@ -130,6 +135,12 @@ void info(struct position pos, const char * fmt, ...)
>>   static void do_error(struct position pos, const char * fmt, va_list args)
>>   {
>>   	static int errors = 0;
>> +
>> +	if (Wall_off) {
>> +		max_warnings = 0;
>> +		return;
>> +	}
>> +
>
> Is this really needed?
> The same check in do_warn should be enough to quiet all messages, isn't it?

I'll test again to be certain, but IIRC, I needed it there, too.
If I don't need it there, I will drop it in a new version of the
patch.

>
>> @@ -479,6 +491,13 @@ static char **handle_onoff_switch(char *arg, char **next, const struct warning w
>>   	char *p = arg + 1;
>>   	unsigned i;
>>
>> +	if (!strcmp(p, "all_off")) {
>> +		for (i = 0; i < n; i++)
>> +			*warnings[i].flag = WARNING_FORCE_OFF;
>> +		Wall_off = 1;
>> +		return NULL;
>> +	}
>> +
>
> Can't you simply set max_warnings to 0 already here
> instead of doing it in do_warn()?

Yes, I will do that. It does make more sense in that block.

>> @@ -127,6 +127,7 @@ extern int Wtypesign;
>>   extern int Wundef;
>>   extern int Wuninitialized;
>>   extern int Wvla;
>> +extern int Wall_off;
>
> I think it should be better to use a much more explicit name,
> something like "ignore_all_warnings" for example.

Also will do that.

> Also it would be nice to document this new option in the man page.

I'll add this to the patch.

>
> Regards,
> Luc
>

Ciao,
Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic