inclhack.def (hpux11_snprintf): New edit.
authorZack Weinberg <zack@codesourcery.com>
Mon, 20 Oct 2003 21:16:13 +0000 (21:16 +0000)
committerZack Weinberg <zack@gcc.gnu.org>
Mon, 20 Oct 2003 21:16:13 +0000 (21:16 +0000)
* fixinc/inclhack.def (hpux11_snprintf): New edit.
* fixinc/fixincl.x: Regenerate.
* fixinc/tests/base/stdio.h: Add test for hpux11_snprintf.

From-SVN: r72719

gcc/ChangeLog
gcc/fixinc/fixincl.x
gcc/fixinc/inclhack.def
gcc/fixinc/tests/base/stdio.h

index 93c69e6..1e0075c 100644 (file)
@@ -1,3 +1,9 @@
+2003-10-20  Zack Weinberg  <zack@codesourcery.com>
+
+       * fixinc/inclhack.def (hpux11_snprintf): New edit.
+       * fixinc/fixincl.x: Regenerate.
+       * fixinc/tests/base/stdio.h: Add test for hpux11_snprintf.
+
 2003-10-20  Mark Mitchell  <mark@codesourcery.com>
 
        * Makefile.in (install-info): Simplify.
index 19f9880..609fc62 100644 (file)
@@ -2,11 +2,11 @@
  * 
  * DO NOT EDIT THIS FILE   (fixincl.x)
  * 
- * It has been AutoGen-ed  Tuesday October 14, 2003 at 02:19:40 AM MEST
+ * It has been AutoGen-ed  Monday October 20, 2003 at 01:29:54 PM PDT
  * From the definitions    inclhack.def
  * and the template file   fixincl
  */
-/* DO NOT CVS-MERGE THIS FILE, EITHER Tue Oct 14 02:19:40 MEST 2003
+/* DO NOT CVS-MERGE THIS FILE, EITHER Mon Oct 20 13:29:54 PDT 2003
  *
  * You must regenerate it.  Use the ./genfixes script.
  *
@@ -15,7 +15,7 @@
  * certain ANSI-incompatible system header files which are fixed to work
  * correctly with ANSI C and placed in a directory that GNU C will search.
  *
- * This file contains 159 fixup descriptions.
+ * This file contains 160 fixup descriptions.
  *
  * See README for more information.
  *
@@ -2140,6 +2140,41 @@ static const char* apzHpux11_VsnprintfPatch[] = {
 
 /* * * * * * * * * * * * * * * * * * * * * * * * * *
  *
+ *  Description of Hpux11_Snprintf fix
+ */
+tSCC zHpux11_SnprintfName[] =
+     "hpux11_snprintf";
+
+/*
+ *  File name selection pattern
+ */
+tSCC zHpux11_SnprintfList[] =
+  "|stdio.h|";
+/*
+ *  Machine/OS name selection pattern
+ */
+#define apzHpux11_SnprintfMachs (const char**)NULL
+
+/*
+ *  content selection pattern - do fix if pattern found
+ */
+tSCC zHpux11_SnprintfSelect0[] =
+       "(extern int snprintf *\\(char *\\*, *(|__|_hpux_)size_t,) *(char *\\*, *\\.\\.\\.\\);)";
+
+#define    HPUX11_SNPRINTF_TEST_CT  1
+static tTestDesc aHpux11_SnprintfTests[] = {
+  { TT_EGREP,    zHpux11_SnprintfSelect0, (regex_t*)NULL }, };
+
+/*
+ *  Fix Command Arguments for Hpux11_Snprintf
+ */
+static const char* apzHpux11_SnprintfPatch[] = {
+    "format",
+    "%1 const %3",
+    (char*)NULL };
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
  *  Description of Hpux8_Bogus_Inlines fix
  */
 tSCC zHpux8_Bogus_InlinesName[] =
@@ -6309,9 +6344,9 @@ static const char* apzX11_SprintfPatch[] = {
  *
  *  List of all fixes
  */
-#define REGEX_COUNT          179
+#define REGEX_COUNT          180
 #define MACH_LIST_SIZE_LIMIT 261
-#define FIX_COUNT            159
+#define FIX_COUNT            160
 
 /*
  *  Enumerate the fixes
@@ -6367,6 +6402,7 @@ typedef enum {
     HPUX11_SIZE_T_FIXIDX,
     HPUX11_UINT32_C_FIXIDX,
     HPUX11_VSNPRINTF_FIXIDX,
+    HPUX11_SNPRINTF_FIXIDX,
     HPUX8_BOGUS_INLINES_FIXIDX,
     HPUX_CTYPE_MACROS_FIXIDX,
     HPUX_LONG_DOUBLE_FIXIDX,
@@ -6729,6 +6765,11 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
      HPUX11_VSNPRINTF_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
      aHpux11_VsnprintfTests,   apzHpux11_VsnprintfPatch, 0 },
 
+  {  zHpux11_SnprintfName,    zHpux11_SnprintfList,
+     apzHpux11_SnprintfMachs,
+     HPUX11_SNPRINTF_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
+     aHpux11_SnprintfTests,   apzHpux11_SnprintfPatch, 0 },
+
   {  zHpux8_Bogus_InlinesName,    zHpux8_Bogus_InlinesList,
      apzHpux8_Bogus_InlinesMachs,
      HPUX8_BOGUS_INLINES_TEST_CT, FD_MACH_ONLY,
index 2d0239b..45a0bb8 100644 (file)
@@ -1255,6 +1255,25 @@ fix = {
 
 
 /*
+ *  Fix hpux 11.00 broken snprintf declaration
+ *  (third argument is char *, needs to be const char * to prevent
+ *  spurious warnings with -Wwrite-strings or in C++).
+ */
+fix = {
+    hackname = hpux11_snprintf;
+    files    = stdio.h;
+    select   = '(extern int snprintf *\(char *\*, *(|__|_hpux_)size_t,)'
+                                    ' *(char *\*, *\.\.\.\);)';
+    c_fix     = format;
+    c_fix_arg = '%1 const %3';
+
+    test_text = "extern int snprintf(char *, size_t, char *, ...);\n"
+                "extern int snprintf(char *, __size_t, char *, ...);\n"
+                "extern int snprintf(char *, _hpux_size_t, char *, ...);";
+};
+
+
+/*
  *  get rid of bogus inline definitions in HP-UX 8.0
  */
 fix = {
index d0eadbc..73f75b8 100644 (file)
@@ -31,6 +31,13 @@ extern int vsnprintf(char *, _hpux_size_t, const char *, __gnuc_va_list);
 #endif  /* HPUX11_VSNPRINTF_CHECK */
 
 
+#if defined( HPUX11_SNPRINTF_CHECK )
+extern int snprintf(char *, size_t, const char *, ...);
+extern int snprintf(char *, _hpux_size_t, const char *, ...);
+extern int snprintf(char *, _hpux_size_t, const char *, ...);
+#endif  /* HPUX11_SNPRINTF_CHECK */
+
+
 #if defined( IRIX_STDIO_DUMMY_VA_LIST_CHECK )
 extern int printf( const char *, __gnuc_va_list );
 #endif  /* IRIX_STDIO_DUMMY_VA_LIST_CHECK */