Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GCC 6: Missing sized deallocation functions #957

Closed
offa opened this issue May 8, 2016 · 6 comments
Closed

GCC 6: Missing sized deallocation functions #957

offa opened this issue May 8, 2016 · 6 comments

Comments

@offa
Copy link
Contributor

offa commented May 8, 2016

Compiling with GCC 6 (Cmake, C++11 enabled) emits following warning:

[…]/cpputest/src/CppUTest/MemoryLeakWarningPlugin.cpp:312:6: Warnung: the program should also define »void operator delete(void*, std::size_t)« [-Wsized-deallocation]
 void operator delete(void* mem) UT_NOTHROW
      ^~~~~~~~
[…]/cpputest/src/CppUTest/MemoryLeakWarningPlugin.cpp:332:6: Warnung: the program should also define »void operator delete [](void*, std::size_t)« [-Wsized-deallocation]
 void operator delete[](void* mem) UT_NOTHROW
      ^~~~~~~~

About this warning:

-Wsized-deallocation (C++ and Objective-C++ only)
Warn about a definition of an unsized deallocation function

          void operator delete (void *) noexcept;
          void operator delete[] (void *) noexcept;

without a definition of the corresponding sized deallocation function

          void operator delete (void *, std::size_t) noexcept;
          void operator delete[] (void *, std::size_t) noexcept;

or vice versa. Enabled by -Wextra along with -fsized-deallocation. 

Update: Same with C++11 disabled.

@offa offa changed the title Missing sized deallocation functions GCC 6: Missing sized deallocation functions May 8, 2016
@arstrube
Copy link
Contributor

It seems that Gcc 6 makes -fsized-deallocation the default.

How about we explicitly specify -fno-sized-deallocation in the compiler options?

Of course, we could add the functions as well, but that seems to make little sense, in that we weren't intending to use them, anyway.

@arstrube
Copy link
Contributor

The option should only be in CXXFLAGS, not in CFLAGS.

@offa
Copy link
Contributor Author

offa commented May 12, 2016

I don't know if there any negative impacts, but I would rather solve the problem by adding the necessary functions than solving it by disabling the warning.

Unfortunately the documentation above doesn't list the rational behind the warning, but I guess the GCC dev's had an intention by adding this.

@arstrube
Copy link
Contributor

It's not like disabling a warning - it's telling Gcc we are not interested in this feature :)

@basvodde
Copy link
Member

I think we could add them, the problem of these is that compiler and compiler versions all deal with it differently. So adding it might not be as simple as it seems :)

@offa
Copy link
Contributor Author

offa commented May 25, 2016

Fixed, see #987

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants