OSDN Git Service

* config/alpha/osf5.h (TARGET_C99_FUNCTIONS): Define.
[pf3gnuchains/gcc-fork.git] / libstdc++-v3 / src / globals.cc
index 36d193f..a0220f1 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -32,6 +32,7 @@
 #include <ostream>
 #include <locale>
 #include <ext/stdio_filebuf.h>
+#include <ext/stdio_sync_filebuf.h>
 
 // On AIX, and perhaps other systems, library initialization order is
 // not guaranteed.  For example, the static initializers for the main
 // time.  This file contains definitions of all global variables that
 // require initialization as arrays of characters.
 
-// Because <iostream> declares the standard streams to be [io]stream
-// types instead of say [io]fstream types, it is also necessary to
-// allocate the actual file buffers in this file.
-namespace std 
+// NB: asm directives can rename these non-exported, namespace
+// __gnu_cxx symbols into exported, namespace std symbols with the
+// appropriate symbol version name.
+// The rename syntax is 
+//   asm (".symver currentname,oldname@@GLIBCPP_3.2")
+// In macro form:
+// _GLIBCPP_ASM_SYMVER(currentname, oldname, GLIBCPP_3.2)
+
+namespace std
 {
-  // Standard "C" locale.
-  typedef char fake_locale[sizeof(locale)]
-  __attribute__ ((aligned(__alignof__(locale))));
-  fake_locale c_locale;
+  // Standard stream objects.
+  // NB: Iff <iostream> is included, these definitions become wonky.
+  typedef char fake_istream[sizeof(istream)]
+  __attribute__ ((aligned(__alignof__(istream))));
+  typedef char fake_ostream[sizeof(ostream)] 
+  __attribute__ ((aligned(__alignof__(ostream))));
+  fake_istream cin;
+  fake_ostream cout;
+  fake_ostream cerr;
+  fake_ostream clog;
+
+#ifdef _GLIBCPP_USE_WCHAR_T
+  typedef char fake_wistream[sizeof(wistream)] 
+  __attribute__ ((aligned(__alignof__(wistream))));
+  typedef char fake_wostream[sizeof(wostream)] 
+  __attribute__ ((aligned(__alignof__(wostream))));
+  fake_wistream wcin;
+  fake_wostream wcout;
+  fake_wostream wcerr;
+  fake_wostream wclog;
+#endif
+} // namespace std
+
+namespace __gnu_cxx
+{
+  using namespace std;
+
+  // We use different stream buffer types depending on whether
+  // ios_base::sync_with_stdio(false) has been called.
+  typedef char fake_stdiobuf[sizeof(stdio_sync_filebuf<char>)]
+  __attribute__ ((aligned(__alignof__(stdio_sync_filebuf<char>))));
+  fake_stdiobuf buf_cout_sync;
+  fake_stdiobuf buf_cin_sync;
+  fake_stdiobuf buf_cerr_sync;
+
+  typedef char fake_filebuf[sizeof(stdio_filebuf<char>)]
+  __attribute__ ((aligned(__alignof__(stdio_filebuf<char>))));
+  fake_filebuf buf_cout;
+  fake_filebuf buf_cin;
+  fake_filebuf buf_cerr;
+
+#ifdef _GLIBCPP_USE_WCHAR_T
+  typedef char fake_wstdiobuf[sizeof(stdio_sync_filebuf<wchar_t>)]
+  __attribute__ ((aligned(__alignof__(stdio_sync_filebuf<wchar_t>))));
+  fake_wstdiobuf buf_wcout_sync;
+  fake_wstdiobuf buf_wcin_sync;
+  fake_wstdiobuf buf_wcerr_sync;
+
+  typedef char fake_wfilebuf[sizeof(stdio_filebuf<wchar_t>)]
+  __attribute__ ((aligned(__alignof__(stdio_filebuf<wchar_t>))));
+  fake_wfilebuf buf_wcout;
+  fake_wfilebuf buf_wcin;
+  fake_wfilebuf buf_wcerr;
+#endif
 
   typedef char fake_locale_Impl[sizeof(locale::_Impl)]
   __attribute__ ((aligned(__alignof__(locale::_Impl))));
   fake_locale_Impl c_locale_impl;
-  
+
+  typedef char fake_locale[sizeof(locale)]
+  __attribute__ ((aligned(__alignof__(locale))));
+  fake_locale c_locale;
+
+  typedef char fake_name_vec[sizeof(char*)]
+  __attribute__ ((aligned(__alignof__(char*))));
+  fake_name_vec name_vec[6 + _GLIBCPP_NUM_CATEGORIES];
+
+  typedef char fake_names[sizeof(char[2])]
+  __attribute__ ((aligned(__alignof__(char[2]))));
+  fake_names name_c[6 + _GLIBCPP_NUM_CATEGORIES];
+
   typedef char fake_facet_vec[sizeof(locale::facet*)]
   __attribute__ ((aligned(__alignof__(locale::facet*))));
   fake_facet_vec facet_vec[_GLIBCPP_NUM_FACETS];
@@ -167,47 +235,10 @@ namespace std
   fake_messages_w messages_w;
 #endif
 
-  // Standard stream objects.
-  typedef char fake_istream[sizeof(istream)]
-  __attribute__ ((aligned(__alignof__(istream))));
-  typedef char fake_ostream[sizeof(ostream)] 
-  __attribute__ ((aligned(__alignof__(ostream))));
-  fake_istream cin;
-  fake_ostream cout;
-  fake_ostream cerr;
-  fake_ostream clog;
-
-  typedef char fake_filebuf[sizeof(__gnu_cxx::stdio_filebuf<char>)]
-  __attribute__ ((aligned(__alignof__(__gnu_cxx::stdio_filebuf<char>))));
-  fake_filebuf buf_cout;
-  fake_filebuf buf_cin;
-  fake_filebuf buf_cerr;
-
-#ifdef _GLIBCPP_USE_WCHAR_T
-  typedef char fake_wistream[sizeof(wistream)] 
-  __attribute__ ((aligned(__alignof__(wistream))));
-  typedef char fake_wostream[sizeof(wostream)] 
-  __attribute__ ((aligned(__alignof__(wostream))));
-  fake_wistream wcin;
-  fake_wostream wcout;
-  fake_wostream wcerr;
-  fake_wostream wclog;
-
-  typedef char fake_wfilebuf[sizeof(__gnu_cxx::stdio_filebuf<wchar_t>)]
-  __attribute__ ((aligned(__alignof__(__gnu_cxx::stdio_filebuf<wchar_t>))));
-  fake_wfilebuf buf_wcout;
-  fake_wfilebuf buf_wcin;
-  fake_wfilebuf buf_wcerr;
-#endif
-
-
   // Globals for once-only runtime initialization of mutex objects.  This
   // allows static initialization of these objects on systems that need a
   // function call to initialize a mutex.  For example, see stl_threads.h.
 #ifdef __GTHREAD_MUTEX_INIT
-  // Need to provide explicit instantiations of static data for
-  // systems with broken weak linkage support.
-  template __gthread_mutex_t _Swap_lock_struct<0>::_S_swap_lock;
 #elif defined(__GTHREAD_MUTEX_INIT_FUNCTION)
   __gthread_once_t _GLIBCPP_once = __GTHREAD_ONCE_INIT;
   __gthread_mutex_t _GLIBCPP_mutex;
@@ -223,4 +254,4 @@ namespace std
   _GLIBCPP_mutex_address_init ()
   { __GTHREAD_MUTEX_INIT_FUNCTION (_GLIBCPP_mutex_address); }
 #endif
-}
+} // namespace __gnu_cxx