]> Savannah Git Hosting - gnulib.git/commitdiff
relocatable-prog: Fix gcc warning on mingw.
authorBruno Haible <bruno@clisp.org>
Fri, 26 Apr 2019 23:09:31 +0000 (01:09 +0200)
committerBruno Haible <bruno@clisp.org>
Fri, 26 Apr 2019 23:09:31 +0000 (01:09 +0200)
* lib/progreloc.c (maybe_executable): Don't define on native Windows and
on EMX.

ChangeLog
lib/progreloc.c

index 3e9d27a766719c90c37121b38b73e537ed2d3d03..594a3d182d0071ae2b4d200ed038896655ee0cf4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2019-04-26  Bruno Haible  <bruno@clisp.org>
+
+       relocatable-prog: Fix gcc warning on mingw.
+       * lib/progreloc.c (maybe_executable): Don't define on native Windows and
+       on EMX.
+
 2019-04-02  Bruno Haible  <bruno@clisp.org>
 
        gitsub.sh: New file.
index b3eb5030b36f1ee7c61699f6a9df9db3cdbb5b64..9d81efa14b6c3eb4127d7e7d1e0b342d5ce317b7 100644 (file)
@@ -151,17 +151,20 @@ full_read (int fd, void *buf, size_t count)
 static int executable_fd = -1;
 #endif
 
+/* Define this function only when it's needed.  */
+#if !(defined WINDOWS_NATIVE || defined __EMX__)
+
 /* Tests whether a given pathname may belong to the executable.  */
 static bool
 maybe_executable (const char *filename)
 {
   /* The native Windows API lacks the access() function.  */
-#if !defined WINDOWS_NATIVE
+# if !defined WINDOWS_NATIVE
   if (access (filename, X_OK) < 0)
     return false;
-#endif
+# endif
 
-#if defined __linux__ || defined __CYGWIN__
+# if defined __linux__ || defined __CYGWIN__
   if (executable_fd >= 0)
     {
       /* If we already have an executable_fd, check that filename points to
@@ -179,11 +182,13 @@ maybe_executable (const char *filename)
             return false;
         }
     }
-#endif
+# endif
 
   return true;
 }
 
+#endif
+
 /* Determine the full pathname of the current executable, freshly allocated.
    Return NULL if unknown.
    Guaranteed to work on Linux and native Windows.  Likely to work on the