You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by we...@apache.org on 2019/02/25 20:31:30 UTC

[arrow] branch master updated: ARROW-4667: [C++] Suppress unused function warnings with MinGW

This is an automated email from the ASF dual-hosted git repository.

wesm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new d5eb47d  ARROW-4667: [C++] Suppress unused function warnings with MinGW
d5eb47d is described below

commit d5eb47d66474c603d0ab2d6f54aba3d93c5b84aa
Author: Kouhei Sutou <ko...@clear-code.com>
AuthorDate: Mon Feb 25 14:31:19 2019 -0600

    ARROW-4667: [C++] Suppress unused function warnings with MinGW
    
    Messages:
    
        In file included from C:/projects/arrow/cpp/src/arrow/io/file.cc:25:
        C:/projects/arrow/cpp/src/arrow/io/mman.h:179:12: warning: 'int munlock(const void*, size_t)' defined but not used [-Wunused-function]
         static int munlock(const void* addr, size_t len) {
                    ^~~~~~~
        C:/projects/arrow/cpp/src/arrow/io/mman.h:171:12: warning: 'int mlock(const void*, size_t)' defined but not used [-Wunused-function]
         static int mlock(const void* addr, size_t len) {
                    ^~~~~
        C:/projects/arrow/cpp/src/arrow/io/mman.h:163:12: warning: 'int msync(void*, size_t, int)' defined but not used [-Wunused-function]
         static int msync(void* addr, size_t len, int flags) {
                    ^~~~~
        C:/projects/arrow/cpp/src/arrow/io/mman.h:152:12: warning: 'int mprotect(void*, size_t, int)' defined but not used [-Wunused-function]
         static int mprotect(void* addr, size_t len, int prot) {
                    ^~~~~~~~
    
    Author: Kouhei Sutou <ko...@clear-code.com>
    
    Closes #3738 from kou/cpp-suppress-warning-with-mingw and squashes the following commits:
    
    7cf44c7f <Kouhei Sutou> Fix format
    960278bb <Kouhei Sutou>  Suppress unused function warnings with MinGW
---
 cpp/src/arrow/io/mman.h | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/cpp/src/arrow/io/mman.h b/cpp/src/arrow/io/mman.h
index 76c441c..139ee7e 100644
--- a/cpp/src/arrow/io/mman.h
+++ b/cpp/src/arrow/io/mman.h
@@ -45,13 +45,13 @@
 #define FILE_MAP_EXECUTE 0x0020
 #endif
 
-static int __map_mman_error(const DWORD err, const int deferr) {
+static inline int __map_mman_error(const DWORD err, const int deferr) {
   if (err == 0) return 0;
   // TODO: implement
   return err;
 }
 
-static DWORD __map_mmap_prot_page(const int prot) {
+static inline DWORD __map_mmap_prot_page(const int prot) {
   DWORD protect = 0;
 
   if (prot == PROT_NONE) return protect;
@@ -65,7 +65,7 @@ static DWORD __map_mmap_prot_page(const int prot) {
   return protect;
 }
 
-static DWORD __map_mmap_prot_file(const int prot) {
+static inline DWORD __map_mmap_prot_file(const int prot) {
   DWORD desiredAccess = 0;
 
   if (prot == PROT_NONE) return desiredAccess;
@@ -77,7 +77,8 @@ static DWORD __map_mmap_prot_file(const int prot) {
   return desiredAccess;
 }
 
-static void* mmap(void* addr, size_t len, int prot, int flags, int fildes, off_t off) {
+static inline void* mmap(void* addr, size_t len, int prot, int flags, int fildes,
+                         off_t off) {
   HANDLE fm, h;
 
   void* map = MAP_FAILED;
@@ -141,7 +142,7 @@ static void* mmap(void* addr, size_t len, int prot, int flags, int fildes, off_t
   return map;
 }
 
-static int munmap(void* addr, size_t len) {
+static inline int munmap(void* addr, size_t len) {
   if (UnmapViewOfFile(addr)) return 0;
 
   errno = __map_mman_error(GetLastError(), EPERM);
@@ -149,7 +150,7 @@ static int munmap(void* addr, size_t len) {
   return -1;
 }
 
-static int mprotect(void* addr, size_t len, int prot) {
+static inline int mprotect(void* addr, size_t len, int prot) {
   DWORD newProtect = __map_mmap_prot_page(prot);
   DWORD oldProtect = 0;
 
@@ -160,7 +161,7 @@ static int mprotect(void* addr, size_t len, int prot) {
   return -1;
 }
 
-static int msync(void* addr, size_t len, int flags) {
+static inline int msync(void* addr, size_t len, int flags) {
   if (FlushViewOfFile(addr, len)) return 0;
 
   errno = __map_mman_error(GetLastError(), EPERM);
@@ -168,7 +169,7 @@ static int msync(void* addr, size_t len, int flags) {
   return -1;
 }
 
-static int mlock(const void* addr, size_t len) {
+static inline int mlock(const void* addr, size_t len) {
   if (VirtualLock((LPVOID)addr, len)) return 0;
 
   errno = __map_mman_error(GetLastError(), EPERM);
@@ -176,7 +177,7 @@ static int mlock(const void* addr, size_t len) {
   return -1;
 }
 
-static int munlock(const void* addr, size_t len) {
+static inline int munlock(const void* addr, size_t len) {
   if (VirtualUnlock((LPVOID)addr, len)) return 0;
 
   errno = __map_mman_error(GetLastError(), EPERM);