From: Eric Botcazou Date: Tue, 9 Oct 2018 15:06:46 +0000 (+0000) Subject: [Ada] Minor tweaks to suppress warnings X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=005f870e9145c83cba08cab71ed9c0de5bb08e2c;p=gcc.git [Ada] Minor tweaks to suppress warnings 2018-10-09 Eric Botcazou 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 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 03c0e46b2fa..d393c453eef 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,15 @@ +2018-10-09 Eric Botcazou + + * 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 * sem_prag.adb (Process_Compile_Time_Warning_Or_Error): Rewrite diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c index 2bd033a78d7..88500a6e027 100644 --- a/gcc/ada/adaint.c +++ b/gcc/ada/adaint.c @@ -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); diff --git a/gcc/ada/socket.c b/gcc/ada/socket.c index 2de38a99bcd..ed5b8dff04b 100644 --- a/gcc/ada/socket.c +++ b/gcc/ada/socket.c @@ -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; diff --git a/gcc/ada/terminals.c b/gcc/ada/terminals.c index bd2cdd0d0ad..b25aadbe6b0 100644 --- a/gcc/ada/terminals.c +++ b/gcc/ada/terminals.c @@ -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; }