[Top][All Lists]

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

bug#10846: warning: non-literal format string

From: Bruno Haible
Subject: bug#10846: warning: non-literal format string
Date: Sun, 19 Feb 2012 13:52:33 +0100
User-agent: KMail/4.7.4 (Linux/3.1.0-1.2-desktop; KDE/4.7.4; x86_64; ; )


With the default settings, guile's compiler warns about a format string
that is returned by the gettext function.

How to reproduce:
================================= prog.scm =================================
(use-modules (ice-9 format))

(setlocale LC_ALL "")
(textdomain "prog")
(bindtextdomain "prog" ".")

(define n (string->number (list-ref (command-line) 1)))

(format #t "~A~%" (gettext "'Your command, please?', asked the waiter."))

(format #t "address@hidden" (ngettext "a piece of cake" "~D pieces of cake" n) 

(format #t "~A~%" (format #f (gettext "~A is replaced by ~A.") "FF" "EUR"))

$ uname -srm
SunOS 5.11 i86pc
$ guile --version
guile (GNU Guile)
$ guile -s prog.scm 2
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;;       or pass the --no-auto-compile argument to disable.
;;; compiling /home/bruno/gettext-0.18.2-32-static/gettext-tools/tests/prog.scm
;;; /home/bruno/gettext-0.18.2-32-static/gettext-tools/tests/prog.scm:13:18: 
warning: non-literal format string
;;; compiled 
'Your command, please?', asked the waiter.
2 pieces of cake
FF is replaced by EUR.

Given that
  - It is normal for a program to be internationalized,
  - It is normal for an internationalized program to have its format strings
    passed through the gettext function.
such situations should not produce warnings with the default settings.

It's OK in my opinion to have this warning enabled through special options
or settings, though.


reply via email to

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