Re: regex compile warnings

2006-07-29 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

According to Paul Eggert on 7/28/2006 5:48 PM:

 ../../lib/regex_internal.h, line 714: warning: token-less macro argument
 
 This one is worth fixing, since the code does not conform to C89.

Fix checked in.

 ../../lib/regexec.c, line 1412: warning: non-constant initializer: op --
 
 I don't understand this one.  Here's the line in question:
 
   Idx num = --fs-num;
 
 and I assume Idx is size_t, which is a 32-bit unsigned integer, so this
 code should be perfectly fine C89.  Am I missing something?  It appears
 to me to be a compiler bug.

I don't have the actual C89 or C99 standards in front of me at the moment,
but this line in the C99 draft explains it:

6.7.8 Initialization
  [#2]  No initializer shall attempt to provide a value for an
   object not contained within the entity being initialized.

I believe it is a gcc extension that allows you to change the value of an
unrelated variable inside an initializer.  The workaround is trivial -
separate the assignment into a followon statement.

- --
Life is short - so eat dessert first!

Eric Blake [EMAIL PROTECTED]
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.2.1 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEy15k84KuGfSFAYARArsAAJ9KLPpfXEzg1iLr1smme+rZbQbkEgCgwpMd
2IsO98+Ym2m/pLCgsH+SOLM=
=6BLj
-END PGP SIGNATURE-




Re: regex compile warnings

2006-07-29 Thread Larry Jones
Paul Eggert writes:
 
 I don't think so.  I think that code is portable KR C code, as well
 as being portable C89 and C99 code, if the item being initialized is a
 scalar.

I agree, I think it's just a plain old compiler bug.  Particularly since
it apparently didn't object to the essentially similar:

  Idx num = fs-num++;

in the previous function.

-Larry Jones

Wh. -- Calvin




regex compile warnings

2006-07-28 Thread Eric Blake
Is it worth silencing these compiler warnings with /usr/ucb/cc on Solaris 7?

../../lib/regex_internal.h, line 714: warning: token-less macro argument
../../lib/regexec.c, line 1412: warning: non-constant initializer: op --

-- 
Eric Blake






Re: regex compile warnings

2006-07-28 Thread Paul Eggert
Eric Blake [EMAIL PROTECTED] writes:

 Is it worth silencing these compiler warnings with /usr/ucb/cc on Solaris 7?

 ../../lib/regex_internal.h, line 714: warning: token-less macro argument

This one is worth fixing, since the code does not conform to C89.  The
obvious fix is to surround that line with #ifdef _LIBC.  If that
works, please install that.

 ../../lib/regexec.c, line 1412: warning: non-constant initializer: op --

I don't understand this one.  Here's the line in question:

  Idx num = --fs-num;

and I assume Idx is size_t, which is a 32-bit unsigned integer, so this
code should be perfectly fine C89.  Am I missing something?  It appears
to me to be a compiler bug.