From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Bruno Haible Newsgroups: gmane.lisp.guile.user Subject: warning about non-literal format strings Date: Tue, 24 Aug 2021 03:18:07 +0200 Message-ID: <18648740.sWSEgdgrri@omega> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2828"; mail-complaints-to="usenet@ciao.gmane.io" To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Tue Aug 24 03:18:27 2021 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mIL58-0000Uv-Mk for guile-user@m.gmane-mx.org; Tue, 24 Aug 2021 03:18:26 +0200 Original-Received: from localhost ([::1]:33272 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mIL56-0002PI-Bv for guile-user@m.gmane-mx.org; Mon, 23 Aug 2021 21:18:24 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36944) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mIL4v-0002PA-RQ for guile-user@gnu.org; Mon, 23 Aug 2021 21:18:13 -0400 Original-Received: from mo4-p00-ob.smtp.rzone.de ([85.215.255.21]:34976) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mIL4t-0000Cp-NF for guile-user@gnu.org; Mon, 23 Aug 2021 21:18:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1629767888; s=strato-dkim-0002; d=clisp.org; h=Message-ID:Date:Subject:To:From:Cc:Date:From:Subject:Sender; bh=so6LT6g9OdNZFfS88rTBJwGBofBpP+06BHc7eU2ZDEo=; b=KtUvXNvFhp7zEMrjJ437+MPGtuOAU+6u2OGgprmeRJSXFin2Qy2JeQplSH5116mHTH QmizeKfG53HcM8zoRwIuh838wc5GkTkzFY+gunUzBof4L6REuCyYe/9lT8Sx5H8xd8zd uDG/okyz/OZKtraSCOoQVRR150MnSqv5JvSxxN6D4DWSpRaodxnqLE15zBWaoD5B1Ph2 BnJsfatTi807uGdiejilcrAjWGiJnFhcNWvTcGG76ABDD/Y3+EQ9Azi+fNHgX238QWXJ GtjQX55+yQ7YMiKJZaYNcT/DHjH8T1aQqmyyvmAC/8mwOP6tFkg5or8pkClVsPketi8y Vehg== Authentication-Results: strato.com; dkim=none X-RZG-AUTH: ":Ln4Re0+Ic/6oZXR1YgKryK8brlshOcZlIWs+iCP5vnk6shH0WWb0LN8XZoH94z26ll5ip69plkMcy3YOOTdoBW3oHWnelEV5bQ==" X-RZG-CLASS-ID: mo00 Original-Received: from omega.localnet by smtp.strato.de (RZmta 47.31.0 AUTH) with ESMTPSA id I0a189x7O1I8rpU (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Tue, 24 Aug 2021 03:18:08 +0200 (CEST) Received-SPF: none client-ip=85.215.255.21; envelope-from=bruno@clisp.org; helo=mo4-p00-ob.smtp.rzone.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: "guile-user" Xref: news.gmane.io gmane.lisp.guile.user:17690 Archived-At: 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