gdbserver/linux-low: turn fast tracepoint ops into methods
[deliverable/binutils-gdb.git] / libiberty / testsuite / test-demangle.c
index 12b07dd6476cde353693f6056c40aff83de44b12..eb3bcbde608940669fb861a8d626be7be10fe66a 100644 (file)
@@ -1,5 +1,5 @@
 /* Demangler test program,
-   Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2002-2020 Free Software Foundation, Inc.
    Written by Zack Weinberg <zack@codesourcery.com
 
    This file is part of GNU libiberty.
@@ -32,6 +32,9 @@
 #if HAVE_STDLIB_H
 # include <stdlib.h>
 #endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
 
 struct line
 {
@@ -46,7 +49,7 @@ static unsigned int lineno;
 #define LINELEN 80
 
 static void
-getline(buf)
+get_line(buf)
      struct line *buf;
 {
   char *data = buf->data;
@@ -159,6 +162,7 @@ exp: %s\n",
                          output is an integer representing ctor_kind.
      --is-v3-dtor        Likewise, but for dtors.
      --ret-postfix       Passes the DMGL_RET_POSTFIX option
+     --ret-drop          Passes the DMGL_RET_DROP 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
@@ -174,7 +178,7 @@ main(argc, argv)
   int no_params;
   int is_v3_ctor;
   int is_v3_dtor;
-  int ret_postfix;
+  int ret_postfix, ret_drop;
   struct line format;
   struct line input;
   struct line expect;
@@ -196,12 +200,12 @@ main(argc, argv)
     {
       const char *inp;
       
-      getline (&format);
+      get_line (&format);
       if (feof (stdin))
        break;
 
-      getline (&input);
-      getline (&expect);
+      get_line (&input);
+      get_line (&expect);
 
       inp = protect_end (input.data);
 
@@ -209,6 +213,7 @@ main(argc, argv)
 
       no_params = 0;
       ret_postfix = 0;
+      ret_drop = 0;
       is_v3_ctor = 0;
       is_v3_dtor = 0;
       if (format.data[0] == '\0')
@@ -265,6 +270,8 @@ main(argc, argv)
                is_v3_dtor = 1;
              else if (strcmp (opt, "--ret-postfix") == 0)
                ret_postfix = 1;
+             else if (strcmp (opt, "--ret-drop") == 0)
+               ret_drop = 1;
              else
                {
                  printf ("FAIL at line %d: unrecognized option %s\n",
@@ -307,9 +314,9 @@ main(argc, argv)
 
       cplus_demangle_set_style (style);
 
-      result = cplus_demangle (inp,
-                              DMGL_PARAMS|DMGL_ANSI|DMGL_TYPES
-                              |(ret_postfix ? DMGL_RET_POSTFIX : 0));
+      result = cplus_demangle (inp, (DMGL_PARAMS | DMGL_ANSI | DMGL_TYPES
+                                    | (ret_postfix ? DMGL_RET_POSTFIX : 0)
+                                    | (ret_drop ? DMGL_RET_DROP : 0)));
 
       if (result
          ? strcmp (result, expect.data)
@@ -322,7 +329,7 @@ main(argc, argv)
 
       if (no_params)
        {
-         getline (&expect);
+         get_line (&expect);
          result = cplus_demangle (inp, DMGL_ANSI|DMGL_TYPES);
 
          if (result
This page took 0.024504 seconds and 4 git commands to generate.