public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* patch for printf/scanf format checking
@ 1997-11-19 19:21 Ulrich Drepper
  0 siblings, 0 replies; only message in thread
From: Ulrich Drepper @ 1997-11-19 19:21 UTC (permalink / raw)
  To: egcs, Richard Kenner

Hi,

Please apply the following patch which adds a bit better support
for the ISO C 9X extensions to printf/scanf.  I hope to implement
the rest soon but these patches are quite useful since they help
to avoid tons of warnings when compiling glibc.

1997-11-19 20:24  Ulrich Drepper  <drepper@cygnus.com>

	* c-common.c (print_char_table): Add a and A to float formats.
	(scan_char_table): Likewise.
	(check_format_info): Recognize `a' a allocate flag only if used
	in the correct context.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--- c-common.c.orig	Wed Nov 19 17:52:28 1997
+++ c-common.c	Wed Nov 19 17:58:47 1997
@@ -929,7 +929,7 @@
 /* Two GNU extensions.  */
   { "Z",	0,	T_ST,	NULL,	NULL,	NULL,	NULL,	"-wp0"		},
   { "m",	0,	T_V,	NULL,	NULL,	NULL,	NULL,	"-wp"		},
-  { "feEgG",	0,	T_D,	NULL,	NULL,	NULL,	T_LD,	"-wp0 +#"	},
+  { "feEgGaA",	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"		},
@@ -942,7 +942,7 @@
 static format_char_info scan_char_table[] = {
   { "di",	1,	T_I,	T_S,	T_L,	T_LL,	T_LL,	"*"	},
   { "ouxX",	1,	T_UI,	T_US,	T_UL,	T_ULL,	T_ULL,	"*"	},	
-  { "efgEG",	1,	T_F,	NULL,	T_D,	NULL,	T_LD,	"*"	},
+  { "efgEGaA",	1,	T_F,	NULL,	T_D,	NULL,	T_LD,	"*"	},
   { "sc",	1,	T_C,	NULL,	T_W,	NULL,	NULL,	"*a"	},
   { "[",	1,	T_C,	NULL,	NULL,	NULL,	NULL,	"*a"	},
   { "C",	1,	T_W,	NULL,	NULL,	NULL,	NULL,	"*"	},
@@ -1404,10 +1404,15 @@
 	    pedwarn ("ANSI C does not support the `ll' length modifier");
 	}
       aflag = 0;
-      if (*format_chars == 'a')
+      if (*format_chars == 'a' && info->is_scan)
 	{
-	  aflag = 1;
-	  format_chars++;
+	  if (format_chars[1] == 's' || format_chars[1] == 'S'
+	      || format_chars[1] == '[')
+	    {
+	      /* `a' is used as a flag.  */
+	      aflag = 1;
+	      format_chars++;
+	    }
 	}
       if (suppressed && length_char != 0)
 	{
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Thanks,

-- Uli
---------------.      drepper at gnu.org  ,-.   Rubensstrasse 5
Ulrich Drepper  \    ,-------------------'   \  76149 Karlsruhe/Germany
Cygnus Solutions `--' drepper at cygnus.com   `------------------------

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1997-11-19 19:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-11-19 19:21 patch for printf/scanf format checking Ulrich Drepper

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