-
Notifications
You must be signed in to change notification settings - Fork 200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Address most implicit 64-to-32-bit conversion warnings. #525
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,7 +63,7 @@ The INT64_OR_DOUBLE type is a 64-bit integer type when available, | |
otherwise double. */ | ||
|
||
BOOL | ||
PRIV(ckd_smul)(PCRE2_SIZE *r, int a, int b) | ||
PRIV(ckd_smul)(PCRE2_SIZE *r, ptrdiff_t a, ptrdiff_t b) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the whole point of this function is to make sure those 2 parameters are There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, yeah, the hand-coded branch would need reworking. ( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. pcre2test is a test application, AFAIK the call for ckd_smul was indeed how we are making sure that the value of the multiplication is always correct. FWIW you could NOT build this test application if all you want is the library an want it to be warning free, there is a configure and cmake option for that. You haven't answered my original question so I am still not sure what the end goal is. |
||
{ | ||
#ifdef HAVE_BUILTIN_MUL_OVERFLOW | ||
PCRE2_SIZE m; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2362,7 +2362,7 @@ SLJIT_ASSERT(stackpos == STACK(stacktop)); | |
typedef struct delayed_mem_copy_status { | ||
struct sljit_compiler *compiler; | ||
int store_bases[RECURSE_TMP_REG_COUNT]; | ||
int store_offsets[RECURSE_TMP_REG_COUNT]; | ||
sljit_sw store_offsets[RECURSE_TMP_REG_COUNT]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are intentionally small values. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Without this change, |
||
int tmp_regs[RECURSE_TMP_REG_COUNT]; | ||
int saved_tmp_regs[RECURSE_TMP_REG_COUNT]; | ||
int next_tmp_reg; | ||
|
@@ -3302,7 +3302,8 @@ OP2(SLJIT_SUB | SLJIT_SET_Z, COUNT_MATCH, 0, COUNT_MATCH, 0, SLJIT_IMM, 1); | |
add_jump(compiler, &common->calllimit, JUMP(SLJIT_ZERO)); | ||
} | ||
|
||
static SLJIT_INLINE void allocate_stack(compiler_common *common, int size) | ||
static SLJIT_INLINE void allocate_stack(compiler_common *common, | ||
PCRE2_SIZE size) | ||
{ | ||
/* May destroy all locals and registers except TMP2. */ | ||
DEFINE_COMPILER; | ||
|
@@ -3319,7 +3320,7 @@ OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), LOCALS1, TMP1, 0); | |
add_stub(common, CMP(SLJIT_LESS, STACK_TOP, 0, STACK_LIMIT, 0)); | ||
} | ||
|
||
static SLJIT_INLINE void free_stack(compiler_common *common, int size) | ||
static SLJIT_INLINE void free_stack(compiler_common *common, PCRE2_SIZE size) | ||
{ | ||
DEFINE_COMPILER; | ||
|
||
|
@@ -4064,7 +4065,7 @@ if (common->invalid_utf) | |
#define READ_CHAR_NEWLINE (READ_CHAR_UPDATE_STR_PTR | READ_CHAR_UTF8_NEWLINE) | ||
#define READ_CHAR_VALID_UTF 0x4 | ||
|
||
static void read_char(compiler_common *common, sljit_u32 min, sljit_u32 max, | ||
static void read_char(compiler_common *common, sljit_uw min, sljit_uw max, | ||
jump_list **backtracks, sljit_u32 options) | ||
{ | ||
/* Reads the precise value of a character into TMP1, if the character is | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -87,7 +87,7 @@ POSSIBILITY OF SUCH DAMAGE. | |
&& ((__clang_major__ == 3 && __clang_minor__ >= 3) || (__clang_major__ > 3))) | ||
__attribute__((no_sanitize_address)) | ||
#endif | ||
static sljit_u8* SLJIT_FUNC FF_FUN(sljit_u8 *str_end, sljit_u8 **str_ptr, sljit_uw offs1, sljit_uw offs2, sljit_uw chars) | ||
static sljit_u8* SLJIT_FUNC FF_FUN(sljit_u8 *str_end, sljit_u8 **str_ptr, sljit_uw offs1, sljit_uw offs2, sljit_u32 chars) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this should break the 16bit library There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not AFAICT, though I must admit I'd initially focused on the 8-bit one. |
||
#undef FF_FUN | ||
{ | ||
quad_word qw; | ||
|
@@ -119,7 +119,7 @@ vect_t vmask = VDUPQ(mask); | |
compare_type compare1_type = compare_match1; | ||
compare_type compare2_type = compare_match1; | ||
vect_t cmp1a, cmp1b, cmp2a, cmp2b; | ||
const sljit_u32 diff = IN_UCHARS(offs1 - offs2); | ||
const sljit_uw diff = IN_UCHARS(offs1 - offs2); | ||
PCRE2_UCHAR char1a = ic.c.c1; | ||
PCRE2_UCHAR char2a = ic.c.c3; | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
API functions cannot be changed, even if they are not the best.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, yeah, I didn't mean to introduce an ABI break. :-/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, right, I'll need to revert the POSIX API changes too.