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.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

              Hide
              bertrandop Olivier Bertrand added a comment -

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

              Show
              bertrandop Olivier Bertrand added a comment - Reopened until you tell me whether my last suggestions work with clang
              Hide
              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.

              Show
              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.
              Hide
              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?

              Show
              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?
              Hide
              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)

              Show
              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)
              Hide
              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)

              Show
              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

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

                  Dates

                  • Created:
                    Updated:
                    Resolved:

                    Time Tracking

                    Estimated:
                    Original Estimate - Not Specified
                    Not Specified
                    Remaining:
                    Remaining Estimate - 0 minutes
                    0m
                    Logged:
                    Time Spent - 5 hours
                    5h