[tools] Use "#pragma GCC" instead of "#pragma clang" to ignore -Wcast-qual in c-index...
authorJie Fu <jiefu@tencent.com>
Wed, 19 Jul 2023 04:05:05 +0000 (12:05 +0800)
committerJie Fu <jiefu@tencent.com>
Wed, 19 Jul 2023 04:05:05 +0000 (12:05 +0800)
clang/tools/c-index-test/c-index-test.c

index 9c60e83..9d66a22 100644 (file)
@@ -231,14 +231,14 @@ void free_remapped_files(struct CXUnsavedFile *unsaved_files,
                          int num_unsaved_files) {
   int i;
   for (i = 0; i != num_unsaved_files; ++i) {
-#if defined(__clang__)
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wcast-qual"
+#ifdef __GNUC__
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wcast-qual"
 #endif
     free((char *)unsaved_files[i].Filename);
     free((char *)unsaved_files[i].Contents);
-#if defined(__clang__)
-#pragma clang diagnostic pop
+#ifdef __GNUC__
+#pragma GCC diagnostic pop
 #endif
   }
   free(unsaved_files);
@@ -3766,13 +3766,13 @@ index_startedTranslationUnit(CXClientData client_data, void *reserved) {
   printCheck(index_data);
 
   printf("[startedTranslationUnit]\n");
-#if defined(__clang__)
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wcast-qual"
+#ifdef __GNUC__
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wcast-qual"
 #endif
   return (CXIdxClientContainer)"TU";
-#if defined(__clang__)
-#pragma clang diagnostic pop
+#ifdef __GNUC__
+#pragma GCC diagnostic pop
 #endif
 }