public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-4782] modula2: Don't treat % in Modula 2 messages specially Date: Mon, 19 Dec 2022 14:01:38 +0000 (GMT) [thread overview] Message-ID: <20221219140138.A66463858C78@sourceware.org> (raw) https://gcc.gnu.org/g:de2b8c41b872c8638d70dff880ebe8e82628af09 commit r13-4782-gde2b8c41b872c8638d70dff880ebe8e82628af09 Author: Jakub Jelinek <jakub@redhat.com> Date: Mon Dec 19 15:00:47 2022 +0100 modula2: Don't treat % in Modula 2 messages specially On top of the just posted patch, this patch makes sure that any % chars in message strings aren't treated as format chars. None of these functions take variable number of arguments, so for most of format specifiers there is nowhere to take arguments from, it is true that a couple of format specifiers don't take any arguments - %%, %m, %<, %>, %' - so it is actually possible to use them, but one needs to verify that no other are emitted and that what should be printed as % is really emitted as %%. If the FE does that, then please ignore this patch, otherwise I think it is safer to do this. 2022-12-19 Jakub Jelinek <jakub@redhat.com> * gm2-gcc/m2linemap.cc (m2linemap_ErrorAt, m2linemap_ErrorAtf, m2linemap_WarningAtf, m2linemap_NoteAtf, m2linemap_internal_error): Call functions with "%s", message rather than just message, so that % chars in message aren't treated as format specifiers. Diff: --- gcc/m2/gm2-gcc/m2linemap.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gcc/m2/gm2-gcc/m2linemap.cc b/gcc/m2/gm2-gcc/m2linemap.cc index c6189b7f1ab..ba09c0b8c8d 100644 --- a/gcc/m2/gm2-gcc/m2linemap.cc +++ b/gcc/m2/gm2-gcc/m2linemap.cc @@ -177,7 +177,7 @@ EXTERN void m2linemap_ErrorAt (location_t location, char *message) { - error_at (location, message); + error_at (location, "%s", message); } /* m2linemap_ErrorAtf - wraps up an error message. */ @@ -198,7 +198,7 @@ m2linemap_ErrorAtf_1 (location_t location, const char *message, ...) void m2linemap_ErrorAtf (location_t location, const char *message) { - m2linemap_ErrorAtf_1 (location, message); + m2linemap_ErrorAtf_1 (location, "%s", message); } /* m2linemap_WarningAtf - wraps up a warning message. */ @@ -219,7 +219,7 @@ m2linemap_WarningAtf_1 (location_t location, const char *message, ...) void m2linemap_WarningAtf (location_t location, const char *message) { - m2linemap_WarningAtf_1 (location, message); + m2linemap_WarningAtf_1 (location, "%s", message); } /* m2linemap_NoteAtf - wraps up a note message. */ @@ -240,7 +240,7 @@ m2linemap_NoteAtf_1 (location_t location, const char *message, ...) void m2linemap_NoteAtf (location_t location, const char *message) { - m2linemap_NoteAtf_1 (location, message); + m2linemap_NoteAtf_1 (location, "%s", message); } /* m2linemap_internal_error - allow Modula-2 to use the GCC internal error. */ @@ -248,7 +248,7 @@ m2linemap_NoteAtf (location_t location, const char *message) void m2linemap_internal_error (const char *message) { - internal_error (message); + internal_error ("%s", message); } /* UnknownLocation - return the predefined location representing an
reply other threads:[~2022-12-19 14:01 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20221219140138.A66463858C78@sourceware.org \ --to=jakub@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).