Commit 510bc3c
committed
kconfig: qconf: replace deprecated QString::sprintf() with QTextStream
QString::sprintf() is deprecated in the latest Qt version, and spawns
a lot of warnings:
HOSTCXX scripts/kconfig/qconf.o
scripts/kconfig/qconf.cc: In member function ‘void ConfigInfoView::menuInfo()’:
scripts/kconfig/qconf.cc:1090:61: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1090 | head += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc:1099:60: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1099 | head += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc:1127:90: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1127 | debug += QString().sprintf("defined at %s:%d<br><br>", _menu->file->name, _menu->lineno);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc: In member function ‘QString ConfigInfoView::debug_info(symbol*)’:
scripts/kconfig/qconf.cc:1150:68: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1150 | debug += QString().sprintf("prompt: <a href=\"m%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
scripts/kconfig/qconf.cc: In static member function ‘static void ConfigInfoView::expr_print_help(void*, symbol*, const char*)’:
scripts/kconfig/qconf.cc:1225:59: warning: ‘QString& QString::sprintf(const char*, ...)’ is deprecated: Use asprintf(), arg() or QTextStream instead [-Wdeprecated-declarations]
1225 | *text += QString().sprintf("<a href=\"s%s\">", sym->name);
| ^
In file included from /usr/include/qt5/QtGui/qkeysequence.h:44,
from /usr/include/qt5/QtWidgets/qaction.h:44,
from /usr/include/qt5/QtWidgets/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/qt5/QtCore/qstring.h:382:14: note: declared here
382 | QString &sprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
| ^~~~~~~
The documentation also says:
"Warning: We do not recommend using QString::asprintf() in new Qt code.
Instead, consider using QTextStream or arg(), both of which support
Unicode strings seamlessly and are type-safe."
Use QTextStream as suggested.
Reported-by: Robert Crawford <flacycads@cox.net>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>1 parent 68fd110 commit 510bc3c
1 file changed
Lines changed: 62 additions & 54 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1076 | 1076 | | |
1077 | 1077 | | |
1078 | 1078 | | |
1079 | | - | |
| 1079 | + | |
| 1080 | + | |
1080 | 1081 | | |
1081 | 1082 | | |
1082 | 1083 | | |
1083 | 1084 | | |
1084 | | - | |
1085 | | - | |
1086 | | - | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
1087 | 1088 | | |
1088 | | - | |
| 1089 | + | |
1089 | 1090 | | |
1090 | | - | |
1091 | | - | |
| 1091 | + | |
| 1092 | + | |
1092 | 1093 | | |
1093 | | - | |
1094 | | - | |
| 1094 | + | |
| 1095 | + | |
1095 | 1096 | | |
1096 | 1097 | | |
1097 | | - | |
| 1098 | + | |
1098 | 1099 | | |
1099 | | - | |
1100 | | - | |
| 1100 | + | |
| 1101 | + | |
1101 | 1102 | | |
1102 | | - | |
1103 | | - | |
| 1103 | + | |
| 1104 | + | |
1104 | 1105 | | |
1105 | | - | |
| 1106 | + | |
1106 | 1107 | | |
1107 | 1108 | | |
1108 | | - | |
| 1109 | + | |
| 1110 | + | |
1109 | 1111 | | |
1110 | | - | |
1111 | | - | |
1112 | | - | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
1113 | 1115 | | |
1114 | 1116 | | |
1115 | | - | |
1116 | | - | |
1117 | | - | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
1118 | 1121 | | |
1119 | 1122 | | |
1120 | 1123 | | |
1121 | 1124 | | |
1122 | | - | |
| 1125 | + | |
| 1126 | + | |
1123 | 1127 | | |
1124 | | - | |
| 1128 | + | |
1125 | 1129 | | |
1126 | 1130 | | |
1127 | 1131 | | |
1128 | 1132 | | |
1129 | 1133 | | |
| 1134 | + | |
1130 | 1135 | | |
1131 | | - | |
1132 | | - | |
| 1136 | + | |
| 1137 | + | |
1133 | 1138 | | |
1134 | | - | |
| 1139 | + | |
1135 | 1140 | | |
1136 | 1141 | | |
1137 | | - | |
1138 | | - | |
1139 | | - | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
1140 | 1145 | | |
1141 | 1146 | | |
1142 | 1147 | | |
1143 | 1148 | | |
1144 | 1149 | | |
1145 | | - | |
1146 | | - | |
1147 | | - | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
1148 | 1153 | | |
1149 | 1154 | | |
1150 | 1155 | | |
1151 | 1156 | | |
1152 | 1157 | | |
1153 | 1158 | | |
1154 | 1159 | | |
1155 | | - | |
1156 | | - | |
1157 | | - | |
1158 | | - | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
1159 | 1165 | | |
1160 | 1166 | | |
1161 | 1167 | | |
1162 | | - | |
1163 | | - | |
1164 | | - | |
| 1168 | + | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
1165 | 1172 | | |
1166 | 1173 | | |
1167 | 1174 | | |
1168 | | - | |
1169 | | - | |
1170 | | - | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
1171 | 1178 | | |
1172 | 1179 | | |
1173 | | - | |
1174 | | - | |
1175 | | - | |
| 1180 | + | |
| 1181 | + | |
| 1182 | + | |
| 1183 | + | |
1176 | 1184 | | |
1177 | 1185 | | |
1178 | | - | |
| 1186 | + | |
1179 | 1187 | | |
1180 | 1188 | | |
1181 | 1189 | | |
| |||
1213 | 1221 | | |
1214 | 1222 | | |
1215 | 1223 | | |
1216 | | - | |
1217 | | - | |
| 1224 | + | |
1218 | 1225 | | |
1219 | 1226 | | |
1220 | | - | |
1221 | | - | |
1222 | | - | |
1223 | | - | |
1224 | | - | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
1225 | 1233 | | |
1226 | 1234 | | |
1227 | 1235 | | |
| |||
0 commit comments