summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Dan Willemsen <dwillemsen@google.com> 2017-11-29 18:47:29 -0800
committer Dan Willemsen <dwillemsen@google.com> 2017-11-29 20:54:33 -0800
commit25c73e91560e95c354a7e34923f9505ed621ceba (patch)
tree2b1b9049d9f222e896528f6e46859b5dc5951a54
parentada8948b9a8129cfc683b224be031490e6af0b73 (diff)
Fix / suppress warnings for clang+mingw
Switch attribute error to attribute unavailable, which apparently works since it then broke the build :-/ Suppress unused parameter warnings. They aren't that useful for windows functions that are just #ifndef WIN32. This is marked as a global cflag, but something is overriding that with the clang+mingw changes, and it's not actually that hard to suppress or fix where necessary. Bug: 69933068 Test: mmma build/tools/libhost Change-Id: I09adda4544bc9b56452b4fe182dba3d0b701dcbb
-rw-r--r--tools/libhost/Android.bp1
-rw-r--r--tools/libhost/CopyFile.c9
2 files changed, 9 insertions, 1 deletions
diff --git a/tools/libhost/Android.bp b/tools/libhost/Android.bp
index e5a5ecf374..4c9100f158 100644
--- a/tools/libhost/Android.bp
+++ b/tools/libhost/Android.bp
@@ -10,6 +10,7 @@ cc_library_host_static {
name: "libhost",
target: {
windows: {
+ cflags: ["-Wno-unused-parameter"],
enabled: true,
},
},
diff --git a/tools/libhost/CopyFile.c b/tools/libhost/CopyFile.c
index bd65f1eed2..f9bda86fd1 100644
--- a/tools/libhost/CopyFile.c
+++ b/tools/libhost/CopyFile.c
@@ -352,7 +352,12 @@ static int copyRegular(const char* src, const char* dst, const struct stat* pSrc
* need to trash it so we can create one.
*/
#if defined(_WIN32)
-extern int copySymlink(const char* src, const char* dst, const struct stat* pSrcStat, unsigned int options) __attribute__((error("no symlinks on Windows")));
+extern int copySymlink(const char* src, const char* dst, const struct stat* pSrcStat, unsigned int options)
+#ifdef __clang__
+ __attribute__((unavailable("no symlinks on Windows")));
+#else
+ __attribute__((error("no symlinks on Windows")));
+#endif
#else
static int copySymlink(const char* src, const char* dst, const struct stat* pSrcStat, unsigned int options)
{
@@ -574,8 +579,10 @@ static int copyFileRecursive(const char* src, const char* dst, bool isCmdLine, u
} else {
retVal = copyDirectory(src, dst, &srcStat, options);
}
+#if !defined(_WIN32)
} else if (S_ISLNK(srcStat.st_mode)) {
retVal = copySymlink(src, dst, &srcStat, options);
+#endif
} else if (S_ISREG(srcStat.st_mode)) {
retVal = copyRegular(src, dst, &srcStat, options);
} else {