unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* warning about non-literal format strings
@ 2021-08-24  1:18 Bruno Haible
  0 siblings, 0 replies; only message in thread
From: Bruno Haible @ 2021-08-24  1:18 UTC (permalink / raw)
  To: guile-user

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






^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-08-24  1:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-24  1:18 warning about non-literal format strings Bruno Haible

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).