Skip to content

Commit 478f36a

Browse files
committed
fix some compiler warnings
1 parent 95fac8f commit 478f36a

File tree

4 files changed

+16
-15
lines changed

4 files changed

+16
-15
lines changed

src/jlapi.c

+12-10
Original file line numberDiff line numberDiff line change
@@ -618,8 +618,7 @@ static NOINLINE int true_main(int argc, char *argv[])
618618
static void lock_low32(void)
619619
{
620620
#if defined(_OS_WINDOWS_) && defined(_P64) && defined(JL_DEBUG_BUILD)
621-
// Wine currently has a that causes it to answer VirtualQuery incorrectly.
622-
// block usage of the 32-bit address space on win64, to catch pointer cast errors
621+
// Prevent usage of the 32-bit address space on Win64, to catch pointer cast errors.
623622
char *const max32addr = (char*)0xffffffffL;
624623
SYSTEM_INFO info;
625624
MEMORY_BASIC_INFORMATION meminfo;
@@ -643,11 +642,12 @@ static void lock_low32(void)
643642
if ((char*)p != first)
644643
// Wine and Windows10 seem to have issues with reporting memory access information correctly
645644
// so we sometimes end up with unexpected results - this is just ignore those and continue
646-
// this is just a debugging aid to help find accidental pointer truncation anyways, so it's not critical
645+
// this is just a debugging aid to help find accidental pointer truncation anyways,
646+
// so it is not critical
647647
VirtualFree(p, 0, MEM_RELEASE);
648648
}
649649
}
650-
meminfo.BaseAddress += meminfo.RegionSize;
650+
meminfo.BaseAddress = (void*)((char*)meminfo.BaseAddress + meminfo.RegionSize);
651651
}
652652
#endif
653653
return;
@@ -656,16 +656,16 @@ static void lock_low32(void)
656656
// Actual definition in `ast.c`
657657
void jl_lisp_prompt(void);
658658

659-
static void rr_detach_teleport(void) {
660659
#ifdef _OS_LINUX_
660+
static void rr_detach_teleport(void) {
661661
#define RR_CALL_BASE 1000
662662
#define SYS_rrcall_detach_teleport (RR_CALL_BASE + 9)
663663
int err = syscall(SYS_rrcall_detach_teleport, 0, 0, 0, 0, 0, 0);
664664
if (err < 0 || jl_running_under_rr(1)) {
665665
jl_error("Failed to detach from rr session");
666666
}
667-
#endif
668667
}
668+
#endif
669669

670670
JL_DLLEXPORT int jl_repl_entrypoint(int argc, char *argv[])
671671
{
@@ -682,16 +682,18 @@ JL_DLLEXPORT int jl_repl_entrypoint(int argc, char *argv[])
682682
memmove(&argv[1], &argv[2], (argc-2)*sizeof(void*));
683683
argc--;
684684
}
685-
char **orig_argv = argv;
686-
jl_parse_opts(&argc, (char***)&argv);
685+
char **new_argv = argv;
686+
jl_parse_opts(&argc, (char***)&new_argv);
687687

688688
// The parent process requested that we detach from the rr session.
689689
// N.B.: In a perfect world, we would only do this for the portion of
690690
// the execution where we actually need to exclude rr (e.g. because we're
691691
// testing for the absence of a memory-model-dependent bug).
692692
if (jl_options.rr_detach && jl_running_under_rr(0)) {
693+
#ifdef _OS_LINUX_
693694
rr_detach_teleport();
694-
execv("/proc/self/exe", orig_argv);
695+
execv("/proc/self/exe", argv);
696+
#endif
695697
jl_error("Failed to self-execute");
696698
}
697699

@@ -701,7 +703,7 @@ JL_DLLEXPORT int jl_repl_entrypoint(int argc, char *argv[])
701703
jl_lisp_prompt();
702704
return 0;
703705
}
704-
int ret = true_main(argc, (char**)argv);
706+
int ret = true_main(argc, (char**)new_argv);
705707
jl_atexit_hook(ret);
706708
return ret;
707709
}

src/signals-mach.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ void *mach_profile_listener(void *arg)
594594
bt_data_prof[bt_size_cur++].uintptr = ptls->tid + 1;
595595

596596
// store task id
597-
bt_data_prof[bt_size_cur++].uintptr = (uintptr_t)jl_atomic_load_relaxed(&ptls->current_task);
597+
bt_data_prof[bt_size_cur++].jlvalue = (jl_value_t*)jl_atomic_load_relaxed(&ptls->current_task);
598598

599599
// store cpu cycle clock
600600
bt_data_prof[bt_size_cur++].uintptr = cycleclock();

src/sys.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -865,12 +865,11 @@ JL_DLLEXPORT int jl_dllist(jl_array_t *list)
865865
} while (cb < cbNeeded);
866866
for (i = 0; i < cbNeeded / sizeof(HMODULE); i++) {
867867
const char *path = jl_pathname_for_handle(hMods[i]);
868-
// XXX: change to jl_arrayset if array storage allocation for Array{String,1} changes:
869868
if (path == NULL)
870869
continue;
871870
jl_array_grow_end((jl_array_t*)list, 1);
872871
jl_value_t *v = jl_cstr_to_string(path);
873-
free(path);
872+
free((char*)path);
874873
jl_array_ptr_set(list, jl_array_dim0(list) - 1, v);
875874
}
876875
free(hMods);

src/threading.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ __attribute__((constructor)) void jl_init_tls(void)
8888

8989
JL_CONST_FUNC jl_gcframe_t **jl_get_pgcstack(void) JL_NOTSAFEPOINT
9090
{
91-
return pthread_getspecific(jl_pgcstack_key);
91+
return (jl_gcframe_t**)pthread_getspecific(jl_pgcstack_key);
9292
}
9393

9494
void jl_set_pgcstack(jl_gcframe_t **pgcstack) JL_NOTSAFEPOINT
@@ -176,7 +176,7 @@ JL_DLLEXPORT void jl_set_safe_restore(jl_jmp_buf *sr)
176176
JL_CONST_FUNC jl_gcframe_t **jl_get_pgcstack(void) JL_NOTSAFEPOINT
177177
{
178178
SAVE_ERRNO;
179-
jl_gcframe_t **pgcstack = (jl_ptls_t)TlsGetValue(jl_pgcstack_key);
179+
jl_gcframe_t **pgcstack = (jl_gcframe_t**)TlsGetValue(jl_pgcstack_key);
180180
LOAD_ERRNO;
181181
return pgcstack;
182182
}

0 commit comments

Comments
 (0)