Mail Archives: djgpp-workers/2001/03/27/03:46:03
Some of DJGPP headers (current CVS) uses
using std::something;
to get symbols visible in global namespace (when C++ compiler is
being used, of course).
When some of header files doesn't put these definitions in std
namespace I'm getting compilation error with gcc-3.0 prerelease.
One of examples of such bad headers in current CVS is go32.h which
defines size_t when included early enough but not in std namespace.
Other such headers (which doesn't put definitions in std namespace
are stdio.h, stdlib.h, string.h, time.h, unistd.h and others). I only tested
definitions of size_t
As result I'm getting compilation error on following source
#include <go32.h>
#include <stddef.h>
or
#include <stdio.h>
#include <stddef.h>
I think one need binaries of gcc-3.0 snapshot for DJGPP to mess with
these things or problems cannot be avoided
Here is one example which shows how we could workaround these
problems (tested with gcc-3.0 snapshot only)
#define __DJ_size_t typedef long unsigned int size_t;
#ifdef __cplusplus
# define __DJ_std_namespace_begin namespace std {
# define __DJ_std_namespace_end }
#else
# define __DJ_std_namespace_begin
# define __DJ_std_namespace_end
#endif
#define __DJ_apply_def_std(a) __DJ_std_namespace_begin a
__DJ_std_namespace_end \
__DJ_apply_def_std(__DJ_size_t);
#define __DJ_size_t
__DJ_apply_def_std(__DJ_size_t);
----------------- output of gcc -E -------------------------------------------
# 1 "bar.cc"
# 1 "c:/djgpp/bin2/../lib/gcc-
lib/djgpp/3.0/../../../../include/sys/version.h" 1
# 2 "bar.cc" 2
# 14 "bar.cc"
namespace std { typedef long unsigned int size_t; };
namespace std { };
Andris
- Raw text -