unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* bug#10846: warning: non-literal format string
@ 2012-02-19 12:52 Bruno Haible
  2012-02-19 22:57 ` Ludovic Courtès
  0 siblings, 1 reply; 2+ messages in thread
From: Bruno Haible @ 2012-02-19 12:52 UTC (permalink / raw)
  To: 10846

Hi,

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 "~@?~%" (ngettext "a piece of cake" "~D pieces of cake" n) 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) 2.0.3.152-c5f6c2
...
$ 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 /home/bruno/.cache/guile/ccache/2.0-LE-4-2.0/home/bruno/gettext-0.18.2-32-static/gettext-tools/tests/prog.scm.go
'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.

Bruno






^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#10846: warning: non-literal format string
  2012-02-19 12:52 bug#10846: warning: non-literal format string Bruno Haible
@ 2012-02-19 22:57 ` Ludovic Courtès
  0 siblings, 0 replies; 2+ messages in thread
From: Ludovic Courtès @ 2012-02-19 22:57 UTC (permalink / raw)
  To: Bruno Haible; +Cc: 10846-done

Hi Bruno,

Bruno Haible <bruno@clisp.org> skribis:

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

Thanks, fixed here:

  http://git.savannah.gnu.org/cgit/guile.git/commit/?h=stable-2.0&id=afc9803113de660a761f476b7957e92cc60bad19
  http://git.savannah.gnu.org/cgit/guile.git/commit/?h=stable-2.0&id=98385ed20abdc191a67daef8a00b1df0290a074a

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

The ‘format’ warning is in ‘%auto-compilation-options’, but it can be
turned off at the user’s option.

Thanks,
Ludo’.





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-02-19 22:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-19 12:52 bug#10846: warning: non-literal format string Bruno Haible
2012-02-19 22:57 ` Ludovic Courtès

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