bug-grep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: z/OS gcc and need for decl before statements


From: Jim Meyering
Subject: Re: z/OS gcc and need for decl before statements
Date: Sat, 19 Nov 2011 22:06:36 +0100

address@hidden wrote:
> Hi Jim et al. Here is the info w.r.t. the GCC for z/OS:
>
>> Date: Fri, 18 Nov 2011 12:22:58 -0700
>> From: Dave Pitts <address@hidden>
>> To: Aharon Robbins <address@hidden>
>> Subject: Re: gcc for z/OS
>>
>> On 11/12/2011 10:24 AM, Aharon Robbins wrote:
>> > Hi.  What's the status of GCC for z/OS?  Is there a reason you don't
>> > use it for building gawk?  I suggested that the grep team stop using
>> > declarations after statements because of z/OS, and got pointed back to
>> > your page on z/OS GCC and the mvsgcc project.
>> >
>> > Thanks,
>> >
>> > Arnold
>>
>> This compiler IS NOT production quality. I stopped actively working on it 
>> about
>> 5 years ago when IBM announced the s390 version of gcc with over 70 percent 
>> of
>> my back end and didn't give me any credit for it.... The GCC people have 
>> since
>> removed the older IBM support from the compiler line. The newer versions of
>> IBM's native C compilers may support the inline declarations. I don't know, 
>> nor
>> do I have the money to upgrade. My z/OS is pretty old now.
>
> So, while I can't force you, it would help me if dfa.c would keep all
> it's declarations before all executable statements.

An old version of z/OS (i.e., lacking a new enough gcc) is not a reasonable
portability target.

This is insufficient justification to dumb-down the code,
but in dfa.c, the impact is minimal, so I've made the changes there.

>From ea1a3cbdf3cb751d0e862b4dcdd8cf449d9d944f Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sat, 19 Nov 2011 22:04:13 +0100
Subject: [PATCH] maint: accommodate -Wdeclaration-after-statement, but only
 in dfa.c,

and because doing so does not impact readability/maintainability.
This is solely to accommodate gawk users who are stuck with ancient gcc.
This is no excuse to change any other code in grep.
* src/dfa.c (dfaoptimize, parse_bracket_exp): Move declaration
to precede first statement in block.
---
 src/dfa.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/dfa.c b/src/dfa.c
index dc87915..8db4aba 100644
--- a/src/dfa.c
+++ b/src/dfa.c
@@ -785,6 +785,7 @@ parse_bracket_exp (void)

   wint_t wc;
   wint_t wc2;
+  wint_t wc1 = 0;

   /* Work area to build a mb_char_classes.  */
   struct mb_char_classes *work_mbc;
@@ -819,7 +820,6 @@ parse_bracket_exp (void)
   else
     invert = 0;

-  wint_t wc1 = 0;
   colon_warning_state = (c == ':');
   do
     {
@@ -3420,10 +3420,11 @@ dfainit (struct dfa *d)
 static void
 dfaoptimize (struct dfa *d)
 {
+  unsigned int i;
+
   if (!MBS_SUPPORT || !using_utf8())
     return;

-  unsigned int i;
   for (i = 0; i < d->tindex; ++i)
     {
       switch(d->tokens[i])
--
1.7.8.rc2.3.g0911



reply via email to

[Prev in Thread] Current Thread [Next in Thread]