head	1.12;
access;
symbols
	RELEASE_5_4_0:1.11
	RELEASE_4_11_0:1.11
	RELEASE_5_3_0:1.11
	RELEASE_4_10_0:1.11
	RELEASE_5_2_1:1.11
	RELEASE_5_2_0:1.11
	RELEASE_4_9_0:1.11
	RELEASE_5_1_0:1.11
	RELEASE_4_8_0:1.11
	RELEASE_5_0_0:1.11
	RELEASE_4_7_0:1.11
	RELEASE_4_6_2:1.10
	RELEASE_4_6_1:1.10
	RELEASE_4_6_0:1.10
	RELEASE_5_0_DP1:1.10
	old_egcs_20020128:1.10
	old_RELEASE_4_5_0:1.9
	old_RELEASE_4_4_0:1.9
	old_egcs_20010430:1.9
	old_RELEASE_4_3_0:1.9
	old_egcs_20010205:1.9
	old_egcs_20001225:1.8
	old_egcs_20001218:1.8
	old_egcs_20001211:1.8
	old_egcs_20001120:1.7
	old_RELEASE_4_2_0:1.6
	old_egcs_20001002:1.6
	old_RELEASE_4_1_1:1.5
	old_egcs_20000828:1.5
	old_egcs_20000717:1.4
	old_egcs_20000501:1.3
	old_RELEASE_4_1_0:1.3
	old_RELEASE_3_5_0:1.3
	old_egcs_20000313:1.3
	old_RELEASE_4_0_0:1.2
	old_egcs_20000306:1.2
	old_egcs_20000221:1.2
	old_egcs_20000207:1.2
	old_RELEASE_3_4_0:1.1
	old_egcs_991102:1.1
	old_egcs_991110:1.1
	old_egcs_991025:1.1
	old_egcs_990920:1.1
	old_RELEASE_3_3_0:1.1
	old_egcs_990629:1.1
	old_egcs_990718:1.1
	old_egcs_990712:1.1
	old_egcs_990616:1.1
	old_egcs_990623:1.1
	old_egcs_990524:1.1
	old_RELEASE_3_2_0:1.1
	old_egcs_990418:1.1;
locks; strict;
comment	@# @;


1.12
date	2005.07.31.13.34.35;	author gerald;	state dead;
branches;
next	1.11;

1.11
date	2002.05.28.03.43.59;	author obrien;	state Exp;
branches;
next	1.10;

1.10
date	2002.02.03.07.15.30;	author obrien;	state Exp;
branches;
next	1.9;

1.9
date	2001.02.14.20.52.39;	author obrien;	state Exp;
branches;
next	1.8;

1.8
date	2000.12.13.02.26.23;	author obrien;	state Exp;
branches;
next	1.7;

1.7
date	2000.11.28.18.55.06;	author obrien;	state Exp;
branches;
next	1.6;

1.6
date	2000.10.10.23.32.34;	author obrien;	state Exp;
branches;
next	1.5;

1.5
date	2000.09.15.23.43.48;	author obrien;	state Exp;
branches;
next	1.4;

1.4
date	2000.09.05.16.59.10;	author obrien;	state Exp;
branches;
next	1.3;

1.3
date	2000.03.19.08.43.52;	author obrien;	state Exp;
branches;
next	1.2;

1.2
date	2000.02.14.11.39.37;	author obrien;	state Exp;
branches;
next	1.1;

1.1
date	99.04.21.07.48.59;	author obrien;	state Exp;
branches;
next	;


desc
@@


1.12
log
@Remove the lang/gcc31 port.  It fails to build on several architectures
(even ones it is supposed to work on, cf. pointyhat), it fails to build
on FreeBSD 6 and 7, and lang/gcc32 is basically the same plus a single
ABI changes and many bug fixes.

It is strongly recommended to migrate to GCC 3.4 or 4.0, since only these
are still actively maintained upstream and support FreeBSD 7, for example.
@
text
@--- gcc/c-format.c.orig	Wed Feb 20 14:54:32 2002
+++ gcc/c-format.c	Mon May 27 20:42:37 2002
@@@@ -19,6 +19,8 @@@@
 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 02111-1307, USA.  */
 
+/* $FreeBSD: ports/lang/gcc31/files/patch-fa,v 1.11 2002/05/28 03:43:59 obrien Exp $ */
+
 #include "config.h"
 #include "system.h"
 #include "tree.h"
@@@@ -75,6 +77,7 @@@@
    last.  */
 enum format_type { printf_format_type, scanf_format_type,
 		   strftime_format_type, strfmon_format_type,
+		   printf0_format_type,
 		   format_type_error };
 
 typedef struct function_format_info
@@@@ -82,6 +85,7 @@@@
   enum format_type format_type;	/* type of format (printf, scanf, etc.) */
   unsigned HOST_WIDE_INT format_num;	/* number of format argument */
   unsigned HOST_WIDE_INT first_arg_num;	/* number of first arg (zero for varargs) */
+  int null_format_ok;			/* TRUE if the format string may be NULL */
 } function_format_info;
 
 static bool decode_format_attr		PARAMS ((tree,
@@@@ -249,7 +253,7 @@@@
     {
       if (validated_p)
 	abort ();
-      error ("unrecognized format specifier");
+      error_with_decl (getdecls (), "unrecognized format specifier");
       return false;
     }
   else
@@@@ -540,6 +544,7 @@@@
   /* Pointer to type of argument expected if '*' is used for a precision,
      or NULL if '*' not used for precisions.  */
   tree *const precision_type;
+  const int null_format_ok;
 } format_kind_info;
 
 
@@@@ -783,6 +788,18 @@@@
   { "S",   1, STD_EXT, { TEX_W,   BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN  }, "-wp",      "R"  },
   /* GNU conversion specifiers.  */
   { "m",   0, STD_EXT, { T89_V,   BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN  }, "-wp",      ""   },
+  /* BSD conversion specifiers.  */
+  /* FreeBSD kernel extensions (src/sys/kern/subr_prf.c).
+     The format %b is supported to decode error registers.
+     Its usage is:	printf("reg=%b\n", regval, "<base><arg>*");
+     which produces:	reg=3<BITTWO,BITONE>
+     The format %D provides a hexdump given a pointer and separator string:
+     ("%6D", ptr, ":")		-> XX:XX:XX:XX:XX:XX
+     ("%*D", len, ptr, " ")	-> XX XX XX XX ...
+   */
+  { "D",   1, STD_EXT, { T89_C,  BADLEN,   BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN  }, "-wp",      "cR" },
+  { "b",   1, STD_EXT, { T89_C,  BADLEN,   BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN  }, "-wp",      ""   },
+  { "rz",  0, STD_EXT, { T89_I,  BADLEN,   BADLEN,   T89_L,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN  }, "-wp0 +#",  "i"  },
   { NULL,  0, 0, NOLENGTHS, NULL, NULL }
 };
 
@@@@ -847,23 +864,29 @@@@
     printf_flag_specs, printf_flag_pairs,
     FMT_FLAG_ARG_CONVERT|FMT_FLAG_DOLLAR_MULTIPLE|FMT_FLAG_USE_DOLLAR|FMT_FLAG_EMPTY_PREC_OK,
     'w', 0, 'p', 0, 'L',
-    &integer_type_node, &integer_type_node
+    &integer_type_node, &integer_type_node, 0
   },
   { "scanf",    scanf_length_specs,   scan_char_table,  "*'I", NULL, 
     scanf_flag_specs, scanf_flag_pairs,
     FMT_FLAG_ARG_CONVERT|FMT_FLAG_SCANF_A_KLUDGE|FMT_FLAG_USE_DOLLAR|FMT_FLAG_ZERO_WIDTH_BAD|FMT_FLAG_DOLLAR_GAP_POINTER_OK,
     'w', 0, 0, '*', 'L',
-    NULL, NULL
+    NULL, NULL, 0
   },
   { "strftime", NULL,                 time_char_table,  "_-0^#", "EO",
     strftime_flag_specs, strftime_flag_pairs,
     FMT_FLAG_FANCY_PERCENT_OK, 'w', 0, 0, 0, 0,
-    NULL, NULL
+    NULL, NULL, 0
   },
   { "strfmon",  strfmon_length_specs, monetary_char_table, "=^+(!-", NULL, 
     strfmon_flag_specs, strfmon_flag_pairs,
     FMT_FLAG_ARG_CONVERT, 'w', '#', 'p', 0, 'L',
-    NULL, NULL
+    NULL, NULL, 0
+  },
+  { "printf0",   printf_length_specs,  print_char_table, " +#0-'I", NULL,
+    printf_flag_specs, printf_flag_pairs,
+    FMT_FLAG_ARG_CONVERT|FMT_FLAG_DOLLAR_MULTIPLE|FMT_FLAG_USE_DOLLAR|FMT_FLAG_EMPTY_PREC_OK,
+   'w', 0, 'p', 0, 'L',
+   &integer_type_node, &integer_type_node, 1
   }
 };
 
@@@@ -917,6 +940,14 @@@@
 
 static void check_format_types	PARAMS ((int *, format_wanted_type *));
 
+
+inline static int get_null_fmt_ok (fmttype)
+	enum format_type fmttype;
+{
+  return format_types[(int)fmttype].null_format_ok;
+}
+
+
 /* Decode a format type from a string, returning the type, or
    format_type_error if not valid, in which case the caller should print an
    error message.  */
@@@@ -1475,7 +1506,7 @@@@
 	 specially if info == NULL and add a res->number_null entry for
 	 that case, or maybe add a function pointer to be called at
 	 the end instead of hardcoding check_format_info_main.  */
-      status_warning (status, "null format string");
+      if (!info->null_format_ok) status_warning (status, "null format string");
 
       /* Skip to first argument to check, so we can see if this format
 	 has any arguments (it shouldn't).  */
@@@@ -1986,6 +2017,57 @@@@
 	    }
 	}
 
+      if (*format_chars == 'b')
+	{
+	  /* There should be an int arg to control the string arg.  */
+	  if (params == 0)
+	    {
+	      status_warning (status, "too few arguments for format");
+	      return;
+	    }
+	    if (info->first_arg_num != 0)
+	    {
+	      cur_param = TREE_VALUE (params);
+	      params = TREE_CHAIN (params);
+	      ++arg_num;
+	      if ((TYPE_MAIN_VARIANT (TREE_TYPE (cur_param))
+		   != integer_type_node)
+		  &&
+		  (TYPE_MAIN_VARIANT (TREE_TYPE (cur_param))
+		   != unsigned_type_node))
+		{
+		  status_warning (status, "bitmap is not type int (arg %d)",
+				  arg_num);
+		}
+	    }
+	}
+      if (*format_chars == 'D')
+	{
+	  /* There should be an unsigned char * arg before the string arg.  */
+	  if (params == 0)
+	    {
+	      status_warning (status, "too few arguments for format");
+	      return;
+	    }
+	    if (info->first_arg_num != 0)
+	    {
+	      tree cur_type;
+
+	      cur_param = TREE_VALUE (params);
+	      params = TREE_CHAIN (params);
+	      ++arg_num;
+	      cur_type = TREE_TYPE (cur_param);
+	      if (TREE_CODE (cur_type) != POINTER_TYPE
+		  || TYPE_MAIN_VARIANT (TREE_TYPE (cur_type))
+		     != unsigned_char_type_node)
+		{
+		  status_warning (status,
+		      "ethernet address is not type unsigned char * (arg %d)",
+				  arg_num);
+		}
+	    }
+	}
+
       format_char = *format_chars;
       if (format_char == 0
 	  || (!(fki->flags & (int) FMT_FLAG_FANCY_PERCENT_OK)
@@@@ -2112,7 +2194,7 @@@@
 	  else if (strchr (fci->flags2, '2') != 0)
 	    y2k_level = 2;
 	  if (y2k_level == 3)
-	    status_warning (status, "`%%%c' yields only last 2 digits of year in some locales",
+	    status_warning (status, "`%%%c' yields only last 2 digits of year in some locales on non-BSD systems",
 			    format_char);
 	  else if (y2k_level == 2)
 	    status_warning (status, "`%%%c' yields only last 2 digits of year", format_char);
@


1.11
log
@Update to match what is in -current.
@
text
@d7 1
a7 1
+/* $FreeBSD: src/contrib/gcc/c-format.c,v 1.4 2002/05/26 16:04:37 obrien Exp $ */
@


1.10
log
@Upgrade to the 28-Jan-2002 GCC 3.1 development snapshot.
@
text
@d1 20
a20 3
--- gcc/c-format.c.orig	Sun Nov 25 10:54:11 2001
+++ gcc/c-format.c	Sat Feb  2 19:04:24 2002
@@@@ -82,12 +82,15 @@@@
d24 1
a24 1
+  /* int null_format_ok; */	/* TRUE if the format string may be NULL */
d28 1
a28 30
 						 function_format_info *, int));
 static enum format_type decode_format_type	PARAMS ((const char *));
 
+/* inline static int get_null_fmt_ok	PARAMS ((enum format_type)); */
+
 /* Handle a "format" attribute; arguments as in
    struct attribute_spec.handler.  */
 tree
@@@@ -97,6 +100,7 @@@@
      tree args;
      int flags;
      bool *no_add_attrs;
+     /* int null_format_ok; */
 {
   tree type = *node;
   function_format_info info;
@@@@ -257,6 +261,7 @@@@
       const char *p = IDENTIFIER_POINTER (format_type_id);
 
       info->format_type = decode_format_type (p);
+      /* info->null_format_ok = get_null_fmt_ok (format_type); */
 
       if (info->format_type == format_type_error)
 	{
@@@@ -292,6 +297,7 @@@@
 
   info->format_num = TREE_INT_CST_LOW (format_num_expr);
   info->first_arg_num = TREE_INT_CST_LOW (first_arg_num_expr);
+  /* info->null_format_ok = TREE_INT_CST_LOW (null_format_ok); */
   if (info->first_arg_num != 0 && info->first_arg_num <= info->format_num)
d31 7
a37 1
@@@@ -540,6 +546,8 @@@@
d41 1
a41 2
+  /* Needed for FreeBSD kernel and the printf0() printf-like function.  */
+  /* int null_format_ok; */
d45 18
a62 1
@@@@ -765,6 +773,20 @@@@
d64 2
a65 20
 static const format_char_info print_char_table[] =
 {
+#warning The FreeBSD kernel extensions in print_char_table might not be done correctly.
+/* FreeBSD kernel extensions (src/sys/kern/subr_prf.c).  */
+/* The format %b is supported to decode error registers.
+   Its usage is:	printf("reg=%b\n", regval, "<base><arg>*");
+   which produces:	reg=3<BITTWO,BITONE>
+   The format %D provides a hexdump given a pointer and separator string:
+   ("%6D", ptr, ":")		-> XX:XX:XX:XX:XX:XX
+   ("%*D", len, ptr, " ")	-> XX XX XX XX ...
+   */
+  { "D",   1, STD_EXT, { T89_C,   T89_C,   BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN  }, "-wp",      "c" },
+  { "b",   1, STD_EXT, { T89_C,   T89_C,   BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN  }, "-wp",      "" },
+  { "rz",  0, STD_EXT, { BADLEN,  T89_I,   T89_I,   T89_L,   BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN  }, "-wp0 +#",  "i" },
+#define unextended_print_char_table	(print_char_table + 3)
+#warning The FreeBSD kernel extensions in print_char_table might not be done correctly.
   /* C89 conversion specifiers.  */
   { "di",  0, STD_C89, { T89_I,   T99_SC,  T89_S,   T89_L,   T9L_LL,  TEX_LL,  T99_SST, T99_PD,  T99_IM  }, "-wp0 +'I", "i"  },
   { "oxX", 0, STD_C89, { T89_UI,  T99_UC,  T89_US,  T89_UL,  T9L_ULL, TEX_ULL, T99_ST,  T99_UPD, T99_UIM }, "-wp0#",    "i"  },
@@@@ -848,23 +870,36 @@@@
d68 2
a69 2
     &integer_type_node, &integer_type_node
+    /* ,0 */
d75 2
a76 2
     NULL, NULL
+    /* ,0 */
d81 2
a82 2
     NULL, NULL
+    /* ,0 */
d87 4
a90 5
     NULL, NULL
+    /* ,0 */
   }
+  /*
+  { "printf0",   printf_length_specs,  print_char_table, " +#0-'I", NULL, 
d93 3
a95 5
+    'w', 0, 'p', 0, 'L',
+    &integer_type_node, &integer_type_node
+    ,1
+  },
+  */
d98 1
a98 2
 
@@@@ -917,6 +952,16 @@@@
a102 1
+/*
a107 1
+*/
d113 1
a113 1
@@@@ -1475,7 +1520,7 @@@@
d118 1
a118 1
+      /*if (!info->null_format_ok)*/ status_warning (status, "null format string");
d122 1
a122 2
@@@@ -1710,6 +1755,54 @@@@
 	      main_arg_num = opnum + info->first_arg_num - 1;
d125 1
d145 2
a146 1
+		  status_warning (status, "bitmap is not type int (arg %d)", arg_num);
d161 1
d171 2
a172 2
+			  "ethernet address is not type unsigned char * (arg %d)",
+			   arg_num);
d176 5
a180 4
 
       /* Read any format flags, but do not yet validate them beyond removing
 	 duplicates, since in general validation depends on the rest of
@@@@ -2113,7 +2206,7 @@@@
@


1.9
log
@Upgrade to the 5-Feb-2001 edition GCC 2.97 development snapshot.
@
text
@d1 8
a8 8
--- gcc/c-format.c.orig	Sat Jan 13 15:29:57 2001
+++ gcc/c-format.c	Wed Feb 14 03:47:34 2001
@@@@ -75,13 +75,16 @@@@
    last.  */
 enum format_type { printf_format_type, scanf_format_type,
 		   strftime_format_type, strfmon_format_type,
+		   printf0_format_type,
 		   format_type_error };
d10 2
a12 4
 static void record_function_format	PARAMS ((tree, tree, enum format_type,
-						 int, int));
+						 int, int, int));
 static void record_international_format	PARAMS ((tree, tree, int));
d14 1
a14 1
+inline static int get_null_fmt_ok	PARAMS ((enum format_type));
d16 12
a27 21
 /* Handle the format attribute (with arguments ARGS) attached to the decl
    DECL.  It is already verified that DECL is a decl and ARGS contains
    exactly three arguments.  */
@@@@ -99,6 +102,7 @@@@
   enum format_type format_type;
   tree argument;
   unsigned int arg_num;
+  int null_format_ok;
 
   if (TREE_CODE (decl) != FUNCTION_DECL)
     {
@@@@ -109,7 +113,7 @@@@
 
   if (TREE_CODE (format_type_id) != IDENTIFIER_NODE)
     {
-      error ("unrecognized format specifier");
+      error_with_decl (decl, "unrecognized format specifier");
       return;
     }
   else
@@@@ -117,6 +121,7 @@@@
d30 2
a31 2
       format_type = decode_format_type (p);
+      null_format_ok = get_null_fmt_ok (format_type);
d33 1
a33 1
       if (format_type == format_type_error)
d35 1
a35 58
@@@@ -195,7 +200,8 @@@@
     }
 
   record_function_format (DECL_NAME (decl), DECL_ASSEMBLER_NAME (decl),
-			  format_type, format_num, first_arg_num);
+			  format_type, format_num, first_arg_num,
+			  null_format_ok);
 }
 
 
@@@@ -276,6 +282,7 @@@@
   enum format_type format_type;	/* type of format (printf, scanf, etc.) */
   int format_num;		/* number of format argument */
   int first_arg_num;		/* number of first arg (zero for varargs) */
+  int null_format_ok;		/* TRUE if the format string may be NULL */
 } function_format_info;
 
 static function_format_info *function_format_list = NULL;
@@@@ -309,44 +316,44 @@@@
     {
       /* Functions from ISO/IEC 9899:1990.  */
       record_function_format (get_identifier ("printf"), NULL_TREE,
-			      printf_format_type, 1, 2);
+			      printf_format_type, 1, 2, 0);
       record_function_format (get_identifier ("__builtin_printf"), NULL_TREE,
-			      printf_format_type, 1, 2);
+			      printf_format_type, 1, 2, 0);
       record_function_format (get_identifier ("fprintf"), NULL_TREE,
-			      printf_format_type, 2, 3);
+			      printf_format_type, 2, 3, 0);
       record_function_format (get_identifier ("__builtin_fprintf"), NULL_TREE,
-			      printf_format_type, 2, 3);
+			      printf_format_type, 2, 3, 0);
       record_function_format (get_identifier ("sprintf"), NULL_TREE,
-			      printf_format_type, 2, 3);
+			      printf_format_type, 2, 3, 0);
       record_function_format (get_identifier ("scanf"), NULL_TREE,
-			      scanf_format_type, 1, 2);
+			      scanf_format_type, 1, 2, 0);
       record_function_format (get_identifier ("fscanf"), NULL_TREE,
-			      scanf_format_type, 2, 3);
+			      scanf_format_type, 2, 3, 0);
       record_function_format (get_identifier ("sscanf"), NULL_TREE,
-			      scanf_format_type, 2, 3);
+			      scanf_format_type, 2, 3, 0);
       record_function_format (get_identifier ("vprintf"), NULL_TREE,
-			      printf_format_type, 1, 0);
+			      printf_format_type, 1, 0, 0);
       record_function_format (get_identifier ("vfprintf"), NULL_TREE,
-			      printf_format_type, 2, 0);
+			      printf_format_type, 2, 0, 0);
       record_function_format (get_identifier ("vsprintf"), NULL_TREE,
-			      printf_format_type, 2, 0);
+			      printf_format_type, 2, 0, 0);
       record_function_format (get_identifier ("strftime"), NULL_TREE,
-			      strftime_format_type, 3, 0);
+			      strftime_format_type, 3, 0, 0);
     }
d37 4
a40 1
   if (flag_hosted && flag_isoc99)
d42 2
a43 52
       /* ISO C99 adds the snprintf and vscanf family functions.  */
       record_function_format (get_identifier ("snprintf"), NULL_TREE,
-			      printf_format_type, 3, 4);
+			      printf_format_type, 3, 4, 0);
       record_function_format (get_identifier ("vsnprintf"), NULL_TREE,
-			      printf_format_type, 3, 0);
+			      printf_format_type, 3, 0, 0);
       record_function_format (get_identifier ("vscanf"), NULL_TREE,
-			      scanf_format_type, 1, 0);
+			      scanf_format_type, 1, 0, 0);
       record_function_format (get_identifier ("vfscanf"), NULL_TREE,
-			      scanf_format_type, 2, 0);
+			      scanf_format_type, 2, 0, 0);
       record_function_format (get_identifier ("vsscanf"), NULL_TREE,
-			      scanf_format_type, 2, 0);
+			      scanf_format_type, 2, 0, 0);
     }
 
   if (flag_hosted && flag_noniso_default_format_attributes)
@@@@ -357,7 +364,7 @@@@
       record_international_format (get_identifier ("dcgettext"), NULL_TREE, 2);
       /* X/Open strfmon function.  */
       record_function_format (get_identifier ("strfmon"), NULL_TREE,
-			      strfmon_format_type, 3, 4);
+			      strfmon_format_type, 3, 4, 0);
     }
 }
 
@@@@ -372,12 +379,13 @@@@
 
 static void
 record_function_format (name, assembler_name, format_type,
-			format_num, first_arg_num)
+			format_num, first_arg_num, null_format_ok)
       tree name;
       tree assembler_name;
       enum format_type format_type;
       int format_num;
       int first_arg_num;
+      int null_format_ok;
 {
   function_format_info *info;
 
@@@@ -401,6 +409,7 @@@@
   info->format_type = format_type;
   info->format_num = format_num;
   info->first_arg_num = first_arg_num;
+  info->null_format_ok = null_format_ok;
 }
 
 /* Record information for the names of function that modify the format
@@@@ -677,6 +686,8 @@@@
d46 1
a46 1
   tree *precision_type;
d48 1
a48 1
+  int null_format_ok;
d52 1
a52 1
@@@@ -902,6 +913,20 @@@@
d73 1
a73 1
@@@@ -985,22 +1010,33 @@@@
d77 1
a77 1
+    ,0
d81 1
a81 1
     FMT_FLAG_ARG_CONVERT|FMT_FLAG_SCANF_A_KLUDGE|FMT_FLAG_USE_DOLLAR|FMT_FLAG_ZERO_WIDTH_BAD,
d84 1
a84 1
+    ,0
d90 1
a90 1
+    ,0
d96 3
a98 2
+    ,0
+  },
d105 2
a106 1
   }
d109 2
a110 1
@@@@ -1053,6 +1089,14 @@@@
d115 1
d121 1
d127 1
a127 1
@@@@ -1568,7 +1612,7 @@@@
d132 1
a132 1
+      if (!info->null_format_ok) status_warning (status, "null format string");
d136 1
a136 1
@@@@ -1764,6 +1808,54 @@@@
d191 1
a191 1
@@@@ -2166,7 +2258,7 @@@@
@


1.8
log
@Upgrade to the 2000-12-11 GCC 2.97 development snapshot.
@
text
@d1 10
a10 5
--- gcc/c-common.c.orig	Sat Dec  2 19:46:03 2000
+++ gcc/c-common.c	Mon Dec 11 12:11:16 2000
@@@@ -232,7 +232,7 @@@@
 						 int, int, int));
 static void init_attributes		PARAMS ((void));
a14 1
 static int default_valid_lang_attribute PARAMS ((tree, tree, tree, tree));
d16 38
a53 53
@@@@ -927,6 +927,7 @@@@
 	    enum format_type format_type;
 	    tree argument;
 	    unsigned int arg_num;
+	    int null_format_ok;
 
 	    if (TREE_CODE (decl) != FUNCTION_DECL)
 	      {
@@@@ -937,7 +938,7 @@@@
 
 	    if (TREE_CODE (format_type_id) != IDENTIFIER_NODE)
 	      {
-		error ("unrecognized format specifier");
+		error_with_decl (decl, "unrecognized format specifier");
 		continue;
 	      }
 	    else
@@@@ -945,12 +946,26 @@@@
 		const char *p = IDENTIFIER_POINTER (format_type_id);
 
 		if (!strcmp (p, "printf") || !strcmp (p, "__printf__"))
+		  {
+		  format_type = printf_format_type;
+		  null_format_ok = 0;
+		  }
+		else if (!strcmp (p, "printf0") || !strcmp (p, "__printf0__"))
+		  {
 		  format_type = printf_format_type;
+		  null_format_ok = 1;
+		  }
 		else if (!strcmp (p, "scanf") || !strcmp (p, "__scanf__"))
+		  {
 		  format_type = scanf_format_type;
+		  null_format_ok = 0;
+		  }
 		else if (!strcmp (p, "strftime")
 			 || !strcmp (p, "__strftime__"))
+		  {
 		  format_type = strftime_format_type;
+		  null_format_ok = 0;
+		  }
 		else
 		  {
 		    warning ("`%s' is an unrecognized format function type", p);
@@@@ -1029,7 +1044,8 @@@@
 
 	    record_function_format (DECL_NAME (decl),
 				    DECL_ASSEMBLER_NAME (decl),
-				    format_type, format_num, first_arg_num);
+				    format_type, format_num, first_arg_num,
+				    null_format_ok);
 	    break;
 	  }
a54 1
@@@@ -1693,6 +1709,20 @@@@
d56 1
a56 20
 static const format_char_info print_char_table[] =
 {
+#warning The FreeBSD kernel extensions in print_char_table might not be done correctly.
+/* FreeBSD kernel extensions (src/sys/kern/subr_prf.c).  */
+/* The format %b is supported to decode error registers.
+   Its usage is:	printf("reg=%b\n", regval, "<base><arg>*");
+   which produces:	reg=3<BITTWO,BITONE>
+   The format %D provides a hexdump given a pointer and separator string:
+   ("%6D", ptr, ":")		-> XX:XX:XX:XX:XX:XX
+   ("%*D", len, ptr, " ")	-> XX XX XX XX ...
+   */
+  { "D",   1, STD_EXT, { T89_C,   T89_C,   BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN  }, "-wp"       "c" },
+  { "b",   1, STD_EXT, { T89_C,   T89_C,   BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN  }, "-wp"       "" },
+  { "rz",  0, STD_EXT, { BADLEN,  T89_I,   T89_I,   T89_L,   BADLEN,  BADLEN,  BADLEN,  BADLEN,  BADLEN  }, "-wp0 +#"   "i" },
+#define unextended_print_char_table	(print_char_table + 3)
+#warning The FreeBSD kernel extensions in print_char_table might not be done correctly.
   /* C89 conversion specifiers.  */
   { "di",  0, STD_C89, { T89_I,   T99_SC,  T89_S,   T89_L,   T99_LL,  TEX_LL,  T99_SST, T99_PD,  T99_IM  }, "-wp0 +'I", "i" },
   { "oxX", 0, STD_C89, { T89_UI,  T99_UC,  T89_US,  T89_UL,  T99_ULL, TEX_ULL, T99_ST,  T99_UPD, T99_UIM }, "-wp0#",    "i" },
@@@@ -1791,6 +1821,7 @@@@
d64 1
a64 1
@@@@ -1876,42 +1907,42 @@@@
d76 3
d126 10
a135 1
@@@@ -1934,12 +1965,13 @@@@
d150 1
a150 1
@@@@ -1963,6 +1995,7 @@@@
d158 80
a237 1
@@@@ -2454,7 +2487,7 @@@@
d246 1
a246 1
@@@@ -2650,6 +2683,54 @@@@
d301 1
a301 1
@@@@ -3024,7 +3105,7 @@@@
@


1.7
log
@Upgrade to the 2000-11-20 GCC 2.97 development snapshot.
This one should be using libstdc++ v3 and the new 3.0 C++ ABI now.
@
text
@d1 3
a3 3
--- gcc/c-common.c.orig	Thu Nov 16 22:05:12 2000
+++ gcc/c-common.c	Mon Nov 27 02:25:55 2000
@@@@ -193,7 +193,7 @@@@
d12 1
a12 1
@@@@ -888,6 +888,7 @@@@
d20 1
a20 1
@@@@ -898,7 +899,7 @@@@
d29 1
a29 1
@@@@ -906,12 +907,26 @@@@
d56 1
a56 1
@@@@ -990,7 +1005,8 @@@@
d66 1
a66 1
@@@@ -1654,6 +1670,13 @@@@
d70 12
a81 5
+#ifdef XXX_NEED_TO_UPDATE_THIS_FOR_GCC297_CHANGES
+/* FreeBSD kernel extensions.  */
+  { "D",	1,	T_C,	T_C,	NULL,	NULL,	NULL,	NULL,	NULL,	"-wp"		},
+  { "b",	1,	T_C,	T_C,	NULL,	NULL,	NULL,	NULL,	NULL,	"-wp"		},
+  { "rz",	0,	NULL,	T_I,	T_I,	T_L,	NULL,	NULL,	NULL,	"-wp0 +#"	},
d83 1
a83 1
+#endif
d87 1
a87 1
@@@@ -1752,6 +1775,7 @@@@
d95 1
a95 1
@@@@ -1837,42 +1861,42 @@@@
d154 1
a154 1
@@@@ -1895,12 +1919,13 @@@@
d169 1
a169 1
@@@@ -1924,6 +1949,7 @@@@
d177 1
a177 1
@@@@ -2415,7 +2441,7 @@@@
d186 1
a186 1
@@@@ -2611,6 +2637,54 @@@@
d241 9
a249 9
@@@@ -2984,7 +3058,7 @@@@
 	else if (strchr (fci->flags2, '2') != 0)
 	  y2k_level = 2;
 	if (y2k_level == 3)
-	  status_warning (status, "`%%%c' yields only last 2 digits of year in some locales",
+	  status_warning (status, "`%%%c' yields only last 2 digits of year in some locales on non-BSD systems",
 			  format_char);
 	else if (y2k_level == 2)
 	  status_warning (status, "`%%%c' yields only last 2 digits of year", format_char);
@


1.6
log
@Upgrade to the 2000-10-02 GCC 2.97 development snapshot.
@
text
@d1 3
a3 3
--- gcc/c-common.c.orig	Mon Sep 25 10:04:45 2000
+++ gcc/c-common.c	Mon Oct  9 02:51:14 2000
@@@@ -171,7 +171,7 @@@@
d12 1
a12 1
@@@@ -862,6 +862,7 @@@@
d20 1
a20 1
@@@@ -872,7 +873,7 @@@@
d29 1
a29 1
@@@@ -880,12 +881,26 @@@@
d55 2
a56 2
 		    status_warning (status, "`%s' is an unrecognized format function type", p);
@@@@ -958,7 +973,8 @@@@
d66 1
a66 1
@@@@ -1441,6 +1457,13 @@@@
d78 3
a80 3
   { "di",  0, STD_C89, { T89_I,   T99_I,   T89_I,   T89_L,   T99_LL,  TEX_LL,  T99_SST, T99_PD,  T99_IM  }, "-wp0 +'I", "i" },
   { "oxX", 0, STD_C89, { T89_UI,  T99_UI,  T89_UI,  T89_UL,  T99_ULL, TEX_ULL, T99_ST,  T99_UPD, T99_UIM }, "-wp0#",    "i" },
@@@@ -1526,6 +1549,7 @@@@
d88 1
a88 1
@@@@ -1570,42 +1594,42 @@@@
d147 1
a147 1
@@@@ -1630,12 +1654,13 @@@@
d162 1
a162 1
@@@@ -1659,6 +1684,7 @@@@
d170 4
a173 4
@@@@ -2019,7 +2045,7 @@@@
 
   if (integer_zerop (format_tree))
     {
d176 5
a180 5
       return;
     }
   if (TREE_CODE (format_tree) != ADDR_EXPR)
@@@@ -2340,6 +2366,54 @@@@
 		}
d232 11
a242 11
       aflag = 0;
 
@@@@ -2441,7 +2515,7 @@@@
 	status_warning (status, "width used with `%c' format", format_char);
       if (index (fci->flags2, '3') != 0
 	  || (format_char == 'y' && index (flag_chars, 'E')))
-	status_warning (status, "`%%%c' yields only last 2 digits of year in some locales",
+	status_warning (status, "`%%%c' yields only last 2 digits of year in some locales on non-BSD systems",
 		 format_char);
       else if (index (fci->flags2, '2') != 0)
 	status_warning (status, "`%%%c' yields only last 2 digits of year", format_char);
@


1.5
log
@Upgrade to the 2000-08-28 GCC 2.96 development snapshot.
@
text
@d1 3
a3 3
--- gcc/c-common.c.orig	Fri Aug 25 08:27:55 2000
+++ gcc/c-common.c	Fri Sep 15 11:30:42 2000
@@@@ -157,7 +157,7 @@@@
d12 1
a12 1
@@@@ -827,6 +827,7 @@@@
d20 1
a20 1
@@@@ -837,7 +838,7 @@@@
d29 1
a29 1
@@@@ -845,12 +846,26 @@@@
d55 2
a56 2
 		    warning ("`%s' is an unrecognized format function type", p);
@@@@ -923,7 +938,8 @@@@
d66 1
a66 2
@@@@ -1242,6 +1258,11 @@@@
 } format_char_info;
d68 3
a70 1
 static format_char_info print_char_table[] = {
d76 5
a80 4
   { "di",	0,	T_I,	T_I,	T_I,	T_L,	T_LL,	T_LL,	T_SST,	T_PD,	T_IM,	"-wp0 +'I"	},
   { "oxX",	0,	T_UI,	T_UI,	T_UI,	T_UL,	T_ULL,	T_ULL,	T_ST,	T_UPD,	T_UIM,	"-wp0#"		},
   { "u",	0,	T_UI,	T_UI,	T_UI,	T_UL,	T_ULL,	T_ULL,	T_ST,	T_UPD,	T_UIM,	"-wp0'I"		},
@@@@ -1314,6 +1335,7 @@@@
d88 1
a88 1
@@@@ -1354,40 +1376,40 @@@@
d94 3
d147 1
a147 1
@@@@ -1410,12 +1432,13 @@@@
d162 1
a162 1
@@@@ -1439,6 +1462,7 @@@@
d170 1
a170 1
@@@@ -1755,7 +1779,8 @@@@
d174 2
a175 3
-      warning ("null format string");
+      if (!info->null_format_ok)
+	warning ("null format string");
d179 1
a179 16
@@@@ -1981,12 +2006,13 @@@@
 		     It will work on most machines, because size_t and int
 		     have the same mode.  But might as well warn anyway,
 		     since it will fail on other machines.  */
+		  /* XXX should we allow unsigned ints here?  */
 		  if ((TYPE_MAIN_VARIANT (TREE_TYPE (cur_param))
 		       != integer_type_node)
 		      &&
 		      (TYPE_MAIN_VARIANT (TREE_TYPE (cur_param))
 		       != unsigned_type_node))
-		    warning ("field width is not type int (arg %d)", arg_num);
+		    warning ("precision is not type int (arg %d)", arg_num);
 		}
 	    }
 	  else
@@@@ -2046,6 +2072,53 @@@@
d188 1
a188 1
+	      tfaff ();
d202 1
a202 1
+		  warning ("bitmap is not type int (arg %d)", arg_num);
d211 1
a211 1
+	      tfaff ();
d216 1
d225 2
a226 2
+		  warning ("ethernet address is not type unsigned char *"
+			   " (arg %d)",
d234 3
a236 13
@@@@ -2130,7 +2203,8 @@@@
       switch (info->format_type)
 	{
 	case printf_format_type:
-	  fci = print_char_table;
+	  fci = flag_format_extensions ? print_char_table
+	  	: unextended_print_char_table;
 	  break;
 	case scanf_format_type:
 	  fci = scan_char_table;
@@@@ -2174,7 +2248,7 @@@@
 	warning ("width used with `%c' format", format_char);
       if (index (fci->flag_chars, '3') != 0
d238 2
a239 2
-	warning ("`%%%c' yields only last 2 digits of year in some locales",
+ 	warning ("`%%%c' yields only last 2 digits of year in some locales on non-BSD systems",
d241 2
a242 2
       else if (index (fci->flag_chars, '2') != 0)
 	warning ("`%%%c' yields only last 2 digits of year", format_char);
@


1.4
log
@Upgrade to the 2000-07-17 GCC 2.96 development snapshot.
@
text
@d1 3
a3 3
--- gcc/c-common.c.orig	Sun Jun 18 06:09:26 2000
+++ gcc/c-common.c	Mon Jun 26 20:15:08 2000
@@@@ -154,7 +154,7 @@@@
d12 1
a12 1
@@@@ -805,6 +805,7 @@@@
d20 1
a20 1
@@@@ -815,7 +816,7 @@@@
d29 1
a29 1
@@@@ -823,12 +824,26 @@@@
d56 1
a56 1
@@@@ -901,7 +916,8 @@@@
d66 1
a66 1
@@@@ -1207,6 +1223,11 @@@@
d75 4
a78 4
   { "di",	0,	T_I,	T_I,	T_I,	T_L,	T_LL,	T_LL,	T_ST,	"-wp0 +"	},
   { "oxX",	0,	T_UI,	T_UI,	T_UI,	T_UL,	T_ULL,	T_ULL,	T_ST,	"-wp0#"		},
   { "u",	0,	T_UI,	T_UI,	T_UI,	T_UL,	T_ULL,	T_ULL,	T_ST,	"-wp0"		},
@@@@ -1269,6 +1290,7 @@@@
d86 57
a142 37
@@@@ -1299,25 +1321,25 @@@@
 init_function_format_info ()
 {
   record_function_format (get_identifier ("printf"), NULL_TREE,
-			  printf_format_type, 1, 2);
+			  printf_format_type, 1, 2, 0);
   record_function_format (get_identifier ("fprintf"), NULL_TREE,
-			  printf_format_type, 2, 3);
+			  printf_format_type, 2, 3, 0);
   record_function_format (get_identifier ("sprintf"), NULL_TREE,
-			  printf_format_type, 2, 3);
+			  printf_format_type, 2, 3, 0);
   record_function_format (get_identifier ("scanf"), NULL_TREE,
-			  scanf_format_type, 1, 2);
+			  scanf_format_type, 1, 2, 0);
   record_function_format (get_identifier ("fscanf"), NULL_TREE,
-			  scanf_format_type, 2, 3);
+			  scanf_format_type, 2, 3, 0);
   record_function_format (get_identifier ("sscanf"), NULL_TREE,
-			  scanf_format_type, 2, 3);
+			  scanf_format_type, 2, 3, 0);
   record_function_format (get_identifier ("vprintf"), NULL_TREE,
-			  printf_format_type, 1, 0);
+			  printf_format_type, 1, 0, 0);
   record_function_format (get_identifier ("vfprintf"), NULL_TREE,
-			  printf_format_type, 2, 0);
+			  printf_format_type, 2, 0, 0);
   record_function_format (get_identifier ("vsprintf"), NULL_TREE,
-			  printf_format_type, 2, 0);
+			  printf_format_type, 2, 0, 0);
   record_function_format (get_identifier ("strftime"), NULL_TREE,
-			  strftime_format_type, 3, 0);
+			  strftime_format_type, 3, 0, 0);
 
   record_international_format (get_identifier ("gettext"), NULL_TREE, 1);
   record_international_format (get_identifier ("dgettext"), NULL_TREE, 2);
@@@@ -1335,12 +1357,13 @@@@
d157 1
a157 1
@@@@ -1364,6 +1387,7 @@@@
d165 1
a165 1
@@@@ -1515,7 +1539,8 @@@@
d175 1
a175 1
@@@@ -1704,12 +1729,13 @@@@
d190 1
a190 1
@@@@ -1754,6 +1780,53 @@@@
d244 1
a244 1
@@@@ -1822,7 +1895,8 @@@@
d254 4
a257 4
@@@@ -1859,7 +1933,7 @@@@
       if (index (fci->flag_chars, '2') != 0)
 	warning ("`%%%c' yields only last 2 digits of year", format_char);
       else if (index (fci->flag_chars, '3') != 0)
d259 1
a259 1
+	warning ("`%%%c' yields only last 2 digits of year in some locales on non-BSD systems",
d261 2
a262 2
       if (precise && index (fci->flag_chars, 'p') == 0)
 	warning ("precision used with `%c' format", format_char);
@


1.3
log
@Upgrade to the 2000-03-13 GCC 2.96 development snapshot.
@
text
@d1 2
a2 2
--- gcc/c-common.c.orig	Wed Mar  8 03:21:26 2000
+++ gcc/c-common.c	Tue Mar 14 21:46:03 2000
a9 1
 static tree c_find_base_decl            PARAMS ((tree));
d11 2
a12 1
@@@@ -786,6 +786,7 @@@@
d20 1
a20 1
@@@@ -796,7 +797,7 @@@@
d29 1
a29 1
@@@@ -804,12 +805,26 @@@@
d56 1
a56 1
@@@@ -882,7 +897,8 @@@@
d61 2
a62 2
+				    format_type,  null_format_ok, format_num,
+				    first_arg_num);
d66 1
a66 1
@@@@ -1186,6 +1202,11 @@@@
d78 1
a78 3
@@@@ -1246,6 +1267,7 @@@@
   tree name;			/* identifier such as "printf" */
   tree assembler_name;		/* optional mangled identifier (for C++) */
a79 1
+  int null_format_ok;		/* TRUE if the format string may be NULL */
d82 1
d84 3
a86 1
@@@@ -1278,25 +1300,25 @@@@
d91 1
a91 1
+			  printf_format_type, 0, 1, 2);
d94 1
a94 1
+			  printf_format_type, 0, 2, 3);
d97 1
a97 1
+			  printf_format_type, 0, 2, 3);
d100 1
a100 1
+			  scanf_format_type, 0, 1, 2);
d103 1
a103 1
+			  scanf_format_type, 0, 2, 3);
d106 1
a106 1
+			  scanf_format_type, 0, 2, 3);
d109 1
a109 1
+			  printf_format_type, 0, 1, 0);
d112 1
a112 1
+			  printf_format_type, 0, 2, 0);
d115 1
a115 1
+			  printf_format_type, 0, 2, 0);
d118 1
a118 1
+			  strftime_format_type, 0, 3, 0);
d122 1
a122 2
@@@@ -1313,11 +1335,12 @@@@
    (e.g. for varargs such as vfprintf).  */
d125 3
a127 3
-record_function_format (name, assembler_name, format_type,
+record_function_format (name, assembler_name, format_type, null_format_ok,
 			format_num, first_arg_num)
a130 1
+      int null_format_ok;
d133 1
d135 1
a135 2
@@@@ -1341,6 +1364,7 @@@@
     }
d137 1
a138 1
+  info->null_format_ok = null_format_ok;
d141 1
d143 3
a145 1
@@@@ -1494,7 +1518,8 @@@@
d155 1
a155 1
@@@@ -1683,12 +1708,13 @@@@
d170 1
a170 1
@@@@ -1733,6 +1759,53 @@@@
d179 1
a179 1
+	      warning (tfaff);
d202 1
a202 1
+	      warning (tfaff);
d224 1
a224 1
@@@@ -1801,7 +1874,8 @@@@
d234 9
@


1.2
log
@Upgrade to the 2000-02-07 GCC 2.96 development snapshot.
@
text
@d1 3
a3 3
--- gcc/c-common.c.orig	Mon Jan 24 12:10:00 2000
+++ gcc/c-common.c	Tue Feb  1 02:43:39 2000
@@@@ -152,7 +152,7 @@@@
d12 1
a12 5
@@@@ -812,6 +812,7 @@@@
 	      = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (args)));
 	    int format_num;
 	    int first_arg_num;
+	    int null_format_ok;
d15 6
a20 2
 	    int arg_num;
@@@@ -825,7 +826,7 @@@@
d29 1
a29 1
@@@@ -833,12 +834,26 @@@@
d56 1
a56 1
@@@@ -909,7 +924,8 @@@@
d66 1
a66 1
@@@@ -1213,6 +1229,11 @@@@
d78 1
a78 1
@@@@ -1273,6 +1294,7 @@@@
d86 1
a86 1
@@@@ -1305,25 +1327,25 @@@@
d122 1
a122 1
@@@@ -1340,11 +1362,12 @@@@
d136 1
a136 1
@@@@ -1368,6 +1391,7 @@@@
d144 1
a144 1
@@@@ -1521,7 +1545,8 @@@@
d154 1
a154 1
@@@@ -1710,12 +1735,13 @@@@
d169 1
a169 1
@@@@ -1760,6 +1786,53 @@@@
d223 1
a223 1
@@@@ -1828,7 +1901,8 @@@@
@


1.1
log
@I give you the latest and greatest of the EGCS snapshot series.
This is their bleeding edge offering.  This will enable us to better track
the direction EGCS is going for future upgrades of /usr/contrib/egcs/.

Above ver 1.1.2, this offering gives you many C++ fixes/enhancements, *and*
a native Java compiler.
@
text
@d1 12
a12 12
--- gcc/c-common.c.orig	Mon Feb 15 16:40:05 1999
+++ gcc/c-common.c	Tue Mar 30 03:35:22 1999
@@@@ -61,7 +61,7 @@@@
 					       int, int, int));
 static void init_attributes		PROTO((void));
 static void record_function_format	PROTO((tree, tree, enum format_type,
-					       int, int));
+					       int, int, int));
 static void record_international_format	PROTO((tree, tree, int));
 
 /* Keep a stack of if statements.  We record the number of compound
@@@@ -669,6 +669,7 @@@@
d20 2
a21 2
@@@@ -682,7 +683,7 @@@@
 	
d29 3
a31 3
@@@@ -690,12 +691,26 @@@@
 		char *p = IDENTIFIER_POINTER (format_type_id);
 		
d55 2
a56 2
 		    error ("`%s' is an unrecognized format function type", p);
@@@@ -766,7 +781,8 @@@@
d66 1
a66 1
@@@@ -1010,6 +1026,11 @@@@
d78 1
a78 1
@@@@ -1070,6 +1091,7 @@@@
d86 1
a86 1
@@@@ -1102,25 +1124,25 @@@@
d122 1
a122 1
@@@@ -1137,11 +1159,12 @@@@
d136 1
a136 1
@@@@ -1165,6 +1188,7 @@@@
d144 1
a144 1
@@@@ -1314,7 +1338,8 @@@@
d154 1
a154 1
@@@@ -1485,12 +1510,13 @@@@
d169 1
a169 1
@@@@ -1535,6 +1561,53 @@@@
d223 1
a223 1
@@@@ -1604,7 +1677,8 @@@@
@

