Front page | perl.perl5.porters |
Postings from May 2003
[PATCH] RE: [PATCH] RE: maint snapshot @ 19525
From:
Robin Barker
Date:
May 23, 2003 09:32
Subject:
[PATCH] RE: [PATCH] RE: maint snapshot @ 19525
Message ID:
533D273D4014D411AB1D00062938C4D90404653C@hotel.npl.co.uk
Further patch, implementing the idea in question 5 below.
To be applied on top of last week's patch.
Attached and appended.
Robin
-----Original Message-----
From: Robin Barker [mailto:Robin.Barker@npl.co.uk]
Sent: 16 May 2003 17:17
To: perl5-porters@perl.org
Subject: [PATCH] RE: maint snapshot @ 19525
Patch for format and other warnings (using gcc-3.3 !)
Appended and attached to beat the MS line wrapping.
Some questions.
(1) I have changed all 'format(printf)' to '__format__(__printf__)',
is this OK?
(2) The second change to MIME/Base64/Base64.xs is needed because
isxdigit has
'(int)' prototype (on my machine, in ctype.h). Is this right?
Should MIME/Base64 use isXDIGIT (a perl.h macro)?
(3) Why is the declaration of PerlIO_debug in perlio.c not perlio.h
?
(4) The 'gimme' variable is unused in pp_hot.c, line 766.
I wonder if the uses of 'GIMME' later in the function should be
'gimme' ?
(5) The '#ifdef CHECK_FORMAT __attribute__(...) #endif' would be
more compact
if there was an __attribute__format__() macro which was non-null
only when
both HASATTRIBUTE and CHECK_FORMAT were set. Should I do this?
Robin
-----End Message-----
*** New patch ***
diff -ru ../perl@19525/embed.pl ./embed.pl
--- ../perl@19525/embed.pl Mon May 19 14:40:33 2003
+++ ./embed.pl
@@ -202,11 +202,8 @@
if( $flags =~ /f/ ) {
my $prefix = $flags =~ /n/ ? '' : 'pTHX_';
my $args = scalar @args;
- $ret .= "\n#ifdef CHECK_FORMAT\n";
- $ret .=
- sprintf "
__attribute__((__format__(__printf__,%s%d,%s%d)))",
+ $ret .= sprintf
"\n\t__attribute__format__(__printf__,%s%d,%s%d)",
$prefix, $args - 1, $prefix, $args;
- $ret .= "\n#endif\n";
}
$ret .= ";";
$ret .= ' */' if $flags =~ /m/;
diff -ru ../perl@19525/perl.h ./perl.h
--- ../perl@19525/perl.h Sun May 4 10:40:35 2003
+++ ./perl.h
@@ -2193,6 +2193,14 @@
# endif
#endif
+#ifndef __attribute__format__
+# ifdef CHECK_FORMAT
+# define __attribute__format__(x,y,z)
__attribute__((__format__(x,y,z)))
+# else
+# define __attribute__format__(x,y,z)
+# endif
+#endif
+
/* Some unistd.h's give a prototype for pause() even though
HAS_PAUSE ends up undefined. This causes the #define
below to be rejected by the compiler. Sigh.
diff -ru ../perl@19525/perlio.c ./perlio.c
--- ../perl@19525/perlio.c Mon May 19 14:40:34 2003
+++ ./perlio.c
@@ -434,10 +434,7 @@
* Why is this here - not in perlio.h? RMB
*/
void PerlIO_debug(const char *fmt, ...)
-#ifdef CHECK_FORMAT
- __attribute__ ((__format__(__printf__, 1, 2)))
-#endif
-;
+ __attribute__format__(__printf__, 1, 2);
void
PerlIO_debug(const char *fmt, ...)
diff -ru ../perl@19525/perlio.h ./perlio.h
--- ../perl@19525/perlio.h Sun May 4 10:40:40 2003
+++ ./perlio.h
@@ -208,10 +208,7 @@
#endif
#ifndef PerlIO_stdoutf
extern int PerlIO_stdoutf(const char *, ...)
-#ifdef CHECK_FORMAT
- __attribute__ ((__format__(__printf__, 1, 2)))
-#endif
-;
+ __attribute__format__(__printf__, 1, 2);
#endif
#ifndef PerlIO_puts
extern int PerlIO_puts(PerlIO *, const char *);
@@ -271,17 +268,11 @@
#endif
#ifndef PerlIO_printf
extern int PerlIO_printf(PerlIO *, const char *, ...)
-#ifdef CHECK_FORMAT
- __attribute__ ((__format__(__printf__, 2, 3)))
-#endif
-;
+ __attribute__format__(__printf__, 2, 3);
#endif
#ifndef PerlIO_sprintf
extern int PerlIO_sprintf(char *, int, const char *, ...)
-#ifdef CHECK_FORMAT
- __attribute__ ((__format__(__printf__, 3, 4)))
-#endif
-;
+ __attribute__format__(__printf__, 3, 4);
#endif
#ifndef PerlIO_vprintf
extern int PerlIO_vprintf(PerlIO *, const char *, va_list);
diff -ru ../perl@19525/proto.h ./proto.h
--- ../perl@19525/proto.h Mon May 19 14:40:34 2003
+++ ./proto.h
@@ -99,83 +99,38 @@
#endif
PERL_CALLCONV OP* Perl_convert(pTHX_ I32 optype, I32 flags, OP*
o);
PERL_CALLCONV void Perl_croak(pTHX_ const char* pat, ...)
__attribute__((noreturn))
-#ifdef CHECK_FORMAT
- __attribute__((__format__(__printf__,pTHX_1,pTHX_2)))
-#endif
-;
+ __attribute__format__(printf,pTHX_1,pTHX_2);
PERL_CALLCONV void Perl_vcroak(pTHX_ const char* pat, va_list*
args) __attribute__((noreturn));
#if defined(PERL_IMPLICIT_CONTEXT)
PERL_CALLCONV void Perl_croak_nocontext(const char* pat, ...)
__attribute__((noreturn))
-#ifdef CHECK_FORMAT
- __attribute__((__format__(__printf__,1,2)))
-#endif
-;
+ __attribute__format__(printf,1,2);
PERL_CALLCONV OP* Perl_die_nocontext(const char* pat, ...)
-#ifdef CHECK_FORMAT
- __attribute__((__format__(__printf__,1,2)))
-#endif
-;
+ __attribute__format__(printf,1,2);
PERL_CALLCONV void Perl_deb_nocontext(const char* pat, ...)
-#ifdef CHECK_FORMAT
- __attribute__((__format__(__printf__,1,2)))
-#endif
-;
+ __attribute__format__(printf,1,2);
PERL_CALLCONV char* Perl_form_nocontext(const char* pat, ...)
-#ifdef CHECK_FORMAT
- __attribute__((__format__(__printf__,1,2)))
-#endif
-;
+ __attribute__format__(printf,1,2);
PERL_CALLCONV void Perl_load_module_nocontext(U32 flags, SV* name,
SV* ver, ...);
PERL_CALLCONV SV* Perl_mess_nocontext(const char* pat, ...)
-#ifdef CHECK_FORMAT
- __attribute__((__format__(__printf__,1,2)))
-#endif
-;
+ __attribute__format__(printf,1,2);
PERL_CALLCONV void Perl_warn_nocontext(const char* pat, ...)
-#ifdef CHECK_FORMAT
- __attribute__((__format__(__printf__,1,2)))
-#endif
-;
+ __attribute__format__(printf,1,2);
PERL_CALLCONV void Perl_warner_nocontext(U32 err, const char* pat,
...)
-#ifdef CHECK_FORMAT
- __attribute__((__format__(__printf__,2,3)))
-#endif
-;
+ __attribute__format__(printf,2,3);
PERL_CALLCONV SV* Perl_newSVpvf_nocontext(const char* pat, ...)
-#ifdef CHECK_FORMAT
- __attribute__((__format__(__printf__,1,2)))
-#endif
-;
+ __attribute__format__(printf,1,2);
PERL_CALLCONV void Perl_sv_catpvf_nocontext(SV* sv, const char*
pat, ...)
-#ifdef CHECK_FORMAT
- __attribute__((__format__(__printf__,2,3)))
-#endif
-;
+ __attribute__format__(printf,2,3);
PERL_CALLCONV void Perl_sv_setpvf_nocontext(SV* sv, const char*
pat, ...)
-#ifdef CHECK_FORMAT
- __attribute__((__format__(__printf__,2,3)))
-#endif
-;
+ __attribute__format__(printf,2,3);
PERL_CALLCONV void Perl_sv_catpvf_mg_nocontext(SV* sv, const char*
pat, ...)
-#ifdef CHECK_FORMAT
- __attribute__((__format__(__printf__,2,3)))
-#endif
-;
+ __attribute__format__(printf,2,3);
PERL_CALLCONV void Perl_sv_setpvf_mg_nocontext(SV* sv, const char*
pat, ...)
-#ifdef CHECK_FORMAT
- __attribute__((__format__(__printf__,2,3)))
-#endif
-;
+ __attribute__format__(printf,2,3);
PERL_CALLCONV int Perl_fprintf_nocontext(PerlIO* stream, const
char* fmt, ...)
-#ifdef CHECK_FORMAT
- __attribute__((__format__(__printf__,2,3)))
-#endif
-;
+ __attribute__format__(printf,2,3);
PERL_CALLCONV int Perl_printf_nocontext(const char* fmt, ...)
-#ifdef CHECK_FORMAT
- __attribute__((__format__(__printf__,1,2)))
-#endif
-;
+ __attribute__format__(printf,1,2);
#endif
PERL_CALLCONV void Perl_cv_ckproto(pTHX_ CV* cv, GV* gv, char* p);
PERL_CALLCONV CV* Perl_cv_clone(pTHX_ CV* proto);
@@ -193,10 +148,7 @@
PERL_CALLCONV PPADDR_t* Perl_get_ppaddr(pTHX);
PERL_CALLCONV I32 Perl_cxinc(pTHX);
PERL_CALLCONV void Perl_deb(pTHX_ const char* pat, ...)
-#ifdef CHECK_FORMAT
- __attribute__((__format__(__printf__,pTHX_1,pTHX_2)))
-#endif
-;
+ __attribute__format__(printf,pTHX_1,pTHX_2);
PERL_CALLCONV void Perl_vdeb(pTHX_ const char* pat, va_list* args);
PERL_CALLCONV void Perl_debprofdump(pTHX);
PERL_CALLCONV I32 Perl_debop(pTHX_ OP* o);
@@ -206,10 +158,7 @@
PERL_CALLCONV void Perl_deprecate(pTHX_ char* s);
PERL_CALLCONV void Perl_deprecate_old(pTHX_ char* s);
PERL_CALLCONV OP* Perl_die(pTHX_ const char* pat, ...)
-#ifdef CHECK_FORMAT
- __attribute__((__format__(__printf__,pTHX_1,pTHX_2)))
-#endif
-;
+ __attribute__format__(printf,pTHX_1,pTHX_2);
PERL_CALLCONV OP* Perl_vdie(pTHX_ const char* pat, va_list* args);
PERL_CALLCONV OP* Perl_die_where(pTHX_ char* message, STRLEN
msglen);
PERL_CALLCONV void Perl_dounwind(pTHX_ I32 cxix);
@@ -276,10 +225,7 @@
PERL_CALLCONV OP* Perl_force_list(pTHX_ OP* arg);
PERL_CALLCONV OP* Perl_fold_constants(pTHX_ OP* arg);
PERL_CALLCONV char* Perl_form(pTHX_ const char* pat, ...)
-#ifdef CHECK_FORMAT
- __attribute__((__format__(__printf__,pTHX_1,pTHX_2)))
-#endif
-;
+ __attribute__format__(printf,pTHX_1,pTHX_2);
PERL_CALLCONV char* Perl_vform(pTHX_ const char* pat, va_list*
args);
PERL_CALLCONV void Perl_free_tmps(pTHX);
PERL_CALLCONV OP* Perl_gen_constant_list(pTHX_ OP* o);
@@ -477,10 +423,7 @@
PERL_CALLCONV char* Perl_mem_collxfrm(pTHX_ const char* s, STRLEN
len, STRLEN* xlen);
#endif
PERL_CALLCONV SV* Perl_mess(pTHX_ const char* pat, ...)
-#ifdef CHECK_FORMAT
- __attribute__((__format__(__printf__,pTHX_1,pTHX_2)))
-#endif
-;
+ __attribute__format__(printf,pTHX_1,pTHX_2);
PERL_CALLCONV SV* Perl_vmess(pTHX_ const char* pat, va_list*
args);
PERL_CALLCONV void Perl_qerror(pTHX_ SV* err);
PERL_CALLCONV void Perl_sortsv(pTHX_ SV ** array, size_t num_elts,
SVCOMPARE_t cmp);
@@ -576,10 +519,7 @@
PERL_CALLCONV SV* Perl_newSVpvn(pTHX_ const char* s, STRLEN len);
PERL_CALLCONV SV* Perl_newSVpvn_share(pTHX_ const char* s, I32
len, U32 hash);
PERL_CALLCONV SV* Perl_newSVpvf(pTHX_ const char* pat, ...)
-#ifdef CHECK_FORMAT
- __attribute__((__format__(__printf__,pTHX_1,pTHX_2)))
-#endif
-;
+ __attribute__format__(printf,pTHX_1,pTHX_2);
PERL_CALLCONV SV* Perl_vnewSVpvf(pTHX_ const char* pat, va_list*
args);
PERL_CALLCONV SV* Perl_newSVrv(pTHX_ SV* rv, const char*
classname);
PERL_CALLCONV SV* Perl_newSVsv(pTHX_ SV* old);
@@ -756,10 +696,7 @@
PERL_CALLCONV int Perl_sv_backoff(pTHX_ SV* sv);
PERL_CALLCONV SV* Perl_sv_bless(pTHX_ SV* sv, HV* stash);
PERL_CALLCONV void Perl_sv_catpvf(pTHX_ SV* sv, const char* pat,
...)
-#ifdef CHECK_FORMAT
- __attribute__((__format__(__printf__,pTHX_2,pTHX_3)))
-#endif
-;
+ __attribute__format__(printf,pTHX_2,pTHX_3);
PERL_CALLCONV void Perl_sv_vcatpvf(pTHX_ SV* sv, const char* pat,
va_list* args);
PERL_CALLCONV void Perl_sv_catpv(pTHX_ SV* sv, const char* ptr);
/* PERL_CALLCONV void sv_catpvn(pTHX_ SV* sv, const char* ptr, STRLEN
len); */
@@ -807,10 +744,7 @@
PERL_CALLCONV void Perl_sv_report_used(pTHX);
PERL_CALLCONV void Perl_sv_reset(pTHX_ char* s, HV* stash);
PERL_CALLCONV void Perl_sv_setpvf(pTHX_ SV* sv, const char* pat,
...)
-#ifdef CHECK_FORMAT
- __attribute__((__format__(__printf__,pTHX_2,pTHX_3)))
-#endif
-;
+ __attribute__format__(printf,pTHX_2,pTHX_3);
PERL_CALLCONV void Perl_sv_vsetpvf(pTHX_ SV* sv, const char* pat,
va_list* args);
PERL_CALLCONV void Perl_sv_setiv(pTHX_ SV* sv, IV num);
PERL_CALLCONV void Perl_sv_setpviv(pTHX_ SV* sv, IV num);
@@ -880,16 +814,10 @@
PERL_CALLCONV void Perl_report_evil_fh(pTHX_ GV *gv, IO *io, I32
op);
PERL_CALLCONV void Perl_report_uninit(pTHX);
PERL_CALLCONV void Perl_warn(pTHX_ const char* pat, ...)
-#ifdef CHECK_FORMAT
- __attribute__((__format__(__printf__,pTHX_1,pTHX_2)))
-#endif
-;
+ __attribute__format__(printf,pTHX_1,pTHX_2);
PERL_CALLCONV void Perl_vwarn(pTHX_ const char* pat, va_list*
args);
PERL_CALLCONV void Perl_warner(pTHX_ U32 err, const char* pat, ...)
-#ifdef CHECK_FORMAT
- __attribute__((__format__(__printf__,pTHX_2,pTHX_3)))
-#endif
-;
+ __attribute__format__(printf,pTHX_2,pTHX_3);
PERL_CALLCONV void Perl_vwarner(pTHX_ U32 err, const char* pat,
va_list* args);
PERL_CALLCONV void Perl_watch(pTHX_ char** addr);
PERL_CALLCONV I32 Perl_whichsig(pTHX_ char* sig);
@@ -917,19 +845,13 @@
PERL_CALLCONV SV* Perl_sv_lock(pTHX_ SV *sv);
#endif
PERL_CALLCONV void Perl_sv_catpvf_mg(pTHX_ SV *sv, const char* pat,
...)
-#ifdef CHECK_FORMAT
- __attribute__((__format__(__printf__,pTHX_2,pTHX_3)))
-#endif
-;
+ __attribute__format__(printf,pTHX_2,pTHX_3);
PERL_CALLCONV void Perl_sv_vcatpvf_mg(pTHX_ SV* sv, const char*
pat, va_list* args);
PERL_CALLCONV void Perl_sv_catpv_mg(pTHX_ SV *sv, const char *ptr);
PERL_CALLCONV void Perl_sv_catpvn_mg(pTHX_ SV *sv, const char *ptr,
STRLEN len);
PERL_CALLCONV void Perl_sv_catsv_mg(pTHX_ SV *dstr, SV *sstr);
PERL_CALLCONV void Perl_sv_setpvf_mg(pTHX_ SV *sv, const char* pat,
...)
-#ifdef CHECK_FORMAT
- __attribute__((__format__(__printf__,pTHX_2,pTHX_3)))
-#endif
-;
+ __attribute__format__(printf,pTHX_2,pTHX_3);
PERL_CALLCONV void Perl_sv_vsetpvf_mg(pTHX_ SV* sv, const char*
pat, va_list* args);
PERL_CALLCONV void Perl_sv_setiv_mg(pTHX_ SV *sv, IV i);
PERL_CALLCONV void Perl_sv_setpviv_mg(pTHX_ SV *sv, IV iv);
@@ -942,10 +864,7 @@
PERL_CALLCONV MGVTBL* Perl_get_vtbl(pTHX_ int vtbl_id);
PERL_CALLCONV char* Perl_pv_display(pTHX_ SV *dsv, char *pv, STRLEN
cur, STRLEN len, STRLEN pvlim);
PERL_CALLCONV void Perl_dump_indent(pTHX_ I32 level, PerlIO *file,
const char* pat, ...)
-#ifdef CHECK_FORMAT
- __attribute__((__format__(__printf__,pTHX_3,pTHX_4)))
-#endif
-;
+ __attribute__format__(printf,pTHX_3,pTHX_4);
PERL_CALLCONV void Perl_dump_vindent(pTHX_ I32 level, PerlIO *file,
const char* pat, va_list *args);
PERL_CALLCONV void Perl_do_gv_dump(pTHX_ I32 level, PerlIO *file,
char *name, GV *sv);
PERL_CALLCONV void Perl_do_gvgv_dump(pTHX_ I32 level, PerlIO *file,
char *name, GV *sv);
End of patch
-------------------------------------------------------------------
This e-mail and any attachments may contain confidential and/or
privileged material; it is for the intended addressee(s) only.
If you are not a named addressee, you must not use, retain or
disclose such information.
NPL Management Ltd cannot guarantee that the e-mail or any
attachments are free from viruses.
NPL Management Ltd. Registered in England and Wales. No: 2937881
Registered Office: Teddington, Middlesex, United Kingdom TW11 0LW.
-------------------------------------------------------------------
-
[PATCH] RE: [PATCH] RE: maint snapshot @ 19525
by Robin Barker