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] |
On 04/28/2017 01:01 PM, Pedro Alves wrote:
On 04/28/2017 05:28 PM, Martin Sebor wrote:On 04/28/2017 05:47 AM, Nathan Sidwell wrote:@@ -427,9 +429,31 @@ static void output_lines (FILE *, const source_t *); static char *make_gcov_file_name (const char *, const char *); static char *mangle_name (const char *, char *); static void release_structures (void); -static void release_function (function_t *); extern int main (int, char **); +function_info::function_info () +{ + memset (this, 0, sizeof (*this));EW. ok with a comment about function_info's c++11's PoDness.Unless it's some other kind of vector, the patch adds a vector member to the class, which makes it not a PoD.(*)Funny, just this week we added this to gdb to catch such misuses at compile time: https://sourceware.org/ml/gdb-patches/2017-04/msg00378.html https://sourceware.org/ml/gdb-patches/2017-04/msg00381.html
It's all too easy to turn a POD into a class and miss that its objects are still being treated as PODs, especially in a C code base that's (slowly) transitioning to C++. It's also easy form GCC to detect them. I'm playing with a simple enhancement that makes GCC warn on these kinds of misuses. Martin
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |