Separate gcc version for gcov 51/320751/1 accepted/tizen_unified accepted/tizen_unified_x accepted/tizen_unified_x_asan tizen accepted/tizen/unified/20241122.171540 accepted/tizen/unified/x/20241218.032615 accepted/tizen/unified/x/asan/20241224.004338
authorJihoon Jung <jh8801.jung@samsung.com>
Fri, 22 Nov 2024 01:49:55 +0000 (10:49 +0900)
committerJihoon Jung <jh8801.jung@samsung.com>
Fri, 22 Nov 2024 01:49:55 +0000 (10:49 +0900)
Change-Id: I35e5c7825e025bdcb40f957c5668a87b6acf2904
Signed-off-by: Jihoon Jung <jh8801.jung@samsung.com>
src/mtp_init.c

index 069054556b8feea09a1c59cb28138a1f4f25cc35..f939c0139b31d6c097fe3fab9723f7c08d7a17b4 100644 (file)
@@ -544,6 +544,18 @@ static inline int _main_init()
        return MTP_ERROR_NONE;
 }
 
+#ifdef TIZEN_TEST_GCOV
+# if (defined(__GNUC__) \
+        && ((__GNUC__ == 11 && __GNUC_MINOR__ >= 1) || (__GNUC__ >= 12))) \
+        || (defined(__clang__) && (__clang_major__ >= 12))
+extern void __gcov_dump(void);
+extern void __gcov_reset(void);
+    #  define __gcov_flush() do { __gcov_dump(); __gcov_reset(); } while (0)
+# else
+extern void __gcov_flush(void);
+# endif
+#endif
+
 #ifndef TIZEN_TEST_GTESTS
 int main(int argc, char *argv[])
 {
@@ -554,7 +566,6 @@ int main(int argc, char *argv[])
 #endif
 
 #ifdef TIZEN_TEST_GCOV
-       void __gcov_flush(void); // if you use C++, you should declare extern "C" at out of the function.
        __gcov_flush();
 #endif