Add extern "C" to declarations of C symbols

These symbols are defined in C code, so in C++ mode we need to use
extern "C" to declare them.  As extern "C" can't be used inside a
function's scope, we move the declarations to the global scope at the
same time.

gdb/ChangeLog:
2015-02-27  Pedro Alves  <palves@redhat.com>

	* cli-out.c (_rl_erase_entire_line): Move declaration out of
	cli_mld_erase_entire_line, and make it extern "C".
	* common/common-defs.h (EXTERN_C): New.
	* completer.c (_rl_completion_prefix_display_length)
	(_rl_print_completions_horizontally, QSFUNC): Move declarations
	out of gdb_display_match_list_1.
	(_rl_qsort_string_compare): Move declaration out of
	gdb_display_match_list_1, and make it extern "C".
	* defs.h (re_comp): Use EXTERN_C.
	* maint.c (_mcleanup): Move declaration out of mcleanup_wrapper,
	and make it extern "C".
	(monstartup): Move declaration out of maintenance_set_profile_cmd,
	and make it extern "C".
	(main): Move declaration out of maintenance_set_profile_cmd.
	* nat/linux-ptrace.c (linux_ptrace_attach_fail_reason_string): Use
	EXTERN_C.
This commit is contained in:
Pedro Alves
2015-02-09 14:59:08 +00:00
parent bcabf4207e
commit 56000a9801
7 changed files with 40 additions and 13 deletions

View File

@@ -1548,6 +1548,12 @@ gdb_complete_get_screenwidth (const struct match_list_displayer *displayer)
return displayer->width;
}
extern int _rl_completion_prefix_display_length;
extern int _rl_print_completions_horizontally;
EXTERN_C int _rl_qsort_string_compare (const void *, const void *);
typedef int QSFUNC (const void *, const void *);
/* GDB version of readline/complete.c:rl_display_match_list.
See gdb_display_match_list for a description of MATCHES, LEN, MAX.
Returns non-zero if all matches are displayed. */
@@ -1560,10 +1566,6 @@ gdb_display_match_list_1 (char **matches, int len, int max,
int i, j, k, l, common_length, sind;
char *temp, *t;
int page_completions = displayer->height != INT_MAX && pagination_enabled;
extern int _rl_completion_prefix_display_length;
extern int _rl_qsort_string_compare (const void *, const void *);
extern int _rl_print_completions_horizontally;
typedef int QSFUNC (const void *, const void *);
/* Find the length of the prefix common to all items: length as displayed
characters (common_length) and as a byte index into the matches (sind) */