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

Macro offset_of confuses Eclipse CDT

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 21
    • 21
    • hotspot
    • b21
    • linux

      The gcc version of the macro `offset_of` [1] and its use in `byte_offset_of` [2] confuses CDT because it gets the precedence of the `(int)` cast and the lambda application in `offset_of` wrong. Wrapping the body of `offset_of` into parentheses helps. So does removing the cast.

      Confused CDT does not find the field references through `*_offset` methods, e.g. `JavaThread::*_offset`

      This has been observed with Eclipse 2021-12 (4.22.0), CDT 10.5.0 and also with Eclipse 2023-03 (4.27.0), CDT 11.1.1

      How to reproduce:

      Unfortunately I was not able to setup a working Eclipse CDT workspace as described in doc/ide.md
      Instead I use https://github.com/reinrich/OpenJDKEclipseProjs

      [1] https://github.com/openjdk/jdk/blob/44d9f55d0b3c469988be6f1c47f0cfbc433c4490/src/hotspot/share/utilities/globalDefinitions_gcc.hpp#L142-L148
      [2] https://github.com/openjdk/jdk/blob/44d9f55d0b3c469988be6f1c47f0cfbc433c4490/src/hotspot/share/utilities/sizes.hpp#L59

            rrich Richard Reingruber
            rrich Richard Reingruber
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: