Harmony
  1. Harmony
  2. HARMONY-6480

FreeBSD comparability: Location of malloc

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.0M14
    • Component/s: DRLVM
    • Labels:
    • Environment:
      operating system : FreeBSD [8.0p2]
      CPU architecture : x86
      ant os name/arch : FreeBSD/i386
      hosting Java : 1.6.0_07 (The FreeBSD Foundation)
    • Patch Info:
      Patch Available
    • Estimated Complexity:
      Novice

      Description

      While attempting to run the included unit tests (attempting to track down another issue), I got an error from a test header file. Apparently the standard library declaration for malloc(size_t) and friends are now in <stdlib.h>, or where they should be. On FreeBSD including <malloc.h> will generate a compiler error (via preprocessor), and directs you to include <stdlib.h>. Those governing the header files are adamant about the modifications.

        Activity

        Hide
        Hudson added a comment -

        Integrated in Harmony-1.5-head-linux-x86_64 #724 (See http://hudson.zones.apache.org/hudson/job/Harmony-1.5-head-linux-x86_64/724/)
        Applying alternative fix for "[#] FreeBSD comparability:
        Location of malloc".

        Show
        Hudson added a comment - Integrated in Harmony-1.5-head-linux-x86_64 #724 (See http://hudson.zones.apache.org/hudson/job/Harmony-1.5-head-linux-x86_64/724/ ) Applying alternative fix for " [#] FreeBSD comparability: Location of malloc".
        Hide
        Mark Hindess added a comment -

        I've made a fix in r926497. Please close this jira if it has been applied as expected.

        Show
        Mark Hindess added a comment - I've made a fix in r926497. Please close this jira if it has been applied as expected.
        Hide
        Mark Hindess added a comment -

        According to the malloc(3) man page, <stdlib.h> is correct on linux too. I have a vague memory of breaking the windows build fixing some of these in classlib in the past so I think the correct fix is to do:

        #ifdef _WIN32
        #include <malloc.h>
        #endif

        Show
        Mark Hindess added a comment - According to the malloc(3) man page, <stdlib.h> is correct on linux too. I have a vague memory of breaking the windows build fixing some of these in classlib in the past so I think the correct fix is to do: #ifdef _WIN32 #include <malloc.h> #endif
        Hide
        Mark Eschbach added a comment -

        I attached the patch fixing the problem.

        Show
        Mark Eschbach added a comment - I attached the patch fixing the problem.
        Hide
        Mark Eschbach added a comment -

        This patch uses the FREEBSD macro to compile the test by including the <stdlib.h> file instead of <malloc.h>. There is probably a better method (configure auto-detection?), however this works for now.

        Show
        Mark Eschbach added a comment - This patch uses the FREEBSD macro to compile the test by including the <stdlib.h> file instead of <malloc.h>. There is probably a better method (configure auto-detection?), however this works for now.

          People

          • Assignee:
            Unassigned
            Reporter:
            Mark Eschbach
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development