gcc/g++/make lint reports awk script

68 views
Skip to first unread message

Stefan Ruppert

unread,
Jan 7, 2011, 3:49:24 AM1/7/11
to bit...@googlegroups.com
Hi all,

I have hacked a small awk script which parses the output of a make build
and creates a Bitten lint report from it. It supports gcc/g++ warning
messages as well as mono c# warnings.

It is just a hack but it does what I want. If someone is interested in
such a script I can provide it to the list.

Regards,
Stefan

Roland Wilczek

unread,
Jan 7, 2011, 3:54:57 AM1/7/11
to bit...@googlegroups.com
Am Freitag, den 07.01.2011, 09:49 +0100 schrieb Stefan Ruppert:
> [...]

> If someone is interested in
> such a script I can provide it to the list.

Yes, please! :-)

--
mfg
- Roland Wilczek
Certified Scrum Master

Nachtigallenstraße 11
53179 Bonn

Tel.: 0228 / 336 70 40 9
Mobil: 0171 / 72 36 849

Simon Cross

unread,
Jan 7, 2011, 3:59:57 AM1/7/11
to bit...@googlegroups.com

That would be cool. :)

Even if it's too hacky or use-case specific to warrant going into
Bitten itself, it's always nice to have good examples (and it's good
for us Bitten developers to see what people are doing with Bitten). If
you like it could go up on the wiki somewhere or find a home in the
contrib/ folder in svn.

Schiavo
Simon

Stefan Ruppert

unread,
Jan 7, 2011, 4:37:27 AM1/7/11
to bit...@googlegroups.com

Ok, here it is. The contrib folder is a nice place to give a home for
the script. Go head.

Now I have the warnings in the database what is the status of the ticket
http://bitten.edgewall.org/ticket/507?

I would like to have a list of all warnings with the appropriate warning
message pointing to the source file and line in the source code browser!
Is there any work ongoing for such a thing?

Regards,
Stefan

bitten-makebuild-warning-parser.awk

W. Martin Borgert

unread,
Jan 7, 2011, 1:22:14 PM1/7/11
to bit...@googlegroups.com, Stefan Ruppert
Hallo Stefan,

Quoting "Stefan Ruppert" <m...@ruppert-it.de>:
> Ok, here it is. The contrib folder is a nice place to give a home
> for the script. Go head.

I tried your script, but found that in one case a compiler
warning was suppressed by your script. Trying to fix it, I
found out, that my AWK knowledge is rusty at best. So I
wrote a very hackish Python variant of it. It works for me,
but has probably more bugs than your AWK script. Have fun!

Beste Grüße

bitten-makebuild-warning-parser.py

Stefan Ruppert

unread,
Jan 8, 2011, 7:07:26 AM1/8/11
to bit...@googlegroups.com, W. Martin Borgert
Hi Martin,

W. Martin Borgert wrote:
> Hallo Stefan,
>
> Quoting "Stefan Ruppert" <m...@ruppert-it.de>:
>> Ok, here it is. The contrib folder is a nice place to give a home for
>> the script. Go head.
>

> wrote a very hackish Python variant of it. It works for me,
> but has probably more bugs than your AWK script. Have fun!
>

Thanks for converting it to a simple python program. I have adjusted
your program a little bit. Now the python script can do the following:

1. provide the correct relativ file path (stripping the basedir)
2. handling mono c# warnings
3. handling gcc/g++ user defined "#warning" warnings
4. escaping the '<', '>' and '&' xml charaters inside the message text.
5. now user defined "#warning" messages are categorized as "refactor"
6. finds also warnings from header files.

Python looks quite simple than awk! ;-)

Regards,
Stefan

bitten-makebuild-warning-parser.py

W. Martin Borgert

unread,
Jan 8, 2011, 7:44:23 AM1/8/11
to bit...@googlegroups.com
On 2011-01-08 13:07, Stefan Ruppert wrote:
> Thanks for converting it to a simple python program. I have adjusted
> your program a little bit.

Cool, many thanks!

> Python looks quite simple than awk! ;-)

Furthermore, Python is a more obvious choice for hacking on
Bitten and Trac, I believe.

osimons

unread,
Jan 8, 2011, 8:39:06 AM1/8/11
to Bitten
Now, if anyone can reorganize the code to be a Bitten command function
instead, you may all have a <c:lint> command ready for inclusion in
Bitten core... Function + Tests + Doc + setup.py command namespace
mapping....

Patch welcome ;-)


:::simon

Stefan Ruppert

unread,
Jan 8, 2011, 8:53:11 AM1/8/11
to bit...@googlegroups.com

Well, I don't think its that easy... The regexp are only valid for
gcc/g++/GNU make and mono C# warnings. Any other compiler or make tool
needs to be checked, if the regexp matches too. So I would propose a
<gcc:lint> or <gnu:lint> command!? Or document that it is currently only
tested with the GNU tool chain.

Note that the links to source code are only correct if the make tool
issues a "Entering directory 'xxx'" message.

Also the script currently eats all input. So I don't know how to write a
filter within bitten which just greps the information from the build
log, but will the stdout and stderr stream intact.

Regards,
Stefan

W. Martin Borgert

unread,
Jan 8, 2011, 2:09:03 PM1/8/11
to bit...@googlegroups.com
On 2011-01-08 13:07, Stefan Ruppert wrote:
> Thanks for converting it to a simple python program. I have adjusted
> your program a little bit.

Just one correction: You attached the script with "us-ascii"
encoding, but it has to be "utf-8". Therefore it arrived broken,
at least for me. The attachment here should be fine.

bitten-makebuild-warning-parser.py

罗勇刚(Yonggang Luo)

unread,
Jan 9, 2011, 7:23:32 AM1/9/11
to bit...@googlegroups.com
For crossplatform reason, it's better to using python script instead!

2011/1/7, Stefan Ruppert <m...@ruppert-it.de>:

--
从我的移动设备发送

此致

罗勇刚
Yours
sincerely,
Yonggang Luo

Simon Cross

unread,
Jan 14, 2011, 6:05:45 AM1/14/11
to bit...@googlegroups.com
On Fri, Jan 7, 2011 at 11:37 AM, Stefan Ruppert <m...@ruppert-it.de> wrote:
> Now I have the warnings in the database what is the status of the ticket
> http://bitten.edgewall.org/ticket/507?

It's marked for 0.6.1 so the patch can go in once we have 0.6.0 out
the door. There may be a little work left to clean up the patch and
test on IE. Feedback (successful use of patch or otherwise) on ticket
welcome.

> I would like to have a list of all warnings with the appropriate warning
> message pointing to the source file and line in the source code browser! Is
> there any work ongoing for such a thing?

The patch attached to 507 should do that.

Schiavo
Simon

Simon Cross

unread,
Jan 14, 2011, 6:42:19 AM1/14/11
to bit...@googlegroups.com
On Sat, Jan 8, 2011 at 3:39 PM, osimons <odds...@gmail.com> wrote:
> Now, if anyone can reorganize the code to be a Bitten command function
> instead, you may all have a <c:lint> command ready for inclusion in
> Bitten core... Function + Tests + Doc + setup.py command namespace
> mapping....

I've created http://bitten.edgewall.org/ticket/654 so that we don't
lose track of this idea. I attached the latest version of the Python
script as a potential starting point and noted some of the
difficulties mentioned by Stefan. Comments (and patches) on ticket
welcome.

Schiavo
Simon

Reply all
Reply to author
Forward
0 new messages