Skip to content

Commit 69fa7fa

Browse files
giordanoN5N3
authored andcommitted
Fix warning about comparison of integer expressions of different signedness (#53658)
(cherry picked from commit 5fc1662)
1 parent c60704b commit 69fa7fa

File tree

7 files changed

+16
-16
lines changed

7 files changed

+16
-16
lines changed

src/flisp/julia_extensions.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ value_t fl_string_only_julia_char(fl_context_t *fl_ctx, value_t *args, uint32_t
405405
uint8_t *s = (uint8_t*)cvalue_data(args[0]);
406406
size_t len = cv_len((cvalue_t*)ptr(args[0]));
407407
uint32_t u = _string_only_julia_char(s, len);
408-
if (u == (uint32_t)-1)
408+
if (u == UINT32_MAX)
409409
return fl_ctx->F;
410410
return fl_list2(fl_ctx, fl_ctx->jl_char_sym, mk_uint32(fl_ctx, u));
411411
}

src/llvm-multiversioning.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -755,7 +755,7 @@ std::pair<uint32_t,GlobalVariable*> CloneCtx::get_reloc_slot(Function *F) const
755755
if (F->isDeclaration()) {
756756
auto extern_decl = extern_relocs.find(F);
757757
assert(extern_decl != extern_relocs.end() && "Missing extern relocation slot!");
758-
return {(uint32_t)-1, extern_decl->second};
758+
return {UINT32_MAX, extern_decl->second};
759759
}
760760
else {
761761
auto id = get_func_id(F);

src/processor.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ JL_UNUSED static uint32_t find_feature_bit(const FeatureName *features, size_t n
385385
return feature.bit;
386386
}
387387
}
388-
return (uint32_t)-1;
388+
return UINT32_MAX;
389389
}
390390

391391
// This is how we save the target identification.
@@ -633,7 +633,7 @@ static inline jl_image_t parse_sysimg(void *hdl, F &&callback)
633633
jl_value_t* rejection_reason = nullptr;
634634
JL_GC_PUSH1(&rejection_reason);
635635
uint32_t target_idx = callback(ids, &rejection_reason);
636-
if (target_idx == (uint32_t)-1) {
636+
if (target_idx == UINT32_MAX) {
637637
jl_error(jl_string_ptr(rejection_reason));
638638
}
639639
JL_GC_POP();
@@ -851,7 +851,7 @@ static inline void check_cmdline(T &&cmdline, bool imaging)
851851
}
852852

853853
struct SysimgMatch {
854-
uint32_t best_idx{(uint32_t)-1};
854+
uint32_t best_idx{UINT32_MAX};
855855
int vreg_size{0};
856856
};
857857

@@ -906,7 +906,7 @@ static inline SysimgMatch match_sysimg_targets(S &&sysimg, T &&target, F &&max_v
906906
feature_size = new_feature_size;
907907
rejection_reasons.push_back("Updating best match to this target\n");
908908
}
909-
if (match.best_idx == (uint32_t)-1) {
909+
if (match.best_idx == UINT32_MAX) {
910910
// Construct a nice error message for debugging purposes
911911
std::string error_msg = "Unable to find compatible target in cached code image.\n";
912912
for (size_t i = 0; i < rejection_reasons.size(); i++) {

src/processor_arm.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ static constexpr auto feature_masks = get_feature_masks(
203203
#undef JL_FEATURE_DEF
204204
-1);
205205
static const auto real_feature_masks =
206-
feature_masks & FeatureList<feature_sz>{{(uint32_t)-1, (uint32_t)-1, 0}};
206+
feature_masks & FeatureList<feature_sz>{{UINT32_MAX, UINT32_MAX, 0}};
207207

208208
namespace Feature {
209209
enum : uint32_t {
@@ -461,7 +461,7 @@ static constexpr auto feature_masks = get_feature_masks(
461461
#undef JL_FEATURE_DEF
462462
-1);
463463
static const auto real_feature_masks =
464-
feature_masks & FeatureList<feature_sz>{{(uint32_t)-1, (uint32_t)-1, 0}};
464+
feature_masks & FeatureList<feature_sz>{{UINT32_MAX, UINT32_MAX, 0}};
465465

466466
namespace Feature {
467467
enum : uint32_t {
@@ -1493,7 +1493,7 @@ static const std::vector<TargetData<feature_sz>> &get_cmdline_targets(void)
14931493
}
14941494
#endif
14951495
auto fbit = find_feature_bit(feature_names, nfeature_names, str, len);
1496-
if (fbit == (uint32_t)-1)
1496+
if (fbit == UINT32_MAX)
14971497
return false;
14981498
set_bit(list, fbit, true);
14991499
return true;
@@ -1574,7 +1574,7 @@ static uint32_t sysimg_init_cb(const void *id, jl_value_t **rejection_reason)
15741574
}
15751575
}
15761576
auto match = match_sysimg_targets(sysimg, target, max_vector_size, rejection_reason);
1577-
if (match.best_idx == -1)
1577+
if (match.best_idx == UINT32_MAX)
15781578
return match.best_idx;
15791579
// Now we've decided on which sysimg version to use.
15801580
// Make sure the JIT target is compatible with it and save the JIT target.
@@ -1846,7 +1846,7 @@ JL_DLLEXPORT jl_value_t* jl_check_pkgimage_clones(char *data)
18461846
JL_GC_PUSH1(&rejection_reason);
18471847
uint32_t match_idx = pkgimg_init_cb(data, &rejection_reason);
18481848
JL_GC_POP();
1849-
if (match_idx == (uint32_t)-1)
1849+
if (match_idx == UINT32_MAX)
18501850
return rejection_reason;
18511851
return jl_nothing;
18521852
}

src/processor_fallback.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ JL_DLLEXPORT jl_value_t* jl_check_pkgimage_clones(char *data)
189189
JL_GC_PUSH1(&rejection_reason);
190190
uint32_t match_idx = pkgimg_init_cb(data, &rejection_reason);
191191
JL_GC_POP();
192-
if (match_idx == (uint32_t)-1)
192+
if (match_idx == UINT32_MAX)
193193
return rejection_reason;
194194
return jl_nothing;
195195
}

src/processor_x86.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,7 @@ static const std::vector<TargetData<feature_sz>> &get_cmdline_targets(void)
776776
{
777777
auto feature_cb = [] (const char *str, size_t len, FeatureList<feature_sz> &list) {
778778
auto fbit = find_feature_bit(feature_names, nfeature_names, str, len);
779-
if (fbit == (uint32_t)-1)
779+
if (fbit == UINT32_MAX)
780780
return false;
781781
set_bit(list, fbit, true);
782782
return true;
@@ -870,7 +870,7 @@ static uint32_t sysimg_init_cb(const void *id, jl_value_t** rejection_reason)
870870
"https://docs.julialang.org/en/v1/devdocs/sysimg/ for more.");
871871
}
872872
auto match = match_sysimg_targets(sysimg, target, max_vector_size, rejection_reason);
873-
if (match.best_idx == (uint32_t)-1)
873+
if (match.best_idx == UINT32_MAX)
874874
return match.best_idx;
875875
// Now we've decided on which sysimg version to use.
876876
// Make sure the JIT target is compatible with it and save the JIT target.
@@ -1041,7 +1041,7 @@ JL_DLLEXPORT jl_value_t* jl_check_pkgimage_clones(char *data)
10411041
JL_GC_PUSH1(&rejection_reason);
10421042
uint32_t match_idx = pkgimg_init_cb(data, &rejection_reason);
10431043
JL_GC_POP();
1044-
if (match_idx == (uint32_t)-1)
1044+
if (match_idx == UINT32_MAX)
10451045
return rejection_reason;
10461046
return jl_nothing;
10471047
}

src/support/utf8.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ extern "C" {
1212
/* is c the start of a utf8 sequence? */
1313
#define isutf(c) (((c)&0xC0)!=0x80)
1414

15-
#define UEOF ((uint32_t)-1)
15+
#define UEOF (UINT32_MAX)
1616

1717
/* convert UTF-8 data to wide character */
1818
size_t u8_toucs(uint32_t *dest, size_t sz, const char *src, size_t srcsz);

0 commit comments

Comments
 (0)