On Feb 22, 2011, at 6:02 PM, Samuel Thibault wrote:

> Note the "/* TODO: how to report? */" comment in the code: we definitely
> _want_ to get users to see the warning and report it.  

Ah, ok.  Could we make that message a little more clear, then?  Maybe something 
like this:

Index: src/topology.c
===================================================================
--- src/topology.c      (revision 3200)
+++ src/topology.c      (working copy)
@@ -48,7 +48,24 @@
   return HWLOC_API_VERSION;
 }

+static void hwloc_report_error(const char *msg, int line)
+{
+    static int reported = 0;

+    if (!reported) {
+        fprintf(stderr, 
"****************************************************************************\n");
+        fprintf(stderr, "* Hwloc has encountered what looks like an error from 
the operating system.\n");
+        fprintf(stderr, "*\n");
+        fprintf(stderr, "* %s\n", msg);
+        fprintf(stderr, "* Error occurred in topology.c line %d\n", line);
+        fprintf(stderr, "*\n");
+        fprintf(stderr, "* Please report this error message to the hwloc 
user's mailing list,\n");
+        fprintf(stderr, "* along with the output from the 
hwloc-gather-topology script.\n");
+        fprintf(stderr, 
"****************************************************************************\n");
+        reported = 1;
+    }
+}
+
 static void
 hwloc_topology_clear (struct hwloc_topology *topology);

@@ -704,7 +721,7 @@
       case HWLOC_OBJ_INCLUDED:
        if (container) {
          /* TODO: how to report?  */
-         fprintf(stderr, "object included in several different objects!\n");
+          hwloc_report_error("object included in several different objects!", 
__LINE__);
          /* We can't handle that.  */
          return;
        }
@@ -713,7 +730,7 @@
        break;
       case HWLOC_OBJ_INTERSECTS:
        /* TODO: how to report?  */
-       fprintf(stderr, "object intersection without inclusion!\n");
+          hwloc_report_error("object intersection without inclusion!", 
__LINE__);
        /* We can't handle that.  */
        return;
       case HWLOC_OBJ_CONTAINS:

-- 
Jeff Squyres
[email protected]
For corporate legal information go to:
http://www.cisco.com/web/about/doing_business/legal/cri/


Reply via email to