[llvm-branch-commits] [llvm-gcc-branch] r71693 - /llvm-gcc-4.2/branches/Apple/Dib/gcc/c-common.c

Bill Wendling isanbard at gmail.com
Wed May 13 11:44:42 PDT 2009


Author: void
Date: Wed May 13 13:44:29 2009
New Revision: 71693

URL: http://llvm.org/viewvc/llvm-project?rev=71693&view=rev
Log:
--- Merging r70874 into '.':
U    gcc/c-common.c

In C-like languages, marking a function pure/const
means it cannot throw an exception.  This is not
the case in other languages such as Ada.  Make this
explicit by having pure/const imply nothrow for C
and friends.

Modified:
    llvm-gcc-4.2/branches/Apple/Dib/gcc/c-common.c

Modified: llvm-gcc-4.2/branches/Apple/Dib/gcc/c-common.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Dib/gcc/c-common.c?rev=71693&r1=71692&r2=71693&view=diff

==============================================================================
--- llvm-gcc-4.2/branches/Apple/Dib/gcc/c-common.c (original)
+++ llvm-gcc-4.2/branches/Apple/Dib/gcc/c-common.c Wed May 13 13:44:29 2009
@@ -4739,9 +4739,12 @@
   tree type = TREE_TYPE (*node);
 
   /* See FIXME comment on noreturn in c_common_attribute_table.  */
-  if (TREE_CODE (*node) == FUNCTION_DECL)
+  /* LLVM LOCAL begin */
+  if (TREE_CODE (*node) == FUNCTION_DECL) {
     TREE_READONLY (*node) = 1;
-  else if (TREE_CODE (type) == POINTER_TYPE
+    TREE_NOTHROW (*node) = 1;
+  } else if (TREE_CODE (type) == POINTER_TYPE
+  /* LLVM LOCAL end */
 	   && TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE)
     TREE_TYPE (*node)
       = build_pointer_type
@@ -5573,10 +5576,13 @@
 handle_pure_attribute (tree *node, tree name, tree ARG_UNUSED (args),
 		       int ARG_UNUSED (flags), bool *no_add_attrs)
 {
-  if (TREE_CODE (*node) == FUNCTION_DECL)
+  /* LLVM LOCAL begin */
+  if (TREE_CODE (*node) == FUNCTION_DECL) {
     DECL_IS_PURE (*node) = 1;
-  /* ??? TODO: Support types.  */
-  else
+    TREE_NOTHROW (*node) = 1;
+  } else
+  /* LLVM LOCAL end */
+    /* ??? TODO: Support types.  */
     {
       warning (OPT_Wattributes, "%qE attribute ignored", name);
       *no_add_attrs = true;





More information about the llvm-branch-commits mailing list