]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
In gcc/:
authorGeoffrey Keating <geoffk@apple.com>
Wed, 1 Nov 2006 05:06:12 +0000 (05:06 +0000)
committerGeoffrey Keating <geoffk@gcc.gnu.org>
Wed, 1 Nov 2006 05:06:12 +0000 (05:06 +0000)
* coverage.c (coverage_checksum_string): Update comment.
* dwarf2out.c (switch_to_eh_frame_section): Update for removal
of get_file_function_name.
* cgraphunit.c (cgraph_build_static_cdtor): Update for rename
of get_file_function_name_long.
* tree.c (get_file_function_name): Rename from
get_file_function_name_long; improve comment; handle 'I' and 'D'
specially when the target has ctor/dtor support; remove special
handling for 'F'.
(get_file_function_name): Remove.
* tree.h (get_file_function_name): Rename from
        get_file_function_name_long.
(get_file_function_name): Remove prototype.
In gcc/cp/:
* name-lookup.c (get_anonymous_namespace_name): New.
(push_namespace_with_attribs): Use get_anonymous_namespace_name.
* decl2.c (start_objects): Update for rename of
get_file_function_name_long.
In gcc/fortran/:
* trans-decl.c (gfc_generate_constructors): Update for removal
of get_file_function_name.

From-SVN: r118360

gcc/ChangeLog
gcc/cgraphunit.c
gcc/coverage.c
gcc/cp/ChangeLog
gcc/cp/decl2.c
gcc/cp/name-lookup.c
gcc/dwarf2out.c
gcc/fortran/ChangeLog
gcc/fortran/trans-decl.c
gcc/tree.c
gcc/tree.h

index bae32ee33051dc61abc83968b86ca3f62fdd5cf2..c5cf3b556d983f4b676a0f6e76622d73f49a7b3b 100644 (file)
@@ -1,3 +1,19 @@
+2006-10-31  Geoffrey Keating  <geoffk@apple.com>
+
+       * coverage.c (coverage_checksum_string): Update comment.
+       * dwarf2out.c (switch_to_eh_frame_section): Update for removal
+       of get_file_function_name.
+       * cgraphunit.c (cgraph_build_static_cdtor): Update for rename
+       of get_file_function_name_long.
+       * tree.c (get_file_function_name): Rename from
+       get_file_function_name_long; improve comment; handle 'I' and 'D'
+       specially when the target has ctor/dtor support; remove special
+       handling for 'F'.
+       (get_file_function_name): Remove.
+       * tree.h (get_file_function_name): Rename from
+        get_file_function_name_long.
+       (get_file_function_name): Remove prototype.
+
 2006-10-31  Geoffrey Keating  <geoffk@apple.com>
 
        * config/i386/darwin.h (PREFERRED_DEBUGGING_TYPE): Remove.
index 309fb73f01235ccd37f10d68b803a6e9b934510d..242738a44697bd7253a21196a6821d7eb9ed5e92 100644 (file)
@@ -1675,7 +1675,7 @@ cgraph_build_static_cdtor (char which, tree body, int priority)
   tree decl, name, resdecl;
 
   sprintf (which_buf, "%c_%d", which, counter++);
-  name = get_file_function_name_long (which_buf);
+  name = get_file_function_name (which_buf);
 
   decl = build_decl (FUNCTION_DECL, name,
                     build_function_type (void_type_node, void_list_node));
index 5eaf4888fe3e2827da31fbf90d567d5530813f0e..399eb6ea6c6a861d8cdad2fb91441132504036e4 100644 (file)
@@ -433,7 +433,7 @@ coverage_checksum_string (unsigned chksum, const char *string)
   char *dup = NULL;
 
   /* Look for everything that looks if it were produced by
-     get_file_function_name_long and zero out the second part
+     get_file_function_name and zero out the second part
      that may result from flag_random_seed.  This is not critical
      as the checksums are used only for sanity checking.  */
   for (i = 0; string[i]; i++)
index 75c2fd4314cd1a8dc10e954a73ce4fb568995f05..27d86cd49bac3e864fe294629316f935eacd3223 100644 (file)
@@ -1,3 +1,10 @@
+2006-10-31  Geoffrey Keating  <geoffk@apple.com>
+
+       * name-lookup.c (get_anonymous_namespace_name): New.
+       (push_namespace_with_attribs): Use get_anonymous_namespace_name.
+       * decl2.c (start_objects): Update for rename of
+       get_file_function_name_long.
+
 2006-10-30  Dirk Mueller  <dmueller@suse.de>
 
        PR c++/28704
index 3b23638e71ad1a12d12848b700562075c7b34b8c..e4b5c00a31e5a282f79c8e24e9f44fa2ac5f3616 100644 (file)
@@ -2324,7 +2324,7 @@ start_objects (int method_type, int initp)
     sprintf (type, "%c", method_type);
 
   fndecl = build_lang_decl (FUNCTION_DECL,
-                           get_file_function_name_long (type),
+                           get_file_function_name (type),
                            build_function_type (void_type_node,
                                                 void_list_node));
   start_preparsed_function (fndecl, /*attrs=*/NULL_TREE, SF_PRE_PARSED);
index 3016bb0ad560b4015a24381d0a019865eea72279..92d398ae5cc97d239029e1a1087293a970d903ee 100644 (file)
@@ -61,6 +61,24 @@ tree global_namespace;
    unit.  */
 static GTY(()) tree anonymous_namespace_name;
 
+/* Initialise anonymous_namespace_name if necessary, and return it.  */
+
+static tree
+get_anonymous_namespace_name(void)
+{
+  if (!anonymous_namespace_name)
+    {
+      /* The anonymous namespace has to have a unique name
+        if typeinfo objects are being compared by name.  */
+      if (! flag_weak || ! SUPPORTS_ONE_ONLY)
+       anonymous_namespace_name = get_file_function_name ("N");
+      else
+       /* The demangler expects anonymous namespaces to be called
+          something starting with '_GLOBAL__N_'.  */
+       anonymous_namespace_name = get_identifier ("_GLOBAL__N_1");
+    }
+  return anonymous_namespace_name;
+}
 
 /* Compute the chain index of a binding_entry given the HASH value of its
    name and the total COUNT of chains.  COUNT is assumed to be a power
@@ -3011,11 +3029,7 @@ push_namespace_with_attribs (tree name, tree attributes)
 
   if (anon)
     {
-      /* The name of anonymous namespace is unique for the translation
-        unit.  */
-      if (!anonymous_namespace_name)
-       anonymous_namespace_name = get_file_function_name ('N');
-      name = anonymous_namespace_name;
+      name = get_anonymous_namespace_name();
       d = IDENTIFIER_NAMESPACE_VALUE (name);
       if (d)
        /* Reopening anonymous namespace.  */
index 13c0e2b2794cd3c547900556efcb3c7a17d84cf2..0aaf70e7431a7a3a062f41c2d7cb3e8939558f3a 100644 (file)
@@ -2030,7 +2030,7 @@ switch_to_eh_frame_section (void)
       /* We have no special eh_frame section.  Put the information in
         the data section and emit special labels to guide collect2.  */
       switch_to_section (data_section);
-      label = get_file_function_name ('F');
+      label = get_file_function_name ("F");
       ASM_OUTPUT_ALIGN (asm_out_file, floor_log2 (PTR_SIZE));
       targetm.asm_out.globalize_label (asm_out_file,
                                       IDENTIFIER_POINTER (label));
index e9ba75fe3b4b2eb6ce38c061869a073f28c419dc..f07fcc9416053dcd2902fac6e87f0dba1d87bd7f 100644 (file)
@@ -1,3 +1,8 @@
+2006-10-31  Geoffrey Keating  <geoffk@apple.com>
+
+       * trans-decl.c (gfc_generate_constructors): Update for removal
+       of get_file_function_name.
+
 2006-11-01  Bernhard Fischer  <aldot@gcc.gnu.org>
 
        PR fortran/29537
index 82315b708fcd7101bb31ab1ead5970e880b23c81..d81b829e5fa21c3da56bbf11768ce95baca155c9 100644 (file)
@@ -3299,7 +3299,7 @@ gfc_generate_constructors (void)
   if (gfc_static_ctors == NULL_TREE)
     return;
 
-  fnname = get_file_function_name ('I');
+  fnname = get_file_function_name ("I");
   type = build_function_type (void_type_node,
                              gfc_chainon_list (NULL_TREE, void_type_node));
 
index 4ee65f0e1b2ed7f8cd6a38851f0eaa73037b6532..d5e3f3f9eeca34b64d2c76bf0038b9e6d48eb100 100644 (file)
@@ -6042,41 +6042,48 @@ clean_symbol_name (char *p)
       *p = '_';
 }
 
-/* Generate a name for a function unique to this translation unit.
+/* Generate a name for a special-purpose function function.
+   The generated name may need to be unique across the whole link.
    TYPE is some string to identify the purpose of this function to the
-   linker or collect2.  */
+   linker or collect2; it must start with an uppercase letter,
+   one of:
+   I - for constructors
+   D - for destructors
+   N - for C++ anonymous namespaces
+   F - for DWARF unwind frame information.  */
 
 tree
-get_file_function_name_long (const char *type)
+get_file_function_name (const char *type)
 {
   char *buf;
   const char *p;
   char *q;
 
+  /* If we already have a name we know to be unique, just use that.  */
   if (first_global_object_name)
+    p = first_global_object_name;
+  /* If the target is handling the constructors/destructors, they
+     will be local to this file and the name is only necessary for
+     debugging purposes.  */
+  else if ((type[0] == 'I' || type[0] == 'D') && targetm.have_ctors_dtors)
     {
-      p = first_global_object_name;
-
-      /* For type 'F', the generated name must be unique not only to this
-        translation unit but also to any given link.  Since global names
-        can be overloaded, we concatenate the first global object name
-        with a string derived from the file name of this object.  */
-      if (!strcmp (type, "F"))
-       {
-         const char *file = main_input_filename;
-
-         if (! file)
-           file = input_filename;
-
-         q = alloca (strlen (p) + 10);
-         sprintf (q, "%s_%08X", p, crc32_string (0, file));
-
-         p = q;
-       }
+      const char *file = main_input_filename;
+      if (! file)
+       file = input_filename;
+      /* Just use the file's basename, because the full pathname
+        might be quite long.  */
+      p = strrchr (file, '/');
+      if (p)
+       p++;
+      else
+       p = file;
+      p = q = ASTRDUP (p);
+      clean_symbol_name (q);
     }
   else
     {
-      /* We don't have anything that we know to be unique to this translation
+      /* Otherwise, the name must be unique across the entire link.
+        We don't have anything that we know to be unique to this translation
         unit, so use what we do have and throw in some randomness.  */
       unsigned len;
       const char *name = weak_global_object_name;
@@ -6108,20 +6115,6 @@ get_file_function_name_long (const char *type)
 
   return get_identifier (buf);
 }
-
-/* If KIND=='I', return a suitable global initializer (constructor) name.
-   If KIND=='D', return a suitable global clean-up (destructor) name.  */
-
-tree
-get_file_function_name (int kind)
-{
-  char p[2];
-
-  p[0] = kind;
-  p[1] = 0;
-
-  return get_file_function_name_long (p);
-}
 \f
 #if defined ENABLE_TREE_CHECKING && (GCC_VERSION >= 2007)
 
index 6c8133f61862c506c9c180594956a93841b80d9c..013232bc1b7b5cc66f0405b5a371bf45a2efc9b1 100644 (file)
@@ -4150,7 +4150,7 @@ extern GTY(()) const char * current_function_func_begin_label;
 /* In tree.c */
 extern unsigned crc32_string (unsigned, const char *);
 extern void clean_symbol_name (char *);
-extern tree get_file_function_name_long (const char *);
+extern tree get_file_function_name (const char *);
 extern tree get_callee_fndecl (tree);
 extern void change_decl_assembler_name (tree, tree);
 extern int type_num_arguments (tree);
@@ -4488,10 +4488,6 @@ extern void gimplify_function_tree (tree);
 extern const char *get_name (tree);
 extern tree unshare_expr (tree);
 extern void sort_case_labels (tree);
-
-/* If KIND=='I', return a suitable global initializer (constructor) name.
-   If KIND=='D', return a suitable global clean-up (destructor) name.  */
-extern tree get_file_function_name (int);
 \f
 /* Interface of the DWARF2 unwind info support.  */