Details

    Description

      When building MariaDB 10.0.14 using clang 3.3 on FreeBSD amd64, there's a compile error in storage/connect/filamap.h

      107: virtual int GetNextPos(void)

      {return (int)Fpos + Nrec;}

      error: cast from pointer to smaller type 'int' loses information

      int is a 32-bit type this will not fit a memory address of a 64-bit platform. This should probably be handled using a uintptr_t type which should be available on all platforms.

      Attachments

        Issue Links

          Activity

            Reopened until you tell me whether my last suggestions work with clang

            bertrandop Olivier Bertrand added a comment - Reopened until you tell me whether my last suggestions work with clang
            spil Bernard Spil added a comment -

            Thanks for your guidance Olivier Please find revised patches attached, Mariadb-10.0.14 builds on FreeBSD 10.0 with these patches.

            spil Bernard Spil added a comment - Thanks for your guidance Olivier Please find revised patches attached, Mariadb-10.0.14 builds on FreeBSD 10.0 with these patches.

            I applied the new patches successfully on Windows. However, on Linux the GCC compiling failed saying that uintptr_t was undeclared.
            Therefore I added:

            #include <stdint.h>         // for uintprt_h

            into the Unix declare section.
            Is this ok with clang on FreeBSD?

            bertrandop Olivier Bertrand added a comment - I applied the new patches successfully on Windows. However, on Linux the GCC compiling failed saying that uintptr_t was undeclared. Therefore I added: #include <stdint.h> // for uintprt_h into the Unix declare section. Is this ok with clang on FreeBSD?
            spil Bernard Spil added a comment -

            Hi Olivier,
            This is OK without adding an include for stdint.h anywhere in the storage/connect/ code
            Built, packaged and deployed the server without a problem using the attached patches (sorry for the DOS CRLF)

            spil Bernard Spil added a comment - Hi Olivier, This is OK without adding an include for stdint.h anywhere in the storage/connect/ code Built, packaged and deployed the server without a problem using the attached patches (sorry for the DOS CRLF)

            This should fix all compiler issues. However, to do it in a cleaner way, I did not exactly apply the above patches:

            In the InitDelete functions I changed the cast from uintptr_t to ptrdiff_t, which seems more appropriate and does not require including stdint.h.

            About the array making, I have added an union in the PARM structure:

            typedef struct _parm {
              union {
                void *Value;
                int   Intval;
                }; // end union
              short Type, Domain;
              PPARM Next;
              } PARM;

            This makes possible to suppress all the funny casting that were done when creating the structure (in TXTFAM::AddListValue) and retrieving the integer value from it (in MakeValueArray)

            bertrandop Olivier Bertrand added a comment - This should fix all compiler issues. However, to do it in a cleaner way, I did not exactly apply the above patches: In the InitDelete functions I changed the cast from uintptr_t to ptrdiff_t, which seems more appropriate and does not require including stdint.h. About the array making, I have added an union in the PARM structure: typedef struct _parm { union { void *Value; int Intval; }; // end union short Type, Domain; PPARM Next; } PARM; This makes possible to suppress all the funny casting that were done when creating the structure (in TXTFAM::AddListValue) and retrieving the integer value from it (in MakeValueArray)

            People

              bertrandop Olivier Bertrand
              spil Bernard Spil
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.