2004-12-24 Havoc Pennington <hp@redhat.com>
authorHavoc Pennington <hp@redhat.com>
Fri, 24 Dec 2004 17:54:01 +0000 (17:54 +0000)
committerHavoc Pennington <hp@redhat.com>
Fri, 24 Dec 2004 17:54:01 +0000 (17:54 +0000)
* test/decode-gcov.c: change to use .gcno and .gcda files, but the
file format has also changed and I haven't adapted to that yet

* Makefile.am: load .gcno files from latest gcc

ChangeLog
Makefile.am
test/decode-gcov.c

index 33da58e..cf6ee41 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2004-12-24  Havoc Pennington  <hp@redhat.com>
+
+       * test/decode-gcov.c: change to use .gcno and .gcda files, but the
+       file format has also changed and I haven't adapted to that yet
+       
+       * Makefile.am: load .gcno files from latest gcc
+
 2004-12-23  John (J5) Palmieri  <johnp@redhat.com>
        * Patch from Rob Taylor <robtaylor@fastmail.fm>
 
index 47ac1de..886618b 100644 (file)
@@ -59,20 +59,20 @@ GCOV_DIRS=dbus bus $(GLIB_SUBDIR) $(QT_SUBDIR)
 ## .PHONY so it always rebuilds it
 .PHONY: coverage-report.txt
 coverage-report.txt:
-       BBG_FILES=`find $(GCOV_DIRS) -name "*.bbg"` ;                             \
-       C_FILES= ;                                                                \
-       for F in $$BBG_FILES ; do                                                 \
-               F_nolibs=`echo $$F | sed -e 's/.libs\///g'` ;                     \
-               C=`echo $$F_nolibs | sed -e 's/.bbg/.c/g'` ;                      \
-               B=`basename $$F .bbg` ;                                           \
-               D=`dirname $$F` ;                                                 \
-               DA=`echo $$F | sed -e 's/.bbg/.da/g'` ;                           \
-               DA_libs=`echo $$D/.libs/$$B/.da` ;                                \
-               if test -e $$DA || test -e $$DA_libs; then                        \
-                       C_FILES="$$C_FILES $$C" ;                                 \
-               fi ;                                                              \
-       done ;                                                                    \
-       echo $$C_FILES ;                                                          \
+       BBG_FILES=`find $(GCOV_DIRS) -name "*.bbg" -o -name "*.gcno"` ;                 \
+       C_FILES= ;                                                                      \
+       for F in $$BBG_FILES ; do                                                       \
+               F_nolibs=`echo $$F | sed -e 's/.libs\///g'` ;                           \
+               C=`echo $$F_nolibs | sed -e 's/.bbg/.c/g' | sed -e 's/.gcno/.c/g'`  ;   \
+               B=`basename $$F .bbg` ;                                                 \
+               D=`dirname $$F` ;                                                       \
+               DA=`echo $$F | sed -e 's/.bbg/.da/g'` ;                                 \
+               DA_libs=`echo $$D/.libs/$$B/.da` ;                                      \
+               if test -e $$DA || test -e $$DA_libs; then                              \
+                       C_FILES="$$C_FILES $$C" ;                                       \
+               fi ;                                                                    \
+       done ;                                                                          \
+       echo $$C_FILES ;                                                                \
        $(top_builddir)/test/decode-gcov --report $$C_FILES > coverage-report.txt
 
 check-coverage: clean-gcov all check coverage-report.txt
index b084d0d..5235a1c 100644 (file)
@@ -1274,15 +1274,26 @@ load_functions_for_c_file (const DBusString *filename,
 {
   DBusString bbg_filename;
   DBusString da_filename;
+  DBusString gcno_filename;
+  DBusString gcda_filename;
   DBusString contents;
+  DBusString *name;
   DBusError error;
 
+  /* With latest gcc it's .gcno instead of .bbg and
+   * gcda instead of .da
+   */
+  
   dbus_error_init (&error);
   
   if (!_dbus_string_init (&bbg_filename) ||
       !_dbus_string_init (&da_filename) ||
+      !_dbus_string_init (&gcno_filename) ||
+      !_dbus_string_init (&gcda_filename) ||
       !_dbus_string_copy (filename, 0, &bbg_filename, 0) ||
       !_dbus_string_copy (filename, 0, &da_filename, 0) ||
+      !_dbus_string_copy (filename, 0, &gcno_filename, 0) ||
+      !_dbus_string_copy (filename, 0, &gcda_filename, 0) ||
       !_dbus_string_init (&contents))
     die ("no memory\n");
 
@@ -1290,10 +1301,17 @@ load_functions_for_c_file (const DBusString *filename,
   _dbus_string_shorten (&da_filename, 2);
 
   if (!_dbus_string_append (&bbg_filename, ".bbg") ||
-      !_dbus_string_append (&da_filename, ".da"))
+      !_dbus_string_append (&da_filename, ".da") ||
+      !_dbus_string_append (&bbg_filename, ".gcno") ||
+      !_dbus_string_append (&bbg_filename, ".gcda"))
     die ("no memory\n");
-      
-  if (!_dbus_file_get_contents (&contents, &bbg_filename,
+
+  if (_dbus_file_exists (_dbus_string_get_const_data (&gcno_filename)))
+    name = &gcno_filename;
+  else
+    name = &bbg_filename;
+  
+  if (!_dbus_file_get_contents (&contents, name,
                                 &error))
     {
       fprintf (stderr, "Could not open file: %s\n",
@@ -1305,25 +1323,30 @@ load_functions_for_c_file (const DBusString *filename,
 
   _dbus_string_set_length (&contents, 0);
 
-  if (!_dbus_file_get_contents (&contents, &da_filename,
+  if (_dbus_file_exists (_dbus_string_get_const_data (&gcda_filename)))
+    name = &gcda_filename;
+  else
+    name = &da_filename;
+  
+  if (!_dbus_file_get_contents (&contents, name,
                                 &error))
     {
       /* Try .libs/file.da */
       int slash;
 
-      if (_dbus_string_find_byte_backward (&da_filename,
-                                            _dbus_string_get_length (&da_filename),
-                                            '/',
-                                            &slash))
+      if (_dbus_string_find_byte_backward (name,
+                                           _dbus_string_get_length (name),
+                                           '/',
+                                           &slash))
         {
           DBusString libs;
           _dbus_string_init_const (&libs, "/.libs");
 
-          if (!_dbus_string_copy (&libs, 0, &da_filename, slash))
+          if (!_dbus_string_copy (&libs, 0, name, slash))
             die ("no memory");
 
           dbus_error_free (&error);
-          if (!_dbus_file_get_contents (&contents, &da_filename,
+          if (!_dbus_file_get_contents (&contents, name,
                                         &error))
             {
               fprintf (stderr, "Could not open file: %s\n",