bug-groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #52335] src: Some warnings from the compiler that need fixing or ex


From: G. Branden Robinson
Subject: [bug #52335] src: Some warnings from the compiler that need fixing or explanations in the code
Date: Fri, 10 Nov 2017 08:11:29 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0

Update of bug #52335 (project groff):

                  Status:                    None => Need Info              

    _______________________________________________________

Follow-up Comment #3:

The following quiets the sized-deallocation warning, but the most obvious
solution (to me) causes a different warning.

Comments welcome.


diff --git a/src/libs/libgroff/new.cpp b/src/libs/libgroff/new.cpp
index 7a1a4730..dc2580f4 100644
--- a/src/libs/libgroff/new.cpp
+++ b/src/libs/libgroff/new.cpp
@@ -67,3 +67,22 @@ void operator delete(void *p)
     free(p);
 #endif /* COOKIE_BUG */
 }
+
+void operator delete(void *p,
+                    __attribute__((__unused__)) long unsigned int size)
+{
+  // It's ugly to duplicate the code from delete(void *) above, but if
+  // we don't, g++ 6.3 can't figure out we're calling through it to
+  // free().
+  //
+  // In function 'void operator delete(void*, long unsigned int)':
+  //   warning: deleting 'void*' is undefined [-Wdelete-incomplete]
+  //delete p;
+#ifdef COOKIE_BUG
+  if (p)
+    free((void *)((char *)p - 8));
+#else
+  if (p)
+    free(p);
+#endif /* COOKIE_BUG */
+}


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?52335>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]