Skip to content

Commit

Permalink
fix 0-argument function signatures
Browse files Browse the repository at this point in the history
avoid using "explicit" as a variable name
ref JuliaLang#5347
  • Loading branch information
JeffBezanson committed Jan 10, 2014
1 parent 298bf1a commit b2f91fa
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 37 deletions.
4 changes: 2 additions & 2 deletions src/ast.c
Original file line number Diff line number Diff line change
Expand Up @@ -462,14 +462,14 @@ int jl_start_parsing_file(const char *fname)
return 0;
}

void jl_stop_parsing()
void jl_stop_parsing(void)
{
fl_applyn(0, symbol_value(symbol("jl-parser-close-stream")));
}

extern int jl_lineno;

jl_value_t *jl_parse_next()
jl_value_t *jl_parse_next(void)
{
value_t c = fl_applyn(0, symbol_value(symbol("jl-parser-next")));
if (c == FL_EOF)
Expand Down
6 changes: 3 additions & 3 deletions src/builtins.c
Original file line number Diff line number Diff line change
Expand Up @@ -653,20 +653,20 @@ DLLEXPORT int jl_strtof(char *str, float *out)

// showing --------------------------------------------------------------------

void jl_flush_cstdio()
void jl_flush_cstdio(void)
{
fflush(stdout);
fflush(stderr);
}

jl_value_t *jl_stdout_obj()
jl_value_t *jl_stdout_obj(void)
{
jl_value_t *stdout_obj = jl_get_global(jl_base_module, jl_symbol("STDOUT"));
if (stdout_obj != NULL) return stdout_obj;
return jl_get_global(jl_base_module, jl_symbol("OUTPUT_STREAM"));
}

jl_value_t *jl_stderr_obj()
jl_value_t *jl_stderr_obj(void)
{
jl_value_t *stderr_obj = jl_get_global(jl_base_module, jl_symbol("STDERR"));
if (stderr_obj != NULL) return stderr_obj;
Expand Down
2 changes: 1 addition & 1 deletion src/ccall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
static std::map<std::string, std::string> sonameMap;
static bool got_sonames = false;

extern "C" DLLEXPORT void jl_read_sonames()
extern "C" DLLEXPORT void jl_read_sonames(void)
{
char *line=NULL;
size_t sz=0;
Expand Down
2 changes: 1 addition & 1 deletion src/gc.c
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ static void run_finalizers(void)
JL_GC_POP();
}

void jl_gc_run_all_finalizers()
void jl_gc_run_all_finalizers(void)
{
for(size_t i=0; i < finalizer_table.size; i+=2) {
jl_value_t *f = finalizer_table.table[i+1];
Expand Down
2 changes: 1 addition & 1 deletion src/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ void julia_init(char *imageFile, int build_mode)
jl_init_frontend();
jl_init_types();
jl_init_tasks(jl_stack_lo, jl_stack_hi-jl_stack_lo);
jl_init_codegen(imageFile);
jl_init_codegen();
jl_an_empty_cell = (jl_value_t*)jl_alloc_cell_1d(0);

jl_init_serializer();
Expand Down
2 changes: 1 addition & 1 deletion src/jl_uv.c
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ DLLEXPORT struct tm* localtime_r(const time_t *t, struct tm *tm)
return uv_loop_new();
}*/

DLLEXPORT uv_loop_t *jl_global_event_loop()
DLLEXPORT uv_loop_t *jl_global_event_loop(void)
{
return jl_io_loop;
}
Expand Down
35 changes: 14 additions & 21 deletions src/julia.h
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,7 @@ DLLEXPORT void jl_run_event_loop(uv_loop_t *loop);
DLLEXPORT int jl_run_once(uv_loop_t *loop);
DLLEXPORT int jl_process_events(uv_loop_t *loop);

DLLEXPORT uv_loop_t *jl_global_event_loop();
DLLEXPORT uv_loop_t *jl_global_event_loop(void);

DLLEXPORT uv_pipe_t *jl_make_pipe(int writable, int julia_only, jl_value_t *julia_struct);
DLLEXPORT void jl_close_uv(uv_handle_t *handle);
Expand All @@ -867,9 +867,7 @@ DLLEXPORT int jl_tcp_bind(uv_tcp_t* handle, uint16_t port, uint32_t host);

DLLEXPORT void NORETURN jl_exit(int status);

DLLEXPORT size_t jl_sizeof_uv_stream_t();
DLLEXPORT size_t jl_sizeof_uv_pipe_t();
DLLEXPORT int jl_sizeof_ios_t();
DLLEXPORT int jl_sizeof_ios_t(void);

#ifdef _OS_WINDOWS_
DLLEXPORT struct tm* localtime_r(const time_t *t, struct tm *tm);
Expand All @@ -893,7 +891,7 @@ void jl_init_types(void);
void jl_init_box_caches(void);
DLLEXPORT void jl_init_frontend(void);
void jl_init_primitives(void);
void jl_init_codegen();
void jl_init_codegen(void);
void jl_init_intrinsic_functions(void);
void jl_init_tasks(void *stack, size_t ssize);
void jl_init_serializer(void);
Expand All @@ -908,17 +906,17 @@ int32_t jl_get_llvm_gv(jl_value_t *p);
DLLEXPORT jl_value_t *jl_parse_input_line(const char *str);
DLLEXPORT jl_value_t *jl_parse_string(const char *str, int pos0, int greedy);
int jl_start_parsing_file(const char *fname);
void jl_stop_parsing();
jl_value_t *jl_parse_next();
void jl_stop_parsing(void);
jl_value_t *jl_parse_next(void);
DLLEXPORT jl_value_t *jl_load_file_string(const char *text, char *filename);
DLLEXPORT jl_value_t *jl_expand(jl_value_t *expr);
jl_lambda_info_t *jl_wrap_expr(jl_value_t *expr);

// some useful functions
DLLEXPORT void jl_show(jl_value_t *stream, jl_value_t *v);
DLLEXPORT void jl_flush_cstdio();
DLLEXPORT jl_value_t *jl_stdout_obj();
DLLEXPORT jl_value_t *jl_stderr_obj();
DLLEXPORT void jl_flush_cstdio(void);
DLLEXPORT jl_value_t *jl_stdout_obj(void);
DLLEXPORT jl_value_t *jl_stderr_obj(void);
DLLEXPORT int jl_egal(jl_value_t *a, jl_value_t *b);
DLLEXPORT uptrint_t jl_object_id(jl_value_t *v);
DLLEXPORT size_t jl_static_show(JL_STREAM *out, jl_value_t *v);
Expand Down Expand Up @@ -961,7 +959,7 @@ enum JL_RTLD_CONSTANT {
};
#define JL_RTLD_DEFAULT (JL_RTLD_LAZY | JL_RTLD_DEEPBIND)
#ifdef _OS_LINUX_
DLLEXPORT void jl_read_sonames();
DLLEXPORT void jl_read_sonames(void);
#endif
DLLEXPORT uv_lib_t *jl_load_dynamic_library(char *fname, unsigned flags);
DLLEXPORT uv_lib_t *jl_load_dynamic_library_e(char *fname, unsigned flags);
Expand All @@ -972,10 +970,6 @@ void *jl_dlsym_e(uv_lib_t *handle, char *symbol); //supress errors
char *jl_dlfind_win32(char *name);
DLLEXPORT int add_library_mapping(char *lib, void *hnd);

// event loop
DLLEXPORT void jl_runEventLoop();
DLLEXPORT void jl_processEvents();

// compiler
void jl_compile(jl_function_t *f);
void jl_generate_fptr(jl_function_t *f);
Expand Down Expand Up @@ -1139,7 +1133,7 @@ void *jl_gc_managed_malloc(size_t sz);
void *jl_gc_managed_realloc(void *d, size_t sz, size_t oldsz, int isaligned);
void jl_gc_free_array(jl_array_t *a);
void jl_gc_track_malloced_array(jl_array_t *a);
void jl_gc_run_all_finalizers();
void jl_gc_run_all_finalizers(void);
void *alloc_2w(void);
void *alloc_3w(void);
void *alloc_4w(void);
Expand All @@ -1165,7 +1159,6 @@ STATIC_INLINE void *alloc_4w() { return allocobj(4*sizeof(void*)); }

DLLEXPORT extern volatile sig_atomic_t jl_signal_pending;
DLLEXPORT extern volatile sig_atomic_t jl_defer_signal;
DLLEXPORT void jl_handle_sigint();

#define JL_SIGATOMIC_BEGIN() (jl_defer_signal++)
#define JL_SIGATOMIC_END() \
Expand Down Expand Up @@ -1232,7 +1225,7 @@ jl_task_t *jl_new_task(jl_function_t *start, size_t ssize);
jl_value_t *jl_switchto(jl_task_t *t, jl_value_t *arg);
DLLEXPORT void NORETURN jl_throw(jl_value_t *e);
DLLEXPORT void NORETURN jl_throw_with_superfluous_argument(jl_value_t *e, int);
DLLEXPORT void NORETURN jl_rethrow();
DLLEXPORT void NORETURN jl_rethrow(void);
DLLEXPORT void NORETURN jl_rethrow_other(jl_value_t *e);

DLLEXPORT jl_array_t *jl_takebuf_array(ios_t *s);
Expand Down Expand Up @@ -1279,9 +1272,9 @@ extern DLLEXPORT uv_stream_t *jl_uv_stdin;
extern DLLEXPORT uv_stream_t * jl_uv_stdout;
extern DLLEXPORT uv_stream_t * jl_uv_stderr;

DLLEXPORT JL_STREAM *jl_stdout_stream();
DLLEXPORT JL_STREAM *jl_stdin_stream();
DLLEXPORT JL_STREAM *jl_stderr_stream();
DLLEXPORT JL_STREAM *jl_stdout_stream(void);
DLLEXPORT JL_STREAM *jl_stdin_stream(void);
DLLEXPORT JL_STREAM *jl_stderr_stream(void);

extern char *julia_home;

Expand Down
13 changes: 7 additions & 6 deletions src/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ jl_binding_t *jl_get_binding_for_method_def(jl_module_t *m, jl_sym_t *var)
}

static void module_import_(jl_module_t *to, jl_module_t *from, jl_sym_t *s,
int explicit);
int explici);

typedef struct _modstack_t {
jl_module_t *m;
Expand Down Expand Up @@ -168,8 +168,9 @@ static int eq_bindings(jl_binding_t *a, jl_binding_t *b)
return 0;
}

// NOTE: we use explici since explicit is a C++ keyword
static void module_import_(jl_module_t *to, jl_module_t *from, jl_sym_t *s,
int explicit)
int explici)
{
if (to == from)
return;
Expand All @@ -188,14 +189,14 @@ static void module_import_(jl_module_t *to, jl_module_t *from, jl_sym_t *s,
}
else if (bto->owner == b->owner) {
// already imported
bto->imported = (explicit!=0);
bto->imported = (explici!=0);
}
else if (bto->owner != to && bto->owner != NULL) {
// already imported from somewhere else
jl_binding_t *bval = jl_get_binding(to, s);
if (bval->constp && bval->value && b->constp && b->value == bval->value) {
// equivalent binding
bto->imported = (explicit!=0);
bto->imported = (explici!=0);
return;
}
jl_printf(JL_STDERR,
Expand All @@ -215,13 +216,13 @@ static void module_import_(jl_module_t *to, jl_module_t *from, jl_sym_t *s,
}
else {
bto->owner = b->owner;
bto->imported = (explicit!=0);
bto->imported = (explici!=0);
}
}
else {
jl_binding_t *nb = new_binding(s);
nb->owner = b->owner;
nb->imported = (explicit!=0);
nb->imported = (explici!=0);
*bp = nb;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/task.c
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@ DLLEXPORT void jl_throw(jl_value_t *e)
throw_internal(e);
}

DLLEXPORT void jl_rethrow()
DLLEXPORT void jl_rethrow(void)
{
throw_internal(jl_exception_in_transit);
}
Expand Down

0 comments on commit b2f91fa

Please sign in to comment.