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

STATIC_ASSERT use of __LINE__ is wrong

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: hotspot
    • Labels:
      None
    • Subcomponent:
      gc
    • Resolved In Build:
      b59
    • CPU:
      generic
    • OS:
      generic

      Backports

        Description

        The STATIC_ASSERT macro attempts to produce a unique type name by macro splicing with __LINE__. However, the way that's presently being done is incorrect:

          STATIC_ASSERT_FAILURE_ ## __LINE__

        doesn't expand __LINE__, so we get STATIC_ASSERT_FAILURE___LINE__.

        Doing this properly requires the use of a deferred concatenation macro, e.g.

        #define CONCAT(X, Y) X ## Y

        and

          CONCAT(STATIC_ASSERT_FAILURE_, __LINE__)

        However, there's a question as to whether we need the unique type name at all. If all the assertions succeed, the types are all the same.

        None of our compilers presently complains about multiple identical typedefs; but maybe we don't have the right warnings enabled. Also need to check whether that's standards conforming.

        Also need to look at the error messages for mix of pass and fail assertions, and multiple fail assertions.

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                kbarrett Kim Barrett
                Reporter:
                kbarrett Kim Barrett
                Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: