From owner-freebsd-hackers@FreeBSD.ORG Thu Oct 9 09:16:51 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9953E106568B; Thu, 9 Oct 2008 09:16:51 +0000 (UTC) (envelope-from z@zlo.nu) Received: from mzh.zlo.nu (ns0.zlo.nu [85.17.141.90]) by mx1.freebsd.org (Postfix) with ESMTP id 569F28FC15; Thu, 9 Oct 2008 09:16:51 +0000 (UTC) (envelope-from z@zlo.nu) Received: by mzh.zlo.nu (Postfix, from userid 1000) id EB312140FA; Thu, 9 Oct 2008 10:54:09 +0200 (CEST) Date: Thu, 9 Oct 2008 10:54:09 +0200 From: Marc Olzheim To: Ivan Voras Message-ID: <20081009085409.GA11669@zlo.nu> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="82I3+IH0IqGh5yIs" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.18 (2008-05-17) Cc: freebsd-hackers@freebsd.org Subject: Re: strftime's %c warning? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Oct 2008 09:16:51 -0000 --82I3+IH0IqGh5yIs Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Oct 08, 2008 at 10:20:00PM +0200, Ivan Voras wrote: > I'm trying to use the %c formatter in strftime(3), documented as: >=20 > " > %c is replaced by national representation of time and date. > " >=20 > ... which looks useful, except that in code in which WFORMAT is defined > as "1" I get this error: >=20 > str.c: In function 'ltime': > str.c:141: warning: '%c' yields only last 2 digits of year in some > locales on non-BSD systems > *** Error code 1 >=20 > Since the code I'm developing is definitely BSD-only (patch to pkg_* > infrastructure), should I: >=20 > a) stop using locale-based %c and choose my own date/time format > b) remove WFORMAT from the Makefile? >=20 > The same warning/error is generated by %x and %X, and %+ described in > the strftime man page isn't recognized. Yes. In FreeBSD 4.x, gcc was patched not to warn about these, so compiling with -Werror was possible even when using this. Since FreeBSD 5.x, this patch wasn't applied anymore. If you only want it to compile on your own system with -Werror, you can use this patch (and probably adapt it to %c, %x and %X as well): http://www.stack.nl/~marcolz/FreeBSD/gcc-strftime-format-freebsd7.patch.txt Marc --82I3+IH0IqGh5yIs Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAkjtxrEACgkQezjnobFOgrGY7wCfTsv6/EU4tbDV+u0R+n7FiXAI ML8An3PCMFn4cDGQcoPQ8hg4/BA8BwLU =b0Sp -----END PGP SIGNATURE----- --82I3+IH0IqGh5yIs--