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 PR/689 and PR/9257


Hi,

This patch fixes PRs #689 and #9257 where, by default, we are issueing
diagnostic along the lines that some classes are being overly private.
Those diagnostics have been reported not very helfpul and breaking major
components like Boost (see PR/9257).
Diagnosing an overly private class is too much:  overly private
classes are diagnosed at the *point of use* anyway. Now, we're giving
that diagnostic only if explicilty requested.

-- Gaby

Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ChangeLog,v
retrieving revision 1.17761
diff -p -r1.17761 ChangeLog
*** ChangeLog	11 May 2003 02:15:17 -0000	1.17761
--- ChangeLog	11 May 2003 12:45:00 -0000
***************
*** 1,3 ****
--- 1,11 ----
+ 2003-05-11  Gabriel Dos Reis  <gdr@integrable-solutions.net>
+ 
+ 	PR C++/689
+ 	PR C++/9257
+ 	* c-opts.c (c_common_decode_option): Don't set
+ 	warn_ctor_dtor_privacy wen -Wall.
+ 	* c-common.c (warn_ctor_dtor_privacy): Don't turn on by default.
+ 
  2003-05-10  Alexandre Oliva  <aoliva@redhat.com>
  
  	* reload1.c (reload_cse_move2add): Revert part of my 2003-05-09's
Index: c-opts.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-opts.c,v
retrieving revision 1.43
diff -p -r1.43 c-opts.c
*** c-opts.c	6 May 2003 20:42:32 -0000	1.43
--- c-opts.c	11 May 2003 12:45:01 -0000
*************** c_common_decode_option (argc, argv)
*** 825,831 ****
        else
  	{
  	  /* C++-specific warnings.  */
- 	  warn_ctor_dtor_privacy = on;
  	  warn_nonvdtor = on;
  	  warn_reorder = on;
  	  warn_nontemplate_friend = on;
--- 825,830 ----
Index: c-common.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-common.c,v
retrieving revision 1.414
diff -p -r1.414 c-common.c
*** c-common.c	3 May 2003 21:44:25 -0000	1.414
--- c-common.c	11 May 2003 12:45:03 -0000
*************** int warn_implicit = 1;
*** 626,632 ****
  /* Nonzero means warn when all ctors or dtors are private, and the class
     has no friends.  */
  
! int warn_ctor_dtor_privacy = 1;
  
  /* Nonzero means warn in function declared in derived class has the
     same name as a virtual in the base class, but fails to match the
--- 626,632 ----
  /* Nonzero means warn when all ctors or dtors are private, and the class
     has no friends.  */
  
! int warn_ctor_dtor_privacy = 0;
  
  /* Nonzero means warn in function declared in derived class has the
     same name as a virtual in the base class, but fails to match the
Index: testsuite/g++.dg/warn/ctor-dtor-privacy-1.C
===================================================================
RCS file: testsuite/g++.dg/warn/ctor-dtor-privacy-1.C
diff -N testsuite/g++.dg/warn/ctor-dtor-privacy-1.C
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- testsuite/g++.dg/warn/ctor-dtor-privacy-1.C	11 May 2003 12:45:04 -0000
***************
*** 0 ****
--- 1,9 ----
+ // { dg-options "-Wctor-dtor-privacy" }
+ 
+ struct C {                      // { dg-warning "" }
+    static bool result;
+ private:
+    static bool check();
+ };
+ 
+ bool C::result = check();
Index: testsuite/g++.dg/warn/ctor-dtor-privacy-2.C
===================================================================
RCS file: testsuite/g++.dg/warn/ctor-dtor-privacy-2.C
diff -N testsuite/g++.dg/warn/ctor-dtor-privacy-2.C
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- testsuite/g++.dg/warn/ctor-dtor-privacy-2.C	11 May 2003 12:45:04 -0000
***************
*** 0 ****
--- 1,7 ----
+ struct C {
+    static bool result;
+ private:
+    static bool check();
+ };
+ 
+ bool C::result = check();


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