From dd1f09c21cbd573bd4fe5ba15b85e49cb77db515 Mon Sep 17 00:00:00 2001
From: Alexandre Oliva <aoliva@redhat.com>
Date: Wed, 7 Mar 2001 18:35:46 +0000
Subject: [PATCH] Add Irix 5.2, 6.3 support.

2001-03-07  Alexandre Oliva  <aoliva@redhat.com>

	Add Irix 5.2, 6.3 support.
        * config/os/irix/bits: Renamed too...
        * config/os/irix/irix6.5/bits: this.
        * config/os/irix/irix5.2/bits: New, copied from irix6.5/bits.
        * config/os/irix/irix5.2/bits/ctype_base.h: Use _U, _L, _N,
        _X, _S, _P, _C and _B instead of IRIX-6.5 _IS* macros.
        * config/os/irix/irix5.2/bits/ctype_noninline.h
        (ctype<char>::ctype): Initialize _M_table with __ctype.
        * configure.target: Adjust.

From-SVN: r40294
---
 libstdc++-v3/ChangeLog                        | 12 ++++
 .../config/os/irix/irix5.2/bits/atomicity.h   | 50 +++++++++++++
 .../config/os/irix/irix5.2/bits/ctype_base.h  | 55 ++++++++++++++
 .../os/irix/irix5.2/bits/ctype_inline.h       | 72 +++++++++++++++++++
 .../os/irix/irix5.2/bits/ctype_noninline.h    | 71 ++++++++++++++++++
 .../config/os/irix/irix5.2/bits/os_defines.h  | 58 +++++++++++++++
 .../os/irix/{ => irix6.5}/bits/atomicity.h    |  0
 .../os/irix/{ => irix6.5}/bits/ctype_base.h   |  0
 .../os/irix/{ => irix6.5}/bits/ctype_inline.h |  0
 .../irix/{ => irix6.5}/bits/ctype_noninline.h |  0
 .../os/irix/{ => irix6.5}/bits/os_defines.h   |  0
 libstdc++-v3/configure.target                 |  8 ++-
 12 files changed, 324 insertions(+), 2 deletions(-)
 create mode 100644 libstdc++-v3/config/os/irix/irix5.2/bits/atomicity.h
 create mode 100644 libstdc++-v3/config/os/irix/irix5.2/bits/ctype_base.h
 create mode 100644 libstdc++-v3/config/os/irix/irix5.2/bits/ctype_inline.h
 create mode 100644 libstdc++-v3/config/os/irix/irix5.2/bits/ctype_noninline.h
 create mode 100644 libstdc++-v3/config/os/irix/irix5.2/bits/os_defines.h
 rename libstdc++-v3/config/os/irix/{ => irix6.5}/bits/atomicity.h (100%)
 rename libstdc++-v3/config/os/irix/{ => irix6.5}/bits/ctype_base.h (100%)
 rename libstdc++-v3/config/os/irix/{ => irix6.5}/bits/ctype_inline.h (100%)
 rename libstdc++-v3/config/os/irix/{ => irix6.5}/bits/ctype_noninline.h (100%)
 rename libstdc++-v3/config/os/irix/{ => irix6.5}/bits/os_defines.h (100%)

diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 2e6b71d3a059..ee266bcd3803 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,15 @@
+2001-03-07  Alexandre Oliva  <aoliva@redhat.com>
+
+	Add Irix 5.2, 6.3 support.
+        * config/os/irix/bits: Renamed too...
+        * config/os/irix/irix6.5/bits: this.
+        * config/os/irix/irix5.2/bits: New, copied from irix6.5/bits.
+        * config/os/irix/irix5.2/bits/ctype_base.h: Use _U, _L, _N,
+        _X, _S, _P, _C and _B instead of IRIX-6.5 _IS* macros.
+        * config/os/irix/irix5.2/bits/ctype_noninline.h
+        (ctype<char>::ctype): Initialize _M_table with __ctype.
+        * configure.target: Adjust.
+    
 2001-03-06  Benjamin Kosnik  <bkoz@redhat.com>
 
 	libstdc++/2181
diff --git a/libstdc++-v3/config/os/irix/irix5.2/bits/atomicity.h b/libstdc++-v3/config/os/irix/irix5.2/bits/atomicity.h
new file mode 100644
index 000000000000..bac483e2f161
--- /dev/null
+++ b/libstdc++-v3/config/os/irix/irix5.2/bits/atomicity.h
@@ -0,0 +1,50 @@
+// Low-level functions for atomic operations: IRIX version  -*- C++ -*-
+
+// Copyright (C) 2001 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+#ifndef _BITS_ATOMICITY_H
+#define _BITS_ATOMICITY_H	1
+
+#include <mutex.h>
+
+typedef long _Atomic_word;
+
+static inline _Atomic_word
+__exchange_and_add (_Atomic_word* __mem, int __val)
+{
+  return (_Atomic_word) test_then_add ((unsigned long*) __mem, __val);
+}
+
+
+static inline void
+__atomic_add (_Atomic_word* __mem, int __val)
+{
+  __exchange_and_add (__mem, __val);
+}
+
+#endif /* atomicity.h */
diff --git a/libstdc++-v3/config/os/irix/irix5.2/bits/ctype_base.h b/libstdc++-v3/config/os/irix/irix5.2/bits/ctype_base.h
new file mode 100644
index 000000000000..2626cd3c062d
--- /dev/null
+++ b/libstdc++-v3/config/os/irix/irix5.2/bits/ctype_base.h
@@ -0,0 +1,55 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 1997-1999, 2001 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 22.1  Locales
+//
+  
+// Information as gleaned from /usr/include/ctype.h on irix 5.2
+  
+  struct ctype_base
+  {
+    // Non-standard typedefs.
+    typedef unsigned int*      	__to_type;
+
+    // NB: Offsets into ctype<char>::_M_table force a particular size
+    // on the mask type. Because of this, we don't use an enum.
+    typedef unsigned char	mask;
+    static const mask upper    	= _U;
+    static const mask lower 	= _L;
+    static const mask alpha 	= _U | _L;
+    static const mask digit 	= _N;
+    static const mask xdigit 	= _X;
+    static const mask space 	= _S;
+    static const mask print 	= _U | _L | _N | _P | _B;
+    static const mask graph 	= _U | _L | _N | _P;
+    static const mask cntrl 	= _C;
+    static const mask punct 	= _P;
+    static const mask alnum 	= _U | _L | _N;
+  };
diff --git a/libstdc++-v3/config/os/irix/irix5.2/bits/ctype_inline.h b/libstdc++-v3/config/os/irix/irix5.2/bits/ctype_inline.h
new file mode 100644
index 000000000000..400b3a7c391e
--- /dev/null
+++ b/libstdc++-v3/config/os/irix/irix5.2/bits/ctype_inline.h
@@ -0,0 +1,72 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 2001 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 22.1  Locales
+//
+  
+// ctype bits to be inlined go here. Non-inlinable (ie virtual do_*)
+// functions go in ctype.cc
+  
+  bool
+  ctype<char>::
+  is(mask __m, char __c) const
+  { return (_M_table)[__c] & __m; }
+
+  const char*
+  ctype<char>::
+  is(const char* __low, const char* __high, mask* __vec) const
+  {
+    while (__low < __high)
+      *__vec++ = (_M_table)[*__low++];
+    return __high;
+  }
+
+  const char*
+  ctype<char>::
+  scan_is(mask __m, const char* __low, const char* __high) const
+  {
+    while (__low < __high && !((_M_table)[*__low] & __m))
+      ++__low;
+    return __low;
+  }
+
+  const char*
+  ctype<char>::
+  scan_not(mask __m, const char* __low, const char* __high) const
+  {
+    while (__low < __high && ((_M_table + 1)[*__low] & __m) != 0)
+      ++__low;
+    return __low;
+  }
+
+
+
+
+
diff --git a/libstdc++-v3/config/os/irix/irix5.2/bits/ctype_noninline.h b/libstdc++-v3/config/os/irix/irix5.2/bits/ctype_noninline.h
new file mode 100644
index 000000000000..cf4b5273e2ba
--- /dev/null
+++ b/libstdc++-v3/config/os/irix/irix5.2/bits/ctype_noninline.h
@@ -0,0 +1,71 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 1997-1999, 2001 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+//
+// ISO C++ 14882: 22.1  Locales
+//
+  
+// Information as gleaned from /usr/include/ctype.h
+
+  ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
+  : __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del), 
+    _M_toupper(NULL), _M_tolower(NULL), _M_ctable(NULL), 
+    _M_table(!__table ? __ctype : __table)
+  { }
+
+  char
+  ctype<char>::do_toupper(char __c) const
+  { return _toupper(__c); }
+
+  const char*
+  ctype<char>::do_toupper(char* __low, const char* __high) const
+  {
+    while (__low < __high)
+      {
+	*__low = do_toupper(*__low);
+	++__low;
+      }
+    return __high;
+  }
+
+  char
+  ctype<char>::do_tolower(char __c) const
+  { return _tolower(__c); }
+
+  const char* 
+  ctype<char>::do_tolower(char* __low, const char* __high) const
+  {
+    while (__low < __high)
+      {
+	*__low = do_tolower(*__low);
+	++__low;
+      }
+    return __high;
+  }
+
diff --git a/libstdc++-v3/config/os/irix/irix5.2/bits/os_defines.h b/libstdc++-v3/config/os/irix/irix5.2/bits/os_defines.h
new file mode 100644
index 000000000000..b4e2a1f36376
--- /dev/null
+++ b/libstdc++-v3/config/os/irix/irix5.2/bits/os_defines.h
@@ -0,0 +1,58 @@
+// Specific definitions for IRIX  -*- C++ -*-
+
+// Copyright (C) 2001 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+// USA.
+
+// As a special exception, you may use this file as part of a free software
+// library without restriction.  Specifically, if other files instantiate
+// templates or use macros or inline functions from this file, or you compile
+// this file and link it with other files to produce an executable, this
+// file does not by itself cause the resulting executable to be covered by
+// the GNU General Public License.  This exception does not however
+// invalidate any other reasons why the executable file might be covered by
+// the GNU General Public License.
+
+
+#ifndef _GLIBCPP_OS_DEFINES
+#define _GLIBCPP_OS_DEFINES
+
+/* System-specific #define, typedefs, corrections, etc, go here.  This
+   file will come before all others. */
+
+/* We need large file support.  There are two ways to turn it on:
+   by defining either _LARGEFILE64_SOURCE or _SGI_SOURCE.  However,
+   it does not actually work to define only the former, as then
+   <sys/stat.h> is invalid: `st_blocks' is defined to be a macro,
+   but then used as a field name.  So, we have to turn on 
+   _SGI_SOURCE.  That only works if _POSIX_SOURCE is turned off,
+   so we have to explicitly turn it off.  (Some of the libio C files
+   explicitly try to turn it on.)  _SGI_SOURCE is actually turned on 
+   implicitly via the command-line.  */
+#undef _POSIX_SOURCE
+
+#define __off_t off_t
+#define __off64_t off64_t
+#define __ssize_t ssize_t
+
+/* GCC does not use thunks on IRIX.  */
+#define _G_USING_THUNKS 0
+
+#endif
+
+
+
diff --git a/libstdc++-v3/config/os/irix/bits/atomicity.h b/libstdc++-v3/config/os/irix/irix6.5/bits/atomicity.h
similarity index 100%
rename from libstdc++-v3/config/os/irix/bits/atomicity.h
rename to libstdc++-v3/config/os/irix/irix6.5/bits/atomicity.h
diff --git a/libstdc++-v3/config/os/irix/bits/ctype_base.h b/libstdc++-v3/config/os/irix/irix6.5/bits/ctype_base.h
similarity index 100%
rename from libstdc++-v3/config/os/irix/bits/ctype_base.h
rename to libstdc++-v3/config/os/irix/irix6.5/bits/ctype_base.h
diff --git a/libstdc++-v3/config/os/irix/bits/ctype_inline.h b/libstdc++-v3/config/os/irix/irix6.5/bits/ctype_inline.h
similarity index 100%
rename from libstdc++-v3/config/os/irix/bits/ctype_inline.h
rename to libstdc++-v3/config/os/irix/irix6.5/bits/ctype_inline.h
diff --git a/libstdc++-v3/config/os/irix/bits/ctype_noninline.h b/libstdc++-v3/config/os/irix/irix6.5/bits/ctype_noninline.h
similarity index 100%
rename from libstdc++-v3/config/os/irix/bits/ctype_noninline.h
rename to libstdc++-v3/config/os/irix/irix6.5/bits/ctype_noninline.h
diff --git a/libstdc++-v3/config/os/irix/bits/os_defines.h b/libstdc++-v3/config/os/irix/irix6.5/bits/os_defines.h
similarity index 100%
rename from libstdc++-v3/config/os/irix/bits/os_defines.h
rename to libstdc++-v3/config/os/irix/irix6.5/bits/os_defines.h
diff --git a/libstdc++-v3/configure.target b/libstdc++-v3/configure.target
index 0b9029cb3290..1da593fc5299 100644
--- a/libstdc++-v3/configure.target
+++ b/libstdc++-v3/configure.target
@@ -84,8 +84,12 @@ case "${target_os}" in
   linux* | gnu*)
     os_include_dir="config/os/gnu-linux"
     ;;
-  irix6.5*)
-    os_include_dir="config/os/irix"
+  irix[1-6] | irix[1-5].* | irix6.[0-4])
+   # This is known to work on at least IRIX 5.2 and 6.3.
+   os_include_dir="config/os/irix/irix5.2"
+   ;;
+  irix6.5)
+    os_include_dir="config/os/irix/irix6.5"
     ;;
   netbsd*)
     os_include_dir="config/os/bsd/netbsd"
-- 
GitLab