incorrect parsing/processing of several C/C++ features
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
pmccabe (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
Binary package hint: pmccabe
the current version of pmccabe (2.6) has several bugs:
-compiler directives are ignored completely, resulting in parsing/reporting errors on code like this:
#if 0
void f() {
#endif
int g() {
-incorrect parsing of throw(), compiler attribute, and volatile keyword annotations on functions/methods:
class X {
void f() const throw() volatile __attribute__(...);
}
-incorrect parsing of multi-line macros where \n comes before \\:
#define con("%x %x\n",
\
0x0)
void foo() {}
-various hangs, bits of memory corruption, etc on valid code
I have fixed all of these issues, and new ones that came up, and have included them in the attached patch. I added new tests to the testsuite for every bug I fixed. I tested on the gcc, scummvm, amop, cgreen, mockitopp, pmccabe, and proprietary C++ sources and verified the top and bottom 10 functions by complexity were correct. I ran the same tests under valgrind, and fixed some minor issues until it was also clean. I cleaned up all but one compiler warning (that appears to be a false positive). Formatting using spaces/tabs was inconsistent within and across files, so I let Eclipse CDT reformat in the BSD/Allman style in order to inject consistency in the modified files.
There are known issues that remain, documented in the TODO file, but none of them yielded dramatically incorrect results in the code bases I tested on.
I also modified the Makefile to use the "mega-compilation" technique (via a new file called combined.c, which allows for effective use of -O3 and -fwhole-program. This resulted in an 80% speed increase in my tests.
This bug was fixed in the package pmccabe - 2.7b-1
---------------
pmccabe (2.7b-1) unstable; urgency=low
* New release from new upstream. manual- page. doc/pmccabe/ .
- Fixes FTBFS on arch's with unsigned char.
- Fixes typos, silencing lintian typo-in-
* Add autopkg testing using upstream regression test suite.
* Update watch file.
* Put NEWS and README file into /usr/share/
-- Simon Josefsson <email address hidden> Thu, 14 Jan 2021 14:12:08 +0100