OSDN Git Service

* configure.ac (ld_vers): Parse GNU ld version 2.17.50.0.3-6 20060715
[pf3gnuchains/gcc-fork.git] / libiberty / testsuite / test-demangle.c
index 6e00d14..9379399 100644 (file)
@@ -16,7 +16,7 @@
 
    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. 
 */
 
 #ifdef HAVE_CONFIG_H
 #include <stdio.h>
 #include "libiberty.h"
 #include "demangle.h"
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#if HAVE_STDLIB_H
+# include <stdlib.h>
+#endif
 
 struct line
 {
@@ -108,6 +114,7 @@ exp: %s\n",
      --is-v3-ctor        Calls is_gnu_v3_mangled_ctor on input; expected
                          output is an integer representing ctor_kind.
      --is-v3-dtor        Likewise, but for dtors.
+     --ret-postfix       Passes the DMGL_RET_POSTFIX option
 
    For compatibility, just in case it matters, the options line may be
    empty, to mean --format=auto.  If it doesn't start with --, then it
@@ -119,10 +126,11 @@ main(argc, argv)
      int argc;
      char **argv;
 {
-  enum demangling_styles style;
+  enum demangling_styles style = auto_demangling;
   int no_params;
   int is_v3_ctor;
   int is_v3_dtor;
+  int ret_postfix;
   struct line format;
   struct line input;
   struct line expect;
@@ -152,6 +160,7 @@ main(argc, argv)
       tests++;
 
       no_params = 0;
+      ret_postfix = 0;
       is_v3_ctor = 0;
       is_v3_dtor = 0;
       if (format.data[0] == '\0')
@@ -206,6 +215,8 @@ main(argc, argv)
                is_v3_ctor = 1;
              else if (strcmp (opt, "--is-v3-dtor") == 0)
                is_v3_dtor = 1;
+             else if (strcmp (opt, "--ret-postfix") == 0)
+               ret_postfix = 1;
              else
                {
                  printf ("FAIL at line %d: unrecognized option %s\n",
@@ -249,7 +260,8 @@ main(argc, argv)
       cplus_demangle_set_style (style);
 
       result = cplus_demangle (input.data,
-                              DMGL_PARAMS|DMGL_ANSI|DMGL_TYPES);
+                              DMGL_PARAMS|DMGL_ANSI|DMGL_TYPES
+                              |(ret_postfix ? DMGL_RET_POSTFIX : 0));
 
       if (result
          ? strcmp (result, expect.data)