Hi.
Running cppcheck on the following contents of a C source it runs forever using 100% CPU time.
The situation: there is a C #define statement which has about 43000 lines. The C source following is just a snippnet!
cppcheck is newest version downloaded via git clone at Wed., July 27th, 2016
#define _MOONNR 36000 /*!< Anzahl der Stützstellen für die Mondbahn */
/*!< Mondbahndaten */
#define _MOON { \
{0.0, 114.10553, 30.00196, 0.00365, 0.00247},\
{0.1, 114.10589, 30.00220, 0.00365, 0.00247},\
{0.2, 114.10626, 30.00245, 0.00365, 0.00247},\
{0.3, 114.10662, 30.00270, 0.00365, 0.00247},\
{0.4, 114.10699, 30.00294, 0.00365, 0.00247},\
{0.5, 114.10735, 30.00319, 0.00365, 0.00247},\
{0.6, 114.10772, 30.00344, 0.00365, 0.00247},\
{0.7, 114.10808, 30.00368, 0.00365, 0.00247},\
{0.8, 114.10845, 30.00393, 0.00365, 0.00247},\
{0.9, 114.10881, 30.00418, 0.00365, 0.00247},\
{1.0, 114.10918, 30.00442, 0.00365, 0.00247},\
{1.1, 114.10954, 30.00467, 0.00365, 0.00247},\
{1.2, 114.10991, 30.00492, 0.00365, 0.00247},\
{1.3, 114.11027, 30.00516, 0.00365, 0.00247},\
......
...... 43000 entries more to follow
......
{359.7, 7.34436, 8.85253, -0.03277, -0.10881},\
{359.8, 7.34109, 8.84165, -0.03273, -0.10873},\
{359.9, 7.33781, 8.83078, -0.03269, -0.10866}\
}
f = open('large.c','wt')
f.write('#define NR 36000\n')
f.write('#define DATA = {\\\n')
for i in range(43000):
f.write(' {1,2,3,4,5},\\\n')
f.write('}\n')
This is moved from Cppcheck trac: http://trac.cppcheck.net/ticket/7638
Hi.
Running cppcheck on the following contents of a C source it runs forever using 100% CPU time.
The situation: there is a C #define statement which has about 43000 lines. The C source following is just a snippnet!
cppcheck is newest version downloaded via git clone at Wed., July 27th, 2016
Regards
Askan
danmar: Here is a Python script that generates such code: