Skip to content

Commit

Permalink
Suppress various header build warnings on MSVC with /W4
Browse files Browse the repository at this point in the history
These prevents noise for downstream embedders.

PR #21031
  • Loading branch information
tonycoz committed Jul 4, 2023
2 parents 07e3b5c + 61dc65b commit 2fea725
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 8 deletions.
4 changes: 4 additions & 0 deletions cop.h
Expand Up @@ -29,6 +29,8 @@
* GSAR 97-03-27
*/

MSVC_DIAG_IGNORE(4324)

struct jmpenv {
struct jmpenv * je_prev;
Sigjmp_buf je_buf; /* uninit if je_prev is NULL */
Expand All @@ -38,6 +40,8 @@ struct jmpenv {
SSize_t je_old_stack_hwm;
};

MSVC_DIAG_RESTORE

typedef struct jmpenv JMPENV;

#if defined DEBUGGING && !defined DEBUGGING_RE_ONLY
Expand Down
15 changes: 10 additions & 5 deletions inline.h
Expand Up @@ -2812,7 +2812,7 @@ Perl_cx_pushsub(pTHX_ PERL_CONTEXT *cx, CV *cv, OP *retop, bool hasargs)

PERL_DTRACE_PROBE_ENTRY(cv);
cx->blk_sub.old_cxsubix = PL_curstackinfo->si_cxsubix;
PL_curstackinfo->si_cxsubix = cx - PL_curstackinfo->si_cxstack;
PL_curstackinfo->si_cxsubix = (I32)(cx - PL_curstackinfo->si_cxstack);
cx->blk_sub.cv = cv;
cx->blk_sub.olddepth = CvDEPTH(cv);
cx->blk_sub.prevcomppad = PL_comppad;
Expand All @@ -2834,7 +2834,7 @@ Perl_cx_popsub_common(pTHX_ PERL_CONTEXT *cx)
assert(CxTYPE(cx) == CXt_SUB);

PL_comppad = cx->blk_sub.prevcomppad;
PL_curpad = LIKELY(PL_comppad) ? AvARRAY(PL_comppad) : NULL;
PL_curpad = LIKELY(PL_comppad != NULL) ? AvARRAY(PL_comppad) : NULL;
cv = cx->blk_sub.cv;
CvDEPTH(cv) = cx->blk_sub.olddepth;
cx->blk_sub.cv = NULL;
Expand Down Expand Up @@ -2887,7 +2887,7 @@ Perl_cx_pushformat(pTHX_ PERL_CONTEXT *cx, CV *cv, OP *retop, GV *gv)
PERL_ARGS_ASSERT_CX_PUSHFORMAT;

cx->blk_format.old_cxsubix = PL_curstackinfo->si_cxsubix;
PL_curstackinfo->si_cxsubix= cx - PL_curstackinfo->si_cxstack;
PL_curstackinfo->si_cxsubix= (I32)(cx - PL_curstackinfo->si_cxstack);
cx->blk_format.cv = cv;
cx->blk_format.retop = retop;
cx->blk_format.gv = gv;
Expand Down Expand Up @@ -2916,7 +2916,7 @@ Perl_cx_popformat(pTHX_ PERL_CONTEXT *cx)
SvREFCNT_dec_NN(dfout);

PL_comppad = cx->blk_format.prevcomppad;
PL_curpad = LIKELY(PL_comppad) ? AvARRAY(PL_comppad) : NULL;
PL_curpad = LIKELY(PL_comppad != NULL) ? AvARRAY(PL_comppad) : NULL;
cv = cx->blk_format.cv;
cx->blk_format.cv = NULL;
--CvDEPTH(cv);
Expand Down Expand Up @@ -2948,7 +2948,7 @@ Perl_cx_pusheval(pTHX_ PERL_CONTEXT *cx, OP *retop, SV *namesv)
Perl_push_evalortry_common(aTHX_ cx, retop, namesv);

cx->blk_eval.old_cxsubix = PL_curstackinfo->si_cxsubix;
PL_curstackinfo->si_cxsubix = cx - PL_curstackinfo->si_cxstack;
PL_curstackinfo->si_cxsubix = (I32)(cx - PL_curstackinfo->si_cxstack);
}

PERL_STATIC_INLINE void
Expand Down Expand Up @@ -3156,6 +3156,8 @@ range bytes match only themselves.
PERL_STATIC_INLINE I32
Perl_foldEQ(pTHX_ const char *s1, const char *s2, I32 len)
{
PERL_UNUSED_CONTEXT;

const U8 *a = (const U8 *)s1;
const U8 *b = (const U8 *)s2;

Expand All @@ -3179,6 +3181,8 @@ Perl_foldEQ_latin1(pTHX_ const char *s1, const char *s2, I32 len)
* does not check for this. Nor does it check that the strings each have
* at least 'len' characters. */

PERL_UNUSED_CONTEXT;

const U8 *a = (const U8 *)s1;
const U8 *b = (const U8 *)s2;

Expand Down Expand Up @@ -3487,6 +3491,7 @@ Perl_mortal_getenv(const char * str)
PERL_STATIC_INLINE bool
Perl_sv_isbool(pTHX_ const SV *sv)
{
PERL_UNUSED_CONTEXT;
return SvBoolFlagsOK(sv) && BOOL_INTERNALS_sv_isbool(sv);
}

Expand Down
2 changes: 2 additions & 0 deletions sv_inline.h
Expand Up @@ -567,6 +567,8 @@ Perl_SvPVXtrue(pTHX_ SV *sv)
{
PERL_ARGS_ASSERT_SVPVXTRUE;

PERL_UNUSED_CONTEXT;

if (! (XPV *) SvANY(sv)) {
return false;
}
Expand Down
3 changes: 2 additions & 1 deletion utf8.h
Expand Up @@ -374,7 +374,8 @@ are in the character. */

/* For use in UTF8_IS_CONTINUATION(). This turns out to be 0xC0 in UTF-8,
* E0 in UTF-EBCDIC */
#define UTF_IS_CONTINUATION_MASK ((U8) (0xFF << UTF_ACCUMULATION_SHIFT))
#define UTF_IS_CONTINUATION_MASK \
((U8) ((0xFF << UTF_ACCUMULATION_SHIFT) & 0xFF))

/* This defines the bits that are to be in the continuation bytes of a
* multi-byte UTF-8 encoded character that mark it is a continuation byte.
Expand Down
4 changes: 2 additions & 2 deletions win32/win32.h
Expand Up @@ -274,7 +274,7 @@ typedef struct
{
FILE _public_file;
char* _ptr;
};
} u;

char* _base;
int _cnt;
Expand All @@ -289,7 +289,7 @@ typedef struct
#define PERLIO_FILE_flag_RD 0x0001 /* _IOREAD */
#define PERLIO_FILE_flag_WR 0x0002 /* _IOWRITE */
#define PERLIO_FILE_flag_RW 0x0004 /* _IOUPDATE */
#define PERLIO_FILE_ptr(f) (((__crt_stdio_stream_data*)(f))->_ptr)
#define PERLIO_FILE_ptr(f) (((__crt_stdio_stream_data*)(f))->u._ptr)
#define PERLIO_FILE_base(f) (((__crt_stdio_stream_data*)(f))->_base)
#define PERLIO_FILE_cnt(f) (((__crt_stdio_stream_data*)(f))->_cnt)
#define PERLIO_FILE_flag(f) ((int)(((__crt_stdio_stream_data*)(f))->_flags))
Expand Down

0 comments on commit 2fea725

Please sign in to comment.