On 5/16/19 12:36 AM, Martin Sebor wrote:
> On 5/15/19 8:50 AM, Martin Sebor wrote:
>> On 5/15/19 5:40 AM, Martin Liška wrote:
>>> On 5/14/19 11:31 PM, Martin Sebor wrote:
>>>> The attached patch implements the -Wformat-diag warning to help find
>>>> quoting, spelling, and other formatting issues in diagnostics issued
>>>> by GCC.
>>>
>>> Just a general comment about this part. Wouldn't it make sense to use regex
>>> for some of the string patterns that you address in the patch?
>>
>> I'm not sure.  Are you wondering about the variants of type
>> names like "signed int" and "unsigned int" and the contractions?
>>
>> The plain format checker scans and advances one word at a time
>> to be efficient.  It does linearly loop over the black-listed
>> words and operators and that could be made more efficient by
>> using a binary search.  Let me do that.  I would expect
>> introducing regexp to the checking to slow it down but
>> I suppose I could try it and see if you think it's worth it.
> 
> I tried both approaches for the operators and keywords:

Hi.

Thanks for considering. It was just an idea I did.

> 
> 1) using bsearch
> 2) using regex
> 
> I finished (1) but did only a proof of concept of (2).  Neither
> made a noticeable difference in my (admittedly very simple)
> benchmarks but both have drawbacks:
> 
> (1) means that the entries in the tables of known operators and
> keywords have to be sorted.  For operators, the sort order is
> different between ASCII and EBCDIC, and would mean duplicating
> the operator table and making sure it stays sorted in each
> encoding after a change.  That seems like a pain in the butt
> for little gain.
> 
> In my prototype of (2), the regular expression quickly started
> to get complicated and hard to read as I tried to handle some
> of the same special cases as I'm handling now.  It might be
> possible to redo the whole thing using regex but it would mean
> starting from scratch.  I'm not convinced it's worth the effort
> (in fact, I would worry about the regular expressions becoming
> too complex to easily extend).
> 
> So I'm inclined to leave things as they are.  I did make a few
> simplifications to the code in the process of this experiment
> and beefed up the test a little bit so I attach an updated
> revision.

Works for me. I'm going to test your patchset on ppc64le and I'll
prepare patch for the target.

Martin

> 
> Martin

Reply via email to