public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Patch, Fortran]: Fix libgfortran.h error for VMS
@ 2012-04-03 12:42 Tristan Gingold
  2012-04-03 15:54 ` Tobias Burnus
  0 siblings, 1 reply; 3+ messages in thread
From: Tristan Gingold @ 2012-04-03 12:42 UTC (permalink / raw)
  To: GCC Patches, fortran

Hi,

unfortunately VMS doesn't like to include complex.h after math.h, while the reverse is allowed.
The reason is that math.h (unless ANSI_C_SOURCE is defined but that hides many math functions) declares cabs/cabsf/cabsl for a structure representing a complex number, which is not compatible with the declarations in complex.h

The simplest path is simply to reverse the include order in libgfortran.h.  I know that this is somewhat VMS specific, and I welcome better ideas.

Tested by building gfortran for x86_64-darwin and ia64-hp-openvms.

Ok for trunk ?

Tristan.

libgfortran/
2012-04-03  Tristan Gingold  <gingold@adacore.com>

	* libgfortran.h: Include complex.h before math.h

diff --git a/libgfortran/libgfortran.h b/libgfortran/libgfortran.h
index be5f133..ea20e14 100644
--- a/libgfortran/libgfortran.h
+++ b/libgfortran/libgfortran.h
@@ -42,11 +42,19 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #include "config.h"
 
 #include <stdio.h>
-#include <math.h>
 #include <stddef.h>
 #include <float.h>
 #include <stdarg.h>
 
+#if HAVE_COMPLEX_H
+/* Must appear before math.h on VMS systems.  */
+# include <complex.h>
+#else
+#define complex __complex__
+#endif
+
+#include <math.h>
+
 /* If we're support quad-precision floating-point type, include the
    header to our support library.  */
 #ifdef HAVE_FLOAT128
@@ -66,12 +74,6 @@ extern long double __strtold (const char *, char **);
 #define gfc_strtold strtold
 #endif
 
-#if HAVE_COMPLEX_H
-# include <complex.h>
-#else
-#define complex __complex__
-#endif
-
 #include "../gcc/fortran/libgfortran.h"
 
 #include "c99_protos.h"

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Patch, Fortran]: Fix libgfortran.h error for VMS
  2012-04-03 12:42 [Patch, Fortran]: Fix libgfortran.h error for VMS Tristan Gingold
@ 2012-04-03 15:54 ` Tobias Burnus
  2012-04-04  7:52   ` Tristan Gingold
  0 siblings, 1 reply; 3+ messages in thread
From: Tobias Burnus @ 2012-04-03 15:54 UTC (permalink / raw)
  To: Tristan Gingold; +Cc: GCC Patches, fortran


On 04/03/2012 02:42 PM, Tristan Gingold wrote:
> The simplest path is simply to reverse the include order in libgfortran.h.  I know that this is somewhat VMS specific, and I welcome better ideas.

Well, changing the order is not that bad than one has to try hard to  
find a better solution. (Unless, it fails on other systems with the new 
order.)

> Tested by building gfortran for x86_64-darwin and ia64-hp-openvms.

OK. Thanks for the patch.

Tobias

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Patch, Fortran]: Fix libgfortran.h error for VMS
  2012-04-03 15:54 ` Tobias Burnus
@ 2012-04-04  7:52   ` Tristan Gingold
  0 siblings, 0 replies; 3+ messages in thread
From: Tristan Gingold @ 2012-04-04  7:52 UTC (permalink / raw)
  To: Tobias Burnus; +Cc: GCC Patches, fortran


On Apr 3, 2012, at 5:53 PM, Tobias Burnus wrote:

> 
> On 04/03/2012 02:42 PM, Tristan Gingold wrote:
>> The simplest path is simply to reverse the include order in libgfortran.h.  I know that this is somewhat VMS specific, and I welcome better ideas.
> 
> Well, changing the order is not that bad than one has to try hard to  find a better solution. (Unless, it fails on other systems with the new order.)

I cross my fingers!

>> Tested by building gfortran for x86_64-darwin and ia64-hp-openvms.
> 
> OK. Thanks for the patch.

You're welcome.  This was my latest patch to make gfortran build for VMS.  AFAIK, this is now the only post F95 fortran compiler available for VMS, although I suppose it lacks some DEC extensions specific to VMS.

Tristan.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-04-04  7:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-03 12:42 [Patch, Fortran]: Fix libgfortran.h error for VMS Tristan Gingold
2012-04-03 15:54 ` Tobias Burnus
2012-04-04  7:52   ` Tristan Gingold

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).