This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
follow-up to 23767
authorRobin Barker <RMBarker@cpan.org>
Tue, 11 Jan 2005 15:48:49 +0000 (15:48 +0000)
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Tue, 11 Jan 2005 17:04:24 +0000 (17:04 +0000)
Message-ID: <533D273D4014D411AB1D00062938C4D90849C56A@hotel.npl.co.uk>

p4raw-id: //depot/perl@23781

Porting/pumpkin.pod
sv.c

index b2e2c2e..ff1e5bd 100644 (file)
@@ -719,37 +719,32 @@ If you have gcc, you can test the correct use of printf-style
 arguments.  Run C<Configure> with S<-Dccflags='-DCHECK_FORMAT
 -Wformat'> (and S<-Dcc=gcc>, if you are not on a system where C<cc>
 is C<gcc>) and run C<make>.  The compiler will produce warnings of
-incorrect use of format arguments.  CHECK_FORMAT changes perl-defined
-formats to common formats, so DO NOT USE the executable produced by
-this process.
+incorrect use of format arguments.  
 
-A more accurate approach is the following commands:
+As of change 23767, CHECK_FORMAT changes perl-defined formats
+to obscure (but standard) formats, and then traps the obscure
+format.  The resulting perl executable operates properly but 
+you should not use the executable produced by this process.
 
 =over 4
 
 =item *
-
-build miniperl with -DCHECK_FORMAT 
-
-    make clean
-    make miniperl OPTIMIZE=-DCHECK_FORMAT >& mini.log  
-
-=item *
-
-build a clean miniperl,
-and build everything else from that with -DCHECK_FORMAT
+A more accurate approach is the following commands:
 
     make clean
-    make miniperl      
     make all OPTIMIZE='-DCHECK_FORMAT -Wformat' >& make.log  
-               
+    perl -nwe 'print if /^\S+:/ and not /^make\b/' make.log
+
 =item *
 
-clean up, and print warnings from the log files
+A more thorough approach to compiler warnings is
 
     make clean
-    perl -nwe 'print if /^\S+:/ and not /^make\b/' \
-       mini.log make.log
+    make miniperl OPTIMIZE=-O\ -DCHECK_FORMAT >& make.log
+    make all OPTIMIZE=-O\ -DCHECK_FORMAT\ -Wall\ -Wno-unused\
+                           -Wno-uninitialized >>& make.log
+    perl -nwe 'print if /^\S+:/ and not /^make\b/' make.log
 
 =back
 
diff --git a/sv.c b/sv.c
index 6fc5588..470d483 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -9615,14 +9615,16 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV
 #ifdef CHECK_FORMAT
            if (left) {
                left = FALSE;
-               if (width > 0) {
+               if (!width)
+                   goto format_sv;     /* %-p  -> %_   */
+               if (vectorize) {
                    width = 0;
-                   if (vectorize) 
-                       goto format_d;
-                   precis = width;
-                   has_precis = TRUE;
+                   goto format_d;      /* %-1p -> %vd  */      
                }
-               goto format_sv;
+               precis = width;
+               has_precis = TRUE;
+               width = 0;
+               goto format_sv;         /* %-Np -> %.N_ */      
            }
 #endif
            if (alt || vectorize)