[polly] r284718 - [cmake] Avoid warnings in feature tests. NFC.

Michael Kruse via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 20 04:16:19 PDT 2016


Author: meinersbur
Date: Thu Oct 20 06:16:19 2016
New Revision: 284718

URL: http://llvm.org/viewvc/llvm-project?rev=284718&view=rev
Log:
[cmake] Avoid warnings in feature tests. NFC.

Apply the __attribute__((unused)) before the function to unambiguously apply to
the function declaration.

Add more casts-to-void to mark return values unused as intended.

Contributed-by: Andy Gibbs <andyg1001 at hotmail.co.uk>

Modified:
    polly/trunk/lib/External/CMakeLists.txt

Modified: polly/trunk/lib/External/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/External/CMakeLists.txt?rev=284718&r1=284717&r2=284718&view=diff
==============================================================================
--- polly/trunk/lib/External/CMakeLists.txt (original)
+++ polly/trunk/lib/External/CMakeLists.txt Thu Oct 20 06:16:19 2016
@@ -65,7 +65,7 @@ if (HAS_ATTRIBUTE_WARN_UNUSED_RESULT)
 endif ()
 
 check_c_source_compiles("
-  static void foo(void) __attribute__ ((unused));
+  __attribute__ ((unused)) static void foo(void);
   int main() { return 0; }
   " HAVE___ATTRIBUTE__)
 
@@ -76,12 +76,12 @@ check_c_source_compiles_numeric("
   " HAVE_DECL_FFS)
 
 check_c_source_compiles_numeric("
-  int main() { __builtin_ffs(0); return 0; }
+  int main() { (void)__builtin_ffs(0); return 0; }
   " HAVE_DECL___BUILTIN_FFS)
 
 check_c_source_compiles_numeric("
   #include <intrin.h>
-  int main() { _BitScanForward(NULL, 0); return 0; }
+  int main() { (void)_BitScanForward(NULL, 0); return 0; }
   " HAVE_DECL__BITSCANFORWARD)
 
 if (NOT HAVE_DECL_FFS AND
@@ -98,7 +98,7 @@ check_c_source_compiles_numeric("
 
 check_c_source_compiles_numeric("
   #include <string.h>
-  int main() { _stricmp(\"\", \"\"); return 0; }
+  int main() { (void)_stricmp(\"\", \"\"); return 0; }
   " HAVE_DECL__STRICMP)
 
 if (NOT HAVE_DECL_STRCASECMP AND NOT HAVE_DECL__STRICMP)
@@ -113,7 +113,7 @@ check_c_source_compiles_numeric("
 
 check_c_source_compiles_numeric("
   #include <string.h>
-  int main() { _strnicmp(\"\", \"\", 0); return 0; }
+  int main() { (void)_strnicmp(\"\", \"\", 0); return 0; }
   " HAVE_DECL__STRNICMP)
 
 if (NOT HAVE_DECL_STRNCASECMP AND NOT HAVE_DECL__STRNICMP)




More information about the llvm-commits mailing list