This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

C++ PATCH: Fix PR18530


This patch fixes a warning regression where we complained about "__ct"
and "__dt" as parameter names.  The root cause was that the names we
were giving to constructors and destructors was the same as the name
of a valid identifier.  Fixed by making the internal names of
constructors and destructors contain a space, which cannot be
expressed by a user.

Tested on i686-pc-linux-gnu, applied on the mainline.

--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com

2004-11-24  Mark Mitchell  <mark@codesourcery.com>

	PR c++/18530
	* cp-tree.h (CTOR_NAME): Remove.
	(DTOR_NAME): Remove.
	* decl.c (initialize_predefined_identifiers): Add spaces to the
	end of constructor and destructor names.

2004-11-24  Mark Mitchell  <mark@codesourcery.com>

	PR c++/18530
	* g++.dg/warn/Wshadow-3.C: New test.

Index: cp/cp-tree.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/cp-tree.h,v
retrieving revision 1.1070
diff -c -5 -p -r1.1070 cp-tree.h
*** cp/cp-tree.h	10 Nov 2004 17:34:47 -0000	1.1070
--- cp/cp-tree.h	24 Nov 2004 17:47:17 -0000
*************** extern GTY(()) varray_type local_classes
*** 3160,3171 ****
  
  #endif	/* NO_DOT_IN_LABEL */
  #endif	/* NO_DOLLAR_IN_LABEL */
  
  #define THIS_NAME "this"
- #define CTOR_NAME "__ct"
- #define DTOR_NAME "__dt"
  
  #define IN_CHARGE_NAME "__in_chrg"
  
  #define VTBL_PTR_TYPE		"__vtbl_ptr_type"
  #define VTABLE_DELTA_NAME	"__delta"
--- 3160,3169 ----
Index: cp/decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/decl.c,v
retrieving revision 1.1329
diff -c -5 -p -r1.1329 decl.c
*** cp/decl.c	17 Nov 2004 00:16:46 -0000	1.1329
--- cp/decl.c	24 Nov 2004 17:47:17 -0000
*************** initialize_predefined_identifiers (void)
*** 2921,2937 ****
    /* A table of identifiers to create at startup.  */
    static const predefined_identifier predefined_identifiers[] = {
      { "C++", &lang_name_cplusplus, 0 },
      { "C", &lang_name_c, 0 },
      { "Java", &lang_name_java, 0 },
!     { CTOR_NAME, &ctor_identifier, 1 },
!     { "__base_ctor", &base_ctor_identifier, 1 },
!     { "__comp_ctor", &complete_ctor_identifier, 1 },
!     { DTOR_NAME, &dtor_identifier, 1 },
!     { "__comp_dtor", &complete_dtor_identifier, 1 },
!     { "__base_dtor", &base_dtor_identifier, 1 },
!     { "__deleting_dtor", &deleting_dtor_identifier, 1 },
      { IN_CHARGE_NAME, &in_charge_identifier, 0 },
      { "nelts", &nelts_identifier, 0 },
      { THIS_NAME, &this_identifier, 0 },
      { VTABLE_DELTA_NAME, &delta_identifier, 0 },
      { VTABLE_PFN_NAME, &pfn_identifier, 0 },
--- 2921,2939 ----
    /* A table of identifiers to create at startup.  */
    static const predefined_identifier predefined_identifiers[] = {
      { "C++", &lang_name_cplusplus, 0 },
      { "C", &lang_name_c, 0 },
      { "Java", &lang_name_java, 0 },
!     /* Some of these names have a trailing space so that it is
!        impossible for them to conflict with names written by users.  */
!     { "__ct ", &ctor_identifier, 1 },
!     { "__base_ctor ", &base_ctor_identifier, 1 },
!     { "__comp_ctor ", &complete_ctor_identifier, 1 },
!     { "__dt ", &dtor_identifier, 1 },
!     { "__comp_dtor ", &complete_dtor_identifier, 1 },
!     { "__base_dtor ", &base_dtor_identifier, 1 },
!     { "__deleting_dtor ", &deleting_dtor_identifier, 1 },
      { IN_CHARGE_NAME, &in_charge_identifier, 0 },
      { "nelts", &nelts_identifier, 0 },
      { THIS_NAME, &this_identifier, 0 },
      { VTABLE_DELTA_NAME, &delta_identifier, 0 },
      { VTABLE_PFN_NAME, &pfn_identifier, 0 },


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]