[Bug ada/40857] Ada broken on newlib-based platforms.

davek at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Sat Jul 25 15:10:00 GMT 2009



------- Comment #1 from davek at gcc dot gnu dot org  2009-07-25 15:09 -------
This is how adaint.h uses the FOPEN, etc. macros to conceal the 32/64 file i/o
selection:

#if defined (__GLIBC__) || defined (sun)  || defined (__sgi)
#define FOPEN fopen64
#define STAT stat64
#define FSTAT fstat64
#define LSTAT lstat64
#define STRUCT_STAT struct stat64
#else
#define FOPEN fopen
#define STAT stat
#define FSTAT fstat
#define LSTAT lstat
#define STRUCT_STAT struct stat
#endif


In newlib, sys/_default_fcntl.h defines FOPEN as a synonym for the _FOPEN fcntl
flag, when !_POSIX_SOURCE:

/*
 * The rest of the flags, used only for opens
 */
#define FOPEN           _FOPEN


I haven't yet decided between the two immediately obvious solutions:

#1.  Prefix _GNAT_ (or similar) to all the #defines in adaint.h and their uses
in the ada code.
#2.  Simply #undef FOPEN before redefining it for our own use.

#1 is slightly more work but I guess a bit more robust.  Will ask advice from
ADA maintainers.

BTW my sandbox is on rev 149338 still, but the same #defines are still present
on HEAD so I don't suppose it's been fixed yet.


-- 

davek at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |davek at gcc dot gnu dot org
                   |dot org                     |
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2009-07-25 15:09:53
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40857



More information about the Gcc-bugs mailing list