Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8369187

Add wrapper for <new> that forbids use of global allocation and deallocation functions

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • None
    • hotspot

      We are using deprecation warnings to block the use of certain C functions that we don't want HotSpot code to (normally) use. The same approach can be taken to block the use of most global allocation and deallocation functions. But we need to make the deprecation declarations visible to potential users.

      JDK-8369186 proposes the use of wrappers for Standard Library headers. Such a wrapper for <new> would provide a place for such deprecation declarations. This is generally an improvement on the existing link-time check for references to these functions, since it happens at compile time and the warning provides the context of the reference, rather than trying to infer it from an objdump.

      It's not completely bulletproof, since 3rd-party headers might include <new> directly, making those functions accessible to HotSpot code without an inclusion of our wrapper. But following include-what-you-use style, that problem should be minimized.

      It's also not completely bulletproof, since there are a few allocation and deallocation functions that are implicitly declared in all translation units. So we still need the existing link-time check for references to those.

            kbarrett Kim Barrett
            kbarrett Kim Barrett
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: