From unknown Sat Jun 21 03:17:01 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#7099 <7099@debbugs.gnu.org> To: bug#7099 <7099@debbugs.gnu.org> Subject: Status: mbsalign.c old c compiler complains about variables defined inside code Reply-To: bug#7099 <7099@debbugs.gnu.org> Date: Sat, 21 Jun 2025 10:17:01 +0000 retitle 7099 mbsalign.c old c compiler complains about variables defined in= side code reassign 7099 coreutils submitter 7099 Suhan Andrei severity 7099 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 24 16:30:04 2010 Received: (at submit) by debbugs.gnu.org; 24 Sep 2010 20:30:04 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OzEuB-0000Co-7m for submit@debbugs.gnu.org; Fri, 24 Sep 2010 16:30:03 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OzEdF-000052-N0 for submit@debbugs.gnu.org; Fri, 24 Sep 2010 16:12:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OzEfp-0001Pb-Qy for submit@debbugs.gnu.org; Fri, 24 Sep 2010 16:15:14 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,T_DKIM_INVALID,T_RP_MATCHES_RCVD, T_TO_NO_BRKTS_FREEMAIL autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([199.232.76.165]:58137) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OzEfp-0001PX-Ok for submit@debbugs.gnu.org; Fri, 24 Sep 2010 16:15:13 -0400 Received: from [140.186.70.92] (port=45402 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OzEfo-0005Tx-Ls for bug-coreutils@gnu.org; Fri, 24 Sep 2010 16:15:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OzEfn-0001P6-AX for bug-coreutils@gnu.org; Fri, 24 Sep 2010 16:15:12 -0400 Received: from web113518.mail.gq1.yahoo.com ([98.136.167.58]:41197) by eggs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1OzEfn-0001On-1Q for bug-coreutils@gnu.org; Fri, 24 Sep 2010 16:15:11 -0400 Received: (qmail 25100 invoked by uid 60001); 24 Sep 2010 20:15:09 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1285359309; bh=hpEJo0c6BC3ERjf7Aui/hvMslocrBCCuEWnORdXgMXg=; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type; b=ne85GiImxEBvMOtAc5IMDC+4L34tRnJyTO6hDTh0DR6Jc3cSHQA+FTFRdtSjEA9DP0Q94/iByrKLivaT8I/wSMFZ1n+FhnZSvS+TpBQIBftr9DnWf9G+5knSuE+rh1gLgUFqRuDpYAIeVWFFZWfVKpGIrPhpWxf0tYGKpxoW720= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type; b=HnnJtpB1LtD4S3C9iNEJAS2dQ3JeMBFgzkrbMW60l2QMS+Lirmf+Y8hYvk3zXjNXEeZejf0DfxOYcvEX86M92NmmmS32v5pKxrbPXu0KMFLzR5Y7mT0HhFUTvdOZu9Uae9q0fuwS/9SZssgayMg57VK0oRRvJtXutSusE6ZxuPs=; Message-ID: <214709.25039.qm@web113518.mail.gq1.yahoo.com> X-YMail-OSG: BWABRpkVM1n1ffx7YoJpjI_XjO9Tfnyo_Sq6uY_q2wc5Iju qsFcMwuwTUWGk7OCFBlfEKjL7wAJSAly5vfLtLe8ungwnXfKqsVO_s8PNJpL 25RRjKdNFa0MdkRcwIpOF7d2xlCDI1MaXbVvJyW0dwSBNl8jSfPJjOZBMmYy .9diJH2wpSJLodyQR3ht2v4O9XZs_uO5NkRpphfYbB4Q29kspazPH2Vpn3U1 4bAVExS2ikNefxVy4ZDIYMp1hIP1Ba81tykXmfauTYk0w6ybsghBX7Y04Ghw 5cq.7ZutP2nd_IcgKy6lXlrJsGs35WOW.mZYNodssKdIA4S9kC4Vupg-- Received: from [188.26.184.235] by web113518.mail.gq1.yahoo.com via HTTP; Fri, 24 Sep 2010 13:15:08 PDT X-Mailer: YahooMailRC/497 YahooMailWebService/0.8.105.279950 Date: Fri, 24 Sep 2010 13:15:08 -0700 (PDT) From: Suhan Andrei Subject: mbsalign.c old c compiler complains about variables defined inside code To: bug-coreutils@gnu.org MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-1739592082-1285359308=:25039" X-detected-operating-system: by eggs.gnu.org: FreeBSD 6.x (1) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -6.6 (------) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Fri, 24 Sep 2010 16:30:01 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.6 (------) --0-1739592082-1285359308=:25039 Content-Type: text/plain; charset=us-ascii Hi Just wanted to let you know there are some errors when using old compiler ( gcc -v Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/specs gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release) ) Tere are 2 variables defined inside blocks of code that triggers old c compiler to spill errors. I used code from coreutils-8.5.tar.gz I moved declaration at the start of code and all compiled ok. Andrei. --0-1739592082-1285359308=:25039 Content-Type: text/html; charset=us-ascii
Hi

Just wanted to let you know there are some errors when using old compiler
(
gcc -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/specs
gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
)


Tere are 2 variables defined inside blocks of code that triggers old c compiler to spill errors.
I used code from coreutils-8.5.tar.gz
I moved declaration at the start of code and all compiled ok.

Andrei.

--0-1739592082-1285359308=:25039-- From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 24 17:32:47 2010 Received: (at 7099) by debbugs.gnu.org; 24 Sep 2010 21:32:47 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OzFss-0000gx-PT for submit@debbugs.gnu.org; Fri, 24 Sep 2010 17:32:46 -0400 Received: from kiwi.cs.ucla.edu ([131.179.128.19]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OzFsp-0000gs-P0 for 7099@debbugs.gnu.org; Fri, 24 Sep 2010 17:32:45 -0400 Received: from [131.179.64.200] (Penguin.CS.UCLA.EDU [131.179.64.200]) by kiwi.cs.ucla.edu (8.13.8+Sun/8.13.8/UCLACS-6.0) with ESMTP id o8OLZN6c021275; Fri, 24 Sep 2010 14:35:23 -0700 (PDT) Message-ID: <4C9D199B.4020007@cs.ucla.edu> Date: Fri, 24 Sep 2010 14:35:23 -0700 From: Paul Eggert Organization: UCLA Computer Science Department User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.12) Gecko/20100915 Thunderbird/3.0.8 MIME-Version: 1.0 To: Suhan Andrei Subject: Re: bug#7099: mbsalign.c old c compiler complains about variables defined inside code References: <214709.25039.qm@web113518.mail.gq1.yahoo.com> In-Reply-To: <214709.25039.qm@web113518.mail.gq1.yahoo.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Spam-Score: -2.1 (--) X-Debbugs-Envelope-To: 7099 Cc: 7099@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.4 (---) On 09/24/10 13:15, Suhan Andrei wrote: > gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release) That compiler was shipped with Red Hat Linux 6.0, if I read the history correctly, and Red Hat stopped supporting that version years ago. Our general rule of thumb is that we don't bother supporting software that the original supplier no longer supports. Is another, more up-to-date compiler available on that old installation? That might be the easiest way to get going. From debbugs-submit-bounces@debbugs.gnu.org Fri Sep 24 17:36:22 2010 Received: (at 7099) by debbugs.gnu.org; 24 Sep 2010 21:36:22 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OzFwM-0000ih-GN for submit@debbugs.gnu.org; Fri, 24 Sep 2010 17:36:22 -0400 Received: from mail1.slb.deg.dub.stisp.net ([84.203.253.98]) by debbugs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1OzFwJ-0000ia-Q0 for 7099@debbugs.gnu.org; Fri, 24 Sep 2010 17:36:20 -0400 Received: (qmail 3919 invoked from network); 24 Sep 2010 21:38:59 -0000 Received: from unknown (HELO ?192.168.2.25?) (84.203.137.218) by mail1.slb.deg.dub.stisp.net with SMTP; 24 Sep 2010 21:38:59 -0000 Message-ID: <4C9D1A5D.60604@draigBrady.com> Date: Fri, 24 Sep 2010 22:38:37 +0100 From: =?ISO-8859-1?Q?P=E1draig_Brady?= User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3 MIME-Version: 1.0 To: Suhan Andrei Subject: Re: bug#7099: mbsalign.c old c compiler complains about variables defined inside code References: <214709.25039.qm@web113518.mail.gq1.yahoo.com> In-Reply-To: <214709.25039.qm@web113518.mail.gq1.yahoo.com> X-Enigmail-Version: 1.0.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: 7099 Cc: 7099@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.7 (--) On 24/09/10 21:15, Suhan Andrei wrote: > Hi > > Just wanted to let you know there are some errors when using old compiler > ( > gcc -v > Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/specs > gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release) > ) > > > Tere are 2 variables defined inside blocks of code that triggers old c compiler > to spill errors. > I used code from coreutils-8.5.tar.gz > I moved declaration at the start of code and all compiled ok. Eep, I'll fix that up, as we want to keep stuff under gl/ C89 conformant, as it may be moved to gnulib at some stage. $ LANG=C gcc -std=c89 -pedantic -Werror -c git/coreutils/gl/lib/mbsalign.c -o /dev/null -I git/coreutils/lib/ cc1: warnings being treated as errors In file included from git/coreutils/gl/lib/mbsalign.c:21: git/coreutils/gl/lib/mbsalign.h:24: error: comma at end of enumerator list git/coreutils/gl/lib/mbsalign.c: In function 'mbsalign': git/coreutils/gl/lib/mbsalign.c:241: error: ISO C90 forbids mixed declarations and code git/coreutils/gl/lib/mbsalign.c: In function 'ambsalign': git/coreutils/gl/lib/mbsalign.c:269: error: ISO C90 forbids mixed declarations and code However I'm confused about how this was the only failure given this info from README: *********************** Pre-C99 build failure ----------------------- There is a new, implicit build requirement: To build the coreutils from source, you should have a C99-conforming compiler, due to the use of declarations after non-declaration statements in several files in src/. There is code in configure to find and, if possible, enable an appropriate compiler. However, if configure doesn't find a C99 compiler, it continues nonetheless, and your build will fail. If that happens, simply[*] apply the included patch using the following command, and then run make again: cd src && patch < c99-to-c89.diff [*] however, as of coreutils-7.1, the "c99-to-c89.diff" file is no longer maintained, so even if the patches still apply, the result will be an incomplete conversion. It's been 10 years. Get a decent compiler! ;-) cheers, Pádraig. From debbugs-submit-bounces@debbugs.gnu.org Fri Oct 01 09:30:43 2010 Received: (at 7099-done) by debbugs.gnu.org; 1 Oct 2010 13:30:43 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1P1fhD-00074F-6K for submit@debbugs.gnu.org; Fri, 01 Oct 2010 09:30:43 -0400 Received: from mail1.slb.deg.dub.stisp.net ([84.203.253.98]) by debbugs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1P1fhA-000749-23 for 7099-done@debbugs.gnu.org; Fri, 01 Oct 2010 09:30:41 -0400 Received: (qmail 62990 invoked from network); 1 Oct 2010 13:33:37 -0000 Received: from unknown (HELO ?192.168.2.25?) (84.203.137.218) by mail1.slb.deg.dub.stisp.net with SMTP; 1 Oct 2010 13:33:37 -0000 Message-ID: <4CA5E2FA.30008@draigBrady.com> Date: Fri, 01 Oct 2010 14:32:42 +0100 From: =?ISO-8859-1?Q?P=E1draig_Brady?= User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3 MIME-Version: 1.0 To: Suhan Andrei Subject: Re: bug#7099: mbsalign.c old c compiler complains about variables defined inside code References: <214709.25039.qm@web113518.mail.gq1.yahoo.com> <4C9D1A5D.60604@draigBrady.com> In-Reply-To: <4C9D1A5D.60604@draigBrady.com> X-Enigmail-Version: 1.0.1 Content-Type: multipart/mixed; boundary="------------030400000808000103020302" X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: 7099-done Cc: 7099-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.7 (--) This is a multi-part message in MIME format. --------------030400000808000103020302 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit On 24/09/10 22:38, Pádraig Brady wrote: > On 24/09/10 21:15, Suhan Andrei wrote: >> Hi >> >> Just wanted to let you know there are some errors when using old compiler >> ( >> gcc -v >> Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/specs >> gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release) >> ) >> >> >> Tere are 2 variables defined inside blocks of code that triggers old c compiler >> to spill errors. >> I used code from coreutils-8.5.tar.gz >> I moved declaration at the start of code and all compiled ok. > > Eep, I'll fix that up, as we want to keep stuff under gl/ > C89 conformant, as it may be moved to gnulib at some stage. I'll push the attached soon. cheers, Pádraig. --------------030400000808000103020302 Content-Type: text/x-patch; name="mbsalign-c89.diff" Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename="mbsalign-c89.diff" commit 013ed013129cf3197686ab83ed4761f82302c916 Author: Pádraig Brady Date: Fri Oct 1 14:28:18 2010 +0100 maint: tweak the mbsalign module to be C89 compatible This module may be moved to gnulib at some stage. * gl/lib/mbsalign.c (mbsalign): Declare variables at start of scope (ambsalign): Likewise * gl/lib/mbsalign.h: Remove trailing comma from enum diff --git a/gl/lib/mbsalign.c b/gl/lib/mbsalign.c index b92fe8f..117e4bf 100644 --- a/gl/lib/mbsalign.c +++ b/gl/lib/mbsalign.c @@ -217,7 +217,7 @@ mbsalign_unibyte: /* Write as much NUL terminated output to DEST as possible. */ if (dest_size != 0) { - size_t start_spaces, end_spaces; + size_t start_spaces, end_spaces, space_left; char *dest_end = dest + dest_size - 1; switch (align) @@ -238,7 +238,7 @@ mbsalign_unibyte: } dest = mbs_align_pad (dest, dest_end, start_spaces); - size_t space_left = dest_end - dest; + space_left = dest_end - dest; dest = mempcpy (dest, str_to_print, MIN (n_used_bytes, space_left)); mbs_align_pad (dest, dest_end, end_spaces); } @@ -265,8 +265,9 @@ ambsalign (const char *src, size_t *width, mbs_align_t align, int flags) while (req >= size) { + char *nbuf; size = req + 1; /* Space for NUL. */ - char *nbuf = realloc (buf, size); + nbuf = realloc (buf, size); if (nbuf == NULL) { free (buf); diff --git a/gl/lib/mbsalign.h b/gl/lib/mbsalign.h index 41bd490..96e81e7 100644 --- a/gl/lib/mbsalign.h +++ b/gl/lib/mbsalign.h @@ -21,7 +21,7 @@ typedef enum { MBS_ALIGN_LEFT, MBS_ALIGN_RIGHT, MBS_ALIGN_CENTER } mbs_align_t; enum { /* Use unibyte mode for invalid multibyte strings or or when heap memory is exhausted. */ - MBA_UNIBYTE_FALLBACK = 0x0001, + MBA_UNIBYTE_FALLBACK = 0x0001 #if 0 /* Other possible options. */ /* Skip invalid multibyte chars rather than failing */ --------------030400000808000103020302-- From unknown Sat Jun 21 03:17:01 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sat, 30 Oct 2010 11:24:03 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator