* support/regression/tests/bug1057979.c:
authorborutr <borutr@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Mon, 15 Sep 2008 19:55:17 +0000 (19:55 +0000)
committerborutr <borutr@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Mon, 15 Sep 2008 19:55:17 +0000 (19:55 +0000)
  removed old pic16 sprintf specifics
* .version, doc/sdccman.lyx: bumped sdcc version to 2.8.4
* doc/sdccman.lyx: documented 'b' binary format specifier removal

git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@5240 4a8a32a2-be11-0410-ad9d-d568d2c75423

.version
ChangeLog
device/lib/pic16/libc/stdio/printf_tiny.c
device/lib/pic16/libc/stdio/vfprintf.c
doc/sdccman.lyx
support/regression/tests/bug1057979.c

index 9f8d8a9164a7ba7a14228a3d2a94931bcfbdf97c..2701a226a2f023fc61ffea3ec329da44c8681cad 100644 (file)
--- a/.version
+++ b/.version
@@ -1 +1 @@
-2.8.3
+2.8.4
index 1ca93c601c46273cb8248a610504cc20fccb518c..723558c494e9feac91953e938b315c77fed6b953 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
        * device/lib/pic16/libc/stdio/vfprintf.c:
          applied patch #2044424: PIC16: vfprintf
          thanks Mauro Giachero
+       * support/regression/tests/bug1057979.c:
+         removed old pic16 sprintf specifics
+       * .version, doc/sdccman.lyx: bumped sdcc version to 2.8.4
+       * doc/sdccman.lyx: documented 'b' binary format specifier removal
 
 2008-09-15 Raphael Neider <rneider AT web.de>
 
index f88bb36da707a5c79f03965fbc1e2756f0534c22..fb44bcf5b561405dfe890e17f56aefdec9ee5714 100644 (file)
 #define ISCHAR          (fchar)
 #define HAVESIGN        (nosign)
 
-
-#if 1
-extern void io_long (long);
-extern void io_int (long);
-extern void io_char (char);
+#ifdef BINARY_SPECIFIER
+/* "%lb" = "0" - "11111111111111111111111111111111" */
+# define BUF_SIZE       33
+#else
+/* "%lo" = "0" - "37777777777" or  "-21777777777" - "17777777777" */
+# define BUF_SIZE       13
 #endif
 
 void
@@ -97,8 +98,7 @@ printf_tiny (const char *fmt, ...)
   char *str, *ch;
   __data char *str1;
   long val;
-//  static char buffer[16];
-  char buffer[16];
+  char buffer[BUF_SIZE];
   va_list ap;
 
   va_start (ap, fmt);
index 95d8b002a4b7045614bb3a346d7df5328595574f..304bb01b03d522e5f5db7a9b94fe0f24a855138e 100644 (file)
  */
 #define EXTRA_INTEGER
 
+#ifdef BINARY_SPECIFIER
+/* "%lb" = "0" - "11111111111111111111111111111111" */
+# define BUF_SIZE       33
+#else
+/* "%lo" = "0" - "37777777777" or  "-20000000000" - "17777777777" */
+# define BUF_SIZE       13
+#endif
+
 #if _DEBUG
 extern void io_long (unsigned long);
 extern void io_str (char *);
@@ -156,8 +164,7 @@ vfprintf (FILE * stream, const char *fmt, va_list ap)
   int count = 0;
   char *str, *ch;
   long val;
-//  static char buffer[16];
-  char buffer[16];
+  char buffer[BUF_SIZE];
 
 #if _DEBUG
   io_str ("vfprintf: ");
index d8aa817a672316999e7e19bb60c12d5d39ea81f2..38436d89dcbbdda8adad09f1efc17ba1e055ee0b 100644 (file)
@@ -104,7 +104,7 @@ SDCC Compiler User Guide
 \begin_layout Date
 
 \size normal
-SDCC 2.8.3
+SDCC 2.8.4
 \size footnotesize
 
 \newline
@@ -1166,10 +1166,14 @@ in older versions, the preprocessor was always called with -std=c99 regardless
  comments
 \end_layout
 
-\begin_layout Standard
-
-\emph on
-<pending: more incompatibilities?>
+\begin_layout Itemize
+in versions older then 2.8.4 the pic16 *printf() and printf_tiny() library
+ functions supported undocumented and not standard compliant 'b' binary
+ format specifier ("%b", "%hb" and "%lb").
+ The 'b' specifier is now disabled by default.
+ It can be enabled by defining BINARY_SPECIFIER macro in files device/lib/pic16/
+libc/stdio/vfprintf.c and device/lib/pic16/libc/stdio/printf_tiny.c and recompilin
+g the library.
 \end_layout
 
 \begin_layout Section
index b7301acbec04533cd4e063e084d6197e154bc5c0..08aa3e1aa52b3d9235871a8782ab7b3cadeaac9e 100644 (file)
@@ -7,66 +7,50 @@
 #include <stdio.h>
 #include <testfwk.h>
 
-char s[12+1];
+char s[12 + 1];
 
 void
-test_sprintf(void)
+test_sprintf (void)
 {
   s[12] = 0x12;
 
-  sprintf( s, "%d", 99 );
-  ASSERT( 0 == strcmp( s, "99" ) );
-  sprintf( s, "%d", 100 );
-  ASSERT( 0 == strcmp( s, "100" ) );
-  sprintf( s, "%d", 2004 );
-  ASSERT( 0 == strcmp( s, "2004" ) );
-  sprintf( s, "%ld", 2147483647L );
-  ASSERT( 0 == strcmp( s, "2147483647" ) );
+  sprintf (s, "%d", 99);
+  ASSERT (0 == strcmp (s, "99"));
+  sprintf (s, "%d", 100);
+  ASSERT (0 == strcmp (s, "100"));
+  sprintf (s, "%d", 2004);
+  ASSERT (0 == strcmp (s, "2004"));
+  sprintf (s, "%ld", 2147483647L);
+  ASSERT (0 == strcmp (s, "2147483647"));
 
   //and from bug 1073386
-#ifdef SDCC_pic16
-  //pic16 printf doesn't support flags, width and precision specifiers
-  sprintf( s, "%04X", 0x8765u );
-  ASSERT( 0 == strcmp( s, "04X" ) );
+  sprintf (s, "%04X", 0x8765u);
+  ASSERT (0 == strcmp (s, "8765"));
 
   //and from bug 1193299
-  sprintf( s, "%3.3s", "abcd" );
-  ASSERT( 0 == strcmp( s, "3.3s" ) );
-  sprintf( s, "%-3.3s", "abcd" );
-  ASSERT( 0 == strcmp( s, "-3.3s" ) );
-  sprintf( s, "%3.3s", "ab" );
-  ASSERT( 0 == strcmp( s, "3.3s" ) );
-  sprintf( s, "%-3.3s", "ab" );
-  ASSERT( 0 == strcmp( s, "-3.3s" ) );
-#else
-  sprintf( s, "%04X", 0x8765u );
-  ASSERT( 0 == strcmp( s, "8765" ) );
-
-  //and from bug 1193299
-  sprintf( s, "%3.3s", "abcd" );
-  ASSERT( 0 == strcmp( s, "abc" ) );
-  sprintf( s, "%-3.3s", "abcd" );
-  ASSERT( 0 == strcmp( s, "abc" ) );
-  sprintf( s, "%3.3s", "ab" );
-  ASSERT( 0 == strcmp( s, " ab" ) );
-  sprintf( s, "%-3.3s", "ab" );
-  ASSERT( 0 == strcmp( s, "ab " ) );
-#endif
+  sprintf (s, "%3.3s", "abcd");
+  ASSERT (0 == strcmp (s, "abc"));
+  sprintf (s, "%-3.3s", "abcd");
+  ASSERT (0 == strcmp (s, "abc"));
+  sprintf (s, "%3.3s", "ab");
+  ASSERT (0 == strcmp (s, " ab"));
+  sprintf (s, "%-3.3s", "ab");
+  ASSERT (0 == strcmp (s, "ab "));
 
 #if defined(SDCC_ds390) || defined(PORT_HOST)
   //and from bug 1358192
-  sprintf( s, "%f", 10.1 );
-  LOG((s));
-  ASSERT( 0 == strcmp( s, "10.100000" ) );
+  sprintf (s, "%f", 10.1);
+  LOG ((s));
+  ASSERT (0 == strcmp (s, "10.100000"));
 
   //and from bug 1388703
-  sprintf( s, "%4.1f", 1.36 );
-  LOG((s));
-  ASSERT( 0 == strcmp( s, " 1.4" ) );
-  sprintf( s, "%4.1f", -1.37 );
-  LOG((s));
-  ASSERT( 0 == strcmp( s, "-1.4" ) );
+  sprintf (s, "%4.1f", 1.36);
+  LOG ((s));
+  ASSERT (0 == strcmp (s, " 1.4"));
+  sprintf (s, "%4.1f", -1.37);
+  LOG ((s));
+  ASSERT (0 == strcmp (s, "-1.4"));
 #endif
 
-  ASSERT( s[12]==0x12 );
+  ASSERT (s[12] == 0x12);
 }