gst.supp: Add new suppression for TLS leak with newer glibc versions
[platform/upstream/gst-common.git] / gstdoc-scangobj
index 26aada6..09039a5 100755 (executable)
@@ -16,7 +16,7 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
 #
 
 #
@@ -43,6 +43,7 @@ require "gtkdoc-common.pl";
 my $MODULE;
 my $OUTPUT_DIR;
 my $INSPECT_DIR;
+my $VERBOSE;
 my $PRINT_VERSION;
 my $PRINT_HELP;
 my $TYPE_INIT_FUNC="g_type_init ()";
@@ -55,10 +56,11 @@ my $TYPE_INIT_FUNC="g_type_init ()";
           'type-init-func' => \$TYPE_INIT_FUNC,
           'output-dir' => \$OUTPUT_DIR,
           'inspect-dir' => \$INSPECT_DIR,
+          'verbose' => \$VERBOSE,
           'version' => \$PRINT_VERSION,
           'help' => \$PRINT_HELP);
 
-GetOptions(\%optctl, "module=s", "source=s", "types:s", "output-dir:s", "inspect-dir:s", "nogtkinit", "type-init-func:s", "version", "help");
+GetOptions(\%optctl, "module=s", "source=s", "types:s", "output-dir:s", "inspect-dir:s", "nogtkinit", "type-init-func:s", "verbose", "version", "help");
 
 if ($NO_GTK_INIT) {
   # Do nothing. This just avoids a warning.
@@ -75,15 +77,19 @@ if (!$MODULE) {
 }
 
 if ($PRINT_HELP) {
-    print "gstdoc-scangobj version 1.5\n";
-    print "\n--module=MODULE_NAME  Name of the doc module being parsed";
-    print "\n--source=SOURCE_NAME  Name of the source module for plugins";
-    print "\n--types=FILE          The name of the file to store the types in";
-    print "\n--type-init-func=FUNC The init function to call instead of g_type_init ()";
-    print "\n--output-dir=DIRNAME  The directory where the results are stored";
-    print "\n--inspect-dir=DIRNAME  The directory where the plugin inspect data is stored";
-    print "\n--version             Print the version of this program";
-    print "\n--help                Print this help\n";
+    print <<EOF;
+gstdoc-scangobj version 1.5 - introspect gstreamer-plugins
+
+--module=MODULE_NAME          Name of the doc module being parsed
+--source=SOURCE_NAME          Name of the source module for plugins
+--types=FILE                  The name of the file to store the types in
+--type-init-func=FUNC         The init function to call instead of g_type_init()
+--output-dir=DIRNAME          The directory where the results are stored
+--inspect-dir=DIRNAME         The directory where the plugin inspect data is stored
+--verbose                     Print extra output while processing
+--version                     Print the version of this program
+--help                        Print this help
+EOF
     exit 0;
 }
 
@@ -105,6 +111,11 @@ my $new_prerequisites_filename = "$OUTPUT_DIR/$MODULE.prerequisites.new";
 my $old_args_filename = "$OUTPUT_DIR/$MODULE.args";
 my $new_args_filename = "$OUTPUT_DIR/$MODULE.args.new";
 
+my $debug_log="g_message";
+if (!defined($VERBOSE) or $VERBOSE eq "0") {
+    $debug_log="//$debug_log";
+}
+
 # write a C program to scan the types
 
 $includes = "";
@@ -131,6 +142,9 @@ for (<TYPES>) {
 $ntypes = @types + @impl_types + 1;
 
 print OUTPUT <<EOT;
+
+/* file generated by common/gstdoc-scangobj */
+
 #include <string.h>
 #include <stdlib.h>
 #include <stdio.h>
@@ -171,7 +185,9 @@ xmlprint (gint indent, const gchar *tag, const gchar *data)
 static gint
 gst_feature_sort_compare (gconstpointer a, gconstpointer b)
 {
-  return strcmp (((GstPluginFeature *)a)->name, ((GstPluginFeature *)b)->name);
+  const gchar *name_a = gst_plugin_feature_get_name ((GstPluginFeature *) a);
+  const gchar *name_b = gst_plugin_feature_get_name ((GstPluginFeature *) b);
+  return strcmp (name_a, name_b);
 }
 
 static gint
@@ -205,7 +221,7 @@ get_object_types (void)
     gboolean reinspect;
 
     /* get a list of features from plugins in our source module */
-    plugins = gst_registry_get_plugin_list (gst_registry_get_default());
+    plugins = gst_registry_get_plugin_list (gst_registry_get ());
 
     xmlstr = g_string_new ("");
 
@@ -221,7 +237,6 @@ get_object_types (void)
       plugin = (GstPlugin *) (plugins->data);
       plugins = g_list_next (plugins);
       source = gst_plugin_get_source (plugin);
-      /*g_print ("plugin: %s source: %s\\n", plugin->desc.name, source);*/
       if (!source || strcmp (source, "$SOURCE") != 0) {
         continue;
       }
@@ -230,11 +245,13 @@ get_object_types (void)
       if (gst_plugin_get_filename (plugin) == NULL)
         continue;
 
-      g_print ("plugin: %s source: %s\\n", plugin->desc.name, source);
+      $debug_log ("plugin: %s source: %s", gst_plugin_get_name (plugin), source);
 
       if (reinspect) {
+        gchar *basename;
+
         inspect_name = g_strdup_printf ("$INSPECT_DIR" G_DIR_SEPARATOR_S "plugin-%s.xml",
-            plugin->desc.name);
+            gst_plugin_get_name (plugin));
         inspect = fopen (inspect_name, "w");
         if (inspect == NULL) {
           g_error ("Could not open %s for writing: %s\\n", inspect_name,
@@ -242,23 +259,27 @@ get_object_types (void)
         }
         g_free (inspect_name);
 
+                 basename = g_path_get_basename (gst_plugin_get_filename (plugin));
+
         /* output plugin data */
         fputs ("<plugin>\\n",inspect);
-        fputs (xmlprint(2, "name", plugin->desc.name),inspect);
-        fputs (xmlprint(2, "description", plugin->desc.description),inspect);
-        fputs (xmlprint(2, "filename", plugin->filename),inspect);
-        fputs (xmlprint(2, "basename", plugin->basename),inspect);
-        fputs (xmlprint(2, "version", plugin->desc.version),inspect);
-        fputs (xmlprint(2, "license", plugin->desc.license),inspect);
-        fputs (xmlprint(2, "source", plugin->desc.source),inspect);
-        fputs (xmlprint(2, "package", plugin->desc.package),inspect);
-        fputs (xmlprint(2, "origin", plugin->desc.origin),inspect);
+        fputs (xmlprint(2, "name", gst_plugin_get_name (plugin)),inspect);
+        fputs (xmlprint(2, "description", gst_plugin_get_description (plugin)),inspect);
+        fputs (xmlprint(2, "filename", gst_plugin_get_filename (plugin)),inspect);
+        fputs (xmlprint(2, "basename", basename),inspect);
+        fputs (xmlprint(2, "version", gst_plugin_get_version (plugin)),inspect);
+        fputs (xmlprint(2, "license", gst_plugin_get_license (plugin)),inspect);
+        fputs (xmlprint(2, "source", gst_plugin_get_source (plugin)),inspect);
+        fputs (xmlprint(2, "package", gst_plugin_get_package (plugin)),inspect);
+        fputs (xmlprint(2, "origin", gst_plugin_get_origin (plugin)),inspect);
         fputs ("  <elements>\\n", inspect);
+
+                 g_free (basename);
       }
 
       features =
-          gst_registry_get_feature_list_by_plugin (gst_registry_get_default (),
-          plugin->desc.name);
+          gst_registry_get_feature_list_by_plugin (gst_registry_get (),
+          gst_plugin_get_name (plugin));
 
       /* sort factories by feature->name */
       features = g_list_sort (features, gst_feature_sort_compare);
@@ -277,7 +298,7 @@ get_object_types (void)
           const gchar *pad_pres[] = { "always","sometimes","request" };
           GList *pads, *pad;
 
-          /*g_print ("  feature: %s\\n", feature->name);*/
+          $debug_log ("  feature: %s", gst_plugin_feature_get_name (feature));
 
           factory = GST_ELEMENT_FACTORY (feature);
           factories = g_list_prepend (factories, factory);
@@ -285,11 +306,11 @@ get_object_types (void)
           if (reinspect) {
             /* output element data */
             fputs ("    <element>\\n", inspect);
-            fputs (xmlprint(6, "name", feature->name),inspect);
-            fputs (xmlprint(6, "longname", gst_element_factory_get_longname (factory)),inspect);
-            fputs (xmlprint(6, "class", gst_element_factory_get_klass (factory)),inspect);
-            fputs (xmlprint(6, "description", gst_element_factory_get_description (factory)),inspect);
-            fputs (xmlprint(6, "author", gst_element_factory_get_author (factory)),inspect);
+            fputs (xmlprint(6, "name", gst_plugin_feature_get_name (feature)),inspect);
+            fputs (xmlprint(6, "longname", gst_element_factory_get_metadata (factory, GST_ELEMENT_METADATA_LONGNAME)),inspect);
+            fputs (xmlprint(6, "class", gst_element_factory_get_metadata (factory, GST_ELEMENT_METADATA_KLASS)),inspect);
+            fputs (xmlprint(6, "description", gst_element_factory_get_metadata (factory, GST_ELEMENT_METADATA_DESCRIPTION)),inspect);
+            fputs (xmlprint(6, "author", gst_element_factory_get_metadata (factory, GST_ELEMENT_METADATA_AUTHOR)),inspect);
             fputs ("      <pads>\\n", inspect);
 
             /* output pad-template data */
@@ -320,7 +341,7 @@ get_object_types (void)
 
     g_string_free (xmlstr, TRUE);
 
-    g_message ("number of element factories: %d", g_list_length (factories));
+    $debug_log ("number of element factories: %d", g_list_length (factories));
 
     /* allocate the object_types array to hold them */
     object_types = g_new0 (GType, g_list_length (factories)+$ntypes+1);
@@ -333,11 +354,11 @@ get_object_types (void)
       factory = GST_ELEMENT_FACTORY (l->data);
       type = gst_element_factory_get_element_type (factory);
       if (type != 0) {
-        g_message ("adding type %p for factory %s", (void *) type, gst_element_factory_get_longname (factory));
+        $debug_log ("adding type for factory %s", gst_element_factory_get_metadata (factory, GST_ELEMENT_METADATA_LONGNAME));
         object_types[i++] = type;
       } else {
         g_message ("type info for factory %s not found",
-            gst_element_factory_get_longname (factory));
+            gst_element_factory_get_metadata (factory, GST_ELEMENT_METADATA_LONGNAME));
       }
       l = g_list_next (l);
     }
@@ -522,7 +543,7 @@ output_object_signal (FILE *fp,
   gchar signal_name[128];
   gchar flags[16];
 
-  /*  g_print ("Object: %s Signal: %u\\n", object_name, signal_id);*/
+  $debug_log ("Object: %s Signal: %u", object_name, signal_id);
 
   param_num = 1;
   widget_num = event_num = callback_num = 0;
@@ -765,6 +786,16 @@ output_object_hierarchy (void)
   fclose (fp);
 }
 
+static int
+compare_types (const void *a, const void *b)
+{
+  const char *na = g_type_name (*((GType *)a));
+  const char *nb = g_type_name (*((GType *)b));
+
+  return g_strcmp0 (na, nb);
+}
+
+
 /* This is called recursively to output the hierarchy of a object. */
 static void
 output_hierarchy (FILE  *fp,
@@ -783,6 +814,8 @@ output_hierarchy (FILE  *fp,
   fprintf (fp, "%s\\n", g_type_name (type));
 
   children = g_type_children (type, &n_children);
+  qsort (children, n_children, sizeof (GType), compare_types);
+
 
   for (i=0; i < n_children; i++)
     output_hierarchy (fp, children[i], level + 1);
@@ -962,16 +995,12 @@ describe_signed_constant (gsize size, gint64 value)
   gchar *desc = NULL;
 
   switch (size) {
-    case 2:
-      if (sizeof (int) == 2) {
-        if (value == G_MAXINT)
-          desc = g_strdup ("G_MAXINT");
-        else if (value == G_MININT)
-          desc = g_strdup ("G_MININT");
-        else if (value == (gint64)G_MAXUINT)
-          desc = g_strdup ("G_MAXUINT");
-      }
-      break;
+    case 8:
+      if (value == G_MAXINT64)
+        desc = g_strdup ("G_MAXINT64");
+      else if (value == G_MININT64)
+        desc = g_strdup ("G_MININT64");
+      /* fall through */
     case 4:
       if (sizeof (int) == 4) {
         if (value == G_MAXINT)
@@ -987,12 +1016,16 @@ describe_signed_constant (gsize size, gint64 value)
         desc = g_strdup ("G_MINLONG");
       else if (value == (gint64)G_MAXULONG)
         desc = g_strdup ("G_MAXULONG");
-      break;
-    case 8:
-      if (value == G_MAXINT64)
-        desc = g_strdup ("G_MAXINT64");
-      else if (value == G_MININT64)
-        desc = g_strdup ("G_MININT64");
+      /* fall through */
+    case 2:
+      if (sizeof (int) == 2) {
+        if (value == G_MAXINT)
+          desc = g_strdup ("G_MAXINT");
+        else if (value == G_MININT)
+          desc = g_strdup ("G_MININT");
+        else if (value == (gint64)G_MAXUINT)
+          desc = g_strdup ("G_MAXUINT");
+      }
       break;
     default:
       break;
@@ -1009,14 +1042,12 @@ describe_unsigned_constant (gsize size, guint64 value)
   gchar *desc = NULL;
 
   switch (size) {
-    case 2:
-      if (sizeof (int) == 2) {
-        if (value == (guint64)G_MAXINT)
-          desc = g_strdup ("G_MAXINT");
-        else if (value == G_MAXUINT)
-          desc = g_strdup ("G_MAXUINT");
-      }
-      break;
+    case 8:
+      if (value == G_MAXINT64)
+        desc = g_strdup ("G_MAXINT64");
+      else if (value == G_MAXUINT64)
+        desc = g_strdup ("G_MAXUINT64");
+      /* fall through */
     case 4:
       if (sizeof (int) == 4) {
         if (value == (guint64)G_MAXINT)
@@ -1028,12 +1059,14 @@ describe_unsigned_constant (gsize size, guint64 value)
         desc = g_strdup ("G_MAXLONG");
       else if (value == G_MAXULONG)
         desc = g_strdup ("G_MAXULONG");
-      break;
-    case 8:
-      if (value == G_MAXINT64)
-        desc = g_strdup ("G_MAXINT64");
-      else if (value == G_MAXUINT64)
-        desc = g_strdup ("G_MAXUINT64");
+      /* fall through */
+    case 2:
+      if (sizeof (int) == 2) {
+        if (value == (guint64)G_MAXINT)
+          desc = g_strdup ("G_MAXINT");
+        else if (value == G_MAXUINT)
+          desc = g_strdup ("G_MAXUINT");
+      }
       break;
     default:
       break;
@@ -1547,25 +1580,30 @@ if ($CC =~ /libtool/) {
   $o_file = "$MODULE-scan.o"
 }
 
-print "gtk-doc: Compiling scanner\n";
-$command = "$CC $CFLAGS -c -o $o_file $MODULE-scan.c";
-system($command) == 0 or die "Compilation of scanner failed: $!\n";
+my $stdout="";
+if (!defined($VERBOSE) or $VERBOSE eq "0") {
+    $stdout=">/dev/null";
+}
 
-print "gtk-doc: Linking scanner\n";
-$command = "$LD -o $MODULE-scan $o_file $LDFLAGS";
+# Compiling scanner
+$command = "$CC $stdout $CFLAGS -c -o $o_file $MODULE-scan.c";
+system("($command)") == 0 or die "Compilation of scanner failed: $!\n";
+
+# Linking scanner
+$command = "$LD $stdout -o $MODULE-scan $o_file $LDFLAGS";
 system($command) == 0 or die "Linking of scanner failed: $!\n";
 
-print "gtk-doc: Running scanner $MODULE-scan\n";
+# Running scanner $MODULE-scan ";
 system("sh -c ./$MODULE-scan") == 0 or die "Scan failed: $!\n";
 
 if (!defined($ENV{"GTK_DOC_KEEP_INTERMEDIATE"})) {
   unlink "./$MODULE-scan.c", "./$MODULE-scan.o", "./$MODULE-scan.lo", "./$MODULE-scan";
 }
 
-#&UpdateFileIfChanged ($old_signals_filename, $new_signals_filename, 0);
 &UpdateFileIfChanged ($old_hierarchy_filename, $new_hierarchy_filename, 0);
-&UpdateFileIfChanged ($old_interfaces_filename, $new_interfaces_filename, 0);
-&UpdateFileIfChanged ($old_prerequisites_filename, $new_prerequisites_filename, 0);
+# we will merge these in scangobj-merge.py
+#&UpdateFileIfChanged ($old_interfaces_filename, $new_interfaces_filename, 0);
+#&UpdateFileIfChanged ($old_prerequisites_filename, $new_prerequisites_filename, 0);
+#&UpdateFileIfChanged ($old_signals_filename, $new_signals_filename, 0);
 #&UpdateFileIfChanged ($old_args_filename, $new_args_filename, 0);
 
-