[PATCH] D153911: [cmake] Add -Wcast-qual to C flags if LLVM_ENABLE_WARNINGS is defined.

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 18 16:45:14 PDT 2023


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG621d1d07d9c4: [cmake] Add -Wcast-qual to C flags if LLVM_ENABLE_WARNINGS is defined. (authored by AlexM, committed by dblaikie).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D153911/new/

https://reviews.llvm.org/D153911

Files:
  llvm/cmake/modules/HandleLLVMOptions.cmake
  llvm/lib/Support/regcomp.c


Index: llvm/lib/Support/regcomp.c
===================================================================
--- llvm/lib/Support/regcomp.c
+++ llvm/lib/Support/regcomp.c
@@ -329,7 +329,15 @@
 
 	/* set things up */
 	p->g = g;
+	/* suppress warning from the following explicit cast. */
+#ifdef __GNUC__
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wcast-qual"
+#endif /* __GNUC__ */
 	p->next = (char *)pattern;	/* convenience; we do not modify it */
+#ifdef __GNUC__
+#pragma GCC diagnostic pop
+#endif /* __GNUC__ */
 	p->end = p->next + len;
 	p->error = 0;
 	p->ncsalloc = 0;
Index: llvm/cmake/modules/HandleLLVMOptions.cmake
===================================================================
--- llvm/cmake/modules/HandleLLVMOptions.cmake
+++ llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -741,7 +741,7 @@
   endif()
 
   append("-Wextra -Wno-unused-parameter -Wwrite-strings" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
-  append("-Wcast-qual" CMAKE_CXX_FLAGS)
+  append("-Wcast-qual" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
 
   # Turn off missing field initializer warnings for gcc to avoid noise from
   # false positives with empty {}. Turn them on otherwise (they're off by


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D153911.541782.patch
Type: text/x-patch
Size: 1176 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230718/835b75f3/attachment.bin>


More information about the llvm-commits mailing list