r89509 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r89508‎ | r89509 | r89510 >
Date:16:52, 5 June 2011
Author:hashar
Status:ok
Tags:
Comment:
-Whelp to dump available warning keys from r89343
Modified paths:
  • /trunk/tools/code-utils/check-vars.php (modified) (history)

Diff [purge]

Index: trunk/tools/code-utils/check-vars.php
@@ -129,10 +129,25 @@
130130 'deprecated-calls' => true,
131131 'deprecated-might' => true,
132132 'poisoned-function' => true,
133 - 'error' => true
 133+ 'error' => true,
 134+ # 'help' keyword is reserved!!
134135 );
 136+ /** print out the default warnings list */
 137+ static function dumpWarningsKeywords() {
 138+ print "Warning keywords suitable for -W<[no]keyword>:\n";
 139+ $w = CheckVars::$enabledWarnings ;
 140+ asort( $w ); // sort by status
 141+ print "Keywords disabled by default:\n";
 142+ $prevStatus = false;
 143+ foreach( $w as $key => $status ) {
 144+ if( $status !== $prevStatus ) {
 145+ $prevStatus = $status;
 146+ print "Keywords enabled by default:\n";
 147+ }
 148+ print "\t$key\n";
 149+ }
 150+ }
135151
136 -
137152 protected $generateDeprecatedList = false;
138153 protected $generateParentList = false;
139154
@@ -1059,7 +1074,16 @@
10601075 }
10611076
10621077 if( $argc < 2 ) {
1063 - die ("Usage: php $argv[0] [--generate-deprecated-list] [--generate-parent-list] <PHP_source_file1> <PHP_source_file2> ...\n");
 1078+ die (
 1079+"Usage:
 1080+ php $argv[0] [options] <PHP_source_file1> <PHP_source_file2> ...
 1081+
 1082+Options:
 1083+ --generate-deprecated-list
 1084+ --generate-parent-list
 1085+ -Whelp : available warnings methods
 1086+ -W[no]key : disabled/enable key warning.
 1087+");
10641088 }
10651089
10661090 $cv = new CheckVars();
@@ -1076,7 +1100,10 @@
10771101
10781102 foreach ( $argv as $arg ) {
10791103 if ( preg_match( '/^-W(no-)?(.*)/', $arg, $m ) ) {
1080 - if ( !isset( CheckVars::$enabledWarnings[ $m[2] ] ) ) {
 1104+ if( $m[2] === 'help' ) {
 1105+ CheckVars::dumpWarningsKeywords();
 1106+ exit;
 1107+ } elseif ( !isset( CheckVars::$enabledWarnings[ $m[2] ] ) ) {
10811108 var_dump($m);
10821109 die( "Wrong warning name $arg\n" );
10831110 }

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r89343Added -Wname and -Wno-name parameters to configure the desired warnings...platonides15:28, 2 June 2011

Status & tagging log