Skip to content

Commit

Permalink
fix some compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
vtjnash committed Oct 14, 2021
1 parent 95fac8f commit 478f36a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 15 deletions.
22 changes: 12 additions & 10 deletions src/jlapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -618,8 +618,7 @@ static NOINLINE int true_main(int argc, char *argv[])
static void lock_low32(void)
{
#if defined(_OS_WINDOWS_) && defined(_P64) && defined(JL_DEBUG_BUILD)
// Wine currently has a that causes it to answer VirtualQuery incorrectly.
// block usage of the 32-bit address space on win64, to catch pointer cast errors
// Prevent usage of the 32-bit address space on Win64, to catch pointer cast errors.
char *const max32addr = (char*)0xffffffffL;
SYSTEM_INFO info;
MEMORY_BASIC_INFORMATION meminfo;
Expand All @@ -643,11 +642,12 @@ static void lock_low32(void)
if ((char*)p != first)
// Wine and Windows10 seem to have issues with reporting memory access information correctly
// so we sometimes end up with unexpected results - this is just ignore those and continue
// this is just a debugging aid to help find accidental pointer truncation anyways, so it's not critical
// this is just a debugging aid to help find accidental pointer truncation anyways,
// so it is not critical
VirtualFree(p, 0, MEM_RELEASE);
}
}
meminfo.BaseAddress += meminfo.RegionSize;
meminfo.BaseAddress = (void*)((char*)meminfo.BaseAddress + meminfo.RegionSize);
}
#endif
return;
Expand All @@ -656,16 +656,16 @@ static void lock_low32(void)
// Actual definition in `ast.c`
void jl_lisp_prompt(void);

static void rr_detach_teleport(void) {
#ifdef _OS_LINUX_
static void rr_detach_teleport(void) {
#define RR_CALL_BASE 1000
#define SYS_rrcall_detach_teleport (RR_CALL_BASE + 9)
int err = syscall(SYS_rrcall_detach_teleport, 0, 0, 0, 0, 0, 0);
if (err < 0 || jl_running_under_rr(1)) {
jl_error("Failed to detach from rr session");
}
#endif
}
#endif

JL_DLLEXPORT int jl_repl_entrypoint(int argc, char *argv[])
{
Expand All @@ -682,16 +682,18 @@ JL_DLLEXPORT int jl_repl_entrypoint(int argc, char *argv[])
memmove(&argv[1], &argv[2], (argc-2)*sizeof(void*));
argc--;
}
char **orig_argv = argv;
jl_parse_opts(&argc, (char***)&argv);
char **new_argv = argv;
jl_parse_opts(&argc, (char***)&new_argv);

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

Expand All @@ -701,7 +703,7 @@ JL_DLLEXPORT int jl_repl_entrypoint(int argc, char *argv[])
jl_lisp_prompt();
return 0;
}
int ret = true_main(argc, (char**)argv);
int ret = true_main(argc, (char**)new_argv);
jl_atexit_hook(ret);
return ret;
}
Expand Down
2 changes: 1 addition & 1 deletion src/signals-mach.c
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ void *mach_profile_listener(void *arg)
bt_data_prof[bt_size_cur++].uintptr = ptls->tid + 1;

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

// store cpu cycle clock
bt_data_prof[bt_size_cur++].uintptr = cycleclock();
Expand Down
3 changes: 1 addition & 2 deletions src/sys.c
Original file line number Diff line number Diff line change
Expand Up @@ -865,12 +865,11 @@ JL_DLLEXPORT int jl_dllist(jl_array_t *list)
} while (cb < cbNeeded);
for (i = 0; i < cbNeeded / sizeof(HMODULE); i++) {
const char *path = jl_pathname_for_handle(hMods[i]);
// XXX: change to jl_arrayset if array storage allocation for Array{String,1} changes:
if (path == NULL)
continue;
jl_array_grow_end((jl_array_t*)list, 1);
jl_value_t *v = jl_cstr_to_string(path);
free(path);
free((char*)path);
jl_array_ptr_set(list, jl_array_dim0(list) - 1, v);
}
free(hMods);
Expand Down
4 changes: 2 additions & 2 deletions src/threading.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ __attribute__((constructor)) void jl_init_tls(void)

JL_CONST_FUNC jl_gcframe_t **jl_get_pgcstack(void) JL_NOTSAFEPOINT
{
return pthread_getspecific(jl_pgcstack_key);
return (jl_gcframe_t**)pthread_getspecific(jl_pgcstack_key);
}

void jl_set_pgcstack(jl_gcframe_t **pgcstack) JL_NOTSAFEPOINT
Expand Down Expand Up @@ -176,7 +176,7 @@ JL_DLLEXPORT void jl_set_safe_restore(jl_jmp_buf *sr)
JL_CONST_FUNC jl_gcframe_t **jl_get_pgcstack(void) JL_NOTSAFEPOINT
{
SAVE_ERRNO;
jl_gcframe_t **pgcstack = (jl_ptls_t)TlsGetValue(jl_pgcstack_key);
jl_gcframe_t **pgcstack = (jl_gcframe_t**)TlsGetValue(jl_pgcstack_key);
LOAD_ERRNO;
return pgcstack;
}
Expand Down

0 comments on commit 478f36a

Please sign in to comment.