[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

warning about non-literal format strings

From: Bruno Haible
Subject: warning about non-literal format strings
Date: Tue, 24 Aug 2021 03:18:07 +0200


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!"))
(format #t (_ "This program is running as process number ~D.") (getpid))

During the first run (with guile 3.0), the program prints to stderr these

;;; 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 

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

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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]