Skip to content

Commit c37f371

Browse files
committed
code cleanup
1 parent 54affdb commit c37f371

File tree

10 files changed

+23
-23
lines changed

10 files changed

+23
-23
lines changed

base/client.jl

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -426,11 +426,8 @@ function _start()
426426
println()
427427
exit(1)
428428
end
429-
if is_interactive
430-
if have_color
431-
print(color_normal)
432-
end
433-
println()
429+
if is_interactive && have_color
430+
print(color_normal)
434431
end
435432
end
436433

src/codegen.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ extern "C" {
121121

122122
#include "builtin_proto.h"
123123

124-
void *__stack_chk_guard = NULL;
124+
DLLEXPORT void *__stack_chk_guard = NULL;
125125

126126
#if defined(_OS_WINDOWS_) && !defined(_COMPILER_MINGW_)
127127
void __stack_chk_fail()

src/disasm.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ void jl_dump_function_asm(const char *Fptr, size_t Fsize,
482482
#ifdef LLVM35
483483
if (MCIA->evaluateBranch(Inst, Index, insSize, addr))
484484
#else
485-
if ((addr = MCIA->evaluateBranch(Inst, Index, insSize)) != -1)
485+
if ((addr = MCIA->evaluateBranch(Inst, Index, insSize)) != (uint64_t)-1)
486486
#endif
487487
DisInfo.insertAddress(addr);
488488
}

src/dump.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1330,10 +1330,8 @@ DLLEXPORT void jl_save_system_image(const char *fname)
13301330
// save module initialization order
13311331
if (jl_module_init_order != NULL) {
13321332
for(i=0; i < jl_array_len(jl_module_init_order); i++) {
1333-
// NULL out any modules that weren't saved
1334-
jl_value_t *mod = jl_cellref(jl_module_init_order, i);
1335-
(void)mod;
1336-
assert(ptrhash_get(&backref_table, mod) != HT_NOTFOUND);
1333+
// verify that all these modules were saved
1334+
assert(ptrhash_get(&backref_table, jl_cellref(jl_module_init_order, i)) != HT_NOTFOUND);
13371335
}
13381336
}
13391337
jl_serialize_value(&f, jl_module_init_order);

src/init.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -765,13 +765,13 @@ static char *abspath(const char *in)
765765
}
766766
}
767767
#else
768-
DWORD n = GetFullPathName(in, 0, NULL, C_NULL);
768+
DWORD n = GetFullPathName(in, 0, NULL, NULL);
769769
if (n <= 0) {
770770
ios_printf(ios_stderr, "fatal error: jl_compileropts.image_file path too long or GetFullPathName failed\n");
771771
exit(1);
772772
}
773773
char *out = (char*)malloc(n);
774-
DWORD m = GetFullPathName(in, n, out, C_NULL);
774+
DWORD m = GetFullPathName(in, n, out, NULL);
775775
if (n != m + 1) {
776776
ios_printf(ios_stderr, "fatal error: jl_compileropts.image_file path too long or GetFullPathName failed\n");
777777
exit(1);
@@ -1096,7 +1096,7 @@ extern void *__stack_chk_guard;
10961096

10971097
void jl_compile_all(void);
10981098

1099-
DLLEXPORT int julia_save()
1099+
DLLEXPORT void julia_save()
11001100
{
11011101
const char *build_path = jl_compileropts.build_path;
11021102
if (build_path) {

src/julia.expmap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
global:
33
__asan*;
4+
__stack_chk_guard;
45
alloc_*w;
56
allocobj;
67
asprintf;

src/julia.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1342,7 +1342,7 @@ extern DLLEXPORT jl_compileropts_t jl_compileropts;
13421342
#define JL_COMPILEROPT_DUMPBITCODE_ON 1
13431343
#define JL_COMPILEROPT_DUMPBITCODE_OFF 2
13441344

1345-
extern void *__stack_chk_guard;
1345+
DLLEXPORT extern void *__stack_chk_guard;
13461346
#define SET_STACK_CHK_GUARD(a,b,c) do { \
13471347
unsigned char *p = (unsigned char *)&__stack_chk_guard; \
13481348
a = p[sizeof(__stack_chk_guard)-1]; \

src/support/dirpath.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
#else
1111
#define PATHSEPSTRING "/"
1212
#define PATHLISTSEPSTRING ":"
13+
#ifndef PATH_MAX // many platforms don't have a max path, we define one anyways
1314
#define PATH_MAX 1024
1415
#endif
16+
#endif
1517

1618
#endif

src/task.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,9 @@ static void NORETURN finish_task(jl_task_t *t, jl_value_t *resultval)
233233
}
234234

235235
#if defined(_OS_WINDOWS_) && !defined(_COMPILER_MINGW_)
236-
void __declspec(noinline)
236+
static void __declspec(noinline)
237237
#else
238-
void __attribute__((noinline))
238+
static void __attribute__((noinline))
239239
#endif
240240
NORETURN start_task()
241241
{
@@ -348,16 +348,18 @@ static void ctx_switch(jl_task_t *t, jl_jmp_buf *where)
348348
asm(" movq %0, %%rsp;\n"
349349
" xorq %%rbp, %%rbp;\n"
350350
" push %%rbp;\n" // instead of RSP
351-
" jmp _start_task" // call stack_task with fake stack frame
352-
: : "r"(jl_stackbase-0x10) : );
351+
" jmp %P1;\n" // call stack_task with fake stack frame
352+
" ud2"
353+
: : "r"(jl_stackbase-0x10), "i"(start_task) : "memory" );
353354
#elif defined(_CPU_X86_)
354355
asm(" movl %0, %%esp;\n"
355356
" xorl %%ebp, %%ebp;\n"
356357
" push %%ebp;\n" // instead of ESP
357-
" jmp _start_task" // call stack_task with fake stack frame
358-
: : "r"(jl_stackbase-0x10) : );
358+
" jmp %P1;\n" // call stack_task with fake stack frame
359+
" ud2"
360+
: : "r"(jl_stackbase-0x10), "i"(start_task) : "memory" );
359361
#else
360-
#error ASM_COPY_STACKS not supported on this platform
362+
#error ASM_COPY_STACKS not supported on this cpu architecture
361363
#endif
362364
#else // ASM_COPY_STACKS
363365
jl_longjmp(jl_base_ctx, 1);

ui/repl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ static int true_main(int argc, char *argv[])
311311
return iserr;
312312
}
313313

314-
DLLEXPORT extern int julia_save();
314+
DLLEXPORT extern void julia_save();
315315

316316
#ifndef _OS_WINDOWS_
317317
int main(int argc, char *argv[])

0 commit comments

Comments
 (0)