]> granicus.if.org Git - clang/commitdiff
Fix driver warning about -pthread on Android.
authorEvgeniy Stepanov <eugeni.stepanov@gmail.com>
Thu, 5 Jun 2014 11:41:39 +0000 (11:41 +0000)
committerEvgeniy Stepanov <eugeni.stepanov@gmail.com>
Thu, 5 Jun 2014 11:41:39 +0000 (11:41 +0000)
-pthread is no-op on Android. Suppress the unused argument warning.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210253 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/Tools.cpp
test/Driver/linux-ld.c

index 7817f8261505926e3e227725f1e3a552f69eed60..37df7eea9b9b166289326ba52ab6abadc0e77966 100644 (file)
@@ -7189,9 +7189,9 @@ void gnutools::Link::ConstructJob(Compilation &C, const JobAction &JA,
       }
       AddRunTimeLibs(ToolChain, D, CmdArgs, Args);
 
-      if (!isAndroid &&
-          (Args.hasArg(options::OPT_pthread) ||
-           Args.hasArg(options::OPT_pthreads) || UsedOpenMPLib != LibUnknown))
+      if ((Args.hasArg(options::OPT_pthread) ||
+           Args.hasArg(options::OPT_pthreads) || UsedOpenMPLib != LibUnknown) &&
+          !isAndroid)
         CmdArgs.push_back("-lpthread");
 
       CmdArgs.push_back("-lc");
index 019e7e92f77d80faa7e8f7c862f31d4e876718b9..c4a2e836b223d37d6e44f32709b59b5053ed0979 100644 (file)
 // RUN:   | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD %s
 // CHECK-ANDROID-PTHREAD-NOT: -lpthread
 //
+// RUN: %clang -no-canonical-prefixes %t.o -### -o %t 2>&1 \
+// RUN:     --target=arm-linux-androideabi -pthread \
+// RUN:     --sysroot=%S/Inputs/basic_android_tree/sysroot \
+// RUN:   | FileCheck --check-prefix=CHECK-ANDROID-PTHREAD-LINK %s
+// CHECK-ANDROID-PTHREAD-LINK-NOT: argument unused during compilation: '-pthread'
+//
 // Check linker invocation on Debian 6 MIPS 32/64-bit.
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
 // RUN:     --target=mipsel-linux-gnu \