Skip to content

Commit 869104d

Browse files
author
Rik
committed
Silence unexpected Octave:mixed-string-concat warning in num2str.m (bug #66647)
* pt-mat.cc (maybe_warn_string_concat): Clarify that cause of warning message is concatenation of single and double quoted strings. * num2str.m: Disable "Octave:mixed-string-concat" warning locally. * warning_ids.m: Clarify that cause of Octave:mixed-string-concat warning message is concatenation of single and double quoted strings.
1 parent 3f049ca commit 869104d

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

libinterp/parse-tree/pt-mat.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ maybe_warn_string_concat (bool all_dq_strings_p, bool all_sq_strings_p)
135135
{
136136
if (! (all_dq_strings_p || all_sq_strings_p))
137137
warning_with_id ("Octave:mixed-string-concat",
138-
"concatenation of different character string types may have unintended consequences");
138+
"concatenation of single and double quoted string objects creates a single quoted string object");
139139
}
140140

141141
tree_expression *

scripts/general/num2str.m

+2
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,8 @@
134134
fmt = "%3d";
135135
endif
136136
endif
137+
## FIXME: Remove when Matlab strings are implemented in Octave.
138+
warning ('off', 'Octave:mixed-string-concat', 'local');
137139
fmt = do_string_escapes (fmt); # required now that '\n' is interpreted.
138140
nd = ndims (x);
139141
nc = columns (x) * (nd - 1); # ND-arrays are expanded in columns

scripts/help/warning_ids.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@
300300
##
301301
## @item Octave:mixed-string-concat
302302
## If the @code{Octave:mixed-string-concat} warning is enabled, print a
303-
## warning when concatenating a mixture of double and single quoted strings.
303+
## warning when concatenating a mixture of single and double quoted strings.
304304
## By default, the @code{Octave:mixed-string-concat} warning is disabled.
305305
##
306306
## @item Octave:nearly-singular-matrix

0 commit comments

Comments
 (0)