diff options
author | TAKAI Kousuke <62541129+t-a-k@users.noreply.github.com> | 2022-09-28 22:15:49 +0900 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2022-10-13 10:27:43 -0600 |
commit | be5c21321156733f58ac73b090ea937da104f7fa (patch) | |
tree | 9961c61d6c643b3d49f6c5ffff2390a97c41052e /locale.c | |
parent | 7e52ee3837b8a55c0f16b1d54a6215442f450deb (diff) | |
download | perl-be5c21321156733f58ac73b090ea937da104f7fa.tar.gz |
locale.c: Add explicit (line_t) cast to silence DEBUGGING build warnings
Warning fixed:
locale.c:130:55: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘int’ [-Wformat=]
130 | dSAVE_ERRNO; dTHX; PerlIO_printf(Perl_debug_log, "\n%s: %" LINE_Tf ": ", \
| ^~~~~~~~~
This warning might be only on 32-bit build.
Diffstat (limited to 'locale.c')
-rw-r--r-- | locale.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -121,14 +121,19 @@ static int debug_initialization = 0; # define DEBUG_INITIALIZATION_set(v) (debug_initialization = v) # define DEBUG_LOCALE_INITIALIZATION_ debug_initialization +/* C standards seem to say that __LINE__ is merely "an integer constant", + * which means it might be either int, long (with L suffix), or long long + * (or their corresponding unsigned type). So, we have to explicitly cast + * __LINE__ to a particular integer type to pass it reliably to variadic + * functions like (PerlIO_)printf, as below: */ # ifdef USE_LOCALE_THREADS # define DEBUG_PRE_STMTS \ dSAVE_ERRNO; dTHX; PerlIO_printf(Perl_debug_log,"\n%s: %" LINE_Tf ": %p: ",\ - __FILE__, __LINE__, aTHX); + __FILE__, (line_t)__LINE__, aTHX); # else # define DEBUG_PRE_STMTS \ dSAVE_ERRNO; dTHX; PerlIO_printf(Perl_debug_log, "\n%s: %" LINE_Tf ": ", \ - __FILE__, __LINE__); + __FILE__, (line_t)__LINE__); # endif # define DEBUG_POST_STMTS RESTORE_ERRNO; #else |