diff options
author | Kai Tietz <kai.tietz@onevision.com> | 2010-03-08 09:01:55 +0100 |
---|---|---|
committer | Kai Tietz <ktietz@gcc.gnu.org> | 2010-03-08 09:01:55 +0100 |
commit | 196c8bc8a319d0be3018c66339e00985857bd627 (patch) | |
tree | 54205f64411c22ef87b871e28f9f42f5c3d81cd5 /libgfortran/libgfortran.h | |
parent | 4bdd4fc006b7fe2f495a1e2ab72948aa1ad9a2a5 (diff) | |
download | gcc-196c8bc8a319d0be3018c66339e00985857bd627.zip gcc-196c8bc8a319d0be3018c66339e00985857bd627.tar.gz gcc-196c8bc8a319d0be3018c66339e00985857bd627.tar.bz2 |
libgfortran.h (_POSIX): Define if __MINGW32__ is defined.
2010-03-08 Kai TIetz <kai.tietz@onevision.com>
PR/42950
* libgfortran.h (_POSIX): Define if __MINGW32__ is defined.
(gfc_printf): Define to gnu_printf for __MINGW32__ case,
otherwise to __printf__.
(gfc_strtof,gfc_strtod,gfc_strtold): Define for mingw case
to POSIX compatible converter functions.
(runtime_error): Use instead gfc_printf as formatter
attribute name.
(runtime_error_at): Likewise.
(runtime_warning_at): Likewise.
(st_printf): Likewise.
* intrinsics/date_and_time.c (localtime_r): Undefine
possible defined macro.
(gmtime_r): Likewise.
* io/read.c (convert_real): Use gfc_strtof, gfc_strtod,
and gfc_strtold.
From-SVN: r157271
Diffstat (limited to 'libgfortran/libgfortran.h')
-rw-r--r-- | libgfortran/libgfortran.h | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/libgfortran/libgfortran.h b/libgfortran/libgfortran.h index dd63fa4..8d1fa4d 100644 --- a/libgfortran/libgfortran.h +++ b/libgfortran/libgfortran.h @@ -28,6 +28,15 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #ifndef LIBGFOR_H #define LIBGFOR_H +/* Ensure that ANSI conform stdio is used. This needs to be set before + any system header file is included. */ +#if defined __MINGW32__ +# define _POSIX 1 +# define gfc_printf gnu_printf +#else +# define gfc_printf __printf__ +#endif + /* config.h MUST be first because it can affect system headers. */ #include "config.h" @@ -37,6 +46,19 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include <float.h> #include <stdarg.h> +#ifdef __MINGW32__ +extern float __strtof (const char *, char **); +#define gfc_strtof __strtof +extern double __strtod (const char *, char **); +#define gfc_strtod __strtod +extern long double __strtold (const char *, char **); +#define gfc_strtold __strtold +#else +#define gfc_strtof strtof +#define gfc_strtod strtod +#define gfc_strtold strtold +#endif + #if HAVE_COMPLEX_H # include <complex.h> #else @@ -703,15 +725,15 @@ extern void show_locus (st_parameter_common *); internal_proto(show_locus); extern void runtime_error (const char *, ...) - __attribute__ ((noreturn, format (printf, 1, 2))); + __attribute__ ((noreturn, format (gfc_printf, 1, 2))); iexport_proto(runtime_error); extern void runtime_error_at (const char *, const char *, ...) - __attribute__ ((noreturn, format (printf, 2, 3))); + __attribute__ ((noreturn, format (gfc_printf, 2, 3))); iexport_proto(runtime_error_at); extern void runtime_warning_at (const char *, const char *, ...) - __attribute__ ((format (printf, 2, 3))); + __attribute__ ((format (gfc_printf, 2, 3))); iexport_proto(runtime_warning_at); extern void internal_error (st_parameter_common *, const char *) @@ -795,7 +817,7 @@ extern int unit_to_fd (int); internal_proto(unit_to_fd); extern int st_printf (const char *, ...) - __attribute__ ((format (printf, 1, 2))); + __attribute__ ((format (gfc_printf, 1, 2))); internal_proto(st_printf); extern int st_vprintf (const char *, va_list); |