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

FORBID_C_FUNCTION needs exception spec consistent with library declaration

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 26
    • 26
    • hotspot
    • master

      The standard libraries for some platforms declare (most) functions noexcept (possibly using compiler-specific notation). C++17 made the exception specification part of the type of the function. As a consequence, some compilers error in some cases where the exception specifications for redeclarations differ.

      clang errors if the first declaration doesn't have an exception specification and a later one is noexcept. It doesn't complain in the reverse case. gcc seems to accept differences in either order. (That might be a gcc bug?) Visual Studio seems to reject any difference, regardless of include order.

      This means that FORBID_C_FUNCTION needs to be able to provide a declaration that matches the exception specification of the corresponding library declaration. (It's easier to just match the library always, rather than further conditionalize on whether the compiler might complain.)

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

              Created:
              Updated:
              Resolved: