From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1914) id 29C383858C50; Mon, 16 May 2022 08:44:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 29C383858C50 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Pierre-Marie de Rodat To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-491] [Ada] replace call to bzero in terminals.c by call to memset X-Act-Checkin: gcc X-Git-Author: Joel Brobecker X-Git-Refname: refs/heads/master X-Git-Oldrev: 21f8b410511d1ee9a46b7a902a368762f6256ea0 X-Git-Newrev: dec636b831a286ab9f7773364a6f0cedf08ac9c0 Message-Id: <20220516084418.29C383858C50@sourceware.org> Date: Mon, 16 May 2022 08:44:18 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 May 2022 08:44:18 -0000 https://gcc.gnu.org/g:dec636b831a286ab9f7773364a6f0cedf08ac9c0 commit r13-491-gdec636b831a286ab9f7773364a6f0cedf08ac9c0 Author: Joel Brobecker Date: Fri Mar 11 04:22:15 2022 +0000 [Ada] replace call to bzero in terminals.c by call to memset bzero is marked as legacy in POSIX.1-2001, and using it triggers a deprecation warnings on some systems such as QNX. This change adjusts the one place where we use it in terminals.c to use memset instead. This, in turns, allows us to get rid of a hack for HP/UX and Solaris. gcc/ada/ * terminals.c: Remove bzero #define on HP/UX or Solaris platforms. (child_setup_tty): Replace bzero call by equivalent call to memset. Diff: --- gcc/ada/terminals.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/gcc/ada/terminals.c b/gcc/ada/terminals.c index 32d30a49c7e..330128abf5d 100644 --- a/gcc/ada/terminals.c +++ b/gcc/ada/terminals.c @@ -1123,12 +1123,6 @@ __gnat_setup_winsize (void *desc ATTRIBUTE_UNUSED, #define CDISABLE _POSIX_VDISABLE -/* On HP-UX and Sun system, there is a bzero function but with a different - signature. Use memset instead */ -#if defined (__hpux__) || defined (__sun__) || defined (_AIX) -# define bzero(s,n) memset (s,0,n) -#endif - /* POSIX does not specify how to open the master side of a terminal.Several methods are available (system specific): 1- using a cloning device (USE_CLONE_DEVICE) @@ -1289,8 +1283,15 @@ child_setup_tty (int fd) struct termios s; int status; - /* ensure that s is filled with 0 */ - bzero (&s, sizeof (s)); + /* Ensure that s is filled with 0. + + Note that we avoid using bzero for a few reasons: + - On HP-UX and Sun system, there is a bzero function but with + a different signature, thus making the use of bzero more + complicated on these platforms (we used to define a bzero + macro that rewrote calls to bzero into calls to memset); + - bzero is deprecated (marked as LEGACY in POSIX.1-2001). */ + memset (&s, 0, sizeof (s)); /* Get the current terminal settings */ status = tcgetattr (fd, &s);