[newlib-cygwin] Cygwin: Fix remaining warnings building path testsuite
Jon TURNEY
jturney@sourceware.org
Wed Dec 2 15:32:30 GMT 2020
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=604bb7126e37a64cac6275fdfcbf98366624d6c1
commit 604bb7126e37a64cac6275fdfcbf98366624d6c1
Author: Corinna Vinschen <corinna@vinschen.de>
Date: Tue Dec 1 10:10:40 2020 +0100
Cygwin: Fix remaining warnings building path testsuite
Diff:
---
winsup/utils/Makefile.in | 2 +-
winsup/utils/path.cc | 6 ++----
winsup/utils/testsuite.cc | 2 ++
winsup/utils/testsuite.h | 12 ++++++------
4 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/winsup/utils/Makefile.in b/winsup/utils/Makefile.in
index 01d2f3062..e4f55dd3c 100644
--- a/winsup/utils/Makefile.in
+++ b/winsup/utils/Makefile.in
@@ -124,7 +124,7 @@ MINGW_BINS += testsuite.exe
MINGW_OBJS += path-testsuite.o testsuite.o
testsuite.exe: path-testsuite.o
path-testsuite.cc: path.cc ; @test -L $@ || ln -sf ${filter %.cc,$^} $@
-path-testsuite.o: MINGW_CXXFLAGS += -DTESTSUITE -Wno-error=write-strings
+path-testsuite.o: MINGW_CXXFLAGS += -DTESTSUITE
# this is necessary because this .c lives in the build dir instead of src
path-testsuite.o: MINGW_CXXFLAGS += -I$(srcdir)
path-testsuite.cc path.cc testsuite.cc: testsuite.h
diff --git a/winsup/utils/path.cc b/winsup/utils/path.cc
index 4c1bb4029..29344be02 100644
--- a/winsup/utils/path.cc
+++ b/winsup/utils/path.cc
@@ -559,6 +559,7 @@ from_fstab (bool user, PWCHAR path, PWCHAR path_end)
#ifndef FSTAB_ONLY
+#ifndef TESTSUITE
static int
mnt_sort (const void *a, const void *b)
{
@@ -580,9 +581,6 @@ extern "C" WCHAR cygwin_dll_path[];
static void
read_mounts ()
{
-/* If TESTSUITE is defined, bypass this whole function as a harness
- mount table will be provided. */
-#ifndef TESTSUITE
HKEY setup_key;
LONG ret;
DWORD len;
@@ -654,8 +652,8 @@ read_mounts ()
from_fstab (false, path, path_end);
from_fstab (true, path, path_end);
qsort (mount_table, max_mount_entry, sizeof (mnt_t), mnt_sort);
-#endif /* !defined(TESTSUITE) */
}
+#endif /* !defined(TESTSUITE) */
/* Return non-zero if PATH1 is a prefix of PATH2.
Both are assumed to be of the same path style and / vs \ usage.
diff --git a/winsup/utils/testsuite.cc b/winsup/utils/testsuite.cc
index c0a800b01..23ed8e0d8 100644
--- a/winsup/utils/testsuite.cc
+++ b/winsup/utils/testsuite.cc
@@ -15,7 +15,9 @@ details. */
#include <unistd.h>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
+#ifndef TESTSUITE
#define TESTSUITE
+#endif
#include "testsuite.h"
typedef struct
diff --git a/winsup/utils/testsuite.h b/winsup/utils/testsuite.h
index d0a47b23a..0dd631539 100644
--- a/winsup/utils/testsuite.h
+++ b/winsup/utils/testsuite.h
@@ -30,12 +30,12 @@ details. */
#if defined(TESTSUITE_MOUNT_TABLE)
static mnt_t mount_table[] = {
/* native posix flags */
- { TESTSUITE_ROOT, (char*)"/", MOUNT_SYSTEM},
- { "O:\\other", (char*)"/otherdir", MOUNT_SYSTEM},
- { "S:\\some\\dir", (char*)"/somedir", MOUNT_SYSTEM},
- { TESTSUITE_ROOT"\\bin", (char*)"/usr/bin", MOUNT_SYSTEM},
- { TESTSUITE_ROOT"\\lib", (char*)"/usr/lib", MOUNT_SYSTEM},
- { ".", (char*)TESTSUITE_CYGDRIVE, MOUNT_SYSTEM | MOUNT_CYGDRIVE},
+ { (char*)TESTSUITE_ROOT, (char*)"/", MOUNT_SYSTEM},
+ { (char*)"O:\\other", (char*)"/otherdir", MOUNT_SYSTEM},
+ { (char*)"S:\\some\\dir", (char*)"/somedir", MOUNT_SYSTEM},
+ { (char*)TESTSUITE_ROOT"\\bin", (char*)"/usr/bin", MOUNT_SYSTEM},
+ { (char*)TESTSUITE_ROOT"\\lib", (char*)"/usr/lib", MOUNT_SYSTEM},
+ { (char*)".", (char*)TESTSUITE_CYGDRIVE, MOUNT_SYSTEM | MOUNT_CYGDRIVE},
{ NULL, (char*)NULL, 0}
};
More information about the Cygwin-cvs
mailing list