cvs: php-gcov-web /cron compile_results.php test_cc_regex.php

From: Date: Tue, 19 Dec 2006 20:27:44 +0000
Subject: cvs: php-gcov-web /cron compile_results.php test_cc_regex.php
Groups: php.mirrors 
Request: Send a blank email to php-mirrors+get-33560@lists.php.net to get a copy of this message
nlopess Tue Dec 19 20:27:44 2006 UTC Added files: /php-gcov-web/cron test_cc_regex.php Modified files: /php-gcov-web/cron compile_results.php Log: highly improved gcc regex to catch gcc warns/errors plus all link-time warns/errors #still needs a little tweak to catch the function names on link-time time warnings

http://cvs.php.net/viewvc.cgi/php-gcov-web/cron/compile_results.php?r1=1.2&r2=1.3&diff_format=u Index: php-gcov-web/cron/compile_results.php diff -u php-gcov-web/cron/compile_results.php:1.2 php-gcov-web/cron/compile_results.php:1.3 --- php-gcov-web/cron/compile_results.php:1.2 Tue Dec 19 15:52:09 2006 +++ php-gcov-web/cron/compile_results.php Tue Dec 19 20:27:44 2006 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: compile_results.php,v 1.2 2006/12/19 15:52:09 nlopess Exp $ */ +/* $Id: compile_results.php,v 1.3 2006/12/19 20:27:44 nlopess Exp $ */ // Compile Results generation script @@ -41,11 +41,11 @@ else { // Regular expression to select the error and warning information - // tuned for gcc 3.4 and 4.0 - $gcc_regex = '/^(.+): In function [`\'](\w+)\':\s+'. - '\1:(\d+): (error|warning):\s+(.+)'. - str_repeat('(?:\s+\1:(\d+): (error|warning):\s+(.+))?', 99). // capture up to 100 errors - '/m'; + // tuned for gcc 3.4, 4.0 and 4.1 + $gcc_regex = '/^((.+)(\(\.text\+[[:xdigit:]]+\))?: In function [`\'](\w+)\':\s+)?'. + '((?(1)(?(3)[^:\n]+|\2)|[^:\n]+)):(\d+): (?:(error|warning):\s+)?(.+)'. + str_repeat('(?:\s+\5:(\d+): (?:(error|warning):\s+)?(.+))?', 99). // capture up to 100 errors + '/mS'; preg_match_all($gcc_regex, $data, $data, PREG_SET_ORDER); @@ -53,10 +53,10 @@ $index_write = ''; - foreach ($data as $error) + foreach ($data as $error) { - $file = $error[1]; + $file = $error[5]; // Remove the phpdir portion from the file path if it occurs if(substr($file, 0, strlen($phpdir)) == $phpdir) @@ -65,7 +65,7 @@ } else { - $file = '/'.$file; + $filepath = $file; } // End check for phpdir in file path // If stats are not previously set for this file, initialize it to the default values @@ -75,16 +75,15 @@ @$stats[$file][1] = 0; // number of file warnings @$stats[$file][2] = ''; // data to write } - - $function = $error[2]; + $function = $error[4] ? $error[4] : '(top level)'; $write = ''; - // Start at 4th element - for ($i = 3; isset($error[$i]); $i += 3) + // the real data starts at 6th element + for ($i = 6; isset($error[$i]); $i += 3) { $line = $error[$i]; - $type = $error[$i+1]; // whether the type was an error or a warning + $type = $error[$i+1] ? $error[$i+1] : 'error'; // warning or error (default) $msg = $error[$i+2]; $lxrpath = ''; @@ -156,9 +155,9 @@ <table border="1"> <tr> -<td>File</td> -<td>Number of errors</td> -<td>Number of warnings</td> +<th>File</th> +<th>Number of errors</th> +<th>Number of warnings</th> </tr> HTML; } else { @@ -195,9 +194,9 @@ $write = <<< HTML <table border="1"> <tr> - <td>Function</td> - <td>Line</td> - <td>Message</td> + <th>Function</th> + <th>Line</th> + <th>Message</th> </tr> HTML; http://cvs.php.net/viewvc.cgi/php-gcov-web/cron/test_cc_regex.php?view=markup&rev=1.1 Index: php-gcov-web/cron/test_cc_regex.php +++ php-gcov-web/cron/test_cc_regex.php <? // this file is not used in the cron job // use it to test the gcc regex with the sample data provided $sampledata = " /p2/var/php_gcov/PHP_4_4/ext/ming/ming.c: In function `zif_swfbitmap_init': /p2/var/php_gcov/PHP_4_4/ext/ming/ming.c:323: warning: assignment from incompatible pointer type /p2/var/php_gcov/PHP_4_4/ext/ming/ming.c: In function `zif_swftextfield_setFont': /p2/var/php_gcov/PHP_4_4/ext/ming/ming.c:2597: warning: passing arg 2 of `SWFTextField_setFont' from incompatible pointer type /p2/var/php_gcov/PHP_4_4/ext/oci8/oci8.c:1027: warning: `oci_ping' defined but not used /p2/var/php_gcov/PHP_4_4/ext/posix/posix.c: In function `zif_posix_getpgid': /p2/var/php_gcov/PHP_4_4/ext/posix/posix.c:484: warning: implicit declaration of function `getpgid' /p2/var/php_gcov/PHP_4_4/ext/posix/posix.c: In function `zif_posix_getsid': /p2/var/php_gcov/PHP_4_4/ext/posix/posix.c:506: warning: implicit declaration of function `getsid' /p2/var/php_gcov/PHP_4_4/ext/session/mod_files.c: In function `ps_read_files': /p2/var/php_gcov/PHP_4_4/ext/session/mod_files.c:302: warning: implicit declaration of function `pread' /p2/var/php_gcov/PHP_4_4/ext/session/mod_files.c: In function `ps_write_files': /p2/var/php_gcov/PHP_4_4/ext/session/mod_files.c:340: warning: implicit declaration of function `pwrite' /p2/var/php_gcov/PHP_4_4/ext/sockets/sockets.c: In function `zif_socket_get_option': /p2/var/php_gcov/PHP_4_4/ext/sockets/sockets.c:1862: warning: unused variable `timeout' /p2/var/php_gcov/PHP_4_4/ext/sockets/sockets.c: In function `zif_socket_set_option': /p2/var/php_gcov/PHP_4_4/ext/sockets/sockets.c:1941: warning: unused variable `timeout' /p2/var/php_gcov/PHP_4_4/regex/regexec.c:19: warning: `nope' defined but not used /p2/var/php_gcov/PHP_4_4/ext/standard/exec.c:50: warning: `php_make_safe_mode_command' defined but not used /p2/var/php_gcov/PHP_4_4/ext/standard/image.c: In function `php_handle_jpc': /p2/var/php_gcov/PHP_4_4/ext/standard/image.c:604: warning: unused variable `dummy_int' /p2/var/php_gcov/PHP_4_4/ext/standard/parsedate.c: In function `php_gd_parse': /p2/var/php_gcov/PHP_4_4/ext/standard/parsedate.c:1138: warning: implicit declaration of function `php_gd_lex' /p2/var/php_gcov/PHP_4_4/ext/standard/parsedate.y: At top level: /p2/var/php_gcov/PHP_4_4/ext/standard/parsedate.y:864: warning: return type defaults to `int' /p2/var/php_gcov/PHP_4_4/ext/sysvmsg/sysvmsg.c: In function `zif_msg_receive': /p2/var/php_gcov/PHP_4_4/ext/sysvmsg/sysvmsg.c:318: warning: passing arg 2 of `php_var_unserialize' from incompatible pointer type /p2/var/php_gcov/PHP_4_4/ext/yp/yp.c: In function `zif_yp_err_string': /p2/var/php_gcov/PHP_4_4/ext/yp/yp.c:372: warning: assignment discards qualifiers from pointer target type Zend/zend_language_scanner.c:5944: warning: `yy_fatal_error' defined but not used Zend/zend_language_scanner.c:2627: warning: `yy_last_accepting_state' defined but not used Zend/zend_language_scanner.c:2628: warning: `yy_last_accepting_cpos' defined but not used Zend/zend_language_scanner.c:2634: warning: `yy_more_flag' defined but not used Zend/zend_language_scanner.c:2635: warning: `yy_more_len' defined but not used Zend/zend_language_scanner.c:5483: warning: `yyunput' defined but not used Zend/zend_language_scanner.c:5929: warning: `yy_top_state' defined but not used conflicts: 2 shift/reduce Zend/zend_ini_scanner.c:457: warning: `yy_last_accepting_state' defined but not used Zend/zend_ini_scanner.c:458: warning: `yy_last_accepting_cpos' defined but not used Zend/zend_ini_scanner.c:1361: warning: `yyunput' defined but not used /p2/var/php_gcov/PHP_4_4/Zend/zend_alloc.c: In function `_safe_emalloc': /p2/var/php_gcov/PHP_4_4/Zend/zend_alloc.c:237: warning: long int format, size_t arg (arg 3) /p2/var/php_gcov/PHP_4_4/Zend/zend_alloc.c:237: warning: long int format, size_t arg (arg 4) /p2/var/php_gcov/PHP_4_4/Zend/zend_alloc.c:237: warning: long int format, size_t arg (arg 5) /p2/var/php_gcov/PHP_4_4/Zend/zend_ini.c:338: warning: `zend_ini_displayer_cb' defined but not used ext/mysql/libmysql/my_tempnam.o(.text+0x80): In function `my_tempnam': /p2/var/php_gcov/PHP_4_4/ext/mysql/libmysql/my_tempnam.c:115: warning: the use of `tempnam' is dangerous, better use `mkstemp' ext/mysql/libmysql/my_tempnam.o(.text+0x80): In function `my_tempnam': /p2/var/php_gcov/PHP_4_4/ext/mysql/libmysql/my_tempnam.c:115: warning: the use of `tempnam' is dangerous, better use `mkstemp' ext/ming/ming.o(.text+0xc115): In function `zim_swfmovie_namedAnchor': /p2/var/php_gcov/PHP_5_2/ext/ming/ming.c:2207: undefined reference to `SWFMovie_namedAnchor' /p2/var/php_gcov/PHP_5_2/ext/ming/ming.c:2209: undefined reference to `SWFMovie_xpto' /p2/var/php_gcov/PHP_5_2/ext/ming/ming.c:2259: undefined reference to `SWFMovie_foo' ext/ming/ming.o(.text+0x851): In function `zif_ming_setSWFCompression': /p2/var/php_gcov/PHP_5_2/ext/ming/ming.c:154: undefined reference to `Ming_setSWFCompression' "; // Regular expression to select the error and warning information // tuned for gcc 3.4, 4.0 and 4.1 $gcc_regex = '/^((.+)(\(\.text\+[[:xdigit:]]+\))?: In function [`\'](\w+)\':\s+)?'. '((?(1)(?(3)[^:\n]+|\2)|[^:\n]+)):(\d+): (?:(error|warning):\s+)?(.+)'. str_repeat('(?:\s+\5:(\d+): (?:(error|warning):\s+)?(.+))?', 99). // capture up to 100 errors '/mS'; var_dump(preg_match_all($gcc_regex, $sampledata, $m, PREG_SET_ORDER)); print_r($m); ?>
« previous php.mirrors (#33560) next »