Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Oct 1997 01:39:05 +0200 (CEST)
From:      Slaven Rezic <eserte@cs.tu-berlin.de>
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Subject:   gnu/4748: cc -Wformat too sensitive
Message-ID:  <199710122339.BAA00623@cottrell.dialup.fu-berlin.de>
Resent-Message-ID: <199710122350.QAA28737@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         4748
>Category:       gnu
>Synopsis:       cc -Wformat too sensitive
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Oct 12 16:50:01 PDT 1997
>Last-Modified:
>Originator:     Slaven Rezic
>Organization:
Private FreeBSD site, Berlin, Germany
>Release:        FreeBSD 2.2.1-RELEASE i386
>Environment:

>Description:

	cc -Wformat warns about "flag `0' used with type `s'". But due
	to the manpage, this is correct and produces the expected
	code, too.

>How-To-Repeat:

	Try this code with "cc -Wformat foo.c":

	#include <stdio.h>
	main() {
	  printf("%08s\n", "12");
	}


>Fix:
	
	The following patch should fix the problem (not tested). Patch
	against file in /usr/src/contrib/gcc.

--- c-common.c.orig	Mon Oct 13 01:33:18 1997
+++ c-common.c	Mon Oct 13 01:34:06 1997
@@ -705,7 +705,7 @@
   { "feEgG",	0,	T_D,	NULL,	NULL,	NULL,	T_LD,	"-wp0 +#"	},
   { "c",	0,	T_I,	NULL,	T_W,	NULL,	NULL,	"-w"		},
   { "C",	0,	T_W,	NULL,	NULL,	NULL,	NULL,	"-w"		},
-  { "s",	1,	T_C,	NULL,	T_W,	NULL,	NULL,	"-wp"		},
+  { "s",	1,	T_C,	NULL,	T_W,	NULL,	NULL,	"-wp0"		},
   { "S",	1,	T_W,	NULL,	NULL,	NULL,	NULL,	"-wp"		},
   { "p",	1,	T_V,	NULL,	NULL,	NULL,	NULL,	"-w"		},
   { "n",	1,	T_I,	T_S,	T_L,	T_LL,	NULL,	""		},

>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199710122339.BAA00623>