[Ada] Minor tweaks to suppress warnings

2018-10-09  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

	* adaint.c (__gnat_get_executable_suffix_ptr): Add new line.
	(__gnat_locate_exec): Check that HOST_EXECUTABLE_SUFFIX is not
	empty before doing a string search for it.
	* socket.c (ATTRIBUTE_UNUSED): Define.
	(__gnat_disable_sigpipe): Add ATTRIBUTE_UNUSED on parameter.
	* terminals.c (ATTRIBUTE_UNUSED): Move around.
	(__gnat_setup_child_communication): Add ATTRIBUTE_UNUSED on
	parameter.
	(__gnat_send_header): Add ATTRIBUTE_UNUSED on parameters.

From-SVN: r264982
This commit is contained in:
Eric Botcazou 2018-10-09 15:06:46 +00:00 committed by Pierre-Marie de Rodat
parent ea891b439e
commit 005f870e91
4 changed files with 27 additions and 9 deletions

View File

@ -1,3 +1,15 @@
2018-10-09 Eric Botcazou <ebotcazou@adacore.com>
* adaint.c (__gnat_get_executable_suffix_ptr): Add new line.
(__gnat_locate_exec): Check that HOST_EXECUTABLE_SUFFIX is not
empty before doing a string search for it.
* socket.c (ATTRIBUTE_UNUSED): Define.
(__gnat_disable_sigpipe): Add ATTRIBUTE_UNUSED on parameter.
* terminals.c (ATTRIBUTE_UNUSED): Move around.
(__gnat_setup_child_communication): Add ATTRIBUTE_UNUSED on
parameter.
(__gnat_send_header): Add ATTRIBUTE_UNUSED on parameters.
2018-10-09 Yannick Moy <moy@adacore.com>
* sem_prag.adb (Process_Compile_Time_Warning_Or_Error): Rewrite

View File

@ -662,6 +662,7 @@ void
__gnat_get_executable_suffix_ptr (int *len, const char **value)
{
*value = HOST_EXECUTABLE_SUFFIX;
if (!*value)
*len = 0;
else
@ -2893,12 +2894,12 @@ __gnat_locate_regular_file (char *file_name, char *path_val)
char *
__gnat_locate_exec (char *exec_name, char *path_val)
{
const unsigned int len = strlen (HOST_EXECUTABLE_SUFFIX);
char *ptr;
if (!strstr (exec_name, HOST_EXECUTABLE_SUFFIX))
if (len > 0 && !strstr (exec_name, HOST_EXECUTABLE_SUFFIX))
{
char *full_exec_name =
(char *) alloca
(strlen (exec_name) + strlen (HOST_EXECUTABLE_SUFFIX) + 1);
char *full_exec_name = (char *) alloca (strlen (exec_name) + len + 1);
strcpy (full_exec_name, exec_name);
strcat (full_exec_name, HOST_EXECUTABLE_SUFFIX);

View File

@ -31,6 +31,8 @@
/* This file provides a portable binding to the sockets API */
#define ATTRIBUTE_UNUSED __attribute__((unused))
/* Ensure access to errno is thread safe. */
#define _REENTRANT
#define _THREAD_SAFE
@ -95,7 +97,7 @@ extern int __gnat_inet_pton (int, const char *, void *);
/* Disable the sending of SIGPIPE for writes on a broken stream */
void
__gnat_disable_sigpipe (int fd)
__gnat_disable_sigpipe (int fd ATTRIBUTE_UNUSED)
{
#ifdef SO_NOSIGPIPE
int val = 1;

View File

@ -29,13 +29,13 @@
* *
****************************************************************************/
#define ATTRIBUTE_UNUSED __attribute__((unused))
/* First all usupported platforms. Add stubs for exported routines. */
#if defined (VMS) || defined (__vxworks) || defined (__Lynx__) \
|| defined (__ANDROID__) || defined (__PikeOS__) || defined(__DJGPP__)
#define ATTRIBUTE_UNUSED __attribute__((unused))
void *
__gnat_new_tty (void)
{
@ -1412,7 +1412,7 @@ int
__gnat_setup_child_communication
(pty_desc *desc,
char **new_argv,
int Use_Pipes)
int Use_Pipes ATTRIBUTE_UNUSED)
{
int status;
int pid = getpid ();
@ -1588,7 +1588,10 @@ __gnat_free_process (pty_desc** desc)
/* __gnat_send_header - dummy function. this interface is only used on Windows */
void
__gnat_send_header (pty_desc* desc, char header[5], int size, int *ret)
__gnat_send_header (pty_desc* desc ATTRIBUTE_UNUSED,
char header[5] ATTRIBUTE_UNUSED,
int size ATTRIBUTE_UNUSED,
int *ret ATTRIBUTE_UNUSED)
{
*ret = 0;
}