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

_GNU_SOURCE is not the right way to test for gcc

    XMLWordPrintable

Details

    • generic
    • generic

    Description

      The source code below (from /src/cpu/sparc/vm/cInterpreter_sparc.inline.hpp
      assumes that _GNU_SOURCE is synonymous with using gcc.
      In fact, _GNU_SOURCE is an assertion about the API used by the source code,
      not the compiler being used. To test for gcc, one should probably use
      __GNUC__

      The code probably works because _GNU_SOURCE is only defined on Linux,
      and the only compiler used on Linux is gcc.


      // We know that on LP32 mode that longs/doubles are the only thing that gives
      // us alignment headaches. We also know that the worst we have is 32bit alignment
      // so thing are not really too bad.
      // (Also sparcworks compiler does the right thing for free if we don't use -arch..
      // switches. Only gcc gives us a hard time. In LP64 mode I think we have no issue
      // with alignment.

      #ifdef _GNU_SOURCE
        #define ALIGN_CONVERTER /* Needs alignment converter */
      #else
        #undef ALIGN_CONVERTER /* No alignment converter */
      #endif /* _GNU_SOURCE */

      Attachments

        Activity

          People

            Unassigned Unassigned
            martin Martin Buchholz
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: