* [PULL 0/1] Qtest patches for 2026-05-18 @ 2026-05-18 15:53 Fabiano Rosas 2026-05-18 15:53 ` [PULL 1/1] tests/qtest: fix discarded const qualifier warning Fabiano Rosas 2026-05-19 19:17 ` [PULL 0/1] Qtest patches for 2026-05-18 Stefan Hajnoczi 0 siblings, 2 replies; 5+ messages in thread From: Fabiano Rosas @ 2026-05-18 15:53 UTC (permalink / raw) To: qemu-devel The following changes since commit ac6721b88df944ade0048822b2b74210f543d656: Merge tag 'vhost-user-rtc-pr-1' of https://gitlab.com/epilys/qemu into staging (2026-05-16 17:37:33 -0400) are available in the Git repository at: https://gitlab.com/farosas/qemu.git tags/qtest-20260518-pull-request for you to fetch changes up to e68da5b7a2cd8f4635d3b253ac1581552a3df16f: tests/qtest: fix discarded const qualifier warning (2026-05-18 12:15:42 -0300) ---------------------------------------------------------------- QTest pull request - fix strstr issue ---------------------------------------------------------------- Matthew Penney (1): tests/qtest: fix discarded const qualifier warning tests/qtest/libqtest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.51.0 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PULL 1/1] tests/qtest: fix discarded const qualifier warning 2026-05-18 15:53 [PULL 0/1] Qtest patches for 2026-05-18 Fabiano Rosas @ 2026-05-18 15:53 ` Fabiano Rosas 2026-05-22 8:27 ` Amit Machhiwal 2026-05-19 19:17 ` [PULL 0/1] Qtest patches for 2026-05-18 Stefan Hajnoczi 1 sibling, 1 reply; 5+ messages in thread From: Fabiano Rosas @ 2026-05-18 15:53 UTC (permalink / raw) To: qemu-devel Cc: Matthew Penney, Thomas Huth, Marc-André Lureau, Philippe Mathieu-Daudé, Pierrick Bouvier From: Matthew Penney <matt@matthewpenney.net> Modern compilers warn that the result of strstr() may discard const qualifiers when assigned to a non-const pointer. Make 'found' a const char * to fix the warning. Signed-off-by: Matthew Penney <matt@matthewpenney.net> Reviewed-by: Thomas Huth <thuth@redhat.com> Tested-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com> Signed-off-by: Fabiano Rosas <farosas@suse.de> --- tests/qtest/libqtest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c index bf9284b9a1..b1e06ea364 100644 --- a/tests/qtest/libqtest.c +++ b/tests/qtest/libqtest.c @@ -2146,7 +2146,7 @@ bool mkimg(const char *file, const char *fmt, unsigned size_mb) bool qtest_verbose(const char *domain) { const char *log = getenv("QTEST_LOG"); - char *found; + const char *found; assert(domain); -- 2.51.0 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PULL 1/1] tests/qtest: fix discarded const qualifier warning 2026-05-18 15:53 ` [PULL 1/1] tests/qtest: fix discarded const qualifier warning Fabiano Rosas @ 2026-05-22 8:27 ` Amit Machhiwal 2026-05-22 11:50 ` Matthew Penney 0 siblings, 1 reply; 5+ messages in thread From: Amit Machhiwal @ 2026-05-22 8:27 UTC (permalink / raw) To: Fabiano Rosas Cc: qemu-devel, Matthew Penney, Thomas Huth, Marc-André Lureau, Philippe Mathieu-Daudé, Pierrick Bouvier Hi Matthew, Thank you for addressing the const qualifier warning in qtest_verbose(). Your fix correctly resolves the immediate compilation issue with modern compilers. I had independently worked on this same issue and submitted a similar fix as part of a patch series: https://lore.kernel.org/all/20260518172517.12466-3-amachhiw@linux.ibm.com/ While both our approaches fix the immediate strstr() warning by making 'found' const, I noticed that getenv() still returns char * despite environment strings being semantically read-only. This creates a subtle const-correctness gap that stricter compilers (like GCC 16) may flag in the future. I've prepared an improved v2 patch [2] that builds upon your merged fix by using g_getenv() and g_strstr_len() to maintain const correctness throughout. This approach: - Uses g_getenv() which returns const gchar *, matching the read-only semantics of environment variables - Employs g_strstr_len() for consistent use of GLib string functions, aligning with QEMU conventions - Eliminates all const-correctness warnings with strict compilers The v2 patch supersedes my earlier attempt and is rebased on top of your merged commit (e68da5b7a2cd). Thanks again for the quick fix! [1] https://lore.kernel.org/all/20260518172517.12466-3-amachhiw@linux.ibm.com/ [2] https://lore.kernel.org/all/20260522082555.54918-1-amachhiw@linux.ibm.com/ Regards, Amit On 2026/05/18 12:53 PM, Fabiano Rosas wrote: > From: Matthew Penney <matt@matthewpenney.net> > > Modern compilers warn that the result of strstr() may discard > const qualifiers when assigned to a non-const pointer. > > Make 'found' a const char * to fix the warning. > > Signed-off-by: Matthew Penney <matt@matthewpenney.net> > Reviewed-by: Thomas Huth <thuth@redhat.com> > Tested-by: Thomas Huth <thuth@redhat.com> > Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> > Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org> > Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> > Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com> > Signed-off-by: Fabiano Rosas <farosas@suse.de> > --- > tests/qtest/libqtest.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c > index bf9284b9a1..b1e06ea364 100644 > --- a/tests/qtest/libqtest.c > +++ b/tests/qtest/libqtest.c > @@ -2146,7 +2146,7 @@ bool mkimg(const char *file, const char *fmt, unsigned size_mb) > bool qtest_verbose(const char *domain) > { > const char *log = getenv("QTEST_LOG"); > - char *found; > + const char *found; > > assert(domain); > > -- > 2.51.0 > > ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PULL 1/1] tests/qtest: fix discarded const qualifier warning 2026-05-22 8:27 ` Amit Machhiwal @ 2026-05-22 11:50 ` Matthew Penney 0 siblings, 0 replies; 5+ messages in thread From: Matthew Penney @ 2026-05-22 11:50 UTC (permalink / raw) To: Amit Machhiwal Cc: Fabiano Rosas, qemu-devel, Thomas Huth, Marc-André Lureau, Philippe Mathieu-Daudé, Pierrick Bouvier Hi Amit, Thanks for the follow-up and for working on a more complete solution. Your approach using g_getenv() and g_strstr_len() makes sense regarding consistency with GLib/QEMU conventions and avoiding future issues with stricter compilers. I appreciate the note and the rebase on top of my merged commit! Regards, Matthew On Friday, 22 May 2026 at 09:27, Amit Machhiwal <amachhiw@linux.ibm.com> wrote: > Hi Matthew, > > Thank you for addressing the const qualifier warning in qtest_verbose(). Your > fix correctly resolves the immediate compilation issue with modern compilers. > > I had independently worked on this same issue and submitted a similar fix as > part of a patch series: > > https://lore.kernel.org/all/20260518172517.12466-3-amachhiw@linux.ibm.com/ > > While both our approaches fix the immediate strstr() warning by making 'found' > const, I noticed that getenv() still returns char * despite environment strings > being semantically read-only. This creates a subtle const-correctness gap that > stricter compilers (like GCC 16) may flag in the future. > > I've prepared an improved v2 patch [2] that builds upon your merged fix by using > g_getenv() and g_strstr_len() to maintain const correctness throughout. This > approach: > > - Uses g_getenv() which returns const gchar *, matching the read-only semantics > of environment variables > - Employs g_strstr_len() for consistent use of GLib string functions, aligning > with QEMU conventions > - Eliminates all const-correctness warnings with strict compilers The v2 patch > supersedes my earlier attempt and is rebased on top of your merged commit > (e68da5b7a2cd). > > Thanks again for the quick fix! > > [1] https://lore.kernel.org/all/20260518172517.12466-3-amachhiw@linux.ibm.com/ > [2] https://lore.kernel.org/all/20260522082555.54918-1-amachhiw@linux.ibm.com/ > > Regards, > Amit > > On 2026/05/18 12:53 PM, Fabiano Rosas wrote: > > From: Matthew Penney <matt@matthewpenney.net> > > > > Modern compilers warn that the result of strstr() may discard > > const qualifiers when assigned to a non-const pointer. > > > > Make 'found' a const char * to fix the warning. > > > > Signed-off-by: Matthew Penney <matt@matthewpenney.net> > > Reviewed-by: Thomas Huth <thuth@redhat.com> > > Tested-by: Thomas Huth <thuth@redhat.com> > > Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> > > Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org> > > Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> > > Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com> > > Signed-off-by: Fabiano Rosas <farosas@suse.de> > > --- > > tests/qtest/libqtest.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/tests/qtest/libqtest.c b/tests/qtest/libqtest.c > > index bf9284b9a1..b1e06ea364 100644 > > --- a/tests/qtest/libqtest.c > > +++ b/tests/qtest/libqtest.c > > @@ -2146,7 +2146,7 @@ bool mkimg(const char *file, const char *fmt, unsigned size_mb) > > bool qtest_verbose(const char *domain) > > { > > const char *log = getenv("QTEST_LOG"); > > - char *found; > > + const char *found; > > > > assert(domain); > > > > -- > > 2.51.0 > > > > > ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PULL 0/1] Qtest patches for 2026-05-18 2026-05-18 15:53 [PULL 0/1] Qtest patches for 2026-05-18 Fabiano Rosas 2026-05-18 15:53 ` [PULL 1/1] tests/qtest: fix discarded const qualifier warning Fabiano Rosas @ 2026-05-19 19:17 ` Stefan Hajnoczi 1 sibling, 0 replies; 5+ messages in thread From: Stefan Hajnoczi @ 2026-05-19 19:17 UTC (permalink / raw) To: Fabiano Rosas; +Cc: qemu-devel [-- Attachment #1: Type: text/plain, Size: 116 bytes --] Applied, thanks. Please update the changelog at https://wiki.qemu.org/ChangeLog/11.1 for any user-visible changes. [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 488 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-05-22 11:51 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-05-18 15:53 [PULL 0/1] Qtest patches for 2026-05-18 Fabiano Rosas 2026-05-18 15:53 ` [PULL 1/1] tests/qtest: fix discarded const qualifier warning Fabiano Rosas 2026-05-22 8:27 ` Amit Machhiwal 2026-05-22 11:50 ` Matthew Penney 2026-05-19 19:17 ` [PULL 0/1] Qtest patches for 2026-05-18 Stefan Hajnoczi
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.