public inbox for cygwin-apps@cygwin.com
 help / color / mirror / Atom feed
* [PATCH setup] Fix -Woverloaded-virtual warnings about Window::Create()
@ 2024-02-06 17:36 Jon Turney
  2024-02-07 10:46 ` [PATCH] In gcc 13, -Wall turns on -Woverloaded-virtual Corinna Vinschen
  0 siblings, 1 reply; 4+ messages in thread
From: Jon Turney @ 2024-02-06 17:36 UTC (permalink / raw)
  To: cygwin-apps; +Cc: Jon Turney

In gcc 13, -Wall turns on -Woverloaded-virtual
---

Notes:
    I think despite being marked virtual, these methods aren't actually
    callable on any derived object because they aren't declared for those
    sublasses.
    
    It seems that all calls to these in methods in derived objects use the
    method name qualified by an explcit classname.
    
    So we can simply fix this warning by removing the 'virtual' specifier.
    
    But someone double-checking my reasoning here is probably a good idea.

 Makefile.am |  2 +-
 proppage.h  | 10 +++++-----
 window.h    |  7 +++----
 3 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index b459d16..22ad30c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -22,7 +22,7 @@ SUBDIRS := @subdirs@ tests
 BASECXXFLAGS = -Werror -Wall -Wpointer-arith -Wcomments \
 	       -Wcast-align -Wwrite-strings -fno-builtin-sscanf \
 	       -Wno-attributes
-AM_CXXFLAGS = $(BASECXXFLAGS) -std=gnu++11 ${$(*F)_CXXFLAGS}
+AM_CXXFLAGS = $(BASECXXFLAGS) -Woverloaded-virtual -std=gnu++11 ${$(*F)_CXXFLAGS}
 AM_CFLAGS = $(BASECXXFLAGS) -Wmissing-declarations -Winline \
 	    -Wstrict-prototypes -Wmissing-prototypes
 AM_YFLAGS = -d
diff --git a/proppage.h b/proppage.h
index 64f822b..9db1a90 100644
--- a/proppage.h
+++ b/proppage.h
@@ -115,11 +115,11 @@ public:
     IsLast = false;
   };
 
-  virtual bool Create (int TemplateID);
-  virtual bool Create (DLGPROC dlgproc, int TemplateID);
-  virtual bool Create (DLGPROC dlgproc,
-		       BOOL (*cmdproc) (HWND h, int id, HWND hwndctl,
-					UINT code), int TemplateID);
+  bool Create (int TemplateID);
+  bool Create (DLGPROC dlgproc, int TemplateID);
+  bool Create (DLGPROC dlgproc,
+               BOOL (*cmdproc) (HWND h, int id, HWND hwndctl,
+                                UINT code), int TemplateID);
 
   virtual void OnInit ()
   {
diff --git a/window.h b/window.h
index 1dfb2a9..dcc81c1 100644
--- a/window.h
+++ b/window.h
@@ -82,10 +82,9 @@ public:
   Window ();
   virtual ~ Window ();
 
-  virtual bool Create (Window * Parent = NULL,
-		       DWORD Style =
-		       WS_OVERLAPPEDWINDOW | WS_VISIBLE | WS_CLIPCHILDREN);
-  
+  bool Create (Window * Parent = NULL,
+               DWORD Style = WS_OVERLAPPEDWINDOW | WS_VISIBLE | WS_CLIPCHILDREN);
+
   static void SetAppInstance (HINSTANCE h)
   {
     // This only has to be called once in the entire app, before
-- 
2.43.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-02-08 17:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-06 17:36 [PATCH setup] Fix -Woverloaded-virtual warnings about Window::Create() Jon Turney
2024-02-07 10:46 ` [PATCH] In gcc 13, -Wall turns on -Woverloaded-virtual Corinna Vinschen
2024-02-08 16:07   ` Jon Turney
2024-02-08 17:11     ` Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).