Mercurial > octave
annotate scripts/miscellaneous/warning_ids.m @ 11587:c792872f8942
all script files: untabify and strip trailing whitespace
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 20 Jan 2011 17:35:29 -0500 |
parents | fd0a3ac60b0e |
children | d1466d956d17 |
rev | line source |
---|---|
11523 | 1 ## Copyright (C) 2006-2011 John W. Eaton |
7016 | 2 ## |
3 ## This file is part of Octave. | |
4 ## | |
5 ## Octave is free software; you can redistribute it and/or modify it | |
6 ## under the terms of the GNU General Public License as published by | |
7 ## the Free Software Foundation; either version 3 of the License, or (at | |
8 ## your option) any later version. | |
9 ## | |
10 ## Octave is distributed in the hope that it will be useful, but | |
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 ## General Public License for more details. | |
14 ## | |
15 ## You should have received a copy of the GNU General Public License | |
16 ## along with Octave; see the file COPYING. If not, see | |
17 ## <http://www.gnu.org/licenses/>. | |
18 | |
5781 | 19 ## -*- texinfo -*- |
20 ## @table @code | |
21 ## @item Octave:array-to-scalar | |
22 ## If the @code{Octave:array-to-scalar} warning is enabled, Octave will | |
23 ## warn when an implicit conversion from an array to a scalar value is | |
24 ## attempted. By default, the @code{Octave:array-to-scalar} warning is | |
25 ## disabled. | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
26 ## |
5781 | 27 ## @item Octave:array-to-vector |
28 ## If the @code{Octave:array-to-vector} warning is enabled, Octave will | |
29 ## warn when an implicit conversion from an array to a vector value is | |
30 ## attempted. By default, the @code{Octave:array-to-vector} warning is | |
31 ## disabled. | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
32 ## |
5781 | 33 ## @item Octave:assign-as-truth-value |
34 ## If the @code{Octave:assign-as-truth-value} warning is | |
35 ## enabled, a warning is issued for statements like | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
36 ## |
5781 | 37 ## @example |
9051
1bf0ce0930be
Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents:
9039
diff
changeset
|
38 ## @group |
5781 | 39 ## if (s = t) |
9039
51dc9691f23f
Cleanup documentation files errors.texi, debug.texi, io.texi
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
40 ## @dots{} |
9051
1bf0ce0930be
Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents:
9039
diff
changeset
|
41 ## @end group |
5781 | 42 ## @end example |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
43 ## |
5781 | 44 ## @noindent |
45 ## since such statements are not common, and it is likely that the intent | |
46 ## was to write | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
47 ## |
5781 | 48 ## @example |
9051
1bf0ce0930be
Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents:
9039
diff
changeset
|
49 ## @group |
5781 | 50 ## if (s == t) |
9039
51dc9691f23f
Cleanup documentation files errors.texi, debug.texi, io.texi
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
51 ## @dots{} |
9051
1bf0ce0930be
Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents:
9039
diff
changeset
|
52 ## @end group |
5781 | 53 ## @end example |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
54 ## |
5781 | 55 ## @noindent |
56 ## instead. | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
57 ## |
5781 | 58 ## There are times when it is useful to write code that contains |
59 ## assignments within the condition of a @code{while} or @code{if} | |
60 ## statement. For example, statements like | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
61 ## |
5781 | 62 ## @example |
9051
1bf0ce0930be
Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents:
9039
diff
changeset
|
63 ## @group |
5781 | 64 ## while (c = getc()) |
9039
51dc9691f23f
Cleanup documentation files errors.texi, debug.texi, io.texi
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
65 ## @dots{} |
9051
1bf0ce0930be
Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents:
9039
diff
changeset
|
66 ## @end group |
5781 | 67 ## @end example |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
68 ## |
5781 | 69 ## @noindent |
70 ## are common in C programming. | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
71 ## |
5781 | 72 ## It is possible to avoid all warnings about such statements by |
73 ## disabling the @code{Octave:assign-as-truth-value} warning, | |
74 ## but that may also let real errors like | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
75 ## |
5781 | 76 ## @example |
9051
1bf0ce0930be
Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents:
9039
diff
changeset
|
77 ## @group |
5781 | 78 ## if (x = 1) # intended to test (x == 1)! |
9039
51dc9691f23f
Cleanup documentation files errors.texi, debug.texi, io.texi
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
79 ## @dots{} |
9051
1bf0ce0930be
Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents:
9039
diff
changeset
|
80 ## @end group |
5781 | 81 ## @end example |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
82 ## |
5781 | 83 ## @noindent |
84 ## slip by. | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
85 ## |
5781 | 86 ## In such cases, it is possible suppress errors for specific statements by |
87 ## writing them with an extra set of parentheses. For example, writing the | |
88 ## previous example as | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
89 ## |
5781 | 90 ## @example |
9051
1bf0ce0930be
Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents:
9039
diff
changeset
|
91 ## @group |
5781 | 92 ## while ((c = getc())) |
9039
51dc9691f23f
Cleanup documentation files errors.texi, debug.texi, io.texi
Rik <rdrider0-list@yahoo.com>
parents:
8920
diff
changeset
|
93 ## @dots{} |
9051
1bf0ce0930be
Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents:
9039
diff
changeset
|
94 ## @end group |
5781 | 95 ## @end example |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
96 ## |
5781 | 97 ## @noindent |
98 ## will prevent the warning from being printed for this statement, while | |
99 ## allowing Octave to warn about other assignments used in conditional | |
100 ## contexts. | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
101 ## |
5781 | 102 ## By default, the @code{Octave:assign-as-truth-value} warning is enabled. |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
103 ## |
5781 | 104 ## @item Octave:associativity-change |
105 ## If the @code{Octave:associativity-change} warning is | |
106 ## enabled, Octave will warn about possible changes in the meaning of | |
107 ## some code due to changes in associativity for some operators. | |
9051
1bf0ce0930be
Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents:
9039
diff
changeset
|
108 ## Associativity changes have typically been made for @sc{matlab} |
5781 | 109 ## compatibility. By default, the @code{Octave:associativity-change} |
110 ## warning is enabled. | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
111 ## |
5781 | 112 ## @item Octave:divide-by-zero |
113 ## If the @code{Octave:divide-by-zero} warning is enabled, a | |
114 ## warning is issued when Octave encounters a division by zero. By | |
115 ## default, the @code{Octave:divide-by-zero} warning is enabled. | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
116 ## |
5781 | 117 ## @item Octave:empty-list-elements |
118 ## If the @code{Octave:empty-list-elements} warning is enabled, a | |
119 ## warning is issued when an empty matrix is found in a matrix list. | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
9051
diff
changeset
|
120 ## For example: |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
121 ## |
5781 | 122 ## @example |
123 ## a = [1, [], 3, [], 5] | |
124 ## @end example | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
125 ## |
5781 | 126 ## @noindent |
127 ## By default, the @code{Octave:empty-list-elements} warning is enabled. | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
128 ## |
5781 | 129 ## @item Octave:fortran-indexing |
130 ## If the @code{Octave:fortran-indexing} warning is enabled, a warning is | |
131 ## printed for expressions which select elements of a two-dimensional matrix | |
132 ## using a single index. By default, the @code{Octave:fortran-indexing} | |
133 ## warning is disabled. | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
134 ## |
5781 | 135 ## @item Octave:function-name-clash |
136 ## If the @code{Octave:function-name-clash} warning is enabled, a | |
137 ## warning is issued when Octave finds that the name of a function | |
138 ## defined in a function file differs from the name of the file. (If | |
139 ## the names disagree, the name declared inside the file is ignored.) | |
140 ## By default, the @code{Octave:function-name-clash} warning is enabled. | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
141 ## |
5781 | 142 ## @item Octave:future-time-stamp |
143 ## If the @code{Octave:future-time-stamp} warning is enabled, Octave | |
144 ## will print a warning if it finds a function file with a time stamp | |
145 ## that is in the future. By default, the | |
146 ## @code{Octave:future-time-stamp} warning is enabled. | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
147 ## |
5781 | 148 ## @item Octave:imag-to-real |
149 ## If the @code{Octave:imag-to-real} warning is enabled, a warning is | |
150 ## printed for implicit conversions of complex numbers to real numbers. | |
151 ## By default, the @code{Octave:imag-to-real} warning is disabled. | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
152 ## |
5794 | 153 ## @item Octave:matlab-incompatible |
154 ## Print warnings for Octave language features that may cause | |
9051
1bf0ce0930be
Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents:
9039
diff
changeset
|
155 ## compatibility problems with @sc{matlab}. |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
156 ## |
5781 | 157 ## @item Octave:missing-semicolon |
158 ## If the @code{Octave:missing-semicolon} warning is enabled, Octave | |
159 ## will warn when statements in function definitions don't end in | |
160 ## semicolons. By default the @code{Octave:missing-semicolon} warning | |
161 ## is disabled. | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
162 ## |
5781 | 163 ## @item Octave:neg-dim-as-zero |
164 ## If the @code{Octave:neg-dim-as-zero} warning is enabled, print a warning | |
165 ## for expressions like | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
166 ## |
5781 | 167 ## @example |
168 ## eye (-1) | |
169 ## @end example | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
170 ## |
5781 | 171 ## @noindent |
172 ## By default, the @code{Octave:neg-dim-as-zero} warning is disabled. | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
173 ## |
5781 | 174 ## @item Octave:num-to-str |
175 ## If the @code{Octave:num-to-str} warning is enable, a warning is | |
176 ## printed for implicit conversions of numbers to their ASCII character | |
177 ## equivalents when strings are constructed using a mixture of strings and | |
178 ## numbers in matrix notation. For example, | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
179 ## |
5781 | 180 ## @example |
181 ## @group | |
182 ## [ "f", 111, 111 ] | |
183 ## @result{} "foo" | |
184 ## @end group | |
185 ## @end example | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
9051
diff
changeset
|
186 ## |
10846
a4f482e66b65
Grammarcheck more of the documentation.
Rik <octave@nomad.inbox5.com>
parents:
10821
diff
changeset
|
187 ## @noindent |
5781 | 188 ## elicits a warning if the @code{Octave:num-to-str} warning is |
189 ## enabled. By default, the @code{Octave:num-to-str} warning is enabled. | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
190 ## |
5781 | 191 ## @item Octave:precedence-change |
192 ## If the @code{Octave:precedence-change} warning is enabled, Octave | |
193 ## will warn about possible changes in the meaning of some code due to | |
194 ## changes in precedence for some operators. Precedence changes have | |
9051
1bf0ce0930be
Grammar check TexInfo in all .m files
Rik <rdrider0-list@yahoo.com>
parents:
9039
diff
changeset
|
195 ## typically been made for @sc{matlab} compatibility. By default, the |
5781 | 196 ## @code{Octave:precedence-change} warning is enabled. |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
197 ## |
5781 | 198 ## @item Octave:reload-forces-clear |
199 ## If several functions have been loaded from the same file, Octave must | |
200 ## clear all the functions before any one of them can be reloaded. If | |
201 ## the @code{Octave:reload-forces-clear} warning is enabled, Octave will | |
202 ## warn you when this happens, and print a list of the additional | |
203 ## functions that it is forced to clear. By default, the | |
204 ## @code{Octave:reload-forces-clear} warning is enabled. | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
205 ## |
5781 | 206 ## @item Octave:resize-on-range-error |
207 ## If the @code{Octave:resize-on-range-error} warning is enabled, print a | |
208 ## warning when a matrix is resized by an indexed assignment with | |
209 ## indices outside the current bounds. By default, the | |
210 ## @code{Octave:resize-on-range-error} warning is disabled. | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
211 ## |
5794 | 212 ## @item Octave:separator-insert |
213 ## Print warning if commas or semicolons might be inserted | |
214 ## automatically in literal matrices. | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
215 ## |
5794 | 216 ## @item Octave:single-quote-string |
8325
b93ac0586e4b
spelling corrections
Brian Gough<bjg@network-theory.co.uk>
parents:
7017
diff
changeset
|
217 ## Print warning if a single quote character is used to introduce a |
5794 | 218 ## string constant. |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
219 ## |
5781 | 220 ## @item Octave:str-to-num |
221 ## If the @code{Octave:str-to-num} warning is enabled, a warning is printed | |
222 ## for implicit conversions of strings to their numeric ASCII equivalents. | |
223 ## For example, | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
9051
diff
changeset
|
224 ## |
5781 | 225 ## @example |
226 ## @group | |
227 ## "abc" + 0 | |
228 ## @result{} 97 98 99 | |
229 ## @end group | |
230 ## @end example | |
10821
693e22af08ae
Grammarcheck documentation of m-files
Rik <octave@nomad.inbox5.com>
parents:
9051
diff
changeset
|
231 ## |
10846
a4f482e66b65
Grammarcheck more of the documentation.
Rik <octave@nomad.inbox5.com>
parents:
10821
diff
changeset
|
232 ## @noindent |
5781 | 233 ## elicits a warning if the @code{Octave:str-to-num} warning is enabled. |
234 ## By default, the @code{Octave:str-to-num} warning is disabled. | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
235 ## |
5781 | 236 ## @item Octave:string-concat |
237 ## If the @code{Octave:string-concat} warning is enabled, print a | |
238 ## warning when concatenating a mixture of double and single quoted strings. | |
239 ## By default, the @code{Octave:string-concat} warning is disabled. | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
240 ## |
5781 | 241 ## @item Octave:undefined-return-values |
242 ## If the @code{Octave:undefined-return-values} warning is disabled, | |
243 ## print a warning if a function does not define all the values in | |
244 ## the return list which are expected. By default, the | |
245 ## @code{Octave:undefined-return-values} warning is enabled. | |
11587
c792872f8942
all script files: untabify and strip trailing whitespace
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
246 ## |
5781 | 247 ## @item Octave:variable-switch-label |
248 ## If the @code{Octave:variable-switch-label} warning is enabled, Octave | |
249 ## will print a warning if a switch label is not a constant or constant | |
250 ## expression. By default, the @code{Octave:variable-switch-label} | |
251 ## warning is disabled. | |
252 ## @end table | |
8673
9e0f0a7bf858
warning_ids.m: make it a function that just calls help
John W. Eaton <jwe@octave.org>
parents:
8325
diff
changeset
|
253 |
9e0f0a7bf858
warning_ids.m: make it a function that just calls help
John W. Eaton <jwe@octave.org>
parents:
8325
diff
changeset
|
254 function warning_ids () |
9e0f0a7bf858
warning_ids.m: make it a function that just calls help
John W. Eaton <jwe@octave.org>
parents:
8325
diff
changeset
|
255 help ("warning_ids"); |
9e0f0a7bf858
warning_ids.m: make it a function that just calls help
John W. Eaton <jwe@octave.org>
parents:
8325
diff
changeset
|
256 endfunction |