diff --git a/lib/mcconfig.h b/lib/mcconfig.h index abc28efe87..78cb4d90ff 100644 --- a/lib/mcconfig.h +++ b/lib/mcconfig.h @@ -54,7 +54,7 @@ gchar **mc_config_get_keys (const mc_config_t * mc_config, const gchar * group, gchar *mc_config_get_string (mc_config_t * mc_config, const gchar * group, const gchar * param, const gchar * def); gchar *mc_config_get_string_raw (mc_config_t * mc_config, const gchar * group, const gchar * param, - const gchar * def); + const gchar * def) __attribute__((weak)); gboolean mc_config_get_bool (mc_config_t * mc_config, const gchar * group, const gchar * param, gboolean def); int mc_config_get_int (mc_config_t * mc_config, const gchar * group, const gchar * param, int def); @@ -96,7 +96,7 @@ void mc_config_deinit_config_paths (void); const char *mc_config_get_data_path (void); const char *mc_config_get_cache_path (void); -const char *mc_config_get_home_dir (void); +const char *mc_config_get_home_dir (void) __attribute__((weak)); const char *mc_config_get_path (void); char *mc_config_get_full_path (const char *config_name); vfs_path_t *mc_config_get_full_vpath (const char *config_name); diff --git a/lib/util.h b/lib/util.h index c03ff6db9b..952bae9a73 100644 --- a/lib/util.h +++ b/lib/util.h @@ -212,7 +212,7 @@ void mc_pclose (mc_pipe_t * p, GError ** error); GString *mc_pstream_get_string (mc_pipe_stream_t * ps); -void my_exit (int status); +void my_exit (int status) __attribute__((weak)); void save_stop_handler (void); /* Tilde expansion */ @@ -249,7 +249,7 @@ gboolean mc_util_make_backup_if_possible (const char *file_name, const char *bac gboolean mc_util_restore_from_backup_if_possible (const char *file_name, const char *backup_suffix); gboolean mc_util_unlink_backup_if_possible (const char *file_name, const char *backup_suffix); -char *guess_message_value (void); +char *guess_message_value (void) __attribute__((weak)); char *mc_build_filename (const char *first_element, ...); char *mc_build_filenamev (const char *first_element, va_list args); diff --git a/lib/vfs/utilvfs.h b/lib/vfs/utilvfs.h index ff94bdbde0..bd4ab008ae 100644 --- a/lib/vfs/utilvfs.h +++ b/lib/vfs/utilvfs.h @@ -43,7 +43,7 @@ vfs_path_element_t *vfs_url_split (const char *path, int default_port, vfs_url_f int vfs_split_text (char *p); int vfs_mkstemps (vfs_path_t ** pname_vpath, const char *prefix, const char *basename); -void vfs_die (const char *msg); +void vfs_die (const char *msg) __attribute__((weak)); char *vfs_get_password (const char *msg); char *vfs_get_local_username (void); diff --git a/lib/vfs/vfs.h b/lib/vfs/vfs.h index 55e9530ecc..2bec2fb322 100644 --- a/lib/vfs/vfs.h +++ b/lib/vfs/vfs.h @@ -264,7 +264,7 @@ const vfs_path_t *vfs_get_raw_current_dir (void); void vfs_set_raw_current_dir (const vfs_path_t * vpath); gboolean vfs_current_is_local (void); -gboolean vfs_file_is_local (const vfs_path_t * vpath); +gboolean vfs_file_is_local (const vfs_path_t * vpath) __attribute__((weak)); char *vfs_strip_suffix_from_filename (const char *filename); @@ -318,13 +318,13 @@ off_t mc_lseek (int fd, off_t offset, int whence); DIR *mc_opendir (const vfs_path_t * vpath); struct vfs_dirent *mc_readdir (DIR * dirp); int mc_closedir (DIR * dir); -int mc_stat (const vfs_path_t * vpath, struct stat *buf); +int mc_stat (const vfs_path_t * vpath, struct stat *buf) __attribute__((weak)); int mc_mknod (const vfs_path_t * vpath, mode_t mode, dev_t dev); int mc_link (const vfs_path_t * vpath1, const vfs_path_t * vpath2); int mc_mkdir (const vfs_path_t * vpath, mode_t mode); int mc_rmdir (const vfs_path_t * vpath); int mc_fstat (int fd, struct stat *buf); -int mc_lstat (const vfs_path_t * vpath, struct stat *buf); +int mc_lstat (const vfs_path_t * vpath, struct stat *buf) __attribute__((weak)); int mc_symlink (const vfs_path_t * vpath1, const vfs_path_t * vpath2); int mc_rename (const vfs_path_t * vpath1, const vfs_path_t * vpath2); int mc_chmod (const vfs_path_t * vpath, mode_t mode); @@ -336,9 +336,9 @@ int mc_unlink (const vfs_path_t * vpath); int mc_ctl (int fd, int ctlop, void *arg); int mc_setctl (const vfs_path_t * vpath, int ctlop, void *arg); int mc_open (const vfs_path_t * vpath, int flags, ...); -vfs_path_t *mc_getlocalcopy (const vfs_path_t * pathname_vpath); +vfs_path_t *mc_getlocalcopy (const vfs_path_t * pathname_vpath) __attribute__((weak)); int mc_ungetlocalcopy (const vfs_path_t * pathname_vpath, const vfs_path_t * local_vpath, - gboolean has_changed); + gboolean has_changed) __attribute__((weak)); int mc_mkstemps (vfs_path_t ** pname_vpath, const char *prefix, const char *suffix); /* Creating temporary files safely */ diff --git a/lib/widget/dialog-switch.h b/lib/widget/dialog-switch.h index 516309594e..fa917da5cc 100644 --- a/lib/widget/dialog-switch.h +++ b/lib/widget/dialog-switch.h @@ -36,7 +36,7 @@ void dialog_switch_shutdown (void); void do_refresh (void); void repaint_screen (void); -void mc_refresh (void); +void mc_refresh (void) __attribute__((weak)); void dialog_change_screen_size (void); /*** inline functions ****************************************************************************/ diff --git a/lib/widget/input_complete.c b/lib/widget/input_complete.c index cd0ccbc879..cead50c5fd 100644 --- a/lib/widget/input_complete.c +++ b/lib/widget/input_complete.c @@ -88,7 +88,8 @@ typedef struct /*** forward declarations (file scope functions) *************************************************/ -GPtrArray *try_complete (char *text, int *lc_start, int *lc_end, input_complete_t flags); +GPtrArray *try_complete (char *text, int *lc_start, int *lc_end, input_complete_t flags) + __attribute__((weak)); void complete_engine_fill_completions (WInput * in); /*** file scope variables ************************************************************************/ diff --git a/lib/widget/wtools.h b/lib/widget/wtools.h index 73c56ca41c..c22f7b107d 100644 --- a/lib/widget/wtools.h +++ b/lib/widget/wtools.h @@ -80,7 +80,7 @@ WDialog *create_message (int flags, const char *title, const char *text, ...) G_GNUC_PRINTF (3, 4); /* Show message box, background safe */ -void message (int flags, const char *title, const char *text, ...) G_GNUC_PRINTF (3, 4); +void message (int flags, const char *title, const char *text, ...) G_GNUC_PRINTF (3, 4) __attribute__((weak)); /* *INDENT-ON* */ gboolean mc_error_message (GError ** mcerror, int *code); diff --git a/m4.include/mc-tests.m4 b/m4.include/mc-tests.m4 index aa553ff9a2..b12b1f30a0 100644 --- a/m4.include/mc-tests.m4 +++ b/m4.include/mc-tests.m4 @@ -48,15 +48,7 @@ AC_DEFUN([mc_UNIT_TESTS],[ #include ]) - # on cygwin, the linker does not accept the "-z" option - case $host_os in - cygwin*) - TESTS_LDFLAGS="-Wl,--allow-multiple-definition" - ;; - *) - TESTS_LDFLAGS="-Wl,-z,muldefs" - ;; - esac + # TODO: check weak attribute? AC_SUBST(TESTS_LDFLAGS) ]) diff --git a/src/editor/edit-impl.h b/src/editor/edit-impl.h index a9f938cca1..76330326ee 100644 --- a/src/editor/edit-impl.h +++ b/src/editor/edit-impl.h @@ -228,9 +228,9 @@ void edit_paste_from_history (WEdit * edit); void edit_set_filename (WEdit * edit, const vfs_path_t * name_vpath); -void edit_load_syntax (WEdit * edit, GPtrArray * pnames, const char *type); +void edit_load_syntax (WEdit * edit, GPtrArray * pnames, const char *type) __attribute__((weak)); void edit_free_syntax_rules (WEdit * edit); -int edit_get_syntax_color (WEdit * edit, off_t byte_index); +int edit_get_syntax_color (WEdit * edit, off_t byte_index) __attribute__((weak)); void edit_syntax_dialog (WEdit * edit); void book_mark_insert (WEdit * edit, long line, int c); diff --git a/src/editor/editcomplete.h b/src/editor/editcomplete.h index 90ded8db8e..0be4f37c8c 100644 --- a/src/editor/editcomplete.h +++ b/src/editor/editcomplete.h @@ -12,7 +12,8 @@ /*** declarations of public functions ************************************************************/ /* Public function for unit tests */ -char *edit_completion_dialog_show (const WEdit * edit, GQueue * compl, int max_width); +char *edit_completion_dialog_show (const WEdit * edit, GQueue * compl, int max_width) + __attribute__((weak)); void edit_complete_word_cmd (WEdit * edit); diff --git a/src/editor/editmacros.h b/src/editor/editmacros.h index 5d234e0d7b..f7acc44d56 100644 --- a/src/editor/editmacros.h +++ b/src/editor/editmacros.h @@ -12,7 +12,7 @@ /*** declarations of public functions ************************************************************/ int edit_store_macro_cmd (WEdit * edit); -gboolean edit_load_macro_cmd (WEdit * edit); +gboolean edit_load_macro_cmd (WEdit * edit) __attribute__((weak)); void edit_delete_macro_cmd (WEdit * edit); gboolean edit_repeat_macro_cmd (WEdit * edit); gboolean edit_execute_macro (WEdit * edit, int hotkey); diff --git a/src/execute.c b/src/execute.c index 4c2a1d3d18..1d51ffa19b 100644 --- a/src/execute.c +++ b/src/execute.c @@ -65,11 +65,11 @@ int pause_after_run = pause_on_dumb_terminals; /*** forward declarations (file scope functions) *************************************************/ -void do_execute (const char *shell, const char *command, int flags); -void do_executev (const char *shell, int flags, char *const argv[]); +void do_execute (const char *shell, const char *command, int flags) __attribute__((weak)); +void do_executev (const char *shell, int flags, char *const argv[]) __attribute__((weak)); char *execute_get_external_cmd_opts_from_config (const char *command, const vfs_path_t * filename_vpath, - long start_line); + long start_line) __attribute__((weak)); /*** file scope variables ************************************************************************/ diff --git a/src/filemanager/layout.h b/src/filemanager/layout.h index 685f2c371d..25a3c9e379 100644 --- a/src/filemanager/layout.h +++ b/src/filemanager/layout.h @@ -65,7 +65,7 @@ void setup_cmdline (void); void create_panel (int num, panel_view_mode_t type); void swap_panels (void); panel_view_mode_t get_panel_type (int idx); -panel_view_mode_t get_current_type (void); +panel_view_mode_t get_current_type (void) __attribute__((weak)); panel_view_mode_t get_other_type (void); int get_current_index (void); int get_other_index (void); diff --git a/src/filemanager/panel.h b/src/filemanager/panel.h index ea20a96397..28fd9cf18e 100644 --- a/src/filemanager/panel.h +++ b/src/filemanager/panel.h @@ -181,7 +181,8 @@ void file_mark (WPanel * panel, int idx, int val); void do_file_mark (WPanel * panel, int idx, int val); gboolean panel_do_cd (WPanel * panel, const vfs_path_t * new_dir_vpath, enum cd_enum cd_type); -gboolean panel_cd (WPanel * panel, const vfs_path_t * new_dir_vpath, enum cd_enum cd_type); +gboolean panel_cd (WPanel * panel, const vfs_path_t * new_dir_vpath, enum cd_enum cd_type) + __attribute__((weak)); gsize panel_get_num_of_sortable_fields (void); char **panel_get_sortable_fields (gsize * array_size); diff --git a/tests/lib/utilunix__my_system-common.c b/tests/lib/utilunix__my_system-common.c index 06d64efaa3..f41cec1f51 100644 --- a/tests/lib/utilunix__my_system-common.c +++ b/tests/lib/utilunix__my_system-common.c @@ -40,6 +40,10 @@ static sigset_t *sigemptyset_set__captured; /* @ThenReturnValue */ static int sigemptyset__return_value = 0; +#ifdef sigemptyset +#undef sigemptyset +#endif + /* @Mock */ int sigemptyset (sigset_t *set)