OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [gcc/] [objcp/] [objcp-decl.c] - Diff between revs 816 and 826

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 816 Rev 826
/* Process the ObjC-specific declarations and variables for
/* Process the ObjC-specific declarations and variables for
   the Objective-C++ compiler.
   the Objective-C++ compiler.
   Copyright (C) 2005, 2007 Free Software Foundation, Inc.
   Copyright (C) 2005, 2007 Free Software Foundation, Inc.
   Contributed by Ziemowit Laski  <zlaski@apple.com>
   Contributed by Ziemowit Laski  <zlaski@apple.com>
 
 
This file is part of GCC.
This file is part of GCC.
 
 
GCC is free software; you can redistribute it and/or modify it under
GCC 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
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3, or (at your option) any later
Software Foundation; either version 3, or (at your option) any later
version.
version.
 
 
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
for more details.
for more details.
 
 
You should have received a copy of the GNU General Public License
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING3.  If not see
along with GCC; see the file COPYING3.  If not see
<http://www.gnu.org/licenses/>.  */
<http://www.gnu.org/licenses/>.  */
 
 
#include "config.h"
#include "config.h"
#include "system.h"
#include "system.h"
#include "coretypes.h"
#include "coretypes.h"
#include "tm.h"
#include "tm.h"
#include "tree.h"
#include "tree.h"
#include "rtl.h"
#include "rtl.h"
#include "expr.h"
#include "expr.h"
#include "cp-tree.h"
#include "cp-tree.h"
#include "c-common.h"
#include "c-common.h"
#include "flags.h"
#include "flags.h"
#include "input.h"
#include "input.h"
#include "except.h"
#include "except.h"
#include "output.h"
#include "output.h"
#include "toplev.h"
#include "toplev.h"
#include "cpplib.h"
#include "cpplib.h"
#include "debug.h"
#include "debug.h"
#include "target.h"
#include "target.h"
#include "varray.h"
#include "varray.h"
 
 
#include "objc-act.h"
#include "objc-act.h"
#include "objcp-decl.h"
#include "objcp-decl.h"
 
 
/* Hacks to simulate start_struct() and finish_struct(). */
/* Hacks to simulate start_struct() and finish_struct(). */
 
 
tree
tree
objcp_start_struct (location_t loc ATTRIBUTE_UNUSED,
objcp_start_struct (location_t loc ATTRIBUTE_UNUSED,
                    enum tree_code code ATTRIBUTE_UNUSED, tree name)
                    enum tree_code code ATTRIBUTE_UNUSED, tree name)
{
{
  tree s;
  tree s;
  /* The idea here is to mimic the actions that the C++ parser takes when
  /* The idea here is to mimic the actions that the C++ parser takes when
     constructing 'extern "C" struct NAME {'.  */
     constructing 'extern "C" struct NAME {'.  */
  push_lang_context (lang_name_c);
  push_lang_context (lang_name_c);
 
 
  if (!name)
  if (!name)
    name = make_anon_name ();
    name = make_anon_name ();
 
 
  s = xref_tag (record_type, name, ts_global, 0);
  s = xref_tag (record_type, name, ts_global, 0);
  CLASSTYPE_DECLARED_CLASS (s) = 0;  /* this is a 'struct', not a 'class'.  */
  CLASSTYPE_DECLARED_CLASS (s) = 0;  /* this is a 'struct', not a 'class'.  */
  xref_basetypes (s, NULL_TREE);     /* no base classes here!  */
  xref_basetypes (s, NULL_TREE);     /* no base classes here!  */
 
 
  return begin_class_definition (s, NULL_TREE);
  return begin_class_definition (s, NULL_TREE);
}
}
 
 
tree
tree
objcp_finish_struct (location_t loc ATTRIBUTE_UNUSED,
objcp_finish_struct (location_t loc ATTRIBUTE_UNUSED,
                     tree t, tree fieldlist, tree attributes)
                     tree t, tree fieldlist, tree attributes)
{
{
  tree field, next_field;
  tree field, next_field;
 
 
  for (field = fieldlist; field; field = next_field)
  for (field = fieldlist; field; field = next_field)
  {
  {
    next_field = TREE_CHAIN (field);      /* insert one field at a time;  */
    next_field = TREE_CHAIN (field);      /* insert one field at a time;  */
    TREE_CHAIN (field) = NULL_TREE;       /* otherwise, grokfield croaks. */
    TREE_CHAIN (field) = NULL_TREE;       /* otherwise, grokfield croaks. */
    finish_member_declaration (field);
    finish_member_declaration (field);
  }
  }
  t = finish_struct (t, attributes);
  t = finish_struct (t, attributes);
  pop_lang_context ();
  pop_lang_context ();
 
 
  return t;
  return t;
}
}
 
 
void
void
objcp_finish_function (void)
objcp_finish_function (void)
{
{
  /* The C++ flavor of 'finish_function' does not generate RTL -- one has
  /* The C++ flavor of 'finish_function' does not generate RTL -- one has
     to call 'expand_or_defer_fn' to do that.  */
     to call 'expand_or_defer_fn' to do that.  */
  expand_or_defer_fn (finish_function (0));
  expand_or_defer_fn (finish_function (0));
}
}
 
 
tree
tree
objcp_xref_tag (enum tree_code code ATTRIBUTE_UNUSED, tree name)
objcp_xref_tag (enum tree_code code ATTRIBUTE_UNUSED, tree name)
{
{
  return xref_tag (record_type, name, ts_global, false);
  return xref_tag (record_type, name, ts_global, false);
}
}
 
 
int
int
objcp_comptypes (tree type1, tree type2)
objcp_comptypes (tree type1, tree type2)
{
{
  return comptypes (type1, type2, COMPARE_STRICT);
  return comptypes (type1, type2, COMPARE_STRICT);
}
}
 
 
tree
tree
objcp_begin_compound_stmt (int flags ATTRIBUTE_UNUSED)
objcp_begin_compound_stmt (int flags ATTRIBUTE_UNUSED)
{
{
  return begin_compound_stmt (0);
  return begin_compound_stmt (0);
}
}
 
 
tree
tree
objcp_end_compound_stmt (tree stmt, int flags ATTRIBUTE_UNUSED)
objcp_end_compound_stmt (tree stmt, int flags ATTRIBUTE_UNUSED)
{
{
  /* The following has been snarfed from
  /* The following has been snarfed from
     cp/semantics.c:finish_compound_stmt().  */
     cp/semantics.c:finish_compound_stmt().  */
  if (TREE_CODE (stmt) == BIND_EXPR)
  if (TREE_CODE (stmt) == BIND_EXPR)
    BIND_EXPR_BODY (stmt) = do_poplevel (BIND_EXPR_BODY (stmt));
    BIND_EXPR_BODY (stmt) = do_poplevel (BIND_EXPR_BODY (stmt));
  else if (STATEMENT_LIST_NO_SCOPE (stmt))
  else if (STATEMENT_LIST_NO_SCOPE (stmt))
    stmt = pop_stmt_list (stmt);
    stmt = pop_stmt_list (stmt);
  else
  else
    stmt = do_poplevel (stmt);
    stmt = do_poplevel (stmt);
 
 
  return stmt;
  return stmt;
}
}
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.