Example #1
0
void
c_type_print_args (struct type *type, struct ui_file *stream,
		   int show_artificial, enum language language)
{
  int i, len;
  struct field *args;
  int printed_any = 0;

  fprintf_filtered (stream, "(");
  args = TYPE_FIELDS (type);
  len = TYPE_NFIELDS (type);

  for (i = 0; i < TYPE_NFIELDS (type); i++)
    {
      if (TYPE_FIELD_ARTIFICIAL (type, i) && !show_artificial)
	continue;

      if (printed_any)
	{
	  fprintf_filtered (stream, ", ");
	  wrap_here ("    ");
	}

      if (language == language_java)
	java_print_type (TYPE_FIELD_TYPE (type, i), "", stream, -1, 0);
      else
	c_print_type (TYPE_FIELD_TYPE (type, i), "", stream, -1, 0);
      printed_any = 1;
    }

  if (printed_any && TYPE_VARARGS (type))
    {
      /* Print out a trailing ellipsis for varargs functions.  Ignore
	 TYPE_VARARGS if the function has no named arguments; that
	 represents unprototyped (K&R style) C functions.  */
      if (printed_any && TYPE_VARARGS (type))
	{
	  fprintf_filtered (stream, ", ");
	  wrap_here ("    ");
	  fprintf_filtered (stream, "...");
	}
    }
  else if (!printed_any
	   && ((TYPE_PROTOTYPED (type) && language != language_java)
	       || language == language_cplus))
    fprintf_filtered (stream, "void");

  fprintf_filtered (stream, ")");
}
static void
cp_type_print_method_args (struct type *mtype, char *prefix, char *varstring,
			   int staticp, struct ui_file *stream)
{
  struct field *args = TYPE_FIELDS (mtype);
  int nargs = TYPE_NFIELDS (mtype);
  int varargs = TYPE_VARARGS (mtype);
  int i;

  fprintf_symbol_filtered (stream, prefix, language_cplus, DMGL_ANSI);
  fprintf_symbol_filtered (stream, varstring, language_cplus, DMGL_ANSI);
  fputs_filtered ("(", stream);

  /* Skip the class variable.  */
  i = staticp ? 0 : 1;
  if (nargs > i)
    {
      while (i < nargs)
	{
	  type_print (args[i++].type, "", stream, 0);

	  if (i == nargs && varargs)
	    fprintf_filtered (stream, ", ...");
	  else if (i < nargs)
	    fprintf_filtered (stream, ", ");
	}
    }
  else if (varargs)
    fprintf_filtered (stream, "...");
  else if (current_language->la_language == language_cplus)
    fprintf_filtered (stream, "void");

  fprintf_filtered (stream, ")");
}
static void
c_type_print_args (struct type *type, struct ui_file *stream)
{
  int i, len;
  struct field *args;
  int printed_any = 0;

  fprintf_filtered (stream, "(");
  args = TYPE_FIELDS (type);
  len = TYPE_NFIELDS (type);

  for (i = 0; i < TYPE_NFIELDS (type); i++)
    {
      if (printed_any)
	{
	  fprintf_filtered (stream, ", ");
	  wrap_here ("    ");
	}

      c_print_type (TYPE_FIELD_TYPE (type, i), "", stream, -1, 0);
      printed_any = 1;
    }

  if (printed_any && TYPE_VARARGS (type))
    {
      /* Print out a trailing ellipsis for varargs functions.  Ignore
	 TYPE_VARARGS if the function has no named arguments; that
	 represents unprototyped (K&R style) C functions.  */
      if (printed_any && TYPE_VARARGS (type))
	{
	  fprintf_filtered (stream, ", ");
	  wrap_here ("    ");
	  fprintf_filtered (stream, "...");
	}
    }
  else if (!printed_any
      && (TYPE_PROTOTYPED (type)
	  || current_language->la_language == language_cplus))
    fprintf_filtered (stream, "void");

  fprintf_filtered (stream, ")");
}
Example #4
0
static void
cp_type_print_method_args (struct type *mtype, const char *prefix,
			   const char *varstring, int staticp,
			   struct ui_file *stream)
{
  struct field *args = TYPE_FIELDS (mtype);
  int nargs = TYPE_NFIELDS (mtype);
  int varargs = TYPE_VARARGS (mtype);
  int i;

  fprintf_symbol_filtered (stream, prefix,
			   language_cplus, DMGL_ANSI);
  fprintf_symbol_filtered (stream, varstring,
			   language_cplus, DMGL_ANSI);
  fputs_filtered ("(", stream);

  /* Skip the class variable.  */
  i = staticp ? 0 : 1;
  if (nargs > i)
    {
      while (i < nargs)
	{
	  type_print (args[i++].type, "", stream, 0);

	  if (i == nargs && varargs)
	    fprintf_filtered (stream, ", ...");
	  else if (i < nargs)
	    fprintf_filtered (stream, ", ");
	}
    }
  else if (varargs)
    fprintf_filtered (stream, "...");
  else if (current_language->la_language == language_cplus)
    fprintf_filtered (stream, "void");

  fprintf_filtered (stream, ")");

  /* For non-static methods, read qualifiers from the type of
     THIS.  */
  if (!staticp)
    {
      struct type *domain;

      gdb_assert (nargs > 0);
      gdb_assert (TYPE_CODE (args[0].type) == TYPE_CODE_PTR);
      domain = TYPE_TARGET_TYPE (args[0].type);

      if (TYPE_CONST (domain))
	fprintf_filtered (stream, " const");

      if (TYPE_VOLATILE (domain))
	fprintf_filtered (stream, " volatile");
    }
}
static void
c_type_print_args (struct type *type, struct ui_file *stream)
{
  int i;
  struct field *args;

  fprintf_filtered (stream, "(");
  args = TYPE_FIELDS (type);
  if (args != NULL)
    {
      int i;

      /* FIXME drow/2002-05-31: Always skips the first argument,
	 should we be checking for static members?  */

      for (i = 1; i < TYPE_NFIELDS (type); i++)
	{
	  c_print_type (args[i].type, "", stream, -1, 0);
	  if (i != TYPE_NFIELDS (type))
	    {
	      fprintf_filtered (stream, ",");
	      wrap_here ("    ");
	    }
	}
      if (TYPE_VARARGS (type))
	fprintf_filtered (stream, "...");
      else if (i == 1
	       /* APPLE LOCAL begin Objective-C++ */
	       && (current_language->la_language == language_cplus
		   || current_language->la_language == language_objcplus))
	/* APPLE LOCAL end Objective-C++ */
	fprintf_filtered (stream, "void");
    }
  /* APPLE LOCAL begin Objective-C++ */
  else if (current_language->la_language == language_cplus
	   || current_language->la_language == language_objcplus)
    /* APPLE LOCAL end Objective-C++ */
    {
      fprintf_filtered (stream, "void");
    }

  fprintf_filtered (stream, ")");
}
Example #6
0
void
c_type_print_args (struct type *type, struct ui_file *stream,
		   int linkage_name, enum language language)
{
  int i, len;
  struct field *args;
  int printed_any = 0;

  fprintf_filtered (stream, "(");
  args = TYPE_FIELDS (type);
  len = TYPE_NFIELDS (type);

  for (i = 0; i < TYPE_NFIELDS (type); i++)
    {
      struct type *param_type;

      if (TYPE_FIELD_ARTIFICIAL (type, i) && linkage_name)
	continue;

      if (printed_any)
	{
	  fprintf_filtered (stream, ", ");
	  wrap_here ("    ");
	}

      param_type = TYPE_FIELD_TYPE (type, i);

      if (language == language_cplus && linkage_name)
	{
	  /* C++ standard, 13.1 Overloadable declarations, point 3, item:
	     - Parameter declarations that differ only in the presence or
	       absence of const and/or volatile are equivalent.

	     And the const/volatile qualifiers are not present in the mangled
	     names as produced by GCC.  */

	  param_type = make_cv_type (0, 0, param_type, NULL);
	}

      if (language == language_java)
	java_print_type (param_type, "", stream, -1, 0);
      else
	c_print_type (param_type, "", stream, -1, 0);
      printed_any = 1;
    }

  if (printed_any && TYPE_VARARGS (type))
    {
      /* Print out a trailing ellipsis for varargs functions.  Ignore
	 TYPE_VARARGS if the function has no named arguments; that
	 represents unprototyped (K&R style) C functions.  */
      if (printed_any && TYPE_VARARGS (type))
	{
	  fprintf_filtered (stream, ", ");
	  wrap_here ("    ");
	  fprintf_filtered (stream, "...");
	}
    }
  else if (!printed_any
	   && ((TYPE_PROTOTYPED (type) && language != language_java)
	       || language == language_cplus))
    fprintf_filtered (stream, "void");

  fprintf_filtered (stream, ")");
}