update copyright dates
[deliverable/binutils-gdb.git] / binutils / stabs.c
index 52a20e848ae9154453beb1e30e689bc2d418ce4e..b40a0955fd4d1e7f7047907203224cf21c0cc867 100644 (file)
@@ -1,13 +1,13 @@
 /* stabs.c -- Parse stabs debugging information
-   Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
-   Free Software Foundation, Inc.
+   Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+   2005, 2006, 2007, 2008  Free Software Foundation, Inc.
    Written by Ian Lance Taylor <ian@cygnus.com>.
 
    This file is part of GNU Binutils.
 
    This program 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 of the License, or
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
 
    This program is distributed in the hope that it will be useful,
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-   02111-1307, USA.  */
+   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+   02110-1301, USA.  */
 
 /* This file contains code which parses stabs debugging information.
    The organization of this code is based on the gdb stabs reading
    code.  The job it does is somewhat different, because it is not
    trying to identify the correct address for anything.  */
 
-#include <stdio.h>
-
+#include "sysdep.h"
 #include "bfd.h"
-#include "bucomm.h"
 #include "libiberty.h"
 #include "safe-ctype.h"
 #include "demangle.h"
@@ -1107,6 +1105,26 @@ parse_stab_string (void *dhandle, struct stab_handle *info, int stabtype,
        return FALSE;
       break;
 
+    case 'Y':
+      /* SUNPro C++ Namespace =Yn0.  */
+      /* Skip the namespace mapping, as it is not used now.  */
+      if (*(++p) == 'n' && *(++p) == '0')
+       {
+         /* =Yn0name; */
+         while (*p != ';')
+           ++p;
+         ++p;
+         return TRUE;
+       }
+      /* TODO SUNPro C++ support:
+         Support default arguments after F,P parameters
+         Ya = Anonymous unions
+         YM,YD = Pointers to class members
+         YT,YI = Templates
+         YR = Run-time type information (RTTI)  */
+
+      /* Fall through.  */
+
     default:
       bad_stab (string);
       return FALSE;
@@ -1696,12 +1714,12 @@ parse_stab_range_type (void *dhandle, struct stab_handle *info, const char *type
 #define ULLHIGH "01777777777777777777777;"
       if (index_type == DEBUG_TYPE_NULL)
        {
-         if (strncmp (s2, LLLOW, sizeof LLLOW - 1) == 0
-             && strncmp (s3, LLHIGH, sizeof LLHIGH - 1) == 0)
+         if (CONST_STRNEQ (s2, LLLOW)
+             && CONST_STRNEQ (s3, LLHIGH))
            return debug_make_int_type (dhandle, 8, FALSE);
          if (! ov2
              && n2 == 0
-             && strncmp (s3, ULLHIGH, sizeof ULLHIGH - 1) == 0)
+             && CONST_STRNEQ (s3, ULLHIGH))
            return debug_make_int_type (dhandle, 8, TRUE);
        }
 
@@ -1839,11 +1857,13 @@ parse_stab_sun_builtin_type (void *dhandle, const char **pp)
     }
   ++*pp;
 
-  /* For some odd reason, all forms of char put a c here.  This is strange
-     because no other type has this honor.  We can safely ignore this because
-     we actually determine 'char'acterness by the number of bits specified in
-     the descriptor.  */
-  if (**pp == 'c')
+  /* OpenSolaris source code indicates that one of "cbv" characters
+     can come next and specify the intrinsic 'iformat' encoding.
+     'c' is character encoding, 'b' is boolean encoding, and 'v' is
+     varargs encoding.  This field can be safely ignored because
+     the type of the field is determined from the bitwidth extracted
+     below.  */
+  if (**pp == 'c' || **pp == 'b' || **pp == 'v')
     ++*pp;
 
   /* The first number appears to be the number of bytes occupied
@@ -2832,7 +2852,7 @@ parse_stab_argtypes (void *dhandle, struct stab_handle *info,
                                   && (ISDIGIT (argtypes[2])
                                       || argtypes[2] == 'Q'
                                       || argtypes[2] == 't'))
-                                 || strncmp (argtypes, "__ct", 4) == 0);
+                                 || CONST_STRNEQ (argtypes, "__ct"));
 
   is_constructor = (is_full_physname_constructor
                    || (tagname != NULL
@@ -2840,7 +2860,7 @@ parse_stab_argtypes (void *dhandle, struct stab_handle *info,
   is_destructor = ((argtypes[0] == '_'
                    && (argtypes[1] == '$' || argtypes[1] == '.')
                    && argtypes[2] == '_')
-                  || strncmp (argtypes, "__dt", 4) == 0);
+                  || CONST_STRNEQ (argtypes, "__dt"));
   is_v3 = argtypes[0] == '_' && argtypes[1] == 'Z';
 
   if (is_destructor || is_full_physname_constructor || is_v3)
@@ -3841,7 +3861,7 @@ stab_demangle_function_name (struct stab_demangle_info *minfo,
   *pp = scan + 2;
 
   if (*pp - name >= 5
-          && strncmp (name, "type", 4) == 0
+          && CONST_STRNEQ (name, "type")
           && (name[4] == '$' || name[4] == '.'))
     {
       const char *tem;
@@ -4321,7 +4341,8 @@ stab_demangle_template (struct stab_demangle_info *minfo, const char **pp,
            {
              unsigned int len;
 
-             if (! stab_demangle_get_count (pp, &len))
+             len = stab_demangle_count (pp);
+             if (len == 0)
                {
                  stab_bad_demangle (orig);
                  return FALSE;
This page took 0.025314 seconds and 4 git commands to generate.