From: Bruno Haible <bruno@clisp.org>
To: guile-user@gnu.org
Subject: warning about non-literal format strings
Date: Tue, 24 Aug 2021 03:18:07 +0200 [thread overview]
Message-ID: <18648740.sWSEgdgrri@omega> (raw)
Hi,
The basic example for use of GNU guile together with GNU gettext looks
like this, when installed:
===============================================================================
#!/usr/bin/guile -s
!#
;;; Example for use of GNU gettext.
;;; This file is in the public domain.
;;; Source code of the GNU guile program.
(use-modules (ice-9 format))
(catch #t (lambda () (setlocale LC_ALL "")) (lambda args #f))
(textdomain "hello-guile")
(bindtextdomain "hello-guile" "/tmp/inst/hello-guile/share/locale")
(define _ gettext)
(display (_ "Hello, world!"))
(newline)
(format #t (_ "This program is running as process number ~D.") (getpid))
(newline)
===============================================================================
During the first run (with guile 3.0), the program prints to stderr these
comments:
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;; or pass the --no-auto-compile argument to disable.
;;; compiling /tmp/inst/hello-guile/bin/hello
;;; /tmp/inst/hello-guile/bin/hello:17:0: warning: non-literal format string
;;; compiled /home/bruno/.cache/guile/ccache/3.0-LE-8-4.2/tmp/inst/hello-guile/bin/hello.go
In a program with internationalization, there are typically many
(hundreds) of format strings with are the result of looking up a string
in the message catalog, by means of the 'gettext' function. With a warning
for each such format string, the number of warnings will be unbearable to an
average developer.
Is there a way to turn off this warning (without turning off other compiler
warnings)?
The documentation [1] tells me to try "guild compile -Whelp"; it shows a single
warning type 'format' ("report wrong number of arguments to `format'"). But I
would like to turn off only the "warning: non-literal format string", not the
other format related warnings.
Bruno
[1] https://www.gnu.org/software/guile/manual/html_node/Compilation.html
reply other threads:[~2021-08-24 1:18 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
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=18648740.sWSEgdgrri@omega \
--to=bruno@clisp.org \
--cc=guile-user@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: link
Be 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).