On 17/07/06, Jarkko Hietaniemi <[EMAIL PROTECTED]> wrote:
> Can it be that -std=c89 isn't that good an idea after all?
> This morning I disabled Cygwin, Now I should disable HP-UX 10.20.

The -std=c89 works for me in
* Debian 3.1 x86 - gcc 3.3.5

There are many glibc versions out there, and in many of them I've
spotted anonymous unions, C++ comments, or other things that makes
them incompatible with standard compilers (or even non-gcc compilers.)
I'd rather disable this for linux completely. (Maybe that means it's
not worth enabling it at all...)

* Tru64 V5.1B - gcc 3.3
* AIX 5.2.0.0 - gcc 3.4.2

but bombs in

* Solaris 10 - gcc 3.4.3

Attached is a patch to do -std=c89 only systems where it's known
to work.  Remember, the point of -std=c89 is not to be used everywhere
and always: only to catch as many non-standardisms as possible, in as
many platforms as possible.  I'm not enabling the -std=c89 in hpux
at all since you don't like it :-)  I would appreciate results from
e.g. freebsd.

> How many more to come? And it is not gcc that is old. On this
> system, 4.1.1 is installed. Pretty recent, right?

The errors you are getting have nothing to do with the C89 strictness
but instead with the operating system headers and gcc not getting along
(some types not getting defined when -std=c89 is on, that kind of thing)
Pretty similar problem as with -ansi -pedantic not being useable
everywhere.




--- cflags.SH.dist      2006-07-17 22:33:05.000000000 +0300
+++ cflags.SH   2006-07-17 22:34:45.000000000 +0300
@@ -99,8 +99,9 @@
 *) case "$cc" in
    *g++*) ;;
    *) case "$osname" in
-      cygwin) ;; # Fails at least up to and including 1.5.20
-      *) stdflags="$stdflags -std=c89" ;;
+      aix|dec_osf|darwin|linux)
+       stdflags="$stdflags -std=c89" ;;
+      *) ;; # Do not enable if not known to work.
       esac
    esac
    ;;
--- pod/perlhack.pod.dist       2006-07-17 22:33:46.000000000 +0300
+++ pod/perlhack.pod    2006-07-17 22:38:44.000000000 +0300
@@ -2462,9 +2462,10 @@
 platforms as possible -- we will, anyway, and it's nice to save
 oneself from public embarrassment.

-If using gcc, starting from Perl 5.9.4 Perl core C files will be
-compiled with the C<-std=c89> option which will hopefully catch
-most of these unportabilities.
+Starting from Perl 5.9.4 Perl core C files will be compiled with gcc
+with the C<-std=c89> option B<if> this is known to work with the
+system headers which will hopefully catch most of the above-mentioned
+unportabilities.

 Use the Configure C<-Dgccansipedantic> flag to enable the gcc
 C<-ansi -pedantic> flags which enforce stricter ANSI rules.


Reply via email to